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
13029b550dc7ef175c4003d228e6329f70de3dad
JavaScript
sharkham/js-advanced-functions-basic-functions-review-lab-online-web-pt-061019
/index.js
UTF-8
1,002
3.953125
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
// Your code here /*LAB: Implement a function called saturdayFun. It should return a String like "This Saturday, I want to ....!" Fill in the ... with the activity that's passed in as the first parameter. If nothing is passed in, default to "roller-skate". */ function saturdayFun(arg = "roller-skate") { return `This...
true
df5b2962e02a0baefecd32d8f291bcc74d77d350
JavaScript
lockyboss1/rockPaperScissors
/main.js
UTF-8
3,911
3.765625
4
[]
no_license
const gameChoices = ["rock", "paper", "scissors"]; let playerScore = 0; let computerScore = 0; let modal = document.getElementById("myModal"); let name = document.getElementById('name'); let submit = document.getElementById("submit"); let result = document.querySelector('#results'); //function that takes the user inpu...
true
34a47c40464310802444f028de58125ad2cfffc2
JavaScript
pd4d10/userscript-meta
/test.js
UTF-8
2,595
2.546875
3
[ "MIT" ]
permissive
'use strict' var assert = require('assert') var hostsUtil = require('./') var parse = hostsUtil.parse var stringify = hostsUtil.stringify var json = { name: 'test', version: '0.1', } var jsonMulti = { name: 'test', match: [ 'http://www.example.com/*', 'http://www.example.org/*', 'http://www.exam...
true
15ed1c7adc44876b99b929947f0a7183d2351f0f
JavaScript
SpookyFM/khamake
/Converter.js
UTF-8
1,209
2.625
3
[]
no_license
var child_process = require('child_process'); var fs = require('fs'); var log = require('./log.js'); exports.convert = function (inFilename, outFilename, encoder, callback) { if (fs.existsSync(outFilename.toString()) && fs.statSync(outFilename.toString()).mtime.getTime() > fs.statSync(inFilename.toString()).mtim...
true
5b379913b702e6ce89ebd594fa2b37beb3c464f5
JavaScript
xcwisc/leetcode-practice
/easy/268.missing-number.js
UTF-8
215
2.90625
3
[]
no_license
/** * @param {number[]} nums * @return {number} */ var missingNumber = function(nums) { let ans = nums.length; for (let i = 0; i < nums.length; i++) { ans ^= (nums[i]^i); } return ans; };
true
678888a84d125ca560a1f38d8d198324228f548b
JavaScript
bpasieka/leetcode-solutions
/algorithms/278_first_bad_version.js
UTF-8
982
3.640625
4
[]
no_license
/** * Definition for isBadVersion() * * @param {number} version number * @return {boolean} whether the version is bad * isBadVersion = function(version) { * ... * }; */ /** * @param {function} isBadVersion() * @return {function} */ const solution = (isBadVersion) => { /** * @param {number} star...
true
40752505184fcf06fd7d755da18f36a2dc6e4f6c
JavaScript
breakx/SistemaEscolar
/public/js/scripts.js
UTF-8
1,020
2.671875
3
[ "MIT", "Apache-2.0" ]
permissive
/** * Created by CristianoGD on 27/09/2015. */ /** * efeito alert */ $(function () { // pegar elemente com corpo da mensagem var corpo_alert = $("#alert-message"); // verificar se o elemente esta presente na pagina if (corpo_alert.length) // gerar efeito para o elemento encontrado na pagina ...
true
b47c3cb896b1f40dffae491572316cdca07be98f
JavaScript
YWithT/LeetCode
/405_数字转换为十六进制数.js
UTF-8
663
3.734375
4
[]
no_license
/** * @param {number} num * @return {string} */ var toHex = function (num) { let arr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]; let res = ""; let count = 0; //因为num最高为32位,所以一次右移4位,最多右移7次 //由于负数在计算机中本身用补码保存,故可以统一处理 while (num != 0 && count++ < 8) { ...
true
226dc91362972a0cbb2faa30066156fa7033bfb4
JavaScript
GiadaVolpi/js-pwdgen-wannabe
/main.js
UTF-8
613
3.25
3
[]
no_license
// prompt: nome var nome = prompt ("Scrivi il tuo nome"); console.log (nome); // prompt: cognome var cognome = prompt ("Scrivi il tuo cognome"); console.log (cognome); // prompt: colore var colore = prompt ("Scrivi il tuo colore preferito"); console.log (colore); // assegno a "numero" un valore var numero = 19 // colle...
true
56d463c87df7c9a9f389d9b2811666df1abea690
JavaScript
ianwaites/portfolio
/apppp.js
UTF-8
3,234
3.28125
3
[ "MIT" ]
permissive
// Low Level request let next, prev const successCallback = function(data){ console.log(data) next = data.next prev = data.previous let template = Handlebars.compile($('#termplate').html()) $('#app').html(template({persons: data.results})) } const errorCallback = function(err){ console.log(err) } //Not su...
true
8d78adb0f1e386bebcbd292d1c7a34bdd7c53a77
JavaScript
arquivo/Pwa-Assessments
/src/main/webapp/javascript/validations.js
UTF-8
324
2.984375
3
[]
no_license
function isValidRadio(radio,msg) { var valid = false; for (var i = 0; i < radio.length; i++) { if (radio[i].checked) { return true; } } alert(msg); return false; } function validateForm(form,msg) { if (isValidRadio(form.relevance,msg)) { return true; } return false;...
true
9d16ad45c41324ff4e40d6211f4edfbf58d6ba09
JavaScript
devonhackley/algorithms
/Algorithms class-Coursera/Data Structure/DisjointSet.js
UTF-8
757
3.390625
3
[]
no_license
class Node { constructor(val) { // creates a singleton set x this.val = val; } } const makeSet = (x) => { // using tree structure to build DisjointSet let set = new Node(x); set.parent = set; set.rank = 0; return set; }; const find = (x) => { // time: O(logn) where n is the depth of the tree ...
true
1bf7128a270470c51293f235eb4639f97b81b6b4
JavaScript
libertyzhao/parser-demo
/dfa_num/FmsTable.js
UTF-8
941
3.34375
3
[]
no_license
const STATE_COUNT = 6; // 图的点 class FmsTable { constructor(){ this.fmsTable = new Array(STATE_COUNT); for(let i = 0 ; i < this.fmsTable.length ; i++){ this.fmsTable[i] = []; } this.init(); } // 初始化图的数据 init(){ this.initForNumber(0,1); this.initForNumber(1,1); this.initForNum...
true
1ea2c0175cd426ce776de26796d313e19dd790af
JavaScript
wwwmewww/engine
/cocos2d/core/components/CCComponentEventHandler.js
UTF-8
4,780
2.6875
3
[ "MIT" ]
permissive
/**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldw...
true
80027208a1381dd19787904e9282d48b061e7a66
JavaScript
justingarrison99/Sandcastle2.0
/src/components/Carousel.js
UTF-8
2,159
2.515625
3
[]
no_license
import React from 'react'; import Container from 'react-bootstrap/Container'; import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; import lango from "../assets/images/lango.png" import gigs from "../assets/images/gig.png" import socials from "../assets/images/sandyskull.png" import Card from ...
true
b0af43b224c69317643b80b7082ccda0cda1e2fd
JavaScript
leticiacb1/first-site
/scripts/addField.js
UTF-8
613
3.4375
3
[]
no_license
//Procurar no Botão document.querySelector("#add-time") //Quando clicar no botão .addEventListener('click',cloneField) //Execiutar uma ação function cloneField(){ //Duplicar campos. Que campos? const newFieldContainer=document.querySelector('.schedule-item').cloneNode(true) //limpar ...
true
1ccf6a4e91f9b400a7541d5db378fbac29b285dd
JavaScript
mielp/aoc2020
/day/7/answer.mjs
UTF-8
1,497
3.5625
4
[]
no_license
'use strict'; /** * Prepare the challenge! * @param input a string containing the puzzle input * @returns an object containing functions that answer part 1 and 2 */ export async function prepare(input) { const childrenExp = /(\d+) ([a-z ]+) bag/; const getBag = (line) => { const [color, contents] = line.s...
true
9b4334a3753071762d6354ae0772280588e979b2
JavaScript
WangDaMME/React
/react_basics/redux/react-redux多组件间-数据的共享combineReducer总state/src/containers/PersonContainer/index.jsx
UTF-8
1,758
2.640625
3
[]
no_license
import React, {Component} from "react" import {connect} from "react-redux"; // 是个函数 import {nanoid} from "nanoid" import {createAddPersonAction} from "../../components/redux/actions/person_action_creators" // 让person 和count 组件互相展示 拿到 对方的信息 //UI 组件不暴露 不写default class Person extends Component{ addPerson...
true
6ab10390f62cc20448c267456bd209877b412ce1
JavaScript
Charles-Mu/swe642
/hw3/form_validation.js
UTF-8
2,426
3.46875
3
[]
no_license
function validation() { var retval = true; //Use name validate var name = document.getElementById("username").value; var usercheck = (/^[a-zA-Z]+$/.test(name)); if (usercheck==false) { clearFields("username"); document.getElementById("name_error").innerHTML = "Should contain only Alphabets"; ...
true
72cf7489d6ad04c792b9805a154f24ba2f2c67ed
JavaScript
Brain-official/eduford
/script.js
UTF-8
207
2.671875
3
[]
no_license
navLinks = document.getElementById("navLinks"); function showMenu() { navLinks.style.visibility = "visible"; } function hideMenu() { navLinks.style.visibility = "hidden" }
true
574c6c7f06d90e324bc9bbf6e797e8c671300a86
JavaScript
fupet/hw3_wordmagic_tdd
/libs/wordMagic.js
UTF-8
1,665
3.703125
4
[]
no_license
/** * WordMagic * * @constructor */ var WordMagic = function(originalWord) { this._originalWord = originalWord; this._permutations = []; }; /** * Returns the permutations array * * @returns {boolean} */ WordMagic.prototype._generatePermutations = function() { this._generatePermutation(this._originalWord); ...
true
fd764b4035a8f002d5cb17368adfe9c7d8fbc07b
JavaScript
Zeumo/datetime-picker
/dist/datepicker.js
UTF-8
11,953
2.59375
3
[]
no_license
/* * datepicker.js 0.8.0 * https://github.com/Zeumo/datepicker.js * * /!\ Don't edit this file directly! * It was generated by the datepicker.js build system. */ (function(window) { var Picker, pluginName = 'picker', templates = {}; var t = function(s,d){ for(var p in d) s=s.replace(new RegExp('{'+p...
true
62ce49e588152523dad2325cbb10a072dcb5619a
JavaScript
CalebeSouza1/RevisaoJS
/atualizando-lista.js
UTF-8
386
3.046875
3
[]
no_license
const listaDeChamada = ['calebe', 'juliana', 'Ana', 'caio', 'breno', 'rafael', 'vinicius', 'celso', 'daniel', 'gabriel', 'jão', 'felipe', 'rafael', 'paulo', 'dyla', 'marcos', 'gilherme'] //remover elemento de qq lugar da array para qq lugar da array // listaDeChamada.splice(1, 2, 'RODRIGO') listaDeChamada.splice(2,...
true
acf950a9237becd54dde60133d31887f862a3d9f
JavaScript
leoterry1/grupo_1_mele
/Site/src/validations/signupValidator.js
UTF-8
1,115
2.609375
3
[]
no_license
const db = require('../database/models') const {check, body} = require('express-validator'); module.exports = [ check('name') .notEmpty().withMessage('El nombre de usuario es requerido'), check('lastName') .notEmpty().withMessage('El apellido de usuario es requerido'), check('email') .isEmail...
true
2deb5c248edde392bb4662f87761a2b2c391dfd8
JavaScript
kanglicheng/meiosis
/tutorial/code/10-using-lit-html-01.js
UTF-8
3,413
2.75
3
[ "MIT" ]
permissive
import { html, render } from "https://unpkg.com/lit-html?module"; /*global flyd, P, S, PS*/ var conditions = { initialState: { conditions: { precipitations: false, sky: "Sunny" } }, actions: function(update) { return { togglePrecipitations: function(value) { update({ conditi...
true
1db1024f14576d8a9ce77baf26632131c9e87498
JavaScript
halibutte/HotelProject
/web/Staff/js/reports.js
UTF-8
1,720
3.09375
3
[ "MIT" ]
permissive
$(document).ready(function() { run_sums(); run_avgs(); }); function run_sums() { //Work out totals from the different room types $("[data-sum]").each(function(idx, el) { var colSum = $(el).data("sum"); //get and sum all the elements of this column //get the card which is containing...
true
ba1e8011ca422952059cb111691209b0ead0e227
JavaScript
nainde0719/study_javascript
/200326/042.js
UTF-8
595
2.953125
3
[]
no_license
//01 const URL = 'http://js.com'; URL = 'http://js.com'; if (true) { const URL2 = 'http://js.com'; } console.log(URL2); //02 const URL = 'hhp://js.com'; URL = 'http://js.com'; if (true) { const URL2 = 'http://js.com'; } console.log(URL2); //03 const URL = 'http://js.com'; URL = 'http://js.com' if (true) ...
true
bb1780a1f70ed388e0d8cf5740ce9544f42e6147
JavaScript
dixonj13/real-interactive
/resources/assets/js/query_tools/Relation.js
UTF-8
9,789
3
3
[]
no_license
var _ = require('lodash/lang'); export var Relation = function(attributes, tuples) { this.attributes = attributes; this.tuples = tuples; }; /** * Creates a new copy of this relation. * @return {Relation} New Relation. */ Relation.prototype.clone = function() { return new Relation(_.cloneDeep(this.attri...
true
4b9abb40c0672fe30fb249d1e8bdf33e670d4186
JavaScript
tarun4all/soket.io-room-connection
/app.js
UTF-8
908
2.515625
3
[]
no_license
const express = require("express"); const app = express(); var cors = require('cors'); var http = require('http').Server(app); var io = require('socket.io')(http); app.use(cors()); app.options('*', cors()); const bodyParser = require("body-parser"); app.use(express.static("public")); app.use(bodyParser.urlencoded(...
true
1cd9e710b4ca0f7f372c2e8df9b4acbc2ca525c0
JavaScript
KaziMinhaj/book-attic-client
/src/components/Checkout/Checkout.js
UTF-8
1,661
2.53125
3
[]
no_license
import React, { useContext, useEffect, useState } from 'react'; import { Table } from 'react-bootstrap'; import { useParams } from 'react-router'; import { UserContext } from '../../App'; import './Checkout.css'; const Checkout = () => { const [aBook,setABook] = useState({}) const {id} = useParams() cons...
true
fd5ee7d3ab0babc40104c2dc44992a1f99f61d0e
JavaScript
montrealist/2020-04-01-Interactive-Calculator
/src/App.js
UTF-8
4,914
2.84375
3
[ "MIT" ]
permissive
import React, { useState } from "react"; import Button from "./components/Button"; function App() { const submit = e => { e.preventDefault(); setUpdating(false); const tip = (total.value / 100) * percentage.value; setTip(tip); }; function useControlledInput(initial) { ...
true
3eb194af8462dad198356587ff6720b9153c7328
JavaScript
EmilyQiRabbit/LeetCoder
/JSCode/Medium/983-minimum-cost-for-tickets.js
UTF-8
1,673
3.703125
4
[]
no_license
/** * @Topic DP - Medium * @Question In a country popular for train travel, * you have planned some train travelling one year in advance. * The days of the year that you will travel is given as an array days. * Each day is an integer from 1 to 365. * * Train tickets ar...
true
47a2377763911721b2191d82484fb3819bfb657d
JavaScript
mihirlaldas/stackapi
/src/Components/AnswerList.jsx
UTF-8
3,845
2.859375
3
[]
no_license
import Card from "./Card"; import React, { Component } from "react"; export class AnswerList extends Component { constructor(props) { super(props); let query = new URLSearchParams(props.location.search); this.state = { questionId: query.get("id"), question: JSON.parse(localStorage.getI...
true
e3b177d98a72fb3c2eb7a7233a1cec6923f02bf4
JavaScript
ibra4/resume-builder-vuex-app
/src/assets/js/editTitle.js
UTF-8
694
2.53125
3
[]
no_license
function someFunc(elem) { var divVal = elem.innerText, node = document.createElement('input'), span = document.createElement('span'), varname ; node.type = "text"; node.className = "editInput"; node.value = divVal; span.innerText = "save"; span.id = "save"; ...
true
21e616b03e65aee0efa065418193acab7cb15974
JavaScript
din982/Threejs-Art
/main.js
UTF-8
13,240
2.65625
3
[]
no_license
/* ==================== [ Global Variables ] ==================== */ var scene, camera, renderer, aspectRatio; var stats; var composer, effect, clock; /* ==================== [ Audio Context ] ==================== */ var ctx = new AudioContext(); var audio = document.getElementById('player'); audio.play(); audio.volum...
true
e58fad51402e24be06a2077693a78b4039aa208b
JavaScript
lail-lei/ctci-javascript
/sort_search/groupAnagrams/index.js
UTF-8
1,227
4.5625
5
[]
no_license
/** * Group Anagrams: Write a method to sort an array of * strings so that all the anagrams are next to each other. */ // Approach 1: sort all strings, // then sort the array of strings // O(nlogn) function groupAnagramsNaive (strings) { let sortedStrings = strings.map((element) => {return sortString(element)...
true
c7a1563002cff9c9a8fb4fda864c7c27247f3473
JavaScript
MadalinaAnghel/mooder
/client/src/components/Avatar.js
UTF-8
1,754
2.53125
3
[]
no_license
import React, {useState, useRef, useEffect} from "react"; import Image from "react-bootstrap/Image"; import axios from "axios"; import noPhoto from "../images/no-photo-available.png"; export default function Avatar(props) { const _isMounted = useRef(true); const jwt = localStorage.getItem('jwtToken'); const [a...
true
f1c30fe225662c7eaa344661d4807f7208a9a84f
JavaScript
arturpr/takeblipteste
/Api/functions/src/services/github_repos.service.js
UTF-8
1,765
2.625
3
[]
no_license
var path = require("path"); var GitHubReposModel = require("../models/github_repos.model"); var moment = require("moment"); const model = new GitHubReposModel(); exports.getTop5OlderCSharpRepos = async function ({ user }) { if (user === undefined || (user !== undefined && user === "")){ throw new ...
true
ae8722b9c8abe8605332c569445999df4f7425b9
JavaScript
sgiangola/homerun-tracker
/js/app.js
UTF-8
3,421
2.640625
3
[]
no_license
console.clear() import React from 'react'; import ReactDOM from 'react-dom' import axios from 'axios'; import ReactTable from 'react-table' class Table extends React.Component { constructor(props) { super(props); this.state = {data: []}; } // Lifecycle method componentDidMount (props) { // Make H...
true
c602f19aa60647cd9a278d10a16c91a91de92356
JavaScript
giftmbanda/novelty
/Routes/contentRoute.js
UTF-8
774
2.5625
3
[]
no_license
const userRouter = require("express").Router(); const contentController = require("../Controllers/contentController"); // [get] route to "/content" to get a list of desired content. /** * @swagger * /content: * get: * tags: * - content * summary: Get content * description: retrieve content f...
true
8f549ac86fb7df267e574d7172f9e2b7013e34e7
JavaScript
impzz/idle_game
/main.js
UTF-8
140
3.140625
3
[]
no_license
var population = 0; function click(number) { population = population + 1; document.getElementByID("population").innerHTML = population; }
true
6a42464d3f8b12d7c31580051533e41c7fc21eec
JavaScript
parakram10/QuizApplication
/app4.js
UTF-8
3,520
2.875
3
[]
no_license
let a = localStorage.getItem('1234567890'); b = JSON.parse(a); console.log(b); let question = document.getElementById('questiondivision'); let option1 = document.getElementById('op1'); let option2 = document.getElementById('op2'); let option3 = document.getElementById('op3'); let option4 = document.getElementById('op...
true
6071f3b7fdf3c741babd3c41816025d664669ce3
JavaScript
hastebrot/logic.js
/lib/logic.js
UTF-8
10,669
3.46875
3
[ "MIT" ]
permissive
(function() { /** * Logic Variable */ class LVar { constructor(id) { this.id = id } toString() { return this.id } } let lvarCounter = 0 // global counter function lvar(id) { if (!id) { id = `~.${lvarCounter}` lvarCounter += 1 } return new LVar(id) } class ImmutableMap { constructor(...
true
a90c3771dafe7d0afd8f9729e2b85b2c36741ef3
JavaScript
AlexZielinski/WebDev
/form-validation-exercise/validation.js
UTF-8
5,564
3.578125
4
[]
no_license
// Java Script validation function checkForm() { // Variables for position information var pos = document.getElementById('position').value; var position = document.getElementById('div_1'); // Variables for passed comp 1536 information var x1 = document.getElementById('radPassedWeb_0').checked; var x2 = docu...
true
dc330a3aa6edb0a73bc0b6988c631347ce141e21
JavaScript
wladimir917/Redux-Friends
/friends/src/components/Friends/SaveFriend.js
UTF-8
1,884
2.515625
3
[]
no_license
import React from 'react'; import { Button, Form, FormGroup, Label, Input } from 'reactstrap'; import axios from 'axios'; import { connect } from 'react-redux'; import { saveFriend } from '../../actions'; class SaveFriend extends React.Component { constructor(props) { super(props); this.state = { ...
true
2df45a0c59608cb0d78d1aae2e66488c2a3a364d
JavaScript
bartecko/quiz
/js/app.js
UTF-8
5,888
3.515625
4
[]
no_license
import Question from "./question.js"; import Quiz from "./quiz.js"; const App = (() => { const quizEl = document.getElementById("app-body"); const questionEl = document.querySelector(".question"); const choicesBoxEl = document.querySelector("ul.answers"); const trackerEl = document.getElementById("trac...
true
6e6647cdfbebb9e804213775e9923c0692051f2b
JavaScript
PopovaSofi/SoftServe-ElementaryTasks
/src/task4.js
UTF-8
1,008
3.53125
4
[]
no_license
function GetPalindrom() { var n = document.forms["reg"].elements["name"].value; checkPalindrome(n); } var reversed; function checkPalindrome(n) { document.getElementById('out2').value = ''; if(isValidPalindrom(n)) { for (i = 0; i < n.length; i++) { for (j = 0; j < n.length; j++) { var p ...
true
98999aae046c330ab85dd5c975dea8c4c373a253
JavaScript
jbaumadsen/jsprac
/callbacks.js
UTF-8
980
4.1875
4
[ "BSD-2-Clause" ]
permissive
// This is the array that contains numbers for you to work with var myArray = [1, 2, 5, 6, 12, 23, 15, 31]; // This array should only contain even numbers var evenArray = []; // This code will call your function when the page loads up // Don't edit this function! window.onload = () => { console.log(filterArray(myAr...
true
50d4a91fc4203665cbb33d93f9482f55e8f757f7
JavaScript
max-vac/Leetcode-Problems
/canPlaceFlowers.js
UTF-8
1,231
3.96875
4
[]
no_license
// 605. Can Place Flowers // You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots. // Given an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n, return if n new flowers can be...
true
6f4aba4f938ad599ea4fa80efbdb6e0776f5af5d
JavaScript
kevinhartmann23/self-care-center
/main.js
UTF-8
3,730
3.078125
3
[]
no_license
//Page Organization var mainPage = document.querySelector(".main-page") var favoritesPage = document.querySelector(".favorites-page"); var favMessageGrid = document.querySelector(".fav-message-grid"); //Text & Image Organization var messageDisplay = document.querySelector('p'); var image = document.querySelector("#lil...
true
bdf68a8e35ac9c4436dba7096b0bb14ebad5f051
JavaScript
kriskowal/collections
/packages/specs/dict.js
UTF-8
3,741
3.171875
3
[ "MIT" ]
permissive
/* global describe, it, expect */ "use strict"; // tests that are equally applicable to Dict, Map, SortedMap, unbounded LruMap, FastMap module.exports = describeDict; function describeDict(Dict) { describe("as Dict", function () { it("is constructable from entry duples", function () { var dict = Dict([[...
true
0beb4e75cf600f98dd70d5198355a7abf6e6353c
JavaScript
marcosjrs/angularjs_ejemplo_services
/app.js
UTF-8
2,037
2.796875
3
[]
no_license
var module = angular.module('app', []); module.service('ContactService', function () { //id que tendrá el contacto creado var uid = 1; //Lista de contactos var contactos = [{ id: 0, 'nombre': 'Prueba', 'email': 'hello@gmail.com', 'telefono': '123-2343-44' }]; ...
true
2353ec46c567e37d9af765d7cfedc6a7e9b5430d
JavaScript
adammo94/navbar
/src/components/login/Login2.js
UTF-8
1,617
2.59375
3
[]
no_license
import React from 'react'; import './Login.css'; const stylPierwszy = { }; const stylDrugi = { color: 'transparent', textShadow: '0 0 8px rgba(255,255,255,0.5)' }; const eye = { otwarte: require('../images/eye_opened.svg'), zamkniete: require('../images/eye_closed.svg') } ...
true
054ef20328c5c88ad079f97297c330e874351803
JavaScript
BasmaMohamed34/egyRent-website
/client/src/Component/dateTime/DateTime.js
UTF-8
773
3.03125
3
[]
no_license
import React from 'react'; import "./DateTime.css" class DateTime extends React.Component { constructor(props) { super(props); this.state = { date: new Date(), }; } componentDidMount() { this.timerID = setInterval( () => this.tick(), 1000 ); ...
true
23aa904c86d13775a3fb6fa8f6aff31503835837
JavaScript
hergert/map-tools
/test/functional/addGroup.Spec.js
UTF-8
1,417
2.984375
3
[ "MIT" ]
permissive
describe('when calling addGroup()', function () { "use strict"; it('should save the "Group Options"', function () { var map = new mapTools({async: false, id: 'mymap', lat: 41.3833, lng: 2.1833}); map.addGroup('myGroup', {myGroupProp: true}); expect(mapTools.maps.mymap.markers.groupOptions.myGroup).to.e...
true
0718a293dce8835e9ba89f2668532b3532be7224
JavaScript
MadhuVK/tap-bam-points
/tBp-Web/routes/api.js
UTF-8
1,750
2.53125
3
[]
no_license
var express = require('express'); var router = express.Router(); var config = require('../bin/config')[process.env.NODE_ENV] var jwt = require('jsonwebtoken'); var auth_helper = require('../src/auth_helper'); router.use(requireJwt); // Checks for token from cookie or x-access-token, in that order // Respond with a...
true
eda6772f598e1367e263a1d5bf05e913e33e551a
JavaScript
sunchaser0/ops-latex-system
/README/js/README.js
UTF-8
626
2.53125
3
[]
no_license
/* ToC Parameters */ $(document).ready(function(){ $("#toc").tableOfContents( null, // Default scoping { startLevel: 2, // H2 depth: 3, // H2 through H4 } ); }); /* Go-To Top Button */ $('.go-top').click(function () { $("html, body").animate({scrollTo...
true
e17a0cd1a1044d236773f487f9a279456f5341c3
JavaScript
isaachyoon/Algo-Expert
/Linked List/findLoop.js
UTF-8
288
3.390625
3
[]
no_license
function findLoop(head) { // Write your code here. let node1 = head.next.next; let node2 = head.next; while (node1 !== node2) { node1 = node1.next.next; node2 = node2.next; } while (head !== node2) { head = head.next; node2 = node2.next; } return head; }
true
14a2ae344d6c748b5a8b12546f026e77a0c1823d
JavaScript
chaoticgd/chaoticgd.github.io
/cgheader.js
UTF-8
1,756
2.859375
3
[]
no_license
var cg = {}; cg.getScriptDirectory = function() { var scripts = document.getElementsByTagName('script'); for(var i in scripts) { if(scripts[i].src.indexOf('cgheader.js') >= 0) { return scripts[i].src.substring(0, scripts[i].src.lastIndexOf('/')); } } }; cg.createHeader = function(breadCrumbs) { var headerS...
true
681d0f2847a04300c5a7478116dbc2c214d79c75
JavaScript
HisakawaKoyomi/JavaScript_pratice
/7sortAlgorithm/quickSort.js
UTF-8
843
3.625
4
[]
no_license
function quickSort(arr,left,right) { let len = arr.length; left = typeof left === 'number'? left: 0; right = typeof right === 'number'? right: len - 1; //递归的外围不要用循环 if (left < right) { let partitionIndex = partition(arr, left, right); quickSort(arr,left,partitionIndex - 1); ...
true
091c240d718d43e2972003b597da1b6dde3400b4
JavaScript
user1837/creativeproject4
/server.js
UTF-8
1,904
3.171875
3
[]
no_license
//always include the following 6 lines in Node server const express = require('express'); const bodyParser = require('body-parser'); const app = express(); //for accepting incoming POST requests app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); //sets up director called "public" that is ...
true
f3a5e546cecf97932dbf9e1de36801042d6f7b8b
JavaScript
cwzp990/summary
/doc/translate.js
UTF-8
1,685
2.90625
3
[]
no_license
const path = require("path"); const fs = require("fs"); const readline = require("readline"); const pathPublic = path.join(__dirname, "/src"); function getFiles(dir, all) { all = all || []; let files = fs.readdirSync(dir); files.forEach((file) => { const filePath = path.join(dir, file); const star = fs....
true
8c66aeab9384fc3cc634293db574674fb5066a86
JavaScript
ConiX21/course-html5
/Html5 Final/14-Worker/worker.js
UTF-8
387
3.140625
3
[]
no_license
// On débute à partir de 1 var n = 1; // Boucle de calcul incrémental recherche: while (true) { n += 1; for (var i = 2; i <= Math.sqrt(n); i += 1) // Si le nombre n’est pas premier, on continue la recherche if (n % i == 0) continue recherche; // Sinon, un nombre premier est trouvé // et...
true
b5f1bbdf48a5934bf1ffcdf506ed3f6a8dfb99eb
JavaScript
guillaumehanotel/reactjs-mr-mood
/src/redux/user/reducer.js
UTF-8
542
2.65625
3
[]
no_license
import userActions from "./constants"; const initialState = { user: { name: "Guigui" }, isLogged: false, } const userReducer = (state = initialState, action) => { switch (action.type) { case userActions.LOGIN: return { ...state, isLogged: tru...
true
87b7ae947b496b06b832a99df3984f23a39e2e1f
JavaScript
AhnDogeon/JavaScript-For-Beginner
/js/todo.js
UTF-8
2,776
3.40625
3
[]
no_license
const toDoform = document.querySelector(".js-toDoForm"), toDoInput = toDoform.querySelector("input"), toDoList = document.querySelector(".js-toDoList"); const TODOS_LS = "toDos"; let toDos = []; function deleteToDo(event){ // delete child element MDN const btn = event.target; const li = btn.paren...
true
5d13146d68a93201f784e9f12dde04c837ed0015
JavaScript
jadeaxon/hello
/JavaScript/rediscovering_javascript/arrow/wrap-throw.js
UTF-8
615
3.015625
3
[]
no_license
/*** * Excerpted from "Rediscovering JavaScript", * published by The Pragmatic Bookshelf. * Copyrights apply to this code. It may not be used to create training material, * courses, books, articles, and the like. Contact us if you are in doubt. * We make no guarantees that this code is fit for any purpose. * Visi...
true
925d999868db50c52dda2e2c4c3b42a2ff7e6074
JavaScript
lpre/RPA-Examples
/Scripts/performance5.js
UTF-8
1,586
2.9375
3
[]
no_license
/*************************************************** RPA - Tool for Rocket Propulsion Analysis Copyright 2009-2014 Alexander Ponomarenko Please contact author <contact@propulsion-analysis.com> or visit http://www.propulsion-analysis.com if you need additional information or have any questions. performance5.js ...
true
2d326457cc4bdb6663617d1abd96aeb8f2a00b21
JavaScript
davidrenz60/launch_school_front_end_course
/javascript_programming/list_proc_functional_abstractions/classRecords.js
UTF-8
6,379
4.28125
4
[]
no_license
// Exercise: Class Records Summary // // One of the things that faculty do at the end of term is to make a class record summary of students based on the weighted scores of exams and exercises. // Exams and Exercises // // The grading areas are exams and exercises, with the following weight: // // Grading Area Weight /...
true
cb10576f2701bb8cae4903c2d6d278e7b564a040
JavaScript
Rekhajambhulkar/EmployeeManagementFrontEnd
/js/Employee.js
UTF-8
1,166
2.765625
3
[]
no_license
save = (event) => { console.log("added"); let empObj = { "firstname": document.getElementById("firstname").value, "lastname": document.getElementById("lastname").value, "emailId": document.getElementById("emailId").value, "phoneNumber": document.getElementById("phoneNumber").valu...
true
0a55f9d461aa5afbf6e3d4ba32159ad260b9e133
JavaScript
NeVeX/slack-polls
/polls-service.js
UTF-8
8,381
2.703125
3
[]
no_license
var fs = require('fs'); var answerStatistics = {}; var allPlayerAnswers = {}; var questions = null; var currentQuestionInUse = null; // Not in play at the start var isQuizPaused = false; var isQuizStopped = true; loadQuestionsFromFile('config/test.json'); // for testing function loadQuestionsFromFile(fileName) { ...
true
6c1f441c2ec606682add9818c659bd29f0c970d4
JavaScript
acornomedia/acornomedia.github.io
/js/three/particles.js
UTF-8
4,068
2.5625
3
[]
no_license
var container; var camera, scene, projector, renderer; var PI2 = Math.PI * 2; var programFill = function ( context ) { context.beginPath(); context.arc( 0, 0, 1, 0, PI2, true ); context.closePath(); context.fill(); } var programStroke = function ( context ) { context.lineWidth ...
true
6f6abb076ebcda2bd2b2c0c0eaea2b99ef654395
JavaScript
dwhr-pi/CoinTicker-4
/index.js
UTF-8
2,447
2.75
3
[ "MIT" ]
permissive
'use strict'; // adds debug features like hotkeys for triggering dev tools and reload require('electron-debug')(); var unirest = require('unirest'); const {app, Tray, Menu, BrowserWindow, dialog} = require('electron'); const path = require('path'); const assetsDirectory = path.join(__dirname, 'assets'); var priceSour...
true
13bfba904e9dd26f278eff43eff18b7fc14e64e9
JavaScript
MaximoJunior/quote-machine
/src/components/Wrapper.js
UTF-8
2,264
2.890625
3
[]
no_license
import React, { Component } from "react"; import "../styles/wrapper.css"; const colors = ['#16a085', '#27ae60', '#2c3e50', '#f39c12', '#e74c3c', '#9b59b6', '#FB6964', '#342224', "#472E32", "#BDBB99", "#77B1A9", "#73A857"]; class Wrapper extends Component { constructor(props){ super(props); this.s...
true
2d6f8b24418e9593d4dc2e97244fd483dd9a4b4c
JavaScript
aniballajoat/codigo-frontend-grupo-7
/semana4/dia2/tarea/scrip.js
UTF-8
967
3.421875
3
[]
no_license
let seleccionar = document.querySelector("select"); let parrafo = document.querySelector('p'); let titulo = document.querySelector("h1"); seleccionar.addEventListener('change', establecerCancion); function establecerCancion(){ let eleccion = seleccionar.value; console.log(eleccion); if(eleccion === "canc...
true
d20ce258ead7b13a0be2cd78944afefa63247370
JavaScript
mknicos/NSS-Cohort-IV-Drills
/2014-01-22-Select.Generator/app/js/source/main.js
UTF-8
369
2.6875
3
[]
no_license
(function(){ 'use strict'; $(document).ready(init); function init(){ $('#addOption').click(addToList); } function addToList(){ var i = $('option').length; var input = $('#colorInput').val(); var $opt = $('<option>').text(input).val(i); $('#selector').append($opt); $('#colorInput').v...
true
0196b4a96ed944aee40508839f61125c256d6099
JavaScript
dskrzyns/terminarz
/js/app.js
UTF-8
390
2.578125
3
[]
no_license
$(document).ready(function() { $board = $('#myBoard'); $('.menuLoader').on('click', function(e) { var filename = $(this).data('file'); $.get( getRealFilename(filename), function(data) { $board.html(data); } ); return false; }); }); function getRe...
true
0004c1ce341d62b2f609a76f539b12afdd67faea
JavaScript
mcgowan/Raw
/js/controllers/formatter.js
UTF-8
1,630
2.640625
3
[]
no_license
function FormatterCtrl($scope) { $scope.recipes = []; $scope.getCategoryName = function (category) { switch (category) { case 1: return "Salads" case 2: return "Shakes" case 3: return "Soups" case 4: return "Dressings" ...
true
3691bb3be43c2fd76deeb6efec4518ddf7accb0d
JavaScript
princekumar21/wcat
/script.js
UTF-8
1,790
3.140625
3
[]
no_license
#!/usr/bin/env node const fs = require("fs"); //let data = fs.readFileSync("abc.txt", "utf-8"); //console.log(data); //fs.writeFileSync("def.txt", "How are you"); //let proceesData = process.argv; //fs.writeFileSync("jkl.txt", "Is Everything good"); //fs.appendFileSync("jkl.txt", "\nYou are in jkl file"); //let fi...
true
933576cf85ba652ecbd6d7ae52bed6e3c804d5b4
JavaScript
alvinjtang/merge-sort
/mergesort.js
UTF-8
797
4.0625
4
[]
no_license
// O(n) function split (wholeArray) { const firstHalf = wholeArray.slice(0,wholeArray.length/2); const secondHalf = wholeArray.slice(wholeArray.length/2); return [firstHalf, secondHalf]; } // O(log(n)) function merge (arr1, arr2) { let result = []; let leftHead = 0; let rightHead = 0; while (leftHead < ...
true
a3f8f926464cba1781335abf6fe8de7a2b200e42
JavaScript
beerfekt/AngularJS
/synchronisation/js/databinding.js
UTF-8
411
2.65625
3
[]
no_license
//Two Way Databinding means: // Model and View are always in sync //here: §scope.message variable //Großes Beispiel: var angestellter = { vorname : 'hans', nachname: 'wurst' }; var meineApp = angular.module('meineApp', []) .controller('meinController', function($scope){ $sco...
true
11f01de33df0001c837719ed6cd7d318102c90ef
JavaScript
RonnyU/business-hunt
/validation/validateCreateBusiness.js
UTF-8
536
2.765625
3
[]
no_license
export default function validateCreateBusiness(values) { let errors = {}; if (!values.name) { errors.name = 'The Name is required'; } else if (!values.company) { errors.company = 'The name of the company is required'; } else if (!values.url) { errors.url = 'The URL of the company is required'; } ...
true
a0626318b3f4d6ae1c7cf35cc1b1f2dee18d4f1b
JavaScript
julieseodev/Prep
/Test/test1.js
UTF-8
1,135
4.21875
4
[]
no_license
// #1 // input: a string ex) 'software' // output: return the length of the input string // input: anything // data types: string, array, tree, .... function stringLength(word) { return word.length; } // #2 // input: 'software', 4 // output: 't' function getChar(str, i) { return str[i]; } // #3 // input:...
true
da11401b2bb2d4be2a9839ea4c57e5953663ea76
JavaScript
thread-speaker/coyl
/src/random.js
UTF-8
601
3.5
4
[]
no_license
// seed is initialized with Math.random, but all other pseudo-random numbers // will be generated via the seed. var seed = Math.random(); function random() { // https://stackoverflow.com/questions/521295/seeding-the-random-number-generator-in-javascript // Slower than Math.random() but allows the use of a seed /...
true
931cbe30c63886f6fe465aeaeef52ae583a3a101
JavaScript
gianca243/appMEAN
/backend/routes/tablero.js
UTF-8
2,598
2.578125
3
[]
no_license
//modulos de node const express = require("express") const router = express.Router() // const Tablero = require("../model/tablero") const {Usuario} = require("../model/usuario") const auth = require("../middleware/auth") const { Mongoose } = require("mongoose") const cargarArchivo = require("../middleware/file") route...
true
9798b21ffc284c4b3fb2113a883a086aa7940964
JavaScript
jdlawrence/thatonepercent
/thatone.js
UTF-8
4,335
2.640625
3
[]
no_license
var starting = 10000; var ending = 110; var timePeriod = 15; var rate = 10.0; var numBuckets = 20; var padding = 20; // Calculate interest with given parameters // ending = Number(starting * Math.pow(1 + rate / 100, timePeriod)).toFixed(2); var app = angular.module('thatone', []); app.controller('inputCtrl', ['$scop...
true
e676dc7d4258239e9e5d47d613e616bb2b7c48e6
JavaScript
JohnLanni619/videogame-website
/src/Components/Pages/GameDetail.js
UTF-8
1,364
2.640625
3
[]
no_license
import React, { useEffect, useState } from "react"; import { useParams } from "react-router"; const BASE_URL = "https://rawg-video-games-database.p.rapidapi.com/games/" const API_KEY = process.env.REACT_APP_GAME_API export function GameDetail() { const { id } = useParams() const [game, setGame] = useState({}...
true
1f4b0e0f37ffe09ad85cc02e794591203142c36c
JavaScript
kartaphilos/sandpit
/node_tutorials/learnyounode/filteredls.js
UTF-8
330
2.765625
3
[]
no_license
var fs = require('fs'); var path = require('path'); file = process.argv[2]; ext = process.argv[3]; var lines = fs.readdir(file, function (err, list) { if (err) { console.log("error on directory read"); } else { for (i = 0; i<list.length; i++) { if (path.extname(list[i]) === '.' + ext) console.log(list[i]); }...
true
67765aa47299937cd1e5c6832c35cb43f4212898
JavaScript
MarKus-del/Learning-Javascript
/02-Arrays/04-filter.js
UTF-8
189
4.1875
4
[]
no_license
// Filter = filtrar o array const numeros = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; const numerosPares = numeros.filter(el => el % 2 === 0 ); console.table(numeros); console.table(numerosPares);
true
5cfc2e857ed545756771ca05b83d59e06321dc4c
JavaScript
exumity/amazon-api-gateway-querystring
/index.js
UTF-8
1,150
2.953125
3
[]
no_license
function recursivelyCheckIfArray (parentObj) { if (Object.prototype.toString.call(parentObj) != '[object Object]') return parentObj; Object.keys(parentObj).map((parentKey) => { var childObj = parentObj[parentKey]; if (Object.prototype.toString.call(childObj) != '[object Object]') return; var keys = O...
true
6ff769c492d0bc3990d168cdc60e4909a60c44a0
JavaScript
kajalagarwal20/covid19update
/map.js
UTF-8
544
2.765625
3
[]
no_license
function updateMap() { fetch("coronadata.json") .then(response => response.json()) .then(rsp => { console.log(rsp.areas) rsp.areas.forEach(element => { lat = element.lat; long= element.long; //Mark on the map ...
true
5d15faed1e91578317558efdbb52256991efb67b
JavaScript
Amicus/end-dash
/test/deprecated/enumerables.js
UTF-8
866
2.625
3
[ "MIT" ]
permissive
require('../support/helper'); var expect = require("expect.js"), fs = require("fs"), generateTemplate = require("../support/generate_template"); describe("An enumerable template", function() { it("should set all the values in the html", function () { var model = { people: [{name: "Zach"}, {name: "Dog"}...
true
6476232d8a51cdb734c064396ed72284adb328b8
JavaScript
Iftimcho/JavaScript-Akademija
/JavaScript/Cas08-RecapSanja/vezba2.js
UTF-8
1,137
3.328125
3
[]
no_license
const players = [ {ime: 'Kobe', prezime: 'Bryant', age:40, height: 200}, {ime: 'Michael', prezime: 'Jordan', age:50, height: 203}, {ime: 'Chris', prezime: 'Paul', age:34, height: 185}, {ime: 'Nate', prezime: 'Robinson', age:35, height: 170}, {ime: 'Shaquille', prezime: 'ONeal', age:46, height: 220},...
true
34ac971144c118eaa1924a43cedf72fca7971f7c
JavaScript
spk2dc/GeneralAssembly_Archive
/1_front_end_development/w03d02/student_labs/dom/app.js
UTF-8
266
2.5625
3
[]
no_license
document.querySelector('h1').innerText = 'Welcome to GA'; let eggos = document.createElement('img') document.querySelector('.container').appendChild(eggos); eggos.setAttribute('src', 'https://i.ytimg.com/vi/TgSmPqMGk2g/maxresdefault.jpg'); eggos.style.width = '50%'
true
24f4c2b5cc4f2f3e27c463d74e868eb9f9ab4f2b
JavaScript
FendiJatmiko/drone-PR
/resources/assets/test/commands/waitToClick.js
UTF-8
340
2.921875
3
[ "MIT" ]
permissive
/** * Combine `waitForElementPresent` and `click` in a single command. * Sugar for the common use case where you want to make sure view is fully loaded before you click. * * @param {string} selector * @returns {exports} */ exports.command = function (selector) { return this.waitForElementVisible(selector) ....
true
d2521f89892f11c58de8d0ca7bc80ecc7b9f79b7
JavaScript
LiuZhi104/es6-basic-collection-practice-2019-7-10-8-20-8-102
/main/section-2/practice-1.js
UTF-8
187
2.53125
3
[]
no_license
'use strict'; module.exports = function countSameElements(collection) { return [...new Set(collection)].map(item=>{return {key:item,count:(collection.filter(i=>i==item).length)}}); }
true
eaf8900f959eadb89c282e59ef11ece93780c859
JavaScript
brainmentorspvtltd/Angular
/Code2/example3/js/controller.js
UTF-8
2,482
3.1875
3
[]
no_license
window.addEventListener("load",bindEvents); function bindEvents(){ document.querySelector("#add").addEventListener("click",doAdd); document.querySelector("#delete").addEventListener("click",deleteItem); } function deleteItem(){ ItemOperations.delete(); printItemTable(); updateCount(); } function doA...
true
37a8eaf6a142dd3fc7d2cc9410f120ae5d1a0ba3
JavaScript
nishant8509/CoForce-COVID19-Resource-Dashboard
/ussd-app/server.js
UTF-8
2,673
2.53125
3
[]
no_license
//require modules var Pusher = require('pusher') var credentials = require('./cred') var africastalking = require('africastalking')(credentials.AT) var cors = require('cors') var bodyParser = require('body-parser') // var Webtask = require('webtask-tools') //configure modules var express = require('express') var app =...
true
a681a0989192461c0fac9b8aeff0fd31674c73d5
JavaScript
daleighan/simplelib
/src/createTemplate.js
UTF-8
1,037
3.125
3
[]
no_license
const createTemplate = string => { string = string.trim().replace(/\s\s+/g, ' '); let sections = []; let insideExp = false; let isExp = false; let isHTML = false; let currentSection = ''; for (let i = 0; i < string.length; i++) { if (string[i] === '{' && string[i + 2] === '{') { if (string[i + 1...
true
88260cc6a2f8bc45599c8783e1fbd140bbb49513
JavaScript
theepicsnail/Draft
/global.js
UTF-8
956
2.90625
3
[]
no_license
//Global stuff, put in another file? function setXY(e){ if (e.targetTouches){ draft.x = e.targetTouches[0].pageX; draft.y = e.targetTouches[0].pageY; } else { draft.x = e.pageX; draft.y = e.pageY; } } function dist(p1, p2){ var dx = p1.x - p2.x; var dy = p1.y - p2.y; ...
true
2ab3cf24fe74181a2d2f03698eecf7231a4f0ec7
JavaScript
sea-ice/nodejs-code
/domain/index.js
UTF-8
1,553
3.609375
4
[]
no_license
const domain = require('domain') const EventEmitter = require('events').EventEmitter // Example 1,创建出来的domain对象会捕获next函数中抛出的异步异常 // process.domain的值在domain对象执行的next函数中不为空,而在函数外部值为空 // function next() { // console.log(process.domain) // setTimeout(() => { // throw new Error("error in timer"); // }, 100) // } ...
true