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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7df2548a422b2b803df6b759bdb59938ec477c89 | JavaScript | grunmouse/math-slae | /analyse.js | UTF-8 | 10,230 | 3.21875 | 3 | [] | no_license | const {MapOfSet} = require('@grunmouse/special-map');
/**
* Считает для каждого неизвестного количество уравнений, в которых оно участвует
* @param {Array<Array[n]<number>>} A - массив векторов, содержащих коэффициенты уравнений
* @returned {Array[n]<number>} - массив с подсчитанными количествами
*/
function var... | true |
0649fce2a67558161f330fe26a368fde0501a472 | JavaScript | paigekim29/coplit | /array/15_getElementsUpTo.js | UTF-8 | 733 | 4.625 | 5 | [] | no_license | // 문제
// 배열과 인덱스를 입력받아 주어진 인덱스 이전의 요소들을 갖는 새로운 배열을 리턴해야 합니다.
// 입력
// 인자 1 : arr
// 임의의 요소를 갖는 배열
// 인자 2 : n
// number 타입의 인덱스 (0 이상의 정수)
// 출력
// n번 인덱스 이전의 새로운 배열을 리턴해야 합니다.
// 주의 사항
// 반복문(for, while) 사용은 금지됩니다.
// 빈 배열을 입력받은 경우, 빈 배열을 리턴해야 합니다.
// 배열의 길이를 넘는 인덱스를 입력받은 경우, 빈 배열을 리턴해야 합니다.
function getElementsUpTo... | true |
ae044cb463c13536743c474675a93d8b011b8e44 | JavaScript | kuangyy/kuangyy.github.io | /resources/html/v1/js/index/music.js | UTF-8 | 5,532 | 2.546875 | 3 | [] | no_license | !function(){
var obj = {
el: $(document),
data: {
timenow: new Array(),//save the played time
time: new Array(),
nowplay: 0,//music id
},
selector: {
musiclist: "#musiclist",
musictext: "#music-... | true |
d63de754f909d09a8fd940d8ec2cd00a9e1446ad | JavaScript | Teo-Reat/work--freelance--mama-travel--lumen | /public/js/slider.js | UTF-8 | 4,069 | 2.53125 | 3 | [
"MIT"
] | permissive | let slideNow = 1;
let slideCount = $('#slidewrapper').children().length;
console.log(slideCount);
let slideInterval = 3000;
let navBtnId = 0;
let translateWidth = 0;
// slider one
$(document).ready(function() {
let switchInterval = setInterval(nextSlide, slideInterval);
$('#viewport').hover(function() {
... | true |
ee513d2adf4696c73c85ba64ead94a6efaec900e | JavaScript | vova-learn/codewars-js | /arrays/11_insert-dashes.js | UTF-8 | 728 | 4.03125 | 4 | [] | no_license | // https://www.codewars.com/kata/insert-dashes
const getNumberWithDash = (number) => {
const numbers = String(number).split(``);
let prevIndex = 0;
return numbers.reduce((acc, item, index, arr) => {
if (item % 2 === 1 && arr[prevIndex] % 2 === 1 && index !== 0) {
acc.push(`-`);
... | true |
64232e7feacaac88f482d5fad6ccc469a61d4603 | JavaScript | cukomadu/dom-manipulations | /main.js | UTF-8 | 2,998 | 3.34375 | 3 | [] | no_license |
document.querySelector("#thanks button").addEventListener('click',function(){
// TASK #1
alert("yowch! don't click me so hard!")
})
document.querySelector("#double button").addEventListener('click',function(){
// TASK #2
var pNode = document.querySelector("#compoundInvestment")
var value = pNode.textContent... | true |
6af639e84ca66b9d4d18a278374dbeae742f4b14 | JavaScript | alexdevero/edabit-challenges | /arrays/js-oddly-or-evenly-positioned.js | UTF-8 | 986 | 3.296875 | 3 | [] | no_license | function charAtPos(r, s) {
return Array.isArray(r) ? r.filter((c, i) => s !== 'even' ? i % 2 === 0 : i % 2 !== 0) : r.split('').filter((c, i) => s !== 'even' ? i % 2 === 0 : i % 2 !== 0).join('')
}
Test.assertSimilar(charAtPos([2,4,6,8,10],"even"), [4,8])
Test.assertSimilar(charAtPos([1,2,3,4,5,6,7,8,9,10],"odd"), [... | true |
ec981729296e27e9ed600c5b6f4024dc1863b1ba | JavaScript | TobyZiegler/tobyzieglerdotcom | /homeapp/contact/contact.add.js | UTF-8 | 1,850 | 2.625 | 3 | [] | no_license | function addContact(contact) {
var bulletSpace = " • ";
// obfuscated email using btoa()
var sendDomain = "VG9ieVppZWdsZXIuY29t";
var sendTo = "VG9ieUA=";
var address = atob(sendTo) + atob(sendDomain);
var mailContent = ("<a href=\"mail" + "to:" + address + "?Subject=Resume\u002... | true |
6b1e12400a0fffc7529fa3cd42b59e6f9e08a8c3 | JavaScript | Kaylajessi/DIG4503 | /lab12/Client/Put.js | UTF-8 | 891 | 2.703125 | 3 | [
"MIT"
] | permissive | import React from "react";
import axios from "axios";
class Put extends React.Component{
constructor(){
this.state = {ISBN:"", title:"", author:"", description:""}
}
render(){
return(<div>
<input type="text" onChange={e=>this.update(e, "ISBN")}>ISBN</input>
<input t... | true |
6f34075d4d2303b69d2c5225bd63e7c1971b3235 | JavaScript | RomanS2N/RomanS2N.github.io | /rs/source/templates/default/js/newline.js | UTF-8 | 445 | 2.828125 | 3 | [] | no_license | if (typeof sttep == 'number' && sttep>0)
{
var reloadTimer = null;
reload_timer_on = true; window.onload = function()
{
setReloadTime(sttep);
}
function setReloadTime(secs)
{
if (arguments.length == 1) {
if (reloadTimer) clearTimeout(reloadTimer);
reloadTimer = setTimeout("setReloadT... | true |
1150d89c1fc249bd4405203debbc11d849ca0a96 | JavaScript | rana-saeed/se-assignment | /test/quote.js | UTF-8 | 7,651 | 2.890625 | 3 | [] | no_license |
var assert = require('chai').assert;
var app = require('../app.js');
var request = require('supertest');
var Quote = require('../quotes.js');
var db = require('../db.js');
var quotes = require('../quotes.json');
before(function (done) {
// use this after you have completed the connect function
db.connect(fun... | true |
3f75a8a176142297411bc039b91eacc439e00234 | JavaScript | zackszhu/AliceAdventure2018 | /AliceAdventure/app/Editor/Scripts/EditorScripts/Scene.js | UTF-8 | 2,603 | 2.765625 | 3 | [] | no_license | 'use strict';
const {PIXI, ID, Event, Debug} = require('./Utilities/Utilities');
const GameProperties = require('./GameProperties');
// class
var Scene;
// variables
Scene = function(_id, _name = "untitledScene"){
if (_id == null) _id = ID.newID; // NEVER MODIFY THIS
this.id = _id;
this.name = _name;
this.conta... | true |
2b386984e9f07aaa230fb0b6dab47c09df3cda6a | JavaScript | ravbialk/ravbialk.github.io | /zadania-domowe/Modul_5/Zadanie-1/pobierz-dane.js | UTF-8 | 439 | 2.71875 | 3 | [] | no_license |
function pobierzDane(e) {
e.preventDefault();
$.getJSON(
"https://akademia108.pl/kurs-front-end/ajax/1-pobierz-dane-programisty.php", wrzucDaneDoHtml)
}
function wrzucDaneDoHtml(dane) {
$('div').append("<p> Imię: "+ dane.imie + "</p>");
$('div').append("<p> Nazwisko: "+ dane.nazwisko + "</p>")... | true |
bc8bc7705e893a383aea5ce066e83e112962af6a | JavaScript | ifreeWorld/interview-code | /leetcode/2.两数相加.js | UTF-8 | 2,016 | 3.75 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=2 lang=javascript
*
* [2] 两数相加
*
* https://leetcode.cn/problems/add-two-numbers/description/
*
* algorithms
* Medium (42.31%)
* Likes: 9069
* Dislikes: 0
* Total Accepted: 1.6M
* Total Submissions: 3.8M
* Testcase Example: '[2,4,3]\n[5,6,4]'
*
* 给你两个 非空 的链表,表示两个非负的整数。它们... | true |
431fffde965c157e5e3a391f554dccd8cbc883ed | JavaScript | DanmarksAdresser/Dawa | /packages/server/public/js/autocomplete/dawa-autocomplete2.es.js | UTF-8 | 54,457 | 2.921875 | 3 | [
"MIT"
] | permissive | var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
// shim for using process in browser
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
function defaultSetTimout() {
throw new Error('setTimeout... | true |
bf0f7028ea378d120874d2388a93a9f6652b0da6 | JavaScript | Thourum/Request-Header-Parser | /index.js | UTF-8 | 678 | 2.625 | 3 | [] | no_license | var express = require('express');
var app = express();
app.get('/', function (req, res) {
var ip = req.headers['x-forwarded-for'] ||
req.connection.remoteAddress ||
req.socket.remoteAddress ||
req.connection.socket.remoteAddress;
var lang = req.headers['accept-language'].split(",... | true |
948105648d7d1456a22f4407729fe72385097be8 | JavaScript | dletk/mithong | /middleware/jwt-auth.js | UTF-8 | 1,214 | 2.734375 | 3 | [
"MIT"
] | permissive | // Middleware for jwt-authentication
const expressJWT = require("express-jwt");
const config = require("config");
// The secret_key should be set using config environment
const SECRET_KEY = String(config.get("jwt_secret_key"));
/**
* Method to extract the JWT token from request header
* @param {request} req the re... | true |
58298f0d6c1858acef448134b75e47851d6aed3e | JavaScript | Fargoboy/MessagingApp | /src/reducer/visitor-reducer.js | UTF-8 | 599 | 2.703125 | 3 | [] | no_license | import { combineReducers } from 'redux';
const INITIAL_STATE = {
all_visitors: [
{visitorName: "Professor", visitorEmail: "Professor@fhsu.edu", visitorPhone: "1800-999-9999"},
],
};
const visitorsReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case 'ADD_VISITOR':
... | true |
b244fb991a9e2d9882f4a8cdd49a66272b0b5b4b | JavaScript | MunrraMT/javascript-Tutorial-and-Projects-Course | /secao-13/aula-272/semAula/src/searchForm.js | UTF-8 | 302 | 2.796875 | 3 | [
"MIT"
] | permissive | function searchForm(input) {
const arrData = JSON.parse(localStorage.getItem('drinks')).drinks;
const filterRegex = new RegExp(`${input.value}`);
const drinksFiltered = arrData.filter((item) => {
return filterRegex.test(item.strDrink);
});
return drinksFiltered;
}
export default searchForm;
| true |
b005eeee07eef89b30b401e4a831ea3ab7dd30a3 | JavaScript | Oyxing/yixiexampp | /nodejs/dome/08.url模板.js | UTF-8 | 640 | 2.765625 | 3 | [] | no_license | var url = require('url');
var obj = url.parse("http://localhost:3000/index.html?username=stark&age=18");
console.log(obj);
/*Url {
protocol: 'http:', // 协议部分
slashes: true, // 斜杠
auth: null, // 授权
host: 'localhost:3000', // 主机
port: '3000', // 端口
hostname: 'localhost', // 主机名(域名部分)
hash: null, ... | true |
7605ca55d9eaa1d7424893a016fcc34da84813ba | JavaScript | araujoivan/alura-es6-good-pratices | /client/js/app-es6/services/ProxyFactory.js | UTF-8 | 1,848 | 3.28125 | 3 | [] | no_license | export class ProxyFactory {
static create(target, props, action) {
return new Proxy(target, {
//when a DealList function is called a call to get and assign is performed
// target : dealList
// prop : may be a funnction
// receiver : reference to proxy obje... | true |
47ae7333a4094c73d462e288e43baa524cc9d654 | JavaScript | curso-react/formularios | /src/components/improved-card.js | UTF-8 | 977 | 2.734375 | 3 | [] | no_license | import React from 'react';
const imporvedCard = (props) => {
// Using complex logic
let awardText;
if (props.hasOscar) {
if (props.imdbRate > 7) {
awardText = <p>WOW Oscar and IMDB rating {props.imdbRate}</p>
} else {
awardText = <p>Got the Oscar and IMDB rating {props.imdbRate}</p>
... | true |
ac06228e34f57489bff2c2bc73ad9f3ee796199b | JavaScript | koziel101/Sinensia-Angular | /FRONTEND/demotypescript/demo.js | UTF-8 | 576 | 3.5 | 4 | [] | no_license | var a = 100;
a = 8;
var nombre = "Pepin";
var numero = 23;
var descartalogado = true;
function doSomething() {
return 30;
}
numero = doSomething();
var numeros = [34, 5, 7, 97];
var cosasVarias = [23, true, "cierto"];
var cualquierCosa = true;
cualquierCosa = "teste";
function hazAlgo(p1, p2) {
return "Funciona... | true |
92fa657516b53320ebfa8a990129f2e663ae51a7 | JavaScript | je223sv/prototype | /src/Wizard/index.js | UTF-8 | 6,110 | 3.109375 | 3 | [] | no_license | import React from 'react'
import * as S from './style'
import config from '../config.js'
// Validation => no spaces in website name!!
function CreateWebsite() {
const [name, setName] = React.useState('')
const [animal, setAnimal] = React.useState('katt')
const [step, setStep] = React.useState(1)
const [show... | true |
c6877ed597298e38f6f277940021b6fbc8b418e1 | JavaScript | dibashthapa/ecommerce-react | /src/Dashboard/pages/Dashboard/store/reducers.js | UTF-8 | 1,899 | 2.703125 | 3 | [] | no_license | import actions from './actions';
const initialState = {
success: false,
loading: false,
error: null,
products: [],
filteredProducts: [],
cartProduct: [],
};
const reducer = (state = initialState, action) => {
switch (action.type) {
case actions.GET_PRODUCTS:
return {
..... | true |
b5261af03e89e5b28bc7b046882c8b937cd29ef0 | JavaScript | Daminichandrakar/Js_Programming_Construct | /SequencePractiseProblems/AddTwoDiceNumbers.js | UTF-8 | 569 | 4.53125 | 5 | [] | no_license | //Use REPL – Add two Random Dice Number and Print the Result
let firstRandomDice =( Math.floor(Math.random() * 10) % 6 ) + 1;
let secondRandomDice =( Math.floor(Math.random() * 10) % 6 ) + 1;
console.log("Randomly 2 Dice Throw And Addition is");
console.log("----------------------------------------------");
console.l... | true |
9b653a6f3b51ff3162e66587b1353a9b4e2ffe2e | JavaScript | michellekarunaratne/driverBuddyServer | /models/driver.js | UTF-8 | 1,403 | 2.65625 | 3 | [] | no_license | const mongoose=require('mongoose');
const Schema =mongoose.Schema;
//mongoose.connect('mongodb://localhost:27017/driverbuddy',{ useNewUrlParser: true });
mongoose.connect('mongodb+srv://driver-1:driver_1@driverbuddy-of8hf.mongodb.net/driverbuddy?retryWrites=true',{ useNewUrlParser: true });
mongoose.connection.once('... | true |
6fc6c9d5ba3fcec729a36419d117ab338b8d7297 | JavaScript | jjwill17/assignments | /exercises/july/july25/getElementBy/app.js | UTF-8 | 841 | 3.65625 | 4 | [] | no_license | var myUl = document.getElementById("my-list")
// Need to create the new element
var myLi = document.createElement("li")
myLi.textContent = "This is from my app.js file"
//Append that element to the ul
myUl.appendChild(myLi)
console.log(myUl)
var submitBtn = document.addEventListener("submit-btn")
// Add eventList... | true |
b175ba7a18f0a5d80eaf302acdfddbfd60893775 | JavaScript | Luan9404/learning-react | /src/templates/Home/index.jsx | UTF-8 | 4,889 | 2.96875 | 3 | [] | no_license | import { useState, useCallback, useEffect } from 'react';
import './styles.css'
import { loadPosts } from '../../utils/loadPosts';
import { Posts } from '../../components/Posts';
import { Button } from '../../components/Button';
import { TextInput } from '../../components/TextInput';
export const Home = () => {
/* st... | true |
c0db50761f41d13a4fd34f97d99ce684c2065d0b | JavaScript | kalinalazarova1/TelerikAcademy | /Web/JS_DOM&UI/11.HTMLTemplatesHandlebars/04.ExtendedLIstViewjQueryPlugin/script.js | UTF-8 | 567 | 2.671875 | 3 | [
"MIT"
] | permissive | // 4.*Extend the previous task to set the template inside the DOM element, instead of setting it with data-template
/// <reference path="jquery-1.11.1.js" />
/// <reference path="handlebars-v1.3.0.js" />
(function ($) {
$.fn.listview = function (collection) {
var $this = $(this);
var template = H... | true |
8f8d85daa1768174fc15cf4e3f62654a07b59dbd | JavaScript | fiknahs/Pixel_Art_Maker | /designs.js | UTF-8 | 862 | 2.828125 | 3 | [] | no_license | $(function() {
var grid = $("#pixelCanvas");
var currentColor = "#000";
$("#sizePicker").submit(function(e) {
e.preventDefault();
makeGrid();
});
$("#colorPicker").change(function() {
currentColor = $(this).val();
});
grid.on("mousemove", "td", function(e) {
... | true |
92ba0bd840e7bba6b220c7309ca710878910eb01 | JavaScript | mandober/debrief.js | /04_grammar/modules/umd.js | UTF-8 | 3,703 | 3.328125 | 3 | [] | no_license | // UMD: Universal Module Definition
// https://github.com/umdjs/umd/tree/master/templates
// no dependencies
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && modul... | true |
abe56fc78b7b2256e0e37316eaa1689be7c7b39f | JavaScript | Tunoc/FullstackJS-TypeScript | /Period1/(11-09-2020) - Promises and asyncawait/exercises/ex1-crypto-module.js | UTF-8 | 1,141 | 3.3125 | 3 | [] | no_license | const crypto = require('crypto');
//generateHexObjects()
// b) Use Promises to solve the problem.Hints:
// 1)Create a function makeSecureRandom(size) that returns a promise, using the callback baseddesign,
// provided by the randomBytes(..) method.
// 2)Since the result from one calculation does not i... | true |
7afe8b6674e431ca027df589dce9639b38ddabf8 | JavaScript | natuan271/tictactoe | /src/components/Test.js | UTF-8 | 747 | 3.0625 | 3 | [] | no_license | import React, { useState }from 'react'
function Test() {
const [counter, setCounter] = React.useState(60);
const [ok,setOk] = useState(true)
const[text,setText]= useState(0)
React.useEffect(() => {
const timer =
counter > 0 && setInterval(() => ok?setCounter(counter - 1):"", 1000);
return () => cl... | true |
06df3bfbaf78829c4eca52b0cd4cfa439647ecc8 | JavaScript | Voisvet/tg-bot-control-panel-frontend | /src/store/rekognition/actions.js | UTF-8 | 894 | 2.609375 | 3 | [] | no_license | import * as api from '../../services/apiConnector';
import * as types from './actionTypes';
import * as errorsActions from '../errors/actions';
// Fetch list of images from server
// And save it in redux store
export function fetchListOfImages() {
return async(dispatch, getState) => {
// Notify that fetch start... | true |
8664910c39f33e3fc87efa50fb2d7ea347b4d1f3 | JavaScript | paulvalderama/solo-proj | /client/index.js | UTF-8 | 616 | 2.546875 | 3 | [] | no_license | import React from 'react';
import { render } from 'react-dom';
import App from './App.jsx';
//DOM Document Object Model, cross-platform and language-indepndent application programming interface that treats an HTML, XHTML, or XML document as a tree structure wherein each node is an object representing a part of the doc... | true |
ababe43f8ad35c3dc83c71985a0441f6c58e4ad4 | JavaScript | maxkvoronin/itmo-js | /dz7.4.js | UTF-8 | 2,083 | 3.84375 | 4 | [] | no_license | /*
* JS Занятие 7. Задача 4**.
* Написать кодер для шифра Цезаря (https://ru.wikipedia.org/wiki/Шифр_Цезаря).
* На вход принимается строка и сдвиг. На выход - зашифрованное/расшифрованное сообщение.
* Выдержка из Вики:
* Шифр Цезаря — это вид шифра подстановки, в котором каждый символ в открытом
* тексте заменя... | true |
c7a10b2bb405b5b82b92dba4a6a0bfb0a8118c82 | JavaScript | anww1/javascript-objects-bootcamp-prep-000 | /objects.js | UTF-8 | 268 | 2.734375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | var playlist = {} ;
playlist.Beyonce = "4";
playlist["Michael Jackson"] = "Bad";
function updatePlaylist(playlist, artist, song) {
playlist[artist]= song;
return playlist;
}
function removeFromPlaylist(playlist, artist) {
delete playlist[artist];
return playlist;
} | true |
d69b726dacc0fa2a3f05c364beebf6b0bd4b5075 | JavaScript | EfrainDiaz-create/JavaScript | /VarJS/var12.js | UTF-8 | 660 | 4.21875 | 4 | [] | no_license | {
var contador;
contador=1;
while (contador<5)
{
let dato=prompt("Introduce número del 1 al 10:", " ");
var num=parseInt(dato); // en esta parte sustituimos "let" por "var" para mostrar el último numero ingresado
//que corresponde al ejercicio 13
document.write("El numero... | true |
9fcaf7d1dfcf494fc613db5c71776b5dcc8e21d9 | JavaScript | huntingkevin/restful-site | /routes/answer.js | UTF-8 | 3,890 | 2.609375 | 3 | [] | no_license | //get all answers
exports.getanswers = function (req, res) {
//
req.models.answer.find(
{'question': req.params.question_id},
function (err, answers) {
if (err === null) {
res.status(200).send("All answers: " + JSON.stringify(answers));
console.log("g... | true |
d603bc18e6409ac74a1895d7bd0b1c842d650c7b | JavaScript | zhanzhilingg/CoinScene | /src/core/widgets/scaler/Scaler.js | UTF-8 | 2,922 | 2.6875 | 3 | [] | no_license | // import * as THREE from 'three'
import Widgets from '../Base'
import { pxConversionMm, mmConversionPx, getViewDisFromCamera } from '@core/utils'
import config from '@core/config/config'
export default class Scaler extends Widgets {
/**
* 名称
*
* @readonly
* @memberof Scaler
*/
get name () {
retu... | true |
0227781092165f3547cd2b9120818eae62101147 | JavaScript | AvianLearning/unit-e2e-testing-vue-calculator | /tests/e2e/specs/test.js | UTF-8 | 2,824 | 2.890625 | 3 | [] | no_license | // https://docs.cypress.io/api/introduction/api.html
describe('calculator', () => {
beforeEach(() => {
cy.visit('/')
});
it('should have working number buttons', () => {
cy.get('#number2').click();
cy.get('.display').should('contain', '2');
});
it('number buttons should update display', () => {... | true |
4ad05a4258a33a5a43efd947dc2fb165c7842339 | JavaScript | dos077/battleship | /tests/unit/GameBoard.spec.js | UTF-8 | 2,044 | 2.859375 | 3 | [] | no_license | import GameBoard from '@/GameBoard.js'
describe('game board', () => {
const board = GameBoard();
const start = { x: 0, y: 0 }
const end = { x: 0, y: 3 }
board.newShip({ start: start, end: end, size: 4 });
it('shows buildable spots', () => {
const buildTargets = board.buildTargets();
expect(buildTarg... | true |
64476d48c00d0d663b9668516bda01bfb54d1d79 | JavaScript | jtguzman/web-gv | /server/routes/api/statics.js | UTF-8 | 871 | 2.53125 | 3 | [] | no_license | 'use strict';
var inflection = require('inflection');
var statics = require('fi-statics');
var is = require('is_js');
module.exports = (router) => {
/** Get statics by name */
router.get('/', (req, res) => {
/* Convert the static name string to array if necessary */
if (is.string(req.query.statics)) {
... | true |
dddee4d49ba4ae93137c738b3f7a93d2b84f2cdb | JavaScript | EstebanCardenas/Cloud-Proyecto1 | /src/components/ConcursoDetail.js | UTF-8 | 4,731 | 2.515625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import Grid from '@material-ui/core/Grid';
import Entrada from './Entrada';
import Pagination from '@material-ui/lab/Pagination';
import CircularProgress from '@material-ui/core/CircularProgress';
export default function ConcursoDetail({match}) {
//state
cons... | true |
064d51e7a57907a522de30422b9efd4ab9ab222e | JavaScript | drinoff/JS-Advanced | /DOM/05. Table - Serach Engine/solution.js | UTF-8 | 799 | 2.96875 | 3 | [
"MIT"
] | permissive | function solve() {
document.querySelector('#searchBtn').addEventListener('click', onClick);
function onClick() {
const searchText = document.getElementById('searchField');
const tablePersonsElements = document.querySelectorAll('tbody td');
for (let i = 0; i < tablePersonsElements.length; i++) {... | true |
3b6103a5857bc1972673587a8a7b4602d60c38ba | JavaScript | moldoc/duck-sightings | /client/src/actions/index.js | UTF-8 | 878 | 2.578125 | 3 | [] | no_license | import axios from 'axios';
import { FETCH_SIGHTINGS } from './types';
import { CREATE_SIGHTING } from './types';
import { FETCH_SPECIES } from './types';
// Forward ajax request to the reducers and dispatch
// action when promise resolved
export const fetchSightings = () => async dispatch => {
const res = await axio... | true |
65d57a5f0de1be766c5c8374cc4d441aee48922b | JavaScript | linkmat1/linkmod | /assets/js/elements/filemanager/helpers.js | UTF-8 | 1,348 | 3 | 3 | [
"MIT"
] | permissive | const DS = '/'
/**
* Représentation d'un dossier
* @typedef {{folder: string, count: number, children: Folder[], path: string}} Folder
*/
/**
* Retour d'API
* @typedef {{path: string, count: number}} Path
*/
/**
* Normalize la structure des dossiers en renvoyant un arbre
*
* @param {Path[]} paths
* @return... | true |
a92719322ab18e17d076ca1f831b651ff5b85f3a | JavaScript | LouisHuangGT/DiseaseDataVisualization | /Virus/js/Arcbar.js | UTF-8 | 8,573 | 3 | 3 | [] | no_license | /**********************************************
/* Example of how to use d3 to create scalable
/* SVG radial progress bars, controllable values
/* and colours are passed in via data attributes.
************************************************/
// var disease = 3;
// showRadialProgress(disease);
function showRadialP... | true |
13666a2f6297b64f9118945cb1ea20da29b96e72 | JavaScript | henrihakkarainen/projects | /Javascript_I/vko40/weather_api/index.js | UTF-8 | 789 | 3.46875 | 3 | [] | no_license | const fetch = require('node-fetch')
/*
* 17.
*/
const source = 'http://api.openweathermap.org/data/2.5/weather?q=Tampere\
&APPID=ef3243182dd30b5349c182a23ce62562'
fetch(source)
.then(function (response) {
return response.json();
})
.then(function (myJson) {
console.log(JSON.stringify(my... | true |
6b0dd2475b7d028dc885d4ced70e6cb13f350c0b | JavaScript | BastienLozach/boye_lozach_lecteur_php | /parser/TokenFactory.js | UTF-8 | 2,473 | 2.84375 | 3 | [] | no_license | const keywords = require('./keywords.js')
const Token = require('../grammar/Token.js')
const chalk = require('chalk')
class TokenFactory{
constructor(){
this.tokens = [];
this.errorList = [] ;
}
tokeniseLine(line, position) {
line = line.replace(/\/\/.*/, "//COMMENTAIRE");
... | true |
1f12cd0b2b7b7f1729c0514c5b36721144e89289 | JavaScript | goostavo25/web-340 | /week-2/ejs-views/roogonzalez-exercise-2.4.js | UTF-8 | 938 | 3.46875 | 3 | [] | no_license | /*
Title: Exercise 2.4 / EJS Views
Author: Gustavo Roo Gonzalez
Date: 22 August 2021
Description: Exercise to access EJS files and display them on a node server.
*/
//Require statements for express, http, and path.
var express = require("express");
var http = require("http");
var path = require("path");
// Assigns Ex... | true |
bbf9c57d44177f9eb5257ab8e3b5b04e26c16fbc | JavaScript | MananDesai54/Small-Javascript-greeting-Library | /app.js | UTF-8 | 571 | 2.546875 | 3 | [] | no_license | var g = G$('Manan','Desai','en');
console.log(g);
console.log(g.fullName());
console.log(g.greeting());
console.log(g.formalGreeting());
console.log(g.greet().log().setLanguage('es'));
console.log(g.fullName());
console.log(g.greeting());
console.log(g.formalGreeting());
g.greet().setLanguage('hindi').greet(tr... | true |
6778e81ed54936d1a77983b1262440a17d31e5a1 | JavaScript | vvodicka/skolka | /app/scripts/services/services.js | UTF-8 | 921 | 2.53125 | 3 | [] | no_license | /**
* Created by vladislav.vodicka on 7. 7. 2016.
*/
angular.module('services', [])
.factory('Gallery', function ($http) {
var services = {};
services.getPaths = function() {
return $http.get('./config.json').then(function (res) {
return res.data;
});
... | true |
8c15cd125dbb4eb8fe120ba9119f816ee7d5360b | JavaScript | wolframkriesing/litJSX | /src/litJSX.mjs | UTF-8 | 10,718 | 3.390625 | 3 | [
"MIT"
] | permissive | /*
* litJSX
*
* JSX-like tagged template literals
*/
// By default, load the browser's build-in DOMParser.
let defaultDomParser = typeof window !== 'undefined' ?
new window.DOMParser() :
null;
// Default cache for processed template strings.
const defaultCache = new WeakMap();
// Return the given string ... | true |
f514fd9332c833ce460f05a522e099f99f902f88 | JavaScript | bpmutter/routing-roundup-starter | /app.js | UTF-8 | 782 | 2.671875 | 3 | [] | no_license | const express = require('express');
const app = express();
const routes = require('./routes/routes')
const port = 8081;
app.set('view engine', 'pug');
app.get('/', (req, res) => {
res.send(`Hello from Express!`)
})
app.get(/xyz$/, (req, res) => {
res.send(`That's all I wrote.`)
})
app.get(/^\/capital-letters\//... | true |
61439f0bc5083fa2d79a1c6589570212e61a1d9d | JavaScript | PranayK-666/Coriolis-Effect | /coriolis.js | UTF-8 | 5,453 | 2.953125 | 3 | [
"MIT"
] | permissive | let rpm = 10;
let vx = -0.73; // m/s
let vy = 0.84; // m/s
let px_per_metre = 180;
let angle = 0; // degrees
let ballx = 0; // metres (0,0) = centre of roundabout
let bally = 0; // metres
let show_ball = false;
$('#shoot').click(function() {
show_ball = true;
// convert vx,vy from roundabout coords into world... | true |
875a8108d8a8c92f7738420ac9c3594f5940c33b | JavaScript | LHIOUI/Arianna | /assets/drawerAr.js | UTF-8 | 12,030 | 2.546875 | 3 | [] | no_license | var click_enabled = true;
var arianna = (function(arianna) {
"use strict";
arianna.drawer = (function(drawer) {
var drawCurrNode = function(stato) {
drawer.currNode = document.getElementById("currNode");
drawer.currNode.setAttribute("cx", stato.currNode.x);
drawer.currNode.setAttribute("cy", stato.cur... | true |
ad7673b531aacaa916aa436b11a306045be33f65 | JavaScript | xidoWeb/smart_210331 | /code/js/src/js_009_loop_02.js | UTF-8 | 2,854 | 3.75 | 4 | [] | no_license | // js/src/js_009_loop_02.js
// 중복으로 처리되는 반복문
var i = 0;
for( ; i < 10 ; i += 1 ){
console.log( 'i: ' , i );
if(i === 5){
console.log('find it!!!');
break;
}
}
var line = function(){
console.log( ' --------------------------- ');
}
line();
i = 0;
for( ; i < 10; i += 1 ){
console.log('i-', i);
var... | true |
4dfb183d238e37033165ee8f893bae1a6521018f | JavaScript | Positrons/d3-mitch-tree | /src/js/NodeSettings.js | UTF-8 | 2,886 | 3.046875 | 3 | [
"MIT"
] | permissive | class NodeSettings {
/**
* @param {object} ownerObject The owner object
* @param {object} options The options for the node settings.
* @param {('nodeSize'|'size')} [options.sizingMode=size] The sizing mode. Should be either 'nodeSize' to automatically size the SVG based on the nodes, or 'size' to use... | true |
893ee345f04a492e9aa55a10fbd3d36ed8e23702 | JavaScript | GCHQDeveloper911/cypress | /npm/react/examples/visual-sudoku/src/components/Timer.js | UTF-8 | 1,132 | 2.734375 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from 'react'
import { useSudokuContext } from '../context/SudokuContext'
import moment from 'moment'
/**
* React component for the Timer in Status Section.
* Uses the 'useEffect' hook to update the timer every minute.
*/
export const Timer = props => {
let [currentTime, setCu... | true |
4e494cde92455aa00cb2d8eadd95a8c1fdc9211b | JavaScript | banganga/javascript | /scripts.js | UTF-8 | 830 | 3.96875 | 4 | [] | no_license | /* ====================== alex ======================== */
console.log('Внешний скрипт подключен!');
/* comment */
function countNum (num1) {
var num1;
num1 = prompt('Введи число', '');
var res = 100 - num1;
return res;
}
var dog = {};
dog.name = 'Good boy';
dog.age = 3;
dog.dick_length = 20;
console.log("My dog... | true |
248e92e03a7c9f429bf3a118788f826fe5c17b21 | JavaScript | ggorlen/mb | /code/wordplay/palindrome/palindrome.js | UTF-8 | 1,202 | 4.75 | 5 | [] | no_license | /* Palindrome checker
* https://en.wikipedia.org/wiki/Palindrome
*/
// processes the form on the page
function process() {
// grab the string to be checked from the input form
var candidate =
document.forms["input"].elements["palindrome"].value;
// create a string to hold the user notification
v... | true |
5a76daeb469acff8f3f58e7d726f9b87cbdf16f0 | JavaScript | senei/barborka | /app/assets/js/memo.js | UTF-8 | 7,385 | 2.734375 | 3 | [] | no_license |
memoGame = function (id) {
var self = this;
self.dom = {
core: null,
images: null,
board: null
};
self.data = {
boardWidth: 4,
boardHeight: 2,
imageCount: 4,
imageMaxCount: 29,
selected: ... | true |
a0f224dbd3bc717791f0ff1f798d603c8f9548ed | JavaScript | Robdel12/jqplot-popup | /js/graph.js | UTF-8 | 1,620 | 2.640625 | 3 | [] | no_license | $(document).ready(function(){
//Just render out your jqplot graph how ever you have it configured.
var plot1 = $.jqplot('pie1', [[['a',2543],['b',1465],['c',7123]]], {
gridPadding: {top:0, bottom:38, left:0, right:0},
seriesDefaults:{
renderer:$.jqplot.PieRenderer,
trendline:{ show:false },
... | true |
4c0264804a0615b101a2c9297413586e1fe29875 | JavaScript | anyqx/mern-oneroof | /validation/comments.js | UTF-8 | 744 | 2.734375 | 3 | [] | no_license | const validText = require("./valid-text");
const Validator = require("validator");
module.exports = function validateCommentInput(data) {
let errors = {};
// CHECK IF DATA IS A VALID STRING
data.authorId = validText(data.authorId) ? data.authorId : "";
data.taskId = validText(data.taskId) ? data.taskId : "";
... | true |
3a2bafbf35eac2ecad8dd812dd436ab557bf1428 | JavaScript | aliabu-yahia/amman-301d14 | /class-07/demo/server/server.js | UTF-8 | 2,262 | 3.03125 | 3 | [
"MIT"
] | permissive | 'use strict';
// Load Environment Variables from the .env file
require('dotenv').config();
// Application Dependencies
const express = require('express');
const superagent = require('superagent');
const cors = require('cors');
// Application Setup
const PORT = process.env.PORT;
const GEO_CODE_API_KEY = process.env.G... | true |
78cbab08dbaec6cfb8c523ac444303d9d7ca22ee | JavaScript | shellscape/nanoid-cli | /test.js | UTF-8 | 505 | 2.625 | 3 | [] | no_license | import test from 'ava';
import execa from 'execa';
test('generates an id', async (t) => {
const { stdout } = await execa('./cli.js');
t.true(stdout.length > 0);
});
test('respects the size option', async (t) => {
const { stdout } = await execa('./cli.js', ['--size', '32']);
t.true(stdout.length === 32);
});... | true |
f3293d750137f1fbae1e628212815d7f46096f32 | JavaScript | Ajayff4/student_record_system | /src/client/components/CurrentTime.jsx | UTF-8 | 464 | 2.515625 | 3 | [] | no_license | import React from 'react';
import '../styles/styles.css';
function timeFormatterAMPM() {
document.getElementById('currTime').innerHTML = new Date().toLocaleTimeString();
}
const CurrentTime = () => {
return (
<div id="currTimeDiv">
<fieldset>
<legend>Time</legend>
... | true |
f6ad9fd9b632cbeecfcf3b963b27f72ca8115337 | JavaScript | umesh-lewa/guvi-CodeKata | /Array/16.js | UTF-8 | 1,337 | 3.9375 | 4 | [] | no_license | /*
You are an intern at GUVI and the company wants to organise its data and delete unnecessary extra storage elements used. You are given k arrays of unequal dimensions. Sort the k arrays individually and concatenate them.
Input Description:
First line contains the number of arrays. Subsequent lines contain the siz... | true |
dc76f401bcd9bcb7cb164dd098a709729461d598 | JavaScript | anishaz/foodsnap-v2 | /public/src/main.jsx | UTF-8 | 1,131 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import Login from './components/login/login';
import Logout from './components/logout/logout';
import * as Cookies from "js-cookie";
class App extends Component {
constructor() {
super();
this.logIn = this.logIn.bind(this);
this.logOut = this.logOut.bind(this);... | true |
bbe911aa1aa41a7f7ca8e220eff0fd4c2e07cd9e | JavaScript | nandhandeveloper/kt-aws | /cuisines/addcuisine/index.js | UTF-8 | 1,469 | 2.734375 | 3 | [] | no_license | const AWS = require("aws-sdk");
var docClient = new AWS.DynamoDB.DocumentClient();
exports.handler = async event => {
const currentDate = new Date();
const cuisineParams = {
TableName: "kt-cuisines",
Key: {
name: event.cuisineName
}
};
const addCuisineParams = {
TableName: "kt-cuisines",... | true |
600cbe17ae6fa01eccf476733cd7b0666e1fdccc | JavaScript | sylviedorsett/sylviedorsett.github.io | /lesson-03/js/lesson3.js | UTF-8 | 117 | 2.84375 | 3 | [] | no_license | var date = new Date();
var currentYear = date.getFullYear();
document.getElementById("year").innerHTML = currentYear; | true |
c1efcc516200d5b108ce690d6e15bb72cf8d3802 | JavaScript | sschwa12/toy-problems | /code-wars/chain-evaluation.js | UTF-8 | 427 | 3.921875 | 4 | [] | no_license | // http://www.codewars.com/kata/545a5dd961aa4c0987000980/train/javascript
Number.prototype.add = function(number) {
return this + number;
}
Number.prototype.subtract = function(number) {
return this - number;
}
Number.prototype.multiply = function(number) {
return this * number;
}
Number.prototype.divide = f... | true |
ab4d0b02b40f6bda0eb37e5966369a3a5eda7fc3 | JavaScript | simon-barnett/adventofcode2020 | /dec01/01/app.js | UTF-8 | 1,464 | 3.828125 | 4 | [] | no_license | var fs = require('fs')
const name = 'Simon'
var textLinesArray
var arraySize
var sumToFind = 2020
var result
startTimeStamp()
readPuzzleInput()
calculatePuzzleResult()
outputPuzzleResult()
endTimeStamp()
function startTimeStamp() {
timeStamp = Date.now()
dateTime = new Date(timeStamp)
console.log(`OK ${n... | true |
1216c175bdb7fa2d18f2fe6323ec1bd036c61561 | JavaScript | critterwilson/cs313-project2 | /models/modeModel.js | UTF-8 | 2,708 | 2.84375 | 3 | [] | no_license | // consts to keep our app running
const { Pool } = require("pg");
const db_url = process.env.DATABASE_URL;
const pool = new Pool({connectionString: db_url});
/*****************************************************
* GET ALL KEYS
* Gets all 15 keys and their ids
*****************************************************/
fun... | true |
456d2d060685131bbd0e745ee893abbb7a498e0e | JavaScript | paulocoe/hashtag-finder | /app_server/controllers/hashtag.js | UTF-8 | 2,485 | 2.546875 | 3 | [] | no_license | 'use strict'
var mongoose = require('mongoose')
var Hashtag = require('../models/hashtag')
var config = require('../../config/config')
var httpRequest = require('request')
var _ = require('lodash')
// Connect to database
mongoose.connect(config.db.uri)
// // On connection success
mongoose.connection.on('connected', ... | true |
0c3113980a99faa39c3cd0661214ecc22f4ccf61 | JavaScript | gtoborges/IMC-com-Javascript | /script.js | UTF-8 | 1,709 | 2.9375 | 3 | [] | no_license | function alertIMC(){
var formulario = document.getElementById("formulario");
var peso = formulario.peso.value;
var altura = formulario.altura.value;
var sexo = formulario.sexo.value;
var imc = peso/(altura*altura);
if(se... | true |
01115722f9ac30be98dbb368c17099879d5f92b4 | JavaScript | tamal11/portfolio-Site | /js/main.js | UTF-8 | 4,940 | 2.96875 | 3 | [] | no_license | const projectId = document.getElementById("nav-list-project");
const sectionProject = document.getElementById("project");
const techskillId = document.getElementById("nav-list-techskill");
const sectionTechskill = document.getElementById("techskill");
const experienceId = document.getElementById("nav-list-experience"... | true |
b3b1343c27018dcf89691bddb5b5c951aee8a815 | JavaScript | collinvine/launch_school | /js_track/exercises/js101/medium_one/fib-memo.js | UTF-8 | 382 | 3.6875 | 4 | [] | no_license | let fibLookup = {};
let fibonacci = num => {
if (fibLookup[num]) {
return fibLookup[num];
} else if (num <= 2) {
fibLookup[num] = 1;
return 1;
}
debugger;
fibLookup[num] = fibonacci(num - 1) + fibonacci(num - 2);
debugger;
return fibLookup[num];
}
console.log(fibonacci(5));
console.log(fib... | true |
cb18c767246ad8be7f124371765881c284edf67f | JavaScript | rjohnmondo/FriendFinder | /app/routing/api-routes.js | UTF-8 | 705 | 2.65625 | 3 | [] | no_license | var express = require('express');
var path = require('path');
var app = express();
var friendsData = require('../data/friends.js');
function checkScores() {
var userTotal = 0;
for (var i = 0; i < friendsData.length; i++) {
for (var j = 0; j < friendsData[i].scores.length; j++) {
userTotal += friend... | true |
764c28d7be56e8496a81252102f673704146229b | JavaScript | HydroXBR/Aaron-Bot | /commands/dc.js | UTF-8 | 362 | 2.65625 | 3 | [] | no_license | const Discord = require('discord.js')
exports.run = async (client, message, args) => {
try{
let u = message.guild.members.cache.get("800510988973506601");
let vc = u.voice.channel;
vc.leave()
message.inlineReply("Ok, desconectei com sucesso :)")
}catch(error){
console.log(`Erro no disconnect: Bot não ... | true |
4e4b841328a995f82f88dad7be955b6b5afc4667 | JavaScript | bgoonz/UsefulResourceRepo2.0 | /_PYTHON/DATA_STRUC_PYTHON_NOTES/WEEKS/wk17/CodeSignal-Solutions/CodeSignal-Solutions-master/Arcade/Intro/javascript/electionsWinners.js | UTF-8 | 311 | 2.796875 | 3 | [
"MIT"
] | permissive | function electionsWinners(votes, k) {
let winners = 0;
for (let i = 0; i < votes.length; i++) {
let win = true;
for (let j = 0; j < votes.length; j++) {
if (j != i && votes[i] + k <= votes[j]) {
win = false;
break;
}
}
if (win) winners++;
}
return winners;
}
| true |
01ab6b4c8b36642814f2a2f4dd8aa88c3335b195 | JavaScript | moskalyk/mimo-ql | /src/MimoStore.js | UTF-8 | 2,790 | 2.609375 | 3 | [] | no_license | const KeyValueStore = require('orbit-db-kvstore');
const EthCrypto = require('eth-crypto');
class MimoStore extends KeyValueStore {
/**
* Instantiates a MimoStore
*
* @param {IPFS} ipfs An IPFS instance
* @param {String} dbname The DB name, should be 'mimo'
* @retu... | true |
63a7fc6eef4845a81d7540fa723dec4011dfc952 | JavaScript | klguenth/animalia-app | /index.js | UTF-8 | 2,720 | 3.125 | 3 | [] | no_license | 'use strict'
const youtubeApiKey = 'AIzaSyAFe_P5hJr88I8OS3HbmX_jsTF91XrNpl4'
const youtubeUrl = 'https://www.googleapis.com/youtube/v3/search'
const gbifUrl = 'https://api.gbif.org/v1/species/search'
function queryParams(params) {
const queryItems = Object.keys(params)
.map(key => `${encodeURIComponent(key)}=${... | true |
1de456c409866e2ffe38235a2b797a48fb152989 | JavaScript | marinetomazi/lab-javascript-vikings | /src/viking.js | UTF-8 | 1,741 | 4.09375 | 4 | [] | no_license | // Soldier
class Soldier {
constructor(health, strength){
this.health = health;
this.strength = strength;
}
attack() {
var result = this.strength;
console.log(result);
}
receiveDamage(theDamage) {
var damage = this.health -= theDamage;
console.log(damage)... | true |
8a1b19876ac5cefa72f08a5e3d5a589785c1246e | JavaScript | hanzogak/smart-tab-manager | /test/test.js | UTF-8 | 361 | 2.9375 | 3 | [] | no_license | QUnit.test("first test", function(assert) {
var actual = 5 - 4;
assert.ok(true, "passes because true is true");
//ok is boolean assertion that passes if the first argument is truthy.
assert.equal(actual, 1, "passes because 1 == 1");
//actual == expected
assert.notEqual(actual, 0, "passes becaus... | true |
c7b6825f117d2f14b91c388998fb883c226cf011 | JavaScript | buchslava/dancing-digits | /examples/todo/app/routes.js | UTF-8 | 378 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | var todosData = [];
function getTodos(res){
res.json(todosData);
};
module.exports = function(app) {
app.get('/api/todos', function(req, res) {
getTodos(res);
});
app.post('/api/todos', function(req, res) {
todosData.push({text : req.body.text});
getTodos(res);
});
app.get('*', function(req,... | true |
f90146b60a1c26a415b40ff0d9ea9707502332ad | JavaScript | briancajulis/Event-Assignment | /src/store/actions/eventActions.js | UTF-8 | 3,860 | 2.640625 | 3 | [] | no_license | import axios from 'axios';
import * as actionTypes from './actionTypes';
const url = 'https://mts-intern-assignment.firebaseio.com/events.json';
// const storageUrl = 'mts-intern-assignment.appspot.com/eventImages'
export const createEvent = (organizerData, eventData) => {
return dispatch => {
console.log(... | true |
b97758d61bcb6d52f184f4b607e96bbfee7d4597 | JavaScript | AndresRodas/tytusx | /20211SVAC/G34/script/EjecutarXpath/exe_xpath.js | UTF-8 | 31,561 | 2.546875 | 3 | [
"MIT"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var etiquetas = [];
var etiquetasdoble = [];
var cadena = "";
function exepath1(listainstrucciones) {
etiquetas = [];
var p = tds_xml_persistente[0];
//console.log(p[i]);
for (var j = 0; j < listainstrucciones.length; j++) {
... | true |
a9f278127d683da3f6ad5beb2b58fb7ca70f7971 | JavaScript | eirslett/reactive-cookbook | /bluebird/MakeFutureToBeResolvedLater.js | UTF-8 | 242 | 2.796875 | 3 | [] | no_license | var Promise = require('bluebird');
var myFuture = new Promise(function(done){
// do some time-consuming stuff, e.g. a network call, or just sleep
setTimeout(function(){
// resolves the future
done(42);
}, 1);
});
| true |
9e75f37e443757fa0eb0c1ccadec3ce344ec9ed5 | JavaScript | lvl99/lvl99 | /es5/tools/trackevent.js | UTF-8 | 4,039 | 2.546875 | 3 | [
"MIT"
] | permissive | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = TrackEvent;
var _lodash = require('lodash.merge');
var _lodash2 = _interopRequireDefault(_lodash);
var _storage = require('./storage');
var _storage2 = _interopRequireDefault(_storage);
function _interopRequireDefault... | true |
de9080fbc5b98580c33dad38939e4eaff3991c35 | JavaScript | heartJJ/test_demo | /ucc/ucc_saas.js | UTF-8 | 6,969 | 2.671875 | 3 | [] | no_license | /**
* UCC解码,待完善
* 目前 SAAS 实际解析UCC所用文件
*/
const moment = require('moment'),
debug = require('debug')('debug'),
_ = require('lodash');
const err = {
MistakeLengthOfArray: '条码数组长度有误',
MistakeLengthOfPackageCode: '包装代码的长度有误',
MistakeLengthOfEnsureAI: '定长AI的长度有误',
CodeParseFail: '无法解析条码',
CodeNotComplet... | true |
388d414954332abc9f61568c62f66627ffeaf99a | JavaScript | Flakster/Testing-practice | /analyze.js | UTF-8 | 322 | 2.8125 | 3 | [
"MIT"
] | permissive | const analyze = (ar) => {
ar.forEach(x => {
if (typeof x !== 'number') {
throw new Error('Element is not a number');
}
});
return {
average: ar.reduce((ant, curr) => ant + curr) / ar.length,
min: Math.min(...ar),
max: Math.max(...ar),
length: ar.length,
};
};
export default analyz... | true |
0cf13ec4e638166b3c9a51ddf60a410102254442 | JavaScript | wanhua1993/modules_all | /model/mysql/mysql.js | UTF-8 | 5,656 | 2.84375 | 3 | [] | no_license | // 连接 mysql 数据库 并对其进行封装
var mysql = require('mysql'); // 引入 mysql 数据库模块
var dataConfig = require('../../config/database'); // 引入 mysql 数据库配置
//使用连接池
var pool = mysql.createPool(dataConfig); // 创建连接池
// 这是连接数据库的第一种方法
var query_0 = function (sql, params, callback) {
//每次使用的时候需要创建链接,数据操作完成之后要关闭连接
var connection = ... | true |
7851331f1d84bcbf659751b720dad3dfd45b4ff5 | JavaScript | svsquirrel/dining | /src/poseidon.js | UTF-8 | 654 | 2.625 | 3 | [] | no_license | function makeHomePage () {
const container = document.querySelector('.container');
const main = document.createElement('div');
main.classList.add('main');
const pageImage = document.createElement('img');
const message = document.createElement('div');
pageImage.src ... | true |
5f96c1df430be674cd452720a1063e19d0f98d30 | JavaScript | robertbelgrave/instabot-trader | /src/exchanges/bitfinex.js | UTF-8 | 2,823 | 2.8125 | 3 | [
"MIT"
] | permissive | const logger = require('../common/logger').logger;
const util = require('../common/util');
const Exchange = require('./exchange');
const BitfinexApiv2 = require('../apis/bitfinexv2');
/**
* Bitfinex version of the exchange
*/
class Bitfinex extends Exchange {
/**
* set up the supported commands and API
... | true |
35d39674f43adc00b12bc73e3523aa519a4e1c20 | JavaScript | allen138/web-studio | /public/js/app.js | UTF-8 | 3,383 | 3.0625 | 3 | [] | no_license | const navbar = document.querySelector(".nav");
const logo = document.querySelector("#logo");
const exitNav = document.querySelector(".close-nav");
const loader = document.querySelector('.loader');
const loaderContainer = document.querySelector('.loader-container');
const main = document.querySelector('.main');
// css ... | true |
9085992148a01ac08dff01a7b9e039bcc12ab6d0 | JavaScript | r3dDoX/fliBeacons | /node/fliBeacons/game/game.js | UTF-8 | 2,995 | 2.53125 | 3 | [] | no_license | var drones = [{name: 'drone', uuid: 'b9407f30-f5f8-466e-aff9-25556b57fe6d', major: 51881, minor: 16836}],
baseStations = [],
activeStation = 0,
gameState = { isRunning: false },
activateEvent = 'activate',
startedEvent = 'started',
finishedEvent = 'finished',
updatedEvent = 'updated',
... | true |
cf1a057725faef0b47398cab08a2ca2e164605c7 | JavaScript | suqcnn/JieMeng | /src/sandClass.js | UTF-8 | 3,600 | 2.578125 | 3 | [
"MIT"
] | permissive | const query = require('./helper/mysql');
const puppeteer = require('puppeteer');
const Keywords = require('./keywords');
class Classes {
constructor(classes) {
this.classes = classes;
this.fetchArray = [];
this.index = 0;
}
start() {
for (let obj of this.classes) {
... | true |