blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 132 | path stringlengths 3 236 | src_encoding stringclasses 29
values | length_bytes int64 8 7.94M | score float64 2.52 5.72 | int_score int64 3 5 | detected_licenses listlengths 0 142 | license_type stringclasses 2
values | text stringlengths 8 7.94M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
56524c1bf1af3a792f3b13ddbca1c9f8a03c97be | JavaScript | SiarheiBalt/Js-pro-course | /lesson_05__Test/test.js | UTF-8 | 7,306 | 2.890625 | 3 | [] | no_license | let dataDefault = [
{
id: 1,
matter: 'Какого цвета елка?',
answers: ['Зеленая', 'Синяя', 'Черная', 'Белая'],
rightAnswers: ['1'],
}, {
id: 2,
matter: 'Что не является языком программирования?',
answers: ['HTML', 'JAVA', 'Phiton', 'CSS'],
rightAnswe... | true |
f5e905c8b0ee7bc709399cef18b1a64cd489ecc0 | JavaScript | curlywallst/user-react-rails-api-phase4-with-context | /client/src/Login.js | UTF-8 | 1,754 | 2.53125 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import React, { useState, useContext } from 'react'
import { UserContext } from "./context/user";
import { useHistory } from 'react-router-dom'
const Login = () => {
const [name, setName] = useState("")
const [password, setPassword] = useState("")
const [error, setError] = useState("")
const history =... | true |
336203fa853381f36f71efb16642b622d9d770cb | JavaScript | syedtayyab-10p/freecodecampFrontend | /react/task10.jsx | UTF-8 | 815 | 2.984375 | 3 | [] | no_license | const TypesOfFruit = () => {
return ( <
div >
<
h2 > Fruits: < /h2> <
ul >
<
li > Apples < /li> <
li > Blueberries < /li> <
li > Strawberries < /li> <
li > Bananas < /li> <
/ul> <
/div>
);
};
const Fruits = () => {
retu... | true |
2a483cc16e83f06215bf873a5d06572d8f802501 | JavaScript | Terrycoco/sharedev | /public/serviceworkers/sw.js | UTF-8 | 1,586 | 2.59375 | 3 | [] | no_license | var CACHE_NAME = 'sw-cache-v3';
var urlsToCache = [
'/images/moccasins.jpg',
'/images/right_arrow.png',
'/images/left_arrow.png',
'/images/menu_white.png'
];
self.addEventListener("install", function(event) {
console.... | true |
2c0d898b06f40bc00ebca9eda8f6c0bc959cd3e4 | JavaScript | sam202020/CS10-car-reviews | /backend/src/routers/routing_middleware/checkIfCar.js | UTF-8 | 797 | 2.59375 | 3 | [
"MIT"
] | permissive | const CarModel = require('../../models/CarModel');
const checkIfCar = (req, res, next) => {
const { year, make, model, edition, score } = req.body;
CarModel.findOne({year: year, make: make, model: model, edition: edition})
.then(car => {
if (car != null) {
req.carID = car._i... | true |
2c1c3ce053835928a601e0d374c778d5202da873 | JavaScript | petabyt/scamsitefinder | /sitefinder.js | UTF-8 | 2,640 | 2.53125 | 3 | [] | no_license | var names = [
"vizio",
"samsung",
"microsoft",
"cisco",
"paycom",
"apple",
"weebly",
"facebook",
"netgear",
"windows",
"sony",
"asus",
"acer",
"gmail",
"outlook",
"instagram",
"twitter"
];
var domains = [
"com",
"net",
"tk",
"cf",
"ml"
]
var sites = [
];
var interval;
var compiled;
var a = 0;... | true |
c87e60ded591c45e248902c9159645ae9541b368 | JavaScript | rramona3/google-apps-script-1 | /lib/functions/unpackRemote.js | UTF-8 | 2,330 | 2.609375 | 3 | [
"MIT"
] | permissive | var fs = require('fs');
var rimrafAll = require('./rimrafAll.js')
var constants = require('../constants.js');
/**
* Unpack a remote google script file into seperate .js and .html files
*
* @param {string} name - Name of the Google Apps Script project.
* @param {callback} callback - The callback that handles the re... | true |
08318763c9e3e9a10c551cbeb669952142dfe278 | JavaScript | ObieWalker/git-cheat-sheet | /src/helpers/inputValidator.js | UTF-8 | 1,940 | 2.84375 | 3 | [] | no_license | import validator from 'validator';
import isEmpty from 'lodash/isEmpty';
const AddCategoryValidator = (data) => {
const categoryTitle = data.categoryTitle.trim(),
errors = {};
if (!validator.isEmpty(categoryTitle)) {
if (!validator.isLength(categoryTitle, { min: 3, max: undefined })) {
errors.catego... | true |
9a0863d68167ba0a55579f1abc825df2e07f7a20 | JavaScript | mirk24/tesis1-master | /controladores/monitoreo.controller.js | UTF-8 | 1,280 | 2.59375 | 3 | [] | no_license | var Monitoreo=require('../modelos/monitoreo.model');
function listaMonitoreo(req, res){
Monitoreo.find({estado:1},(err,resul)=>{
res.status(200).json({mgs:'todo legal',estado:1, lista:resul});
})
}
function nuevoMonitoreo(req, res){
req.body.estado=1;
let est= new Monitoreo(req.body);
est.... | true |
0149ae6708312845ca897f3b2fef7e745a5df4b6 | JavaScript | 66goddness/god | /public/javascripts/register.js | UTF-8 | 962 | 3.3125 | 3 | [
"MIT"
] | permissive | init();
function init() {
var btn_add=document.getElementById("btn_add");
var btn_ch=document.getElementById("btn_ch");//中文名验证按钮
var input_add=document.getElementById("address");//地址输入框
var input_ch=document.getElementById("chName");//中文名输入框
//地址验证事件处理程序
btn_add.onclick=function() {
var v=input_add.value... | true |
e95b62b1e7e174e35e31628bc66e2344b1fc669b | JavaScript | caspahouzer/TiCropImageEditor | /example/app.js | UTF-8 | 1,536 | 2.640625 | 3 | [] | no_license | // This is a test harness for your module
// You should do something interesting in this harness
// to test out the module and to provide instructions
// to users on how to use it by example.
// open a single window
var win = Ti.UI.createWindow({
backgroundColor:'white'
});
var label = Ti.UI.createLabel();
//win.a... | true |
4870d2ea53f5dec190ef801bbb4fdb8ae6a283db | JavaScript | sophieroe95/cs-principles-and-js-katas | /appfive.test.js | UTF-8 | 1,424 | 3.03125 | 3 | [] | no_license | import { findLargestAndSmallest } from "./appfive.js";
describe("How do you find the largest and smallest number in an unsorted integer array?", () => {
it("Should return top and tail in a sorted array", () => {
expect(findLargestAndSmallest([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).smallest).toBe(1);
expec... | true |
04454ca07c59c1ba5b72e4f55a2542d67dd3577b | JavaScript | shummie/screeps | /remote-harvester.js | UTF-8 | 1,878 | 2.953125 | 3 | [] | no_license | /* RemoteHarvesters
*/
var Base = require('base');
class RemoteHarvester extends Base{
constructor(creep) {
super(creep);
}
}
RemoteHarvester.prototype.performRole = function () {
// The source we are trying to harvest is stored as a flag on the map and then in this creep's memory.
const flag = Game.flags[this... | true |
f31324bd89460d5c91e98d0dadc4ea2882f95b98 | JavaScript | aslkami/react-demo | /react-context-lesson/src/provider/cart.provider.jsx | UTF-8 | 1,238 | 2.53125 | 3 | [
"MIT"
] | permissive | import React, { createContext, useEffect, useState } from "react";
import {
addItemToCart,
deleteItem,
getCartTotal,
removeItemFromCart
} from "./cart.utils";
export const CartContext = createContext({
hidden: true,
toggleCartHidden: () => {},
cartItems: [],
addItem: () => {},
removeItem: () => {},
... | true |
4ac01ed2d5b397fd2b32e25fc61cbddd2f541bc6 | JavaScript | mcred2030/todo | /ListView/NYT.js | UTF-8 | 1,040 | 2.59375 | 3 | [] | no_license | const API_KEY = "73b19491b83909c7e07016f4bb4644f9:2:60667290";
const LIST_NAME = "hardcover-fiction";
const API_STEM = "https://api.nytimes.com/svc/books/v3/lists";
const API_JSON = "https://www.tech2030.com:14318/V2/inc/JSON2.asp?method=list2";
// https://api.nytimes.com/svc/books/v3/lists/hardcover-fiction?response-... | true |
446a0db890b03a47a260a254da0c186065ccedd9 | JavaScript | jack19861225/Recharts | /inst/htmlwidgets/Bar.js | UTF-8 | 2,838 | 2.609375 | 3 | [] | no_license | HTMLWidgets.widget({
name: 'Bar',
type: 'output',
initialize: function(el, width, height) {
document.getElementById(el.id).width = width;
document.getElementById(el.id).height = height;
var myChart = echarts.init(document.getElementById(el.id));
return {
chart: myChart
}
},
ren... | true |
94f1422d2bca8e096fb719043481a6ff23a78a98 | JavaScript | sheikhshack/docking-bay-sample | /tests/supertest.test.js | UTF-8 | 6,222 | 2.65625 | 3 | [] | no_license | const supertest = require('supertest');
const mongoose = require('mongoose');
const app = require('../app');
const Blog = require('../models/blog');
const User = require('../models/user');
const bloghelper = require('./test_helper_blogs');
const userhelper = require('./test_helper_users');
const api = supertest(app);... | true |
a592b1b704cf2d0abeb91e35007340514fdc2ee6 | JavaScript | azhang919/2048-react | /src/App.js | UTF-8 | 1,316 | 2.765625 | 3 | [] | no_license | import { useState } from 'react';
import useKeypress from 'react-use-keypress';
import './App.css';
import Game from './engine/Game.js';
import Board from './components/Board.js';
import Message from './components/Message.js';
function App() {
let [game, setGame] = useState(new Game(4));
// Handle arrow key pres... | true |
c26a262cf3363f6a601535a2baec9ec739612335 | JavaScript | mattt416/chexbox | /lib/utils.js | UTF-8 | 1,088 | 3.234375 | 3 | [] | no_license | const Table = require('cli-table2');
function daysAgo(timestamp) {
// Date is in milliseconds, so we / 1000 to give us seconds
return parseInt((new Date() - parseInt(timestamp)) / 1000 / 60 / 60 / 24);
}
function list(val) {
return val.split(',');
}
function vertTable(data = []) {
/* A vertical table doesn't... | true |
04b4c8da0c81c0af6f8eacd65b6090d279fcfb04 | JavaScript | ivarcode/js-cert | /final_project/roman_numeral_converter.js | UTF-8 | 2,022 | 3.953125 | 4 | [] | no_license | function convertToRoman(num) {
if (num < 4000) {
let a = parseInt(num / 1000);
let b = "";
for (let i = 0; i < a; i++) {
b += 'M';
}
return b + one_thousand(num - (1000 * a));
} else {
return "number out of bounds :: improper roman numeral";
}
}
f... | true |
d2f8ed718bc499e30c59d667b2c82dec5368086a | JavaScript | riboseinc/uuid-pack-js | /scripts/test.js | UTF-8 | 2,445 | 3.109375 | 3 | [
"MIT"
] | permissive | 'use strict'
// Connect the module with functions
require(["uuids"], function() {
// Set valid characters (last one will be delimiter with delta compression)
// this equal Base64 with delimiter '_'
var alpStrBase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-_';
// this equal binary
... | true |
fdf897338c306400659cf950ff3ef25243194c58 | JavaScript | arungpro/task-manager | /playground/promise-playground copy.js | UTF-8 | 522 | 3.515625 | 4 | [] | no_license | var add = (a,b) => {
return new Promise( (success, failure) => {
setTimeout( () => {
success(a + b)
},2000)
})
}
const sub = (a, b) => {
return new Promise( (resolve, reject) => {
setTimeout(() => {
resolve(a - b)
}, 2000)
})
}
add(10, 20).then(... | true |
ca84a3c8b0911d2329105e95924ef7d9fc0fcd37 | JavaScript | Marco00/Informatica | /Esercizi su HTML e Javascript/Esercizio1/public_html/Script.js | UTF-8 | 3,324 | 3.03125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
function controllaCampi() {
let cognome = document.getElementById("cognome").value;
let nome = document.getElementById("nome"... | true |
e78627de99f103565c87db587544234ca8de3f92 | JavaScript | T-era/Trism | /Trism_LevelUp.js | SHIFT_JIS | 2,438 | 2.8125 | 3 | [] | no_license | (function () {
function StatusUp() {
this.getMessages = function() {
return [this._name + "̖͂I"
, this._name + "̉삪I"
, this.SpecialMessage];
};
}
function StatusUpR() {
this._name = "";
this.SpecialMessage = " ߂ɕɂ낤Ƃ\n₯ǂI\n......̖͂オ!!";
this.event = function(slime) {
slime.R ++;
... | true |
ea2e8cab7c975d30ef8451bbb95e1d44ee624a5c | JavaScript | patriciax/simon-dice-pract | /clase18.js | UTF-8 | 913 | 3.75 | 4 | [
"MIT"
] | permissive | var alex = {
nombre: 'alex',
apellido: 'gomez',
altura: 1.72
}
var willian = {
nombre: 'willian',
apellido: 'gomez',
altura: 1.86
}
var andres = {
nombre: 'andres',
apellido: 'gomez',
altura: 1.85
}
var sharon = {
nombre: 'sharon',
apellido: 'gomez',
altura: 1.56
}
var jesus = {
nombre: 'j... | true |
d30991159344232a7be0c7d0dafec2775ef21744 | JavaScript | IanAriel96/mapa-server | /dist/metodos.js | UTF-8 | 18,099 | 3 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Metodos {
constructor() { }
;
static calcularCoordenadas(radio) {
let puntos = [];
radio = Math.pow(radio, 2);
let x = radio / 2;
let y = Math.sqrt(radio - Math.pow(x, 2));
x = x / 111.... | true |
c1f867c6b3a73e1fd42546b5ac9017acd66cfbd9 | JavaScript | miksa1987/one-job | /src/components/main/tests/DateChanger.test.js | UTF-8 | 1,990 | 2.65625 | 3 | [] | no_license | import React from 'react';
import { render, cleanup, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import DateChanger from '../DateChanger';
jest.mock('../../../store/store');
let date = [];
const renderAndGetComponentAndDate = () => {
const component = render(<DateCh... | true |
adaad9ee0ccdfa9d43d204e262bdb8870372b404 | JavaScript | douglasjva/sinutri-spa | /spa/js/controllers/history-patient-controller.js | UTF-8 | 1,300 | 2.53125 | 3 | [] | no_license | (function() {
function HistoryPatientController($scope, PersonService, HistoryPatientConstants) {
init();
function init() {
enableLoading();
loadHistory();
$scope.tryAgain = tryAgain;
}
function successLoadHistory(response) {
enableSucess();
$scope.person = response.... | true |
2b1ecf81c64b8027b44622ec4661144f60af5bc4 | JavaScript | sharonttop/Pet-project-react | /src/pages/member/admin/user/petId/PetId.js | UTF-8 | 5,180 | 2.5625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import conf, {
IMG_PATH,
UPLOAD_AVATAR,
// JWT_GET_DATA,
} from '../../../config'
import axios from 'axios'
import petIdRemoveMark from '../../../images/petIdRemoveMark80x80.svg'
import petIdAddMark from '../../../images/petIdAddMark80x80.svg'
import './PetId.s... | true |
6ccb6aa7a5854c84fbd551e87252cf1a4d66bfd5 | JavaScript | BigPinkRoom/bank-accounts-information | /src/helpers/numbers.js | UTF-8 | 91 | 2.734375 | 3 | [] | no_license | export function convertToFloatOne(rawNumber) {
return Number(rawNumber.toFixed(1));
}
| true |
4313f07f1b41a4bf332137ec3662e6f0acfb416e | JavaScript | mg-skc/todo | /Public/Test/server-test.js | UTF-8 | 6,382 | 2.703125 | 3 | [] | no_license | const mongoose = require('mongoose');
var List = require('./models/ToDo.js');
var Item = require('./models/ToDoItem.js');
//putting in lodash
var _ = require('lodash');
//load in express
const express = require('express');
const path = require('path');
//new express app and validator
const app = express();
const { ... | true |
294ce6eb6ab2cdff5cd19318889e2a0a2359a527 | JavaScript | jellz/mmbot | /mmbot/src/commands/Fun/dogfact.js | UTF-8 | 453 | 2.59375 | 3 | [
"MIT"
] | permissive | const { Command } = require('klasa');
const fetch = require('node-fetch');
module.exports = class extends Command {
constructor(...args) {
super(...args, {
description: 'Get a random dog fact',
});
}
async run(msg) {
const m = await msg.channel.send('🐶 Getting random dog fact...');
const r... | true |
14263c5cae78c081d0e571d2494f9474b8936fa3 | JavaScript | excelo0702/rcr | /src/components/FindComponents/FindComponents.js | UTF-8 | 3,258 | 2.515625 | 3 | [] | no_license | import React, { Component } from "react";
import PageDivision from "./pageDivision";
import axios from 'axios';
import NavbarComponent from '../Layout/NavbarComponent';
const components = [
{ id: "1", techType: "java", componentFunction: "sort", name: "jSort" , facetedSearch:"facetedSearch" },
{
id: "2",
... | true |
228b27a7712a4591a84c18c4f02bf79eb1f4dd01 | JavaScript | luo-677/webcode | /Stage-three/day02/2.url.js | UTF-8 | 1,138 | 2.984375 | 3 | [] | no_license | const url = require("url");
const qs = require("querystring");
const { type } = require("os");
const urlStr = 'http://m.root.cn:8000/index/a?goodid=1002&goodname=手机#hash';
// 将请求地址转换成对象
let obj = url.parse(urlStr);
// console.log(obj);
// 返回内容
// Url {
// protocol: 'http:',
// slashes: true,
// a... | true |
777fcfa6f7b5c965733626e005b986e04984bb09 | JavaScript | RonakBipinThakkar/Assignment6_CS648-01 | /js/01-larger-or-smaller.js | UTF-8 | 358 | 4.21875 | 4 | [] | no_license | var numOne = parseInt(prompt("Enter the first number:"));
var numTwo = parseInt(prompt("Enter the second number:"));
if (numOne == numTwo) {
document.write("Both the numbers are equal.");
} else if (numOne > numTwo) {
document.write(numOne + " i.e. the first number is larger.");
} else {
document.write(numTwo + " ... | true |
30997ef45c64e0429125a5c1ca00d5aaa7bcf7a6 | JavaScript | brainyfarm/contact-manager | /js/app.js | UTF-8 | 1,681 | 2.953125 | 3 | [] | no_license | const preloadedContacts = [{
title: "Mr",
name: "John Smith",
email: "john.smith@gmail.com",
imageUrl: "http://completeflyfisherman.co.za/wp-content/uploads/2015/02/team-2.jpg"
},
{
title: "Mrs",
name: "Tracy James",
email: "tracey.2018@gmail.com",
imageUrl: "http://completeflyfisherman.co.za/wp-conten... | true |
0d9598a734912c315cfab009f3a646e6f1c461b7 | JavaScript | doit-homepage/backend | /socket.js | UTF-8 | 1,527 | 2.828125 | 3 | [] | no_license |
module.exports = (io) => {
io.on('connection', (socket) => {
function log() {
let array = ['Message from server:'];
array.push.apply(array,arguments);
socket.emit('log',array);
}
socket.on('message',message=>{
log('Client said : ' ,me... | true |
f4a6b0bf7ca2c9dffed7628123048a4a5bf2d44e | JavaScript | banana6hz/node-stream-demo | /api.js | UTF-8 | 1,452 | 2.609375 | 3 | [] | no_license | /**
* api.js
*@author wuzhe
*create 2017-12-26 18:47
*/
var express = require('express');
var app = express();
var Excel = require('exceljs');
app.get('/excel', function (req, res, next) {
res.set('Content-Type','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
res.setHeader("Content-Dispo... | true |
a34c1bea610b95108f30b4f59975f9c1bdccd780 | JavaScript | SPluto0/shiro-plus | /src/main/resources/static/js/system/permissionlist.js | UTF-8 | 2,984 | 2.578125 | 3 | [] | no_license | //下拉框改变显示条数
function selectSize(){
var pageSize = $(".pageSize option:selected").val();
location.href="/system/permissionlist.html?pageSize="+pageSize;
}
//输入框改变页码
function changePage(event){
var pageNum = $(event).val();
var pageSize = $(".pageSize option:selected").val();
location.href="/system/permissionlist.h... | true |
e4c0244dc95f7e81619a655187ceaab28dbcfdba | JavaScript | RB-Codes/amman-301d9 | /class-03/demo/templates/scripts/neighborhood.js | UTF-8 | 1,671 | 3.578125 | 4 | [] | no_license | 'use strict';
let neighborhoodsArray = [];
function Neighborhood(neighborhoodObject){
// this.name = neighborhoodObject.name;
// this.cityName = neighborhoodObject.city;
// this.population = neighborhoodObject.population;
// this.founded = neighborhoodObject.founded;
// this.body = neighborhoodObj... | true |
b294e22dc9719ae258585d19dc7277bf582ed915 | JavaScript | usefulfwei/Algorithm-Leetcode | /Leetcode/date.js | UTF-8 | 523 | 3.53125 | 4 | [] | no_license | function date(date){
let day = date.getDate();
let hour = date.getHours();
let min = date.getMinutes();
let sec = date.getSeconds();
let str = day+" "+hour+":"+adjust(min)+":"+adjust(sec);
return str;
}
function adjust(num){
if(num<10){
return '0' + num
}
else return num;
}
/*
co... | true |
3c253550c6ed81cd2c56700da0184503b2815787 | JavaScript | Leandro-Bezerra-Santos/Bootcamp_Eduzz | /JavaScript-ES6_essencial/Array/criar.js | UTF-8 | 144 | 3.453125 | 3 | [
"MIT"
] | permissive | const array = [1, 2, 3];
const inst = new Array(1, 3, 2);
const arr = Array.of(1,2,3);
console.log(array);
console.log(inst);
console.log(arr); | true |
6d1af9dd5c33100eee8c4d797386116f0895ad21 | JavaScript | wangtengda0310/was2048 | /laya/src/script/Tile.js | UTF-8 | 1,273 | 2.734375 | 3 | [] | no_license | export default class Tile extends Laya.Sprite {
constructor() {
super();
this._tilePosX = -1;
this._tilePosY = -1;
this.tileLeft = null;
this.tileRight = null;
this.tileUp = null;
this.tileDown = null;
}
onEnable() {
//盒子等级
this.level ... | true |
fd44a206f839e70e87df44160fd4dd083a1a2927 | JavaScript | koval-andrey/goit-tasks-bot | /js/task-31.js | UTF-8 | 730 | 4.03125 | 4 | [] | no_license | /*
Выполни рефакторинг функции findNumber(start, end, divisor) так, чтобы она:
возвращала первое число от start до end, которое делится на divisor без остатка;
не использовала оператор break;
не использовала переменную number.*/
function findNumber(start, end, divisor) {
// Пиши код ниже этой строки
for (... | true |
ecd8899e4159f23eb696f25aeb67bcd066629263 | JavaScript | Flotyx/Homework5 | /src/App.js | UTF-8 | 848 | 3.09375 | 3 | [] | no_license | import React from 'react'
import ToDoApp from './Component/ToDoApp'
var ToDoList=[]
function App(){
<div>
<ToDoApp list = {ToDoList}/>
</div>
}
export default App;
//NOTE OF ToDoAPP
/*
ToDo APP
-TODOTITLE
-TODOFORM
-TODOLIST(todo list是一個array),所以todo app 那裏會一個todo list
*/
//NOTE OF REACT
//jsx ... | true |
c4df790eb02c83660f9c40a331808fb1e7670bd5 | JavaScript | moushicheng/ExArray | /src/utils/index.js | UTF-8 | 908 | 2.9375 | 3 | [
"MIT"
] | permissive | /*
* @Author: 某时橙
* @Date: 2021-04-11 21:08:29
* @LastEditTime: 2021-04-17 20:29:29
* @LastEditors: your name
* @Description: 请添加介绍
* @FilePath: \ExArray\src\utils\index.js
* 可以输入预定的版权声明、个性签名、空行等
*/
export function error(m){
throw Error(m)
}
//use方法不会触发方法事件和add/change/delete特殊事件
export func... | true |
42ba61df25338c23b4b0c4250c033c6db808a3f1 | JavaScript | imclab/SingleRoomMultiplayer | /rewrite/sandbox/webworkers/Particles.js | UTF-8 | 11,883 | 2.96875 | 3 | [] | no_license | /**
* Written by Luke Moody http://www.github.com/squarefeet/
* A rewrite of Lee Stemkoski's ParticleEngine: http://www.adelphi.edu/~stemkoski/
*/
function Particle() {
this.position = null;
this.velocity = null;
this.acceleration = null;
this.color = new THREE.Color();
this.colorVector = new THREE.Vector3()... | true |
6b909d5a7e8ee9669ca72612b01c731756867732 | JavaScript | SuhasD/practice | /Hackerank/JigSaw.js | UTF-8 | 2,925 | 4.125 | 4 | [] | no_license | // Design a jigsaw puzzle algorithm, given a Piece class, a Side class containing sideTypes, and a helper function which returns whether or not two pieces are a match
We will need couple of classes to represent this:
Piece
Edge (contained by Piece)
Jigsaw game
First you need a "Piece" class to represent one piece of ... | true |
740c3b4c67f06c5cbea0a69e2e4ef3faade7c111 | JavaScript | Harryever/Harry-Potter | /main.js | UTF-8 | 1,117 | 3.03125 | 3 | [] | no_license | var canvas = new fabric.Canvas ("myCanvas");
player_x = 10;
player_y = 10;
hermione_image_width = 30;
hermione_image_height = 30;
ron_image_width = 30;
ron_image_height = 30;
var player_object = "";
var block_image_object = "";
function player_update()
{
fabric.Image.fromURL("images (1).jpg",... | true |
b8dcdefcb3870d2c2efd73675594f23a293d1824 | JavaScript | jkinman/SocialTerrain | /src/components/3d/AOsnippet.js | UTF-8 | 5,869 | 2.515625 | 3 | [] | no_license | require( "../assets/three.js/examples/js/postprocessing/EffectComposer.js");
require( "../assets/three.js/examples/js/postprocessing/RenderPass.js");
require( "../assets/three.js/examples/js/postprocessing/ShaderPass.js");
require( "../assets/three.js/examples/js/postprocessing/MaskPass.js");
require( "../assets/three.... | true |
43c5f0e11c30900e2cb529d17b215e1a6c242c13 | JavaScript | reintrance/node.js-design-patterns | /patterns/Streams/readable/test.js | UTF-8 | 297 | 2.96875 | 3 | [] | no_license | const RandomStream = require('./randomStream');
const randomStream = new RandomStream();
randomStream.on('readable', () => {
let chunk;
while (chunk = randomStream.read()) {
console.log(`Read from randomStream: ${chunk.toString()}`);
}
}).on('end', () => console.log('End of data.')); | true |
89e0cc72944f0707ea3b2d7aae65dbb3931a53c4 | JavaScript | DrSzav/tonepoems | /oldTones/tonePoem/subcollider-master/src/lib/asInteger.js | UTF-8 | 327 | 2.625 | 3 | [
"MIT"
] | permissive | /**
* @arguments _none_
* @example
* "0.5".asInteger(); // => 0
* [1, 2, 3.14].asInteger(); // => [1, 2, 3]
*/
sc.define("asInteger", {
Number: function() {
return this|0;
},
Array: function() {
return this.map(function(x) { return x.asInteger(); });
},
String: function() {
return this|0;
... | true |
dad767e82369a845c8ad6e088ed5adb93b9b020d | JavaScript | DaaasukeMurata/javascript | /shogi_es5/pieces.js | UTF-8 | 1,792 | 3.296875 | 3 | [] | no_license | var canvas;
var ctx;
var nametbl = [
"王", "飛", "角", "金", "銀", "桂", "香", "歩",
"--", "竜", "馬", "--", "全", "圭", "杏", "と"
];
var x1 = [0, 1, 1, 1, 0, -1, -1, -1, 1, -1]; // xの移動量
var y1 = [-1, -1, 0, 1, 1, 1, 0, -1, -2, -2]; // yの移動量
// 移動できる位置。
var movtbl = [
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0], // 王
[2, 0, 2, 0, ... | true |
4eff671f04d433a5f6a252b6c95931c93c772931 | JavaScript | amcginlay/comedystore | /app/routes/jokes.server.routes.js | UTF-8 | 2,533 | 2.5625 | 3 | [
"MIT"
] | permissive | 'use strict';
module.exports = function(app) {
var users = require('../../app/controllers/users.server.controller');
var jokesInternal = require('../../app/controllers/jokes.server.controller');
var jokesExternal = require('../../app/controllers/jokes.icndb.server.controller');
var getJokes = function... | true |
afc1c920332f982df38b324d1b3847093c8a7f6b | JavaScript | YYeceJ/react-demos | /src/TemperatureConvert/component/TemperatureInput.js | UTF-8 | 446 | 2.53125 | 3 | [] | no_license | import React, {Component} from 'react';
class TemperatureInput extends Component {
render() {
return (
<fieldset>
<legend>enter temperature in { this.props.scale === 'c' ? 'Celsius' : 'Fahrenheit'}</legend>
<input onChange={(e) => this.props.onTemperatureChange(... | true |
bf95db5e51e56645ac4c651ca5d233d72be27fc6 | JavaScript | sanmiguella/coding_and_ctf | /Web_dev/JS/Week 4/PE4/After/04_02/script.js | UTF-8 | 2,124 | 3.96875 | 4 | [] | no_license | function find_biggest_fraction() {
// declaration of variables
var numerator_a, denominator_a;
var numerator_b, denominator_b;
// assign the value from textboxes to variable
numerator_a = parseInt(document.getElementById('numerator_a').value);
denominator_a = parseInt(document.getElementById... | true |
9d653dd949dcc486037d1253198b0f8a5dc483f4 | JavaScript | NXLuu/tryHardJS | /1. JS Languege/Function/10. Object properties configuration.js | UTF-8 | 2,660 | 4.28125 | 4 | [] | no_license | /*
Config Object
Property flasgs:
Objects có 3 attributes gọi là flags:
- writable: true - giá trị có thể thay đổi
- enumerable: true - có vòng lặp
- configurable: true - Thuộc tính có thể bị xoá và các attributes có thể thay đổi
Để thay đổi flags chúng ta sử dụng :Object.defineProperty
*... | true |
7f3a5766935ecf101d9b7c5b57b3ba0065c8af5e | JavaScript | chardoo/finalyearproject | /routes/auth.js | UTF-8 | 2,060 | 2.546875 | 3 | [] | no_license | const express = require("express");
const router = express.Router();
const passport = require("passport");
const companyModel =require("../models/company")
claimModel = require("../models/claims")
const authcheck = (req, res, next) => {
if (req.user) {
next();
} else {
res.redirect("/");
}
};
router.p... | true |
d2951116badf7655ab7879304baf12fc28cea7d5 | JavaScript | wreality/patrontrends | /netlify/functions/fetch.js | UTF-8 | 2,265 | 2.59375 | 3 | [] | no_license | //
/* eslint-env node */
const fetch = require("node-fetch")
const URL = "https://www.patronicity.com/"
const defaultOpts = {}
exports.handler = async function (event) {
const slug = event.queryStringParameters.slug
if (!slug) {
return {
statusCode: 404,
}
}
try {
let response = await fetch(... | true |
774d543dbc357850492cb0a56f6181b19d274512 | JavaScript | CyanoFresh/SmartHomePHP | /web/js/site.js | UTF-8 | 939 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | function showErrorMessage(message) {
return $.snackbar({
content: message,
timeout: 5000
});
}
function showSuccessMessage(message) {
return $.snackbar({
content: message,
timeout: 5000
});
}
$('.navbar-toggle-drawer').click(function (e) {
e.preventDefault();
$... | true |
dd716f82f3e015c0bb4ae320266a5506ad9b9a4d | JavaScript | diego-lcruz/Ouvidoria | /routes/usuarios.js | UTF-8 | 2,119 | 2.640625 | 3 | [] | no_license | var express = require("express")
var app = express()
var models = require('../models/index');
var utils = require('../modules/utils');
var Usuario = models.Usuario;
app.post('/usuarios',function (req,res){
Usuario
.create(req.body)
.then(function(usuario){
utils.response(res, true ,"O usuário foi adicionado",usu... | true |
84b837bb22e16cffa18c1b7a412598396d1c2e50 | JavaScript | Wayne-Bai/AST-normalize | /data/Sage/argos-sdk/src/Fields/DecimalField.js | UTF-8 | 5,697 | 2.8125 | 3 | [] | no_license | /* Copyright (c) 2010, Sage Software, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required ... | true |
b4483cde492603f18b9438aba23266739b277f9b | JavaScript | LilMit/WebDevProject | /wbdv-fa20-project-client-react/src/components/CreateRecipe/CreateRecipeComponent.js | UTF-8 | 8,638 | 2.515625 | 3 | [] | no_license | import React, {useState} from 'react';
import RecipeService from '../../services/RecipeService';
import {useHistory, useParams} from 'react-router-dom';
import { connect } from 'react-redux';
import NavigationComponent from '../Navigation/NavigationComponent';
const CreateRecipeComponent = ({userId}) => {
const i... | true |
1c3a215872ec2df61ebf639d60d531e7788c730b | JavaScript | richwilkinson/project_2 | /server.js | UTF-8 | 2,050 | 2.671875 | 3 | [
"MIT"
] | permissive | // Requiring necessary npm packages
const express = require("express");
const session = require("express-session");
// Requiring passport as we've configured it
const passport = require("./config/passport");
// Setting up port and requiring models for syncing
const PORT = process.env.PORT || 8080;
const db = require("... | true |
8116f9e15ba5c6998265c843f77c9477aa8aaf52 | JavaScript | SatwikYadav/M | /Training/HTML CSS/JS/app.js | UTF-8 | 115 | 2.9375 | 3 | [] | no_license | var arr=[35,62,3,45,43,67]
var total =0
for (var i=0;i<arr.length;i++){
total=total+arr[i]
}
console.log(total) | true |
82d0e94ff9deaedea1eebe837208d42c49e6bdf5 | JavaScript | brendansudol/card-counting-game | /src/util/index.js | UTF-8 | 1,275 | 3.3125 | 3 | [] | no_license | const SUITS = { H: '♥', D: '♦', C: '♣', S: '♠' }
export const randBetween = (min, max) => (
Math.floor(Math.random() * (max - min + 1) + min)
)
export const rand = () => randBetween(2, 4)
export const shuffle = arr => {
let counter = arr.length
while (counter > 0) {
let index = Math.floor(Math.random() * ... | true |
d911efa66b53f6a5bc14d555aeb8644bcf718e02 | JavaScript | Jesse-efe/Gotanyalo-React | /src/Components/FormComponent.js | UTF-8 | 3,204 | 2.796875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import { FormContainer } from "../Components/MyStyledComponents";
import FormPage1 from "../Components/FormPage1";
import FormPage2 from "../Components/FormPage2";
import FormPage3 from "../Components/FormPage3";
const FormComponent = () => {
const defaultState = {... | true |
82bff30f0954334cfd71e09a5ea62b4825724591 | JavaScript | Vishwanth-Setty/pos | /src/main/webapp/static/app.js | UTF-8 | 6,490 | 2.734375 | 3 | [] | no_license | //TOAST SERVICE
function toast(message, type) {
$('.toast-body').html(message)
switch (type) {
case 'INFO':
$('#toast').css({
"background": "#9affa2",
"opacity": "1",
"color": "black",
"font-weight": "bold",
"fon... | true |
fa0c6876bddd5d6b20092a0baed54015ff71743b | JavaScript | mazsola739/Rika-s-Katas | /Functional_Fruits/6 kyu Replace With Alphabet Position/index.js | UTF-8 | 611 | 4.34375 | 4 | [] | no_license | /*
Description:
Welcome.
In this kata you are required to, given a string, replace every letter with its position in the alphabet.
If anything in the text isn't a letter, ignore it and don't return it.
"a" = 1, "b" = 2, etc.
Example
alphabetPosition("The sunset sets at twelve o' clock.")
Should return "20 8 5 19 ... | true |
c98226fe18aea22b617635463a9793323f60c5b3 | JavaScript | digitalbazaar/edv-client | /lib/assert.js | UTF-8 | 1,947 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | /*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
*/
import * as base58 from 'base58-universal';
export function assert(variable, name, types) {
if(!Array.isArray(types)) {
types = [types];
}
const type = variable instanceof Uint8Array ? 'Uint8Array' : typeof variable;
if(!types.includes... | true |
f08f02b345ba3d479e14a40d7aacd65b9fabf8ad | JavaScript | dimitardanailov/ddanailov | /website/pages-nextjs/Pages/02-material-ui-custom-list/Components/Content.js | UTF-8 | 2,195 | 2.515625 | 3 | [
"MIT"
] | permissive | import React from 'react'
import Prism from 'prismjs'
import 'prismjs/themes/prism.css'
import Slogan from '@ddanailov/styled/Slogan'
import TargetBlank from '@ddanailov/components/TargetBlankLink'
import List from '@material-ui/core/List'
import ListItem from '@material-ui/core/ListItem'
import styled from 'styled-... | true |
7d96a34a7bbbb703e6312c2e175cf5a25e410e7b | JavaScript | teoDev/TT_skype_bot_web | /app/scripts/filter/tagFilter.js | UTF-8 | 916 | 2.703125 | 3 | [] | no_license | 'use strict';
angular.module('angularjsSkypeBotApp').filter('tagFilter', function () {
return function (questions, tags) {
var result = [];
if (tags.length === 0){
return questions;
}
angular.forEach(questions, function (question) {
var correctQuestion = false;
angular.forEach(quest... | true |
3133bc460e80685ddb11e55ecf31439bbe30d4a5 | JavaScript | babel/babel | /packages/babel-plugin-proposal-decorators/test/fixtures/2022-03-ordering--to-es2015/initializers/exec.js | UTF-8 | 1,095 | 3.109375 | 3 | [
"MIT"
] | permissive | var log = [];
function push(x) { log.push(x); return x; }
function logDecoratorRun(a, b, c) {
push(a);
return function (el, { addInitializer }) {
push(b);
addInitializer(function () { push(c); });
return el;
};
}
@logDecoratorRun(0, 35, 45)
@logDecoratorRun(1, 34, 44)
class A {
@logDecoratorRun(2... | true |
c905fafa4c27efcf9620ca9ea17b247377869286 | JavaScript | clearlydefined/crawler | /ghcrawler/providers/storage/file.js | UTF-8 | 1,933 | 2.75 | 3 | [
"MIT"
] | permissive | // Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
const fs = require('fs')
const path = require('path')
const mkdirp = require('mkdirp')
// TODO finish the implementation of the relevant methods
class FileStore {
constructor(options) {
this.options = options
}
co... | true |
ebfbf696dbde820f2cdeb6877bad0b17d1c4795f | JavaScript | niklauspalerme/Node_JS_Acamica | /Meeting #24 - SQL Part 2 (Node + SQL)/3) Programo (Efrain) - Simple/services/artistasQueries.js | UTF-8 | 1,547 | 2.609375 | 3 | [] | no_license | const sequelize = require('./conexion');
///////////////////////////////////////////////////////////
//Funciones
const findAllArtists = async () => {
return await sequelize.query("SELECT * FROM bandamusical", { type: sequelize.QueryTypes.SELECT })
.then(bandas => bandas)
}
const createArtist = async (n... | true |
ce6a0c55f4b21f23afc9780064d6b2bf8d1e3073 | JavaScript | HammadAhmedSherazi/JavaScript-Assignment-Chapter-1-67 | /Chapter 17-20/Question 3/app.js | UTF-8 | 63 | 2.5625 | 3 | [] | no_license | for ( var i =1; i<=10; i++)
{
document.write(i + '<br>');
} | true |
2120bb131b163f519a4411e7ad02338b2377a9c0 | JavaScript | abdurrauf2022/egatepas_sserver | /cra/src/mannir/egatepass/EGatePassApp.js | UTF-8 | 2,619 | 2.75 | 3 | [] | no_license | import React from "react";
import AppBarDrawer from "./AppBarDrawer";
import axios from "axios";
import io from "socket.io-client";
const config = require('../config');
export default class EGatePassApp extends React.Component {
constructor() {
super();
this.server = process.env.REACT_APP_API_URL || conf... | true |
a35e00dfce0ad1de770429b594a64d76ac655185 | JavaScript | Mendoncadvd/psAurum | /exerc2.js | UTF-8 | 959 | 3.703125 | 4 | [] | no_license | const removeChar = (sequencia, multiplicador) => {
let sequenciaNova = "";
for (let i = 0; i < sequencia.length; i++) {
if (sequencia[i] !== "?") {
let recebe = "";
sequenciaNova += recebe.concat(sequencia[i])
} else {
if (sequencia[i - 1] == undefined) {
... | true |
958e19ec9f548354499a00e449e1bc4e2db9c7b9 | JavaScript | Tina-A-Zhang/public_library_app | /src/model/Book.js | UTF-8 | 2,404 | 3.1875 | 3 | [] | no_license | function Book(slots) {
this.isbn = slots.isbn;
this.title = slots.title;
this.year = slots.year;
};
Book.loadAll = function () {
var i = 0, key = "", keys = [], bookTableString = "", bookTable = {};
try {
if (localStorage["bookTable"]) {
bookTableString = localStorage["bookTable... | true |
837484c59011722d70c062b073fe72f9edcaa284 | JavaScript | austintheriot/algorithms-and-data-structures | /src/Algorithms/Graphs/isGraphATree/Implementations/2021-2-26 isGraphATree (one liner).js | UTF-8 | 586 | 3.390625 | 3 | [] | no_license | /*
Given a node from a connected graph, implement an algorithm
to determine whether the graph is a tree or not.
*/
export default function isGraphATree(node) {
if (!node) return isATree;
if (node.visited) return false;
node.visited = true;
for (let child of node.children) {
if (!isGraphATree(child)) r... | true |
804ed3a46cb5c7b17019bde24caa6f61d7f0a332 | JavaScript | Cloudoki/react-redux-donderstarter | /internals/generate/componentStateless/templates/component.js | UTF-8 | 1,168 | 2.9375 | 3 | [
"MIT"
] | permissive | const styles = `
const styles = {
container: {
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
minHeight: '100%',
},
}
`
module.exports = function (name, withStylesheet) {
const className = name.charAt(0).toLowerCase() + name.slice(1)
return `import... | true |
aa310d12cee54eaa58dd710e07ed9c5c5e355249 | JavaScript | pescador95/api-appharma | /src/app/controllers/EstoqueController.js | UTF-8 | 4,427 | 2.609375 | 3 | [] | no_license | import Estoque from '../models/Estoque'
const { Op, QueryTypes } = require("sequelize");
class EstoqueController {
async show(req, res) {
const { idloja, idproduto } = req.params
console.log("Entrei para pegar idLoja: "+ idloja +" idproduto: "+ idproduto)
try {
const estoque = ... | true |
d2e4056f5eb9bd12a855ed010f79cd4a520b7575 | JavaScript | LonleyBuzzyBee/EventLog | /src/_tests_/reducers/eventlist-reducer.test.js | UTF-8 | 1,935 | 2.65625 | 3 | [] | no_license |
import eventListReducer from '../../reducers/eventlist-reducer';
describe('eventListReducer', () => {
let action;
const eventData = {
title: 'a thing happened',
location: 'a place',
description: 'this was a cool thing that happened',
occurrences: 1,
id: 1,
};
const current... | true |
e0bcb8ac034174651799f01c59eb6d805fc5fcfa | JavaScript | briehl/kbase-ui-plugin-feeds | /src/plugin/iframe_root/modules/vendor/kbase-common-js/dom.js | UTF-8 | 1,827 | 2.703125 | 3 | [
"MIT"
] | permissive | /*global
define
*/
/*jslint
browser: true,
white: true
*/
define([], function () {
'use strict';
function createElement(name) {
return document.createElement(name);
}
function appendRoot(child) {
document.appendChild(child);
}
function append(parent, child) {
return ... | true |
64251f9aaa70af6cb467ceabc1c5a1d5de511830 | JavaScript | tinderzone/algorithm-practice | /compareWithBackspace.js | UTF-8 | 614 | 4.40625 | 4 | [] | no_license | // This week's question:
// Given two strings n and m, return true if they are equal when both are typed into empty text editors. The twist: # means a backspace character.
function processString(str) {
return str
.split("")
.reduce((acc, letter) => {
letter == "#" ? acc.pop() : acc.push(letter);
r... | true |
df22348ed6496e9b20c5f458b737c26b4668d229 | JavaScript | Lintik/CodeFights-Arcade | /Intro/Exploring the Waters/Are Similar/code.js | UTF-8 | 227 | 3.0625 | 3 | [] | no_license | function areSimilar(a, b) {
let s = new Array();
for(let i = 0; i < a.length;i++)
if(a[i] != b[i])
s.push(i);
return s.length == 0 || s.length == 2 && a[s[0]] == b[s[1]] && b[s[0]] == a[s[1]];
}
| true |
a8d9675c5f131f8cb257ad23feb2cc005fa247d1 | JavaScript | Podepod/ReeeeManJs2.0 | /discord/Commands/misc/someone.js | UTF-8 | 857 | 2.640625 | 3 | [] | no_license | const Discord = require('discord.js');
module.exports = {
name: 'someone',
description: 'Tag someone random',
category: 'misc',
guildOnly: false,
dmOnly: false,
execute(bot, message, args) {
message.guild.members.fetch({ withPresences: true }).then(fetchedMembers => {
const ... | true |
8fa1e1c9421a504470cbc2998d1adf7391189540 | JavaScript | matthewbdaly/JSBasicShell | /static/js/parser.js | UTF-8 | 3,572 | 3.421875 | 3 | [] | no_license | // Constructor
function Parser() {
'use strict';
return true;
}
// Process the tokens
Parser.prototype.processTokens = function (input) {
'use strict';
// Define variables
var item, output, token, tokens = [], linenum, programline;
// Get the tokens
for (item in input) {
if (inpu... | true |
b440d2d09afb447fa177b2fe4f303bb59f370348 | JavaScript | cb161769/aws-lambda-serverless-Functional | /helpers/healthConsumptionHelper.js | UTF-8 | 8,975 | 2.6875 | 3 | [] | no_license | //connections
const {
getMonthlyHelperConnection,
} = require("../helpers/connectionHelpers/monthlyHelper");
const {
getByMonthConnections,
} = require("../helpers/connectionHelpers/getByMonthHelper");
const { getMonthlyHelper } = require("../helpers/monthlyHelper");
//device
const { getWeeklyHelper } = require("..... | true |
0f13e77ce1c504661d1e7f4775e87b8667ee4b6c | JavaScript | CourtneeM/TOP | /Remade Projects/todo_list/src/modules/display_controller/todo.js | UTF-8 | 6,322 | 2.953125 | 3 | [] | no_license | import '../../styles/todo_container/style.css';
const todoContainer = (() =>{
const render = (() => {
const todoContainer = (todo) => {
const todoContainer = document.createElement('div');
const editDeleteTodoBtnsContainer = todoControls.generateEditDeleteBtnsContainer();
todoContainer.c... | true |
fe022821d299a24ee7a794eff24934a7e558fd76 | JavaScript | allagrim/n220spring2021 | /labs/lab2/worldwrap/js/app.js | UTF-8 | 180 | 3.09375 | 3 | [] | no_license | let x = 0;
let y = 100;
function setup(){
createCanvas(800,600)
}
function draw(){
background(100);
circle(x,y,25)
x = x+5;
if(x>800){
x = 0
}
} | true |
1b0362736f4c939168d5b4eab6443fa0d8f63265 | JavaScript | B3rn475/proxied-socket | /lib/client.js | UTF-8 | 2,277 | 2.6875 | 3 | [
"MIT"
] | permissive | /*jslint node: true, nomen: true, es5: true */
/**
* Developed By Carlo Bernaschina (GitHub - B3rn475)
* www.bernaschina.com
*
* Distributed under the MIT Licence
*/
"use strict";
var ipaddr = require('ipaddr.js');
function formatIPv4Header(socket) {
var header = new Buffer(14);
header.writeUInt8(13, 0);... | true |
c71e0765e7dc046fbb22e911b1ebf15cde4bc9c8 | JavaScript | jsadoun/CodingDojo | /MEAN/fullMEAN/Post-n-Comments/server/controllers/UserController.js | UTF-8 | 1,987 | 2.59375 | 3 | [] | no_license | let User = require("mongoose").model("User");
class UserController{
all(req,res){
User.find({}, (err,users)=> {
if(users){
return res.json(users);
}else{
return res.json({errors: "Failed to retrieve users"});
}
});
}
regis... | true |
7302f457702c5fae8ffcf66bfb804d9a2b1b42b3 | JavaScript | dmitru/react-svg-chart | /src/utils/computeTickValues.js | UTF-8 | 593 | 2.96875 | 3 | [] | no_license | import ceil from 'lodash/ceil';
import floor from 'lodash/floor';
function computeTickValues({ min, max }) {
const maxAbs = Math.max(Math.abs(min), Math.abs(max));
const maxAbsExponent = Math.ceil(Math.log10(maxAbs + 1)) - 1;
const maxRounded = ceil(max, -maxAbsExponent);
const minRounded = floor(min, -maxAbsE... | true |
8d84b0aa1a819c920c9d7d7c06720ce5b2889494 | JavaScript | DamonOehlman/versionit | /test/helpers/mocker.js | UTF-8 | 1,406 | 2.734375 | 3 | [
"MIT"
] | permissive | var async = require('async');
var path = require('path');
var fs = require('fs');
var _ = require('underscore');
var scaffoldData = {
name: 'Scaffold Test Data'
};
function canDelete(filename) {
return (/\.json$/i).test(filename) || filename === 'test.js';
}
exports.removeVersionFiles = function(callback) {
va... | true |
9baceba9ce5f755de4fe0e53cc58ce5a47e312c9 | JavaScript | tavareshenrique/fastfeet-app | /src/components/Avatar/index.js | UTF-8 | 847 | 2.734375 | 3 | [
"MIT"
] | permissive | import React, { useState, useCallback, useEffect } from 'react';
import PropTypes from 'prop-types';
import { Container, Name } from './styles';
export default function Avatar({ name, size }) {
const [color, setColor] = useState(null);
const shortName = useCallback(() => {
let initials = name.match(/\b\w/g) ... | true |
24fad9bdf39dd737c221bfc394161122daf496ab | JavaScript | SL0TR/nodejs-express-mongo | /ex-1/server.js | UTF-8 | 753 | 3.15625 | 3 | [] | no_license | // TODO: create a basic server with express
// that will send back the index.html file on a GET request to '/'
// it should then send back jsonData on a GET to /data
var jsonData = {
count: 1,
message: 'hey man, this is my message yo',
lama: 12
};
const express = require('express'),
app = express();
app.ge... | true |
9af48890c737201b064710c2d1237f76912917c2 | JavaScript | runzezhang/gnss | /server/service/handleProcess/handleFollowData.js | UTF-8 | 3,072 | 2.515625 | 3 | [] | no_license |
var fs = require('fs');
var os = require('os');
var parse = require('../../canavprocess/follow_process.js');
var readLine = require('linebyline');
function followProcess(cwd, dataPath, config, cb) {
var stream;
var len = 300;
var maxLen = 400;
var followDataPath = cwd + '/followData/' + dataPath.spli... | true |
e39db825c12a32eb7c3545af2e05e935f7fa4cc5 | JavaScript | muahlers/GrowTeam | /src/public/assets/js/aux-functions.js | UTF-8 | 1,423 | 2.8125 | 3 | [] | no_license | function postData(url = '', data = {}) {
return fetch(url, {
method: 'POST',
mode: 'cors',
cache: 'no-cache',
credentials: 'include', // need for cookies to pass
headers: {
'Content-Type': 'application/json',
},
redirect: 'follow',
referrer: 'no-referer',
body: JSON.stringify... | true |
2bd746421445000104a9bc8fdc91af92fa95c90b | JavaScript | DanielaDominguez/JavaScript-Avanzado | /04-calculadora-edad.js | UTF-8 | 312 | 3.640625 | 4 | [] | no_license | const nombre = prompt('¿Cual es tu nombre?');
const year = parseInt (prompt ('¿Cual es el año en que naciste?'));
const actualyear = 2021;
const edad = actualyear - year ;
/* es equivalente a lo siguiente */
const saludo = `<p> Hola ${nombre} saludos. Tu edad es ${edad} años</p>`;
document.write(saludo); | true |