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
d559f8cb268e32dd7a44ce4b4b97a70d02732e57
JavaScript
TheWarming/leetcodePractice
/814. 二叉树剪枝.js
UTF-8
1,259
3.828125
4
[]
no_license
/* 814. 二叉树剪枝 给定二叉树根结点 root ,此外树的每个结点的值要么是 0,要么是 1。 返回移除了所有不包含 1 的子树的原二叉树。 ( 节点 X 的子树为 X 本身,以及所有 X 的后代。) */ /** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val===undefined ? 0 : val) * this.left = (left===undefined ? null : left) * this.right = (right==...
true
62d2f21bc422775e29e4e171ca3b2bf84053d007
JavaScript
dzeninside/DataLogic
/LineSearch.js
UTF-8
236
3.546875
4
[]
no_license
const array = [1,4,5,8,5,1,2,7,5,2,11] const lineSearch = (array, item) => { for (let i = 0; i < array.length; i++) { if (array[i] === item) { return i } } return null } lineSearch(array, 11)
true
4a16c218b51d694fd388724c5249ee9a6853d681
JavaScript
patrickfatrick/colorizer
/src/lib/utils.js
UTF-8
4,463
3.21875
3
[ "MIT" ]
permissive
import { format, normalize, formatFactor } from './formatters' import { convertRgbToHsl, convertHslToRgb } from './converters' /** * Apply any arithmetic transform to all rgb values * @param {String} method transform to apply * @param {Number,Array,String} factor value(s) to transform the rgb array w...
true
27a1621da9e5144632a9d289069e0ae64d209e76
JavaScript
aliunluml/web_tech_cw
/public/animate.js
UTF-8
5,817
2.65625
3
[]
no_license
document.addEventListener('DOMContentLoaded', () => { var closebtns = document.getElementsByClassName("closebtn"); for (var i = 0; i < closebtns.length; i++) { closebtns[i].onclick = function(){ var div = this.parentElement; div.style.opacity = "0"; setTimeout(function(){ div.style.display = ...
true
0de17af2319f2e853d00ff6452a22259495bfaec
JavaScript
zkliu67/mocking-fintech-app
/temp/temp/product-local.js
UTF-8
2,091
3.25
3
[]
no_license
/* This part we use local json file for items //const fs = require('fs'); //const path = require('path'); const Cart = require('../models/cart'); const p = path.join(path.dirname(process.mainModule.filename), 'data', 'products.json' ); const getProductsFromFile = cb => { fs.readFile(p, (err, fileCont...
true
6cbfe68de2f40243013eec0a5c477714a54594aa
JavaScript
NavProjects/week_2
/day_1/likes/script.js
UTF-8
146
3.15625
3
[]
no_license
var count = 0 var countElement = document.querySelector("#count") function add1(){ count+=1; countElement.innerHTML = count + "like(s)" }
true
c212f75ed93dd255b0ec77a1871310d859001f01
JavaScript
dawnpatrol506/Trivia_Game_Basic
/assets/javascript/game.js
UTF-8
3,375
3.109375
3
[]
no_license
$(document).ready(function () { var outOfTen = 0; var qArray = randomizeArray(questions); var timeOut; var interval; function startGame() { var timer = $("<h1 id='timer' class='col-12 text-center'>90</h3>") $(".game-area").append(timer); var timeRemaining = 90; ...
true
af26816bf6636dd458097094fb965c8223d194af
JavaScript
r0cc4t0/rocketseat-starter
/JavaScriptES6/modulo3/src/exercicio3.js
UTF-8
459
2.640625
3
[]
no_license
import axios from 'axios'; export default class GitHub { static async getRepositories(repo) { try { const response = await axios.get(`https://api.github.com/repos/${repo}`); setTimeout(() => { console.log(response.data); console.log('\n'); ...
true
f4379bd8c7b2c2ff824df789b2f381d660989f1b
JavaScript
agprett/shelfie
/src/App.js
UTF-8
1,615
2.546875
3
[]
no_license
import React from 'react'; import axios from 'axios'; import './App.css'; import Header from './Components/Header' import Dashboard from './Components/Dashboard' import Form from './Components/Form' class App extends React.Component { constructor() { super() this.state ={ inventory: [], editting...
true
432ffa79556eb36a4f75c125b34d18875585d67e
JavaScript
zhuang-ai/WechatStudy
/pages/users/mygames/mygames.js
UTF-8
455
2.6875
3
[]
no_license
Page({ data: { reservelist:[] }, onLoad: function () { this.fetchData(); }, fetchData:function(){ var output = [] for (let index = 1; index < 5; index++) { if(index<5){ output.push({ "id": index, "name": "第"+index+"个游戏", "imgurl": "../../../images/ba...
true
7191fb2ecd857721af8989b5ba6ba9e875143c28
JavaScript
gomezjuliana/FCC-Projects
/Generator/generator.js
UTF-8
1,077
2.671875
3
[]
no_license
function updateQuote(json) { var quoteAuthor = json.quoteAuthor ? json.quoteAuthor : "Author Unknown" $(".message").html(json.quoteText + "<br>" + "<h3>" + quoteAuthor + "</h3>" ...
true
dafeb9d88faa202531e19159d0e907938c1e538d
JavaScript
ritailchenko/Liri-node-app
/movie-this.js
UTF-8
1,078
2.515625
3
[]
no_license
var axios = require("axios"); module.exports = function(movie){ if( !movie || movie.trim().length === 0) { movie = "mr.Nobody"; } var result = []; return axios.get("http://www.omdbapi.com/?t=" + movie.replace(/\s/g, '+') + "&y=&plot=short&apikey=trilogy").then( function(response) { result.push(...
true
32a347279c5f08d67bbde22e40f854487f910500
JavaScript
yoursmengle/iotdb-examples
/arduino/FirmataChainableLED2.js
UTF-8
858
2.703125
3
[]
no_license
/* * FirmataChainableLED2.js * * David Janes * IOTDB * 2014-04-30 * * - Have a DHT11 connected to pin D2 * - Have a Grove Chainable LED connected to pin 7 * - As the temperature changes, so will the LED color * * Note the use of the Color library to use 'hue'. We'll * likely be making changes soon ...
true
248ef8e47334fb857150e13925acb3595713f815
JavaScript
qwiz1/toy-robot-simulator
/src/tests/move.test.js
UTF-8
1,121
2.703125
3
[]
no_license
const { expect, it } = require('@jest/globals'); const { Move } = require('../commands/move'); const { Location } = require('../location'); const move = new Move(); describe('Move - tests: ', () => { it('Should move towards west', () => { expect(move.execute(new Location(2, 2, 'W'))).toEqual(new Location(1, 2, ...
true
c5f6e23aa301329d13f9feb77da93a755c38e64b
JavaScript
moaaz-bhnas/libse-seller
/src/api/firebase.js
UTF-8
4,596
2.546875
3
[]
no_license
import firebase, { firestore } from "../firebase/clientApp"; import generateUuid from "../utils/generateUuid"; /* ------------------ products --------------------- */ /* get product by id --- */ export const getProduct = async (id) => { const product = await firestore.collection("products").doc(id).get(); retur...
true
9e2e3da887894a5a7c4b9d455835d84b8e7df577
JavaScript
arm-path/React-english-words-firebase
/src/Redux/actions/authorizationAction.js
UTF-8
2,234
2.71875
3
[]
no_license
import axios from "axios"; import {AUTO_LOGOUT, LOGIN_OR_REGISTRATION} from './typeAction' export function loginAndRegistration(email, password, isLogin) { return async dispatch => { try { let date = { email: email, password: password, returnSecur...
true
4df0051068d1fd94f27c72557be3c640d1c748d7
JavaScript
Mathursan-007/Conference-Back-End
/dal/upload.dao.js
UTF-8
2,069
2.671875
3
[]
no_license
let upload = null; const ObjectID = require('mongodb').ObjectId; setTimeout( async () => { upload = await require('./connection').db('conferenceDB').collection('upload'); }, 10000); // Retrieving all the Research Papers submitted from the DB const getAllUploads = async () => { const results = await upload.f...
true
e53a50207fcb56be699e5a1be226fc45c32b1d46
JavaScript
menafalici/Flicker_API
/script.js
UTF-8
3,945
3.09375
3
[]
no_license
window.onload = function() { document.getElementById("searchbutton").addEventListener("click", function() { let searchText = document.getElementById("search").value; let searchTextEncoded = encodeURI(searchText); document.getElementById("result").innerHTML = ""; let script = document...
true
ecc0ff619f9587db2879fd1a45761dcae23eeabb
JavaScript
Nephilim-Telerik/RedGag
/scripts/likes.js
UTF-8
2,210
2.765625
3
[]
no_license
import { saveToDb } from "./push.js"; function Likes() { return function (array) { var likes = document.getElementsByClassName("glyphicon glyphicon-chevron-up"); for(var i=0; i<likes.length; i=i+1) { likes[i].addEventListener("click", Like); } function Like(ev) { let isNeutral = true; var ta...
true
dbd8ea6082e325a9d67a6034552699aac5a0fef5
JavaScript
maumercado/rxjs_operators_review
/race/index.js
UTF-8
249
2.78125
3
[]
no_license
import { race, timer } from "rxjs"; import { map } from "rxjs/operators"; const apiA$ = timer(1500, 100).pipe(map(n => `API A ${n}`)); const apiB$ = timer(2000, 100).pipe(map(n => `API B ${n}`)); race(apiA$, apiB$).subscribe(n => console.log(n));
true
805bff28c79ae97731c6b598e180541cc5822ba1
JavaScript
wu4f/cs495-src
/xss-csp/csp_server.js
UTF-8
1,025
2.59375
3
[]
no_license
"use strict" var express = require('express') for (let port of [1234, 4321]) { var app = express() app.use('/script.js', (req, res) => { res.send(`document.querySelector('#${req.query.id}').innerHTML = 'changed by ${req.query.id} script'`) console.log(req.url) }) app.use((req, res) => { var csp = r...
true
1f75cbebccfb460661d2da6dbd34b602f1c44aff
JavaScript
mliu/i-mario
/public/src/enemies.js
UTF-8
5,860
2.671875
3
[]
no_license
Q.Sprite.extend('Enemy',{ init: function(p, hash) { this._super(p, hash); this.addEventListeners(); this.on('damage', 'onDamage'); }, insertHealthDisplay: function () { var hd = new Q.HealthDisplay(); this.p.healthDisplay = hd; this.stage.insert(hd); hd.followObject(this); }, onDam...
true
731fcbcc1b2073b617433ad54418eb64c56fd0c0
JavaScript
liuxiang/myWeb
/@demo/Async_Progra/JavaScript异步编程/callback.js
UTF-8
277
2.78125
3
[]
no_license
/** * Created by Administrator on 2016/7/20 0020. */ (function () { 'use strict'; function f2() { console.log("f2"); } function f1(callback) { console.log("f1"); setTimeout(function () { callback(); }, 1000); } // 执行 f1(f2); })();
true
55938e7a9612b17c92d7286721ee3dfa035d0307
JavaScript
knakamura13/Javascript-Coding-Challenges
/Practice Problems/project_euler/002-even-fibonacci-numbers.js
UTF-8
1,956
4.5
4
[]
no_license
/* Project Euler 002 Even Fibonacci Numbers Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 By considering the terms in the Fibonacci sequence whose values do not exc...
true
66dc5f405616cdae7b2cd078b3b585177cd4cb7d
JavaScript
hutaoao/design-pattern
/singleton6.js
UTF-8
236
3.140625
3
[]
no_license
class People { constructor(name) { if (!People.instance) { this.name = name; People.instance = this; } return People.instance; } } const a = new People('a'); const b = new People('b'); console.log(a === b);
true
02fc6237273b7ab09dc52e76fa384295e4df3138
JavaScript
amandakelake/blog
/Framework/Routing principle/Router-history.js
UTF-8
946
2.78125
3
[]
no_license
class Router { constructor() { this.routes = {}; this.currentUrl = ''; } route(path, callback) { this.routes[path] = callback || function () { }; } updateView(url) { this.currentUrl = url; this.routes[this.currentUrl] && this.routes[this.currentUrl](); } bindLink() { const all...
true
054adf5f10a3f4a0f6f87eea1ca3868f64eb7bff
JavaScript
JevGor/task2.js
/task2.js
UTF-8
109
2.890625
3
[]
no_license
var x = 30, y = 20; x = x + y; y = x - y; x = x - y; console.log(x); console.log(y);
true
619aaef2a36ed861ca8e3d8b580846d2bf12a066
JavaScript
TheJenster/google-01
/public/javascripts/main.js
UTF-8
1,457
2.578125
3
[]
no_license
/** * * Retrieves the Data from Traffic Cameras * * */ var map = null; async function getAnalytics() { $('#waitDialog').css('display', 'inline-block'); try { let promise = new Promise((resolve) => { getGoogleAnalytics(); }); await promise; } ca...
true
527253293244a9f87189ab4a8b34c3b4a122ed60
JavaScript
JuanmaRuizF/Dulce-Capricho
/app/javascript/proyecto/script.js
UTF-8
15,983
2.671875
3
[]
no_license
window.submitContacto = function(e) { var nombre = $("#nombre").val(); var apellido = $("#apellido").val(); var email = $("#email").val(); var domicilio = $("#domicilio").val(); var codigoPostal = $("#codigoPostal").val(); var fecha = $("#fecha").val(); var comentario = $("#comentario"...
true
3bdbcc7688a1da67228c76de75a707b4b02d7313
JavaScript
hishamelreedy/EgyFWD_WebAdvanced
/project2_would_you_rather/src/actions/users.js
UTF-8
475
2.515625
3
[ "MIT" ]
permissive
import { _getUsers } from "../utils/_DATA"; export const GET_USERS = 'GET_USERS' //LOADS ALL USERS function getUsers (users) { return { type: GET_USERS, users } } export const loadingUsers = () => { return dispatch => { const allusers= _getUsers().then(response => dispatch(getUsers(response))) ...
true
42e0a93d33fea2437c54260f789a80323b6bdadf
JavaScript
aasanakey/Scrumboard
/src/utils/dateformater.js
UTF-8
1,051
3.0625
3
[]
no_license
import moment from "moment"; export default function formatDate(dateTime) { if(moment().diff(moment(dateTime), 'days') > 0){ if(moment().diff(moment(dateTime), 'days') === 1){ return 'a day ago'; } return `${moment().diff(moment(dateTime), 'days')} days ago` } if (mo...
true
afea948c4d38562626cc81fc40fe00dd252c4952
JavaScript
koery/Vcanbuy
/App/Manage/Resources/JS/country.js
UTF-8
318
2.625
3
[]
no_license
function verifyData() { if( document.getElementById("country").value =="") { document.getElementById("country").focus(); document.getElementById("msg_country").style.display =''; return false; } else{ document.getElementById("msg_country").style.display ='none'; } return true; }
true
d5f0a320b6d1e5bbfbc6e794e64860cc831f6a06
JavaScript
kgurjit/Week11-Hangman
/word.js
UTF-8
586
3.171875
3
[]
no_license
var maxGuessCount = 25; exports.isGuessCorrect = function(currentWord, realWord) { return currentWord === realWord; }; exports.isGuessCountOver = function(incorrectGuesses) { return incorrectGuesses === maxGuessCount; }; var getGuessesLeft = function(currentGuessCount) { return maxGuessCount - currentGuessCount; ...
true
f6c5d7b9dbddc7d5f519c486ddc03c7023c150ab
JavaScript
camilleweins/Expressive-Voice-Interfaces
/pos-music-with-voice/getPos.js
UTF-8
394
2.78125
3
[]
no_license
var pos = require('pos'); function getPOS(wordText) { var words = new pos.Lexer().lex(wordText); var tagger = new pos.Tagger(); var taggedWords = tagger.tag(words); var wordObj = []; for (i in taggedWords) { var taggedWord = taggedWords[i]; var word = taggedWord[0]; var tag = taggedWord[1]; wordObj.pus...
true
9cecbb2157b87eaaff6949fbf9d7abf8a1bdcb16
JavaScript
sgrezza/deltalink
/js/scripts.js
UTF-8
380
2.921875
3
[]
no_license
function showMenu() { let burger = document.getElementById('navbar-burger'); let menu = document.getElementById('navbar-menu'); if (burger.classList.contains('is-active')) { burger.classList.remove('is-active'); menu.classList.remove('is-active'); } else { burger.classList.add('i...
true
30fbe386ed51c93ac915e085b3a1c5e57b18bc6a
JavaScript
karamani/yuka-fractals
/js/app/views/fractal.js
UTF-8
9,464
2.6875
3
[]
no_license
App.Views.FractalCanvas = Backbone.View.extend({ el: ".fractal-canvas", tagName: 'div', className: "fractal-canvas", context: null, canvasWidth: 0, canvasHeight: 0, canvasData: null, events: { "click .refreshButton" : "refresh" }, initialize: function() { ...
true
76e54b7253891a7ff31b3f1c529a34b21b26b605
JavaScript
quasipickle/unotify
/unotify.js
UTF-8
3,364
2.546875
3
[ "MIT" ]
permissive
var uNotify = { $wrapper:null, isSetup:false, defaults: { classes:{ 'info': 'alert alert-info', 'danger': 'alert alert-danger', 'warning': 'alert alert-warning', 'success': 'alert alert-success' }, dismiss:{ markup:'<button class = "btn btn-xs btn-default unotify-dismiss"></button>', sele...
true
e4e1c4c840052e7d6ac09ed9b5d5e4060254e80e
JavaScript
RShergold/remi-shergold.com
/src/javascripts/admin/Files.js
UTF-8
3,707
3
3
[]
no_license
class Files { constructor(post_id) { const resource_uri = `/uploads/${post_id}/` this.server_files = new ServerFiles(resource_uri) this.file_list = new FileList('js-fileList', resource_uri) this._init_file_selector() this._init_drag_and_drop() } list() { this.server_files.index() ...
true
734f4b507bf5d1a0f912b85c08275813dd77c10e
JavaScript
ZeRiix/site-web-edisgn4you
/projet_site/jeux_js/jeux.js
UTF-8
9,503
3
3
[]
no_license
function jeux() { // cette function est un casse briques var canvas = document.getElementById("myCanvas"); // recuperation de la balise canvas par son id var system2d = canvas.getContext("2d"); // espace 2d (canvas) var dimball = 10; // dimension de la ball en pixel; var x = canvas.width/2; // place l'axe d...
true
c1e306c68e7409e562ea83a75d60d8a8a61a0b67
JavaScript
bmt/photobooth
/embedded/cameras/camera.js
UTF-8
975
2.515625
3
[ "MIT" ]
permissive
'use strict'; var promise = require('bluebird'); var Camera = function() { this.preview = null; }; Camera.prototype.reset = function() { if (this.preview) { return this.preview.close(); } else { return promise.resolve(); } }; Camera.prototype.takePhotoImpl = function() { throw new Error('Subclasse...
true
0ca7a86114f1934041ba7e67d8e372afa370f811
JavaScript
puow-mond/TOT-Weather-Care-API
/seed/seed_daily_Bangpeeyai.js
UTF-8
926
2.765625
3
[]
no_license
const { admin } = require('./config/firebaseConfig') const newsCollection = admin.firestore().collection('BangpeeyaiNews') const news = [ { date: "12-7-2560", status: "500", report: "We won't work today due to PM2.5!" }, { date: "1-3-2562", status: "200", re...
true
4e606a3e622c326413cfbb808dd4350e372be863
JavaScript
BodySplash/funland
/src/list.spec.js
UTF-8
1,592
3.109375
3
[]
no_license
const List = require('./list'); const expect = require('chai').expect; describe('List', () => { it('should give an array', function () { const array = List.Cons(1, List.Cons(2, List.Nil)).toArray(); expect(array).to.deep.equal([1, 2]); }); it('should be created from array', function () { const crea...
true
43655f5ffd4d633663436d635cffaf673ab4cebf
JavaScript
nara1030/TIL
/docs/lecture_list/inflearn/src/rock_paper_scissors.js
UTF-8
1,856
3.484375
3
[]
no_license
var img = { left: '0px', interval: '', } // 컴퓨터 game_start(); // 사용자 console.log(document.querySelectorAll('.btn')); // NodeList(3) console.log(document.querySelectorAll('.btn').length); // 3 document.querySelectorAll('.btn').forEach(function(button) { button.addEventListener('click', function() { ...
true
e83f53bc21ddc99b4e16b05f627690b8d1f073e1
JavaScript
EveFer/weekly_expense
/src/App.js
UTF-8
2,429
2.796875
3
[]
no_license
import React, {useState, useEffect} from 'react'; import Question from './components/Question' import Form from './components/Form' import ListaGastos from './components/ListaGastos' import ControlPresupuesto from './components/ControlPresupuesto' function App() { // definir state const [presupuesto, setPresupuest...
true
1360ad6e231943854b7a919554c51d9d551be3a6
JavaScript
ssobirov3/notes
/app.js
UTF-8
774
2.703125
3
[]
no_license
const express=require('express'); const app=express(); app.use('/static',express.static('public')) app.set('view engine', 'pug'); const notes=require('./data.js'); app.get('/',(req,res) =>{ //to do -- Handler for Root URL res.render('home'); }) app.get('/create',(req,res) =>{ //to do -- Handler for Root URL ...
true
a5e7ca513ea1b01f3534deff54a4c8ad82ecedf1
JavaScript
wilfredo31205/mearnstask
/controllers/authcontrollers.js
UTF-8
3,109
2.8125
3
[]
no_license
//const Usuario = require('../models/Usuario'); const Usuario = require('../models/Usuario'); const bcryts = require('bcryptjs'); // importando bcryts para ocultar las contraseñas const { validationResult} = require('express-validator'); // validando el resultado de los check que estan en routes const jwt = require...
true
764c77ab51354b44563962fded67b53c5466eec8
JavaScript
rickydhanota/contains_linked_list
/contain.js
UTF-8
609
3.671875
4
[]
no_license
class Node{ constructor(val){ this.value=val; this.next=null; } display(){ console.log("I am Node", this.value) } } class ListNode{ constructor(val){ var list=this.head if(list.val == val){ return true } else{ list = lis...
true
9664303d1e6b4ae96bb5ad4688438ad68beba286
JavaScript
samalamb/project-1
/index.js
UTF-8
7,050
2.515625
3
[]
no_license
/** Copyright 2014-2015 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at http://aws.amazon.com/apache2.0/ or in the "license" f...
true
2c54806821c7614ab1e361d2025bacfafeacfe5d
JavaScript
InformationServiceSystems/phiop
/scripts/math.js
UTF-8
1,835
3.328125
3
[]
no_license
/* return sum of all elements of a 2D symmetric matrix */ function TwoDMatrixSum(m){ var s = 0; for (var i = 0; i < m.length; i++) { for (var j = 0; j < m.length; j++) { s+=m[i][j]; }; }; /* only for WIKI because USE has additional 1 in first column */ /* adjust for each model: model complexity constrai...
true
47670124ebe01b8c3f623a8e508b1ab425d038a8
JavaScript
huangfe1/MyCode
/DreamWeaver/WebContent/js/addAgent.js
UTF-8
9,069
2.53125
3
[ "MIT" ]
permissive
function onSubmit1 () { document.getElementById("firstIdSpan1").style.display=""; document.getElementById("firstIdSpan2").style.display="none"; document.getElementById("endIdSpan1").style.display=""; document.getElementById("endIdSpan...
true
a8010d160a11d273059940145453efd343c3c24b
JavaScript
domino31620/Week-7
/index.js
UTF-8
1,682
2.65625
3
[]
no_license
const express = require('express'); const app = express(); const secret = "suPErdUperBigSeCRet"; const PORT = 5000; const jwt = require('jsonwebtoken'); const bcrypt = require('bcrypt'); const saltRounds = 10; app.use(express.json()); app.post('/create-token', (req,res) => { const payload = { username: req...
true
4d0f6c1fed55c4576c0f933c51104702692a4b48
JavaScript
mattjk00/lipcritic
/js/audio-handler.js
UTF-8
1,660
3.0625
3
[]
no_license
let progressBar = document.getElementById("progressBar"); let playButton = document.getElementById("playButton"); let readyToPause = true; let audioInterval; let song; let lastPosition; var els = new Howl({ src: ['music/els.mp3'] }); let songs = { "els":els }; function playSong(sn) { if (progressBar == null)...
true
6b42f05b82adb1d4cb2695d527d615bcbf03b403
JavaScript
kikiChow/codeWorkSpace
/js/笔试/京东/demo.js
UTF-8
613
3.515625
4
[]
no_license
function oneCount(arr) { var result = 0; if (arr[0] == 1 && arr[arr.length - 1] == 1) { console.log('111'); if (arr.indexOf(0)) { var Index = arr.indexOf(0); var firstCount = Index ; console.log(firstCount); } if (arr.lastIndexOf(0)) { ...
true
270d448d43e7447f3ffd90dbc08aa43da5cfdb78
JavaScript
SCduze/vuetest
/todolist/app2.js
UTF-8
3,167
2.84375
3
[]
no_license
var store = { save(key, value) { localStorage.setItem(key, JSON.stringify(value)); }, fetch(key) { return JSON.parse(localStorage.getItem(key)) || []; } } /* var list = [ { title:"吃饭睡觉打豆豆0", isChecked:false }, { title:"吃饭睡觉打豆豆1", isChecked:fals...
true
eccabcf2ebdb60021584372e2bdb0b3cdb3a59b2
JavaScript
ShivamThakur2411/project-27-Newton-s-Cradle
/sketch.js
UTF-8
1,383
2.90625
3
[]
no_license
const Constraint = Matter.Constraint; var roofObject; var bobObject1,bobObject2,bobObject3,bobObject4,bobObject5; var chain1,chain2,chain3,chain4,chain5; const Engine = Matter.Engine; const World = Matter.World; const Bodies = Matter.Bodies; const Body = Matter.Body; function setup() { createCanvas(800, 700); engi...
true
50ba7f516d7eb4b58b72f538e41a39b23fc3c07b
JavaScript
elminsterrr/FreeCodeCamp
/Front End Development/06. Intermediate Algorithm Scripting/02. Diff Two Arrays/_What Did I Learn From This Challenge/Diff Two Arrays - example.js
UTF-8
843
3.5
4
[]
no_license
function diffArray(arr1, arr2) { let difference = arr1 .filter(x => arr2.indexOf(x) == -1) .concat(arr2.filter(x => arr1.indexOf(x) == -1)); return difference; } diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]); ---------------------------------------------------------------------...
true
491ed9bc189d50a4e613ddc6f4b2d0c29078ebbf
JavaScript
jennycl/SheepHearder
/sketch.js
UTF-8
20,759
3.25
3
[]
no_license
// global variables for images and time var moveAwayTime = 5; // sheep moves away from dog when collision detected for 5 frames // holds time left ot play game and time game is played var timeLeft; var timePassed = 0; // canvas dimensions var theCanvas; var canvasWidth = 900; var canvasHeight = 650; // pen dimension...
true
cf46679fac0bd3703323a3e764768883ededd20d
JavaScript
pmuellr/euler
/005.js
UTF-8
3,604
3.71875
4
[]
no_license
#!/usr/bin/env node // https://projecteuler.net/problem=5 // Smallest multiple // Problem 5 // 2520 is the smallest number that can be divided by each of the numbers from // 1 to 10 without any remainder. // // What is the smallest positive number that is evenly divisible by all of the // numbers from 1 to 20? init(...
true
d2416bdf03bbd25518eb151adb386e99b4cd42ca
JavaScript
andreazaffanella/MilanoGeoServizi
/MilanoGeoServizi/routes/insertcomment.js
UTF-8
1,438
2.578125
3
[]
no_license
var express = require('express'); var router = express.Router(); var mysql = require('mysql'); var conn = mysql.createConnection({ host: "localhost", user: "exampleuser", password: "secret", database: "mydb" }); conn.connect(function(err) { if (err) throw err; console.log("Connected!"); }); var bodyParser = requir...
true
957fac0becd6851ec6ec8ca1c53107b7449d708f
JavaScript
yashb007/assignment
/src/components/screens/CreatePost.js
UTF-8
2,117
2.515625
3
[]
no_license
import React , {useState , useEffect}from 'react'; import {Link, useHistory} from 'react-router-dom'; import '../css/Create.css' import M from 'materialize-css' function CreatePost(){ const history = useHistory() const [title , setTitle] = useState(); const [body, setBody] = useState(); const [id , setI...
true
6d005f2f8758bdb25f18760db6529c29cb825ea1
JavaScript
vikidi/OhjTest-Shalom
/tests/divide.test.js
UTF-8
1,185
3.3125
3
[ "MIT" ]
permissive
import divide from '../src/divide'; /* Documentation Notes * * Label: Critical * Functionality according to documentation is wrong! * Also functionality does not work! * Check found errors. /* Found Errors * * Label: Critical * Does not work at all, returns 1 for every single division. * */ describe('di...
true
08d31df679c967088813a48edea586717667d77e
JavaScript
johndpope/Chronicles
/frontend/src/components/pages/EntityPage/EntityStatuses.js
UTF-8
1,489
2.578125
3
[]
no_license
import React from "react" import { useSelector } from 'react-redux' import Countdown from 'react-countdown' import Badge from '@material-ui/core/Badge' import ChipWithBadge from '../../mylib/ChipWithBadge' export default function EntityStatuses({ entity }) { const statuses = useSelector(state => state.statuses) ...
true
c863c8f816d31bb77db1591d37c28d97a7c418ff
JavaScript
zaplitnyak/spellit
/js/exceptions.js
UTF-8
1,254
2.703125
3
[ "MIT" ]
permissive
/** * Exceptions classes file * Here collected all possible exceptions and their general handlers */ var CommonException = (function () { var self, message, name; function CommonException(message, name) { self = this; self.message = message; self.name = (name !== undefined) ? name :...
true
d58a72a7fd029c59716ce22d58abca557fe06362
JavaScript
taliacornwall/hackathon
/app/public/components/dropdown.js
UTF-8
1,236
2.6875
3
[]
no_license
import React from 'react'; import ReactDOM from 'react-dom'; import countryCodes from '../countryCodes'; const codes = countryCodes.map(function(elm){ return {"code": elm.Code, "name": elm.Name}; }); class Dropdown extends React.Component { constructor(props){ super(props); this.state = { selected: "All", ...
true
5bacfd388f72f4e2bc36946b7e6c8436fb37ea98
JavaScript
Jack-Gooding/Experiments
/static/experiments/3D/3D.js
UTF-8
5,690
2.859375
3
[]
no_license
let cWidth = 300; let cHeight = 300; let total = 8; let lineDetail = 5; let linePairs = 1000; let radius = 100; let moons = []; let grid; let starGraphics; var easycam; function polarise(cX,cY) { let x = radius*Math.sin(cX)*Math.cos(cY); let y = radius*Math.sin(cX)*Math.sin(cY); let z = radius*Math.cos(cX); ...
true
27364c812698eefda8df989389ee3cd823cf835d
JavaScript
Svempolin/project-survey
/code/src/components/MovieType.js
UTF-8
1,183
2.65625
3
[]
no_license
import React, { useState } from "react"; import MovieRecommendation from "./MovieRecommendation"; const choice = { scary: ["80'scary movie", "2020 scary movie"], action: ["Arnold Schwardznegger", "No Arnold Schwardznegger"], romantic: ["Richard Gere", "Matthew McConaghey"], documentary: ["Animals", "Politic"],...
true
b56d02446777cee59a1799e6d0161d381024d959
JavaScript
arik-so/react-native-wasm-experiment
/wasm-test/chacha_poly1305_rust.js
UTF-8
5,159
2.859375
3
[]
no_license
let wasm; /** * @returns {number} */ export function perform_complicated_calculation() { const ret = wasm.perform_complicated_calculation(); return ret >>> 0; } let cachegetUint8Memory = null; function getUint8Memory() { if (cachegetUint8Memory === null || cachegetUint8Memory.buffer !== wasm.memory.buffe...
true
2b0d26b3b5874182baf4b08a0ca44aebe0786375
JavaScript
appijumbo/wikipediaViewer
/js/main.js
UTF-8
4,102
2.890625
3
[]
no_license
(function () { "use strict"; // ************* Declare API elements ************* var wikipediaAPi = "https://en.wikipedia.org/w/api.php?"; var dataTypeList = {action: 'opensearch', format: 'json', namespace:'0', limit:'10'}; var searchBBC = 'bbc'; dataTypeList.search = ...
true
99329574610e9dc4dd69d070830920589f6993d8
JavaScript
AlexanderMartinKane/react-redux-widget
/src/containers/Stats/index.js
UTF-8
1,443
2.515625
3
[]
no_license
import React, { Component } from 'react'; import './index.css'; const items = [ ['Пакетные туры', 3], ['Ручное бронирование', 11], ['Отели', 1] ]; const total = items.reduce((sum, current) => { return sum + current[1]; }, 0); const colors = [ '#ace2f8', '#b1e19b', '#bfc0e4', '#ec9fd5', '#ecdb9f' ] ...
true
54745bd5261e907859e2bbc5b2f002bde76f2440
JavaScript
emilyswitzer/Insurance-JS-form
/js/javascript.js
UTF-8
13,576
2.84375
3
[]
no_license
// JavaScript Document function secondsToMinutes(time) { //Minutes and seconds let mins = Math.floor((time % 3600) / 60); let secs = Math.floor(time % 60); let answer = ""; answer += "" + mins + ":" + (secs < 10 ? "0" : ""); answer += "" + secs; return answer; } f...
true
c69d0980d03742d5e852bb40266744ed3f26b929
JavaScript
DJCordhose/javascript-einfuehrung
/workspace/src/es6/Person.js
UTF-8
154
2.75
3
[ "MIT" ]
permissive
export default class Person { constructor(name) { console.log('Person'); this._name = name; } get name() { return this._name; } }
true
49d0af33c7a6e79175295215e5547cdc4d6edcca
JavaScript
SarahL4/Practice
/智能社视频案例/照片墙/js/demo.js
UTF-8
2,272
2.96875
3
[]
no_license
window.onload = function(){ var oDiv = document.getElementById('div1'); var oUl = oDiv.children[0]; var aLi = oUl.children; var now = 0; var ready=true; //获取按钮 var aBtn1 = oDiv.children[1].getElementsByTagName('a'); //将隐藏的图片全部叠加到第三排 for(var i=0;i<aLi.length;i++) { aLi[i].style.left=aLi[i].offsetLeft+'px'; ...
true
736a37bdbe1583ad49b2279fe427b3c2d73be2eb
JavaScript
AllegroFox/standard-deviants
/server/game/Round-rhymes.js
UTF-8
2,949
2.921875
3
[]
no_license
const Guess = require('./Guess.js'); const Answer = require('./Answer.js'); const buildPool = require ('./gameModules/bank-gen-rhymes.js'); class Round { constructor (messager) { this.messager = messager; this.guesses = []; this.answerBank = [{id: "victory", status: "unguessed", pointValue: 0}, {id: "sp...
true
a856c63d5c248361714859cba135b9584368d1c3
JavaScript
abhishek-pariha/Node-Js
/13-09-2021/fsReadfile.js
UTF-8
151
2.578125
3
[]
no_license
var fs = require('fs'); fs.readFile('test\\demo.txt','utf-8',function(err, data){ if(err) throw err; console.log("Read the file \n"+data); });
true
0abeb9ecf2335badcf87c174ae44c7dbff005c1a
JavaScript
realyxf/refactor_homework
/test/rankTest.js
UTF-8
7,264
2.65625
3
[]
no_license
const rankTest = require('ava'); const { voyageRisk, voyageProfitFactor, captainHistoryRisk, rating } = require('../src/rank'); rankTest('foo', t => { t.pass(); }); rankTest('bar', async t => { const bar = Promise.resolve('bar'); t.is(await bar, 'bar'); }); rankTest('rank case 1. voyageRisk test voyage zone is...
true
a3871757fe408d7f713dd3d2c4eec8031086283f
JavaScript
galikeev/project_loan
/src/js/modules/playVideo.js
UTF-8
4,676
2.59375
3
[]
no_license
export default class VideoPlayer { constructor(triggers, overlay) { this.btns = document.querySelectorAll(triggers); this.overlay = document.querySelector(overlay); this.close = this.overlay.querySelector('.close'); } bindTriggers() { /* метод подвязки триггеров к определенным дейст...
true
8e9e22b058d9b37ec2da996cfc0b3c5033b135e7
JavaScript
lucasreidrade/fbclone
/api/models/users.js
UTF-8
1,660
2.65625
3
[]
no_license
var mongoose = require( 'mongoose' ); var crypto = require('crypto'); var jwt = require('jsonwebtoken'); //Getting ObjectId type const ObjectId = mongoose.Schema.Types.ObjectId; //Security constants const iterations = 500; //More iterations = more secure but slower const hLen = 64; //Hash output size of pbkdf2...
true
58e44ad991806075d7d0d6e1da7465db65f4be10
JavaScript
matrixcreater/drum-kit
/index.js
UTF-8
1,465
3.0625
3
[]
no_license
for (var i = 0; i < document.querySelectorAll(".drum").length; i++) { document.querySelectorAll("button")[i].addEventListener("click", function() { var buttoninnerhtml = this.innerHTML; do_thing(buttoninnerhtml); buttonAnimation(buttoninnerhtml); }); } document.addEventListener("keydown", function (pr...
true
f1cae63c491a22325deaec7e62b5de116845c9ed
JavaScript
Ananya2306/Survey
/js/Form.js
UTF-8
2,019
3.140625
3
[]
no_license
class Form { constructor(){ this.que2 = createElement('h4',"Have you come into close contact (within 6 feet) with someone who has a laboratory confirmed COVID – 19 diagnosis in the past 14 days?"); this.que2.style('color', 'rgb(0,0,0)'); this.opt1 = createRadio('h5'); this.opt1.opti...
true
0f5626054838745c70de45bccfb789e486e48019
JavaScript
b-chang93/builder
/test/test-exercise.js
UTF-8
3,957
2.5625
3
[]
no_license
'use strict'; require('dotenv').config(); const chai = require('chai'); const chaiHttp = require('chai-http'); const jwt = require('jsonwebtoken'); const mongoose = require('mongoose'); const User = require('../users/models'); const Exercise = require('../exercises/models'); const {TEST_BUILDER_DATABASE} = require('.....
true
1c0c642ce2225eb42a445ec78f23ad21192178b7
JavaScript
parthmparmar/Constructor-Word-Guess
/index.js
UTF-8
3,012
3.5625
4
[]
no_license
var inquirer = require("inquirer"); var Word = require("./Word.js"); var wordList = ["eleven", "demogorgon", "hopper", "hawkins", "experiment", "laboratory","russian", "gate", "demodogs", "rats", "eggo"];; var counter = 0; var limit = 10; var wins = 0; var losses = 0; var guessedLetters = []; function getRandom(min, ...
true
b4c5d95baf1f6cdbc94439b5a6a7c6a069f50a6a
JavaScript
ayndri/Belajar-nodejs
/controller.js
UTF-8
1,867
2.640625
3
[]
no_license
'use strict'; var response = require('./res'); var connection = require('./conn'); //read exports.users = function(req, res) { connection.query('SELECT * FROM product', function (error, rows, fields){ if(error){ console.log(error) } else{ response.ok(rows, res) } ...
true
6bb20b766f60b69826105907bd3f6114f2ba8116
JavaScript
bengscott2/bowling-challenge
/spec/frameSpec.js
UTF-8
1,035
2.859375
3
[ "MIT" ]
permissive
describe('Frame', function(){ var frame; beforeEach(function() { frame = new Frame }); it('defaults with certain requirements', function() { expect(frame.strike).toEqual(false) expect(frame.firstRoll).toEqual(true) expect(frame.spare).toEqual(false) expect(frame.score).toEqual(0) expe...
true
e58ee2eeb52c909eaeea08d2be2fc5dce8f44c2e
JavaScript
jonwalz/jonwalz.github.io
/js/fireMessage.js
UTF-8
964
2.921875
3
[]
no_license
var contactFrom = document.getElementById('contact-form'); var contactSuccess = document.getElementById('contact-success'); var contactError = document.getElementById('contact-error'); var sendBtn = document.getElementById('send-button'); var onMessageComplete = function(error) { sendBtn.disabled ...
true
8fa404d7fdb76245f233a75a8e1d3c622f13347f
JavaScript
NieeeIksdeee/lekcja
/sliderv2/script.js
UTF-8
771
3
3
[]
no_license
function slider(){ let slideShow = document.querySelector(".slideShow"); let button_top = document.querySelector(".top"); let button_bottom = document.querySelector(".bottom"); let addDiv = document.querySelector(".addDiv") let dx = 0; function slideImg(){ slideShow.style.transform = `...
true
d2b5851577edd6230336ea3d31a2501a91fa1a59
JavaScript
washington-kibichii/movie-recommender
/src/store/movies.js
UTF-8
1,645
3.03125
3
[]
no_license
// Action types const LIKE_ITEM = "LIKE_ITEM"; const DISLIKE_ITEM = "DISLIKE_ITEM"; // Action creators export const likeItem = (movie) => { return (dispatch) => { dispatch({ type: LIKE_ITEM, payload: { movie, }, }); }; }; export const dislikeItem = (movie) => { return (dispatch...
true
6aa20e9e95c826c26663b31d47b4150f29433e7c
JavaScript
js-tasks-ru/jsbasic-20210201_---
/8-module/3-task/index.js
UTF-8
1,274
2.96875
3
[]
no_license
export default class Cart { cartItems = []; // [product: {...}, count: N] constructor(cartIcon) { this.cartIcon = cartIcon; } addProduct(product) { let cartItem = this.cartItems.find(function(item){ return item.product.id == product.id }); if (cartItem) cartItem.count += 1; else { cartItem = { ...
true
e36005950d50a48e981275050051d1d90f619987
JavaScript
krishna16600/Pokemon-App-UI
/src/components/signup/Signup.js
UTF-8
3,453
2.53125
3
[]
no_license
import React , {Component} from 'react'; import axios from 'axios'; import { withRouter } from 'react-router-dom'; import {Link, Redirect} from 'react-router-dom'; class Signup extends Component { constructor(props){ super(props); this.state = { name: '', email: '', passwor...
true
b4f29d7433003f69a3650ca26d61d62a49971ceb
JavaScript
josejunquera/FRONT-END
/react-chat/src/components/ChatRoom.js
UTF-8
2,587
2.625
3
[]
no_license
import React, { useRef, useState } from "react"; import { ChatRoomHeader2 as ChatRoomHeader } from "./ChatRoomHeader"; import { Message } from "./Message"; import { useRemoteMessages } from "./useRemoteMessages"; export const ChatRoom = () => { const [newMessage, setNewMessage] = useState(""); const { messages, er...
true
d96ba2167629d2abdd2ea7d3902577730e80e24b
JavaScript
orlandocaraballo/class-examples
/express-sequelize-example-futurecode/routes/students.js
UTF-8
1,374
2.546875
3
[]
no_license
const express = require("express"); const router = express.Router(); const { Student, Meal } = require("../db"); // student routes router.post("/", async (req, res, next) => { try { const student = await Student.create(req.body); res.json(student); } catch (err) { next(err); } }); // read all route...
true
8c5f90885218f335a2807af3b44057cf166124cd
JavaScript
demohack/yute
/done/31-5-node-markov/markov.js
UTF-8
1,872
4
4
[ "MIT" ]
permissive
/** Textual markov chain generator */ const random = require('random'); class MarkovMachine { /** build markov machine; read in text.*/ constructor(text) { let words = text.split(/[ \r\n]+/); this.words = words.filter(c => c !== ""); console.log("input : " + this.words); this.makeChains(); } ...
true
ef4a8ff8a675a684c2379fadd76f4b01de2dd8a6
JavaScript
Alrxu/student-management-system
/src/controllers/accoutController.js
UTF-8
3,088
2.71875
3
[]
no_license
// 注册控制器 const path = require('path') // 导入captchapng const captchapng = require('captchapng') // 导入数据库操作模块 const databasetool = require(path.join(__dirname,'../tools/databaseTool.js')) exports.getRegistorPage = (req, res) => { // res.sendFile() 原封不动的读取文件 res.sendFile(path.join(__dirname, '../statics/views/reg...
true
b3ee68efa736ca093767f6e05d5d6b1169cabc1a
JavaScript
jhadev/firebase-react-auth
/src/components/Session/withAuthentication.js
UTF-8
1,330
2.59375
3
[]
no_license
import React from 'react'; import { withFirebase } from '../Firebase'; import AuthUserContext from './context'; // higher order component to handle authentication. firebase includes a listener that handles state changes and we can use that to setState ourselves. const withAuthentication = Component => { class IsAuth...
true
cf74f836a505bc2dbab4b495eeb82e50dd8869a3
JavaScript
Jorgeeab-jz/rock-paper-scissors
/script.js
UTF-8
3,970
3.484375
3
[]
no_license
let rock = { identity: 'ROCK', weakness: 'PAPER', goodAgnst: 'SCISSORS' }; let scissors = { identity: 'SCISSORS', weakness: 'ROCK', goodAgnst: 'PAPER' }; let paper = { identity: 'PAPER', weakness: 'SCISSORS', goodAgnst: 'ROCK' };//The three options and their properties let options = ...
true
98ec844a7afc8afbb43d3b6e2826baf61bac9688
JavaScript
Matt0472/js-jq-carousel
/javascript/main.js
UTF-8
1,878
2.828125
3
[]
no_license
// Partendo dai file html e css che vi allego, implementate la funzionalità slider. // Se clicchiamo sulle icone next e prev andiamo avanti o indietro con le visualizzazioni. Il giro deve ripartire se siamo sull'ultima o la prima. // I cerchietti devono cambiare colore contemporaneamente. $(document).ready( funct...
true
58b2dced5d0488690d056501262e0ff153bc5916
JavaScript
envil/haproxy-vagrant
/app-server-1/Your.Rentals-master/app/filters/cardNumberFilter.js
UTF-8
686
2.734375
3
[ "MIT" ]
permissive
(function() { 'use strict'; var app = angular.module('yrapp', []); var cardNumberFilter = function() { return function(cardNumber) { if (typeof(cardNumber) == 'undefined' || cardNumber == null) { return ''; } var solidNumber = ''; for (var i = 0; i < cardNumber.length && i < 1...
true
38a8beefe0b693b170f1acec66bbc160c22df2b1
JavaScript
JasonPollman/Dist.io
/lib/SlaveArray.js
UTF-8
5,655
2.90625
3
[ "ISC" ]
permissive
/** * @file * Represents a collection of slaves, and their actions as a collective object. * @copyright © 2016 Jason James Pollman */ 'use strict'; require('proto-lib').get('_'); /** * @module DistIO/SlaveArray */ /** * Validates that all arguments are Slave objects. * @param {...*} slaves The slave list to ...
true
dc07f6ae062d4a3a928c074588f2092a36989925
JavaScript
noraghali95/codewars
/7kyu/squareEveryDigit.js
UTF-8
151
3.21875
3
[]
no_license
var squareDigits = (num) => { let numArray = num.toString().split(""); return parseInt((numArray.map((n) => parseInt(n) * parseInt(n))).join("")); }
true
8631689b9569f99cd1dc231611d68df4d1652f92
JavaScript
DipesAtcodeict/firebase-4picsOneWord..
/src/App.js
UTF-8
1,191
2.640625
3
[]
no_license
import React, { Component } from "react"; import Header from "./Components/Header/header"; import Playground from "./Components/Playground/playground"; import ScoreCard from "./Components/Footer/footer"; import { firebaseDB } from "./firebase"; let next = 0; class App extends Component { state = { answer: "",...
true
22fdad188575da335ead31a4c590f5ed9d357a57
JavaScript
WaffleBweh/RPG_Dungeon
/RPG_Dungeon/DIVERS/randomDungeon.js
UTF-8
7,386
3.734375
4
[]
no_license
//Objet dongeon // 0 = vide // 1 = mur // 2 = joueur function dungeon(width, height) { this.width = width; this.height = height; this.grid = []; this.cellWidth = 32; this.cellHeight = 32; this.isFilled = function(array) { for (i = 0; i < array.length; i++) { for (j = 0; j < ...
true