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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1c97f92fd7f19122569ac671c0c474f5581eb918 | JavaScript | hash004/EloquentJavascript | /chapter_3/beanCount.js | UTF-8 | 340 | 3.59375 | 4 | [] | no_license | function countBs(word){
count = 0;
for(var i=0;i<word.length;i++){
if(word.charAt(i)==="B"){
count++;
}
}
return count;
}
function countChar(word, key){
count = 0;
for(var i=0;i<word.length;i++){
if(word.charAt(i)===key){
count++;
}
}
... | true |
a8f0d496e6fb20a9337cc134e4509782a8708693 | JavaScript | AhmedHalabyah/-W01D05_-Scopes | /main.js | UTF-8 | 4,542 | 4.15625 | 4 | [] | no_license | console.log(arrowTitle)
/* START CODE UNDER THIS LINE */
// qestion_1
// make sure that the variable is in the global scope
let myFavoriteFood = 'borger';
const favoriteFood = function () {
return myFavoriteFood;
// TODO: Your code here
};
// => the value of `myFavoriteFood` variable
/... | true |
f9b256b8d55cfe8de20dad3110612d190f2e23fe | JavaScript | CTillmon1/1stNode | /app.js | UTF-8 | 960 | 3.78125 | 4 | [] | no_license | const https = require('https');
//Problem: We need a simple way to look at a user's badge count and Javascript points.
//Solution: Use node js to connect to Treehouses API to get information to print out.
function printMessage(userName, badgeCount, points) {
const message = `${userName} has ${badgeCount} total badge... | true |
dbf00632913c7f7b9c3072e085b5e0c2de71f864 | JavaScript | zhaomenghuan/learn-android | /example/LearnJ2V8/app/src/main/assets/www/index.js | UTF-8 | 167 | 2.59375 | 3 | [] | no_license | var hello = 'hello, ';
var world = 'world!';
console.log('result: '+ hello.concat(world).length);
//var personInfo = {
// name: 'zhaomenghuan',
// age: '24'
//} | true |
4780fd6a3e34b24648a21e49962baddbf8b0b37d | JavaScript | dbbudd/JavaScript-Experiments | /Canvas OO/Game/collisions.js | UTF-8 | 2,980 | 3.375 | 3 | [] | no_license | var context = document.getElementById('canvas').getContext('2d');
canvas.width = 800;
canvas.height = 600;
//declare a method to extend the class
Number.prototype.clamp = function(min, max) {
return Math.min(Math.max(this, min), max);
};
//create a sprite class
function Sprite(x, y, width, height, speed, ... | true |
54fd88921c20905778e987d155baac9063057d7e | JavaScript | Techworker/sbx | /packages/crypto/src/Encryption/Pascal/ECIES/Data.js | UTF-8 | 1,537 | 2.703125 | 3 | [
"MIT"
] | permissive | /**
* Copyright (c) Benjamin Ansbach - all rights reserved.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
'use strict';
const P_PUBLIC_KEY = Symbol('pubkey');
const P_MAC = Symbol('mac');
const P_ORIGINAL_DATA_LENGTH = Symbol('o... | true |
e8c774778199563bdcdf745b0269710cefe176f9 | JavaScript | tBoccinfuso/avariavs-api | /index.js | UTF-8 | 2,036 | 2.75 | 3 | [] | no_license | const express = require('express');
const app = express();
const fs = require("fs");
const bodyParser = require('body-parser')
app.use( bodyParser.json() ); // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true
}));
app.get('/', functi... | true |
6fe4d613022a660a3ebe75168ab8708754e45858 | JavaScript | timvanelst/JavaScriptUnitTesting | /ngSite/app/sample-code/sampleUsingCustomAndNgService.js | UTF-8 | 557 | 2.578125 | 3 | [] | no_license | (function () {
'use strict';
var controllerId = 'sampleControllerWithNgService';
angular.module('sampleServices', []).controller(controllerId,
['$rootScope', 'utilSvc', sample]);
function sample($rootScope, utilSvc) {
var useOfUtil = utilSvc;
$rootScope.title = 'Test Titel';
... | true |
7a9d70475027c7926e9d1c627c10015ab6dc679e | JavaScript | soundparticle/high-scores | /high-scores.js | UTF-8 | 1,048 | 2.8125 | 3 | [] | no_license | /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
class HighScores {
constructor(input) {
let highestInput = 0;
const personalBest = [];
let lastInput = 0;
let highestDiff = 0;
this.scores = personalBest;
this.input = input;
this.latest = input[input.length - 1];
... | true |
d75019da1b820bf40f0ced9a18ecd4b552722581 | JavaScript | elxor/jetum-wallet-offline | /src/redux/actions/tokens.js | UTF-8 | 748 | 2.5625 | 3 | [
"MIT"
] | permissive | import { ADD_TOKEN, REMOVE_TOKEN } from './actionTypes';
export function addToken(contractAddress, decimals, symbol) {
return dispatch => {
const value = {
symbol: symbol,
balance: '',
decimals: decimals,
contract: contractAddress
}
d... | true |
389eb3f0b0f893148689963ff416f2dab9baabca | JavaScript | gbsfDeveloper/attack-game | /src/game/Player.js | UTF-8 | 9,221 | 2.53125 | 3 | [] | no_license | import Phaser from '../lib/phaser.js'
import Bullet from '../game/Bullet.js'
import Weapon from '../game/Weapon.js'
/** @enum {string} */
const Directions = {
UP:"UP",
DOWN:"DOWN",
LEFT:"LEFT",
RIGHT:"RIGHT",
}
class Player extends Phaser.Physics.Arcade.Sprite
{
constructor(scene, x, y, texture, ... | true |
b053c13f7fd6e1ef777e3dfaa89eaa7f0e443c86 | JavaScript | ehopperdietzel/JuegoGrafica | /src/js/game/game.js | UTF-8 | 4,287 | 2.640625 | 3 | [] | no_license | /**************************************
**
** Austral Tournament - 2020
** Autor: Eduardo Hopperdietzel
** Archivo: game.js
**
** Descripción: Sección encargada de generar,
** controlar y actualizar todos los aspectos de una partida.
** El loop principal se encuentra en esta sección.
**
**********************... | true |
7a2d14f52aa7b134c0e82bed5384b7669cec9c9f | JavaScript | anselm/noodlingwithcesium | /threejs_cesium/flatmaps3js.js | UTF-8 | 10,374 | 3.09375 | 3 | [] | no_license |
/*
var FlatLandBing = {
// a copy of the code from https://msdn.microsoft.com/en-us/library/bb259689.aspx
// https://en.wikipedia.org/wiki/Geographic_coordinate_system
EarthRadius:6378137,
MinLatitude:85.05112878,
MaxLatitude:85.05112878,
MinLongitude:-180,
MaxLongitude:180,
Clip: function(n,minValue,m... | true |
3bb95b182268b11d2dc0d7242ec8829b1b1c7eb0 | JavaScript | xreignmanx/MongoScrape | /server.js | UTF-8 | 5,023 | 2.75 | 3 | [] | no_license |
// Dependencies - Express/Hanlebars
var express = require('express');
var exphbs = require('express-handlebars');
var mongoose = require("mongoose");
var bodyParser = require("body-parser")
var axios = require("axios");
var cheerio = require("cheerio");
var db = require("./models");
var PORT = process.env.PORT || ... | true |
20f8b28031634208eca995aae6b74ee58a893358 | JavaScript | brentatkins/tracktimes | /server/fileProcessor.js | UTF-8 | 2,710 | 2.71875 | 3 | [] | no_license | const R = require("ramda");
const { lines } = require("transduce/string");
const stream = require("transduce-stream");
const fs = require("fs");
const buildLineArray = R.pipe(
R.split(" "),
R.map(R.trim),
R.filter(R.complement(R.not))
);
const mapToRaceTime = data => ({
overallPosition: data[0],
time: data... | true |
1d56c15a0b77b8bff89c3332c506e6f917b746b1 | JavaScript | krolb/simple-game | /script.js | UTF-8 | 6,172 | 2.671875 | 3 | [] | no_license | var game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.CANVAS,'', { preload: preload, create: create, update: update });
function preload() {
//ładowanie zasobów
game.load.image('sky', 'assets/sky.png');
game.load.image('ground', 'assets/platform.png');
game.load.spritesheet('dude', 'assets/dude.pn... | true |
7c3d810bc64ab193bb51b305ffb46aeb4dbbeeb0 | JavaScript | iamrdsharma/TutorialsPointExamples | /openFile.js | UTF-8 | 568 | 3.046875 | 3 | [] | no_license | const fs = require("fs");
//Opening 'input.txt' in read and write mode
console.log("Started to open the file");
fs.open("input.txt", "r+", (err, fd) => {
if (err) console.log(err);
console.log("File opened successfully");
});
//Getting stats of the 'input.txt' file
console.log("Getting the info of the fil... | true |
fdc27c060bb70f169a33f86c322498e155831851 | JavaScript | amiclot/liri-bot | /liri.js | UTF-8 | 4,312 | 2.734375 | 3 | [] | no_license |
var keys = require("./keys.js");
var Twitter = require('twitter');
var Spotify = require('node-spotify-api');
var request = require('request');
var fs = require("fs");
var action = process.argv[2];
var value = process.argv[3];
var errorSong = "The Sign";
var errorMovie = "Mr. Nobody";
var client = new Twitter(keys... | true |
ddb2fb0dfd0994d57fc2d82f3b976e1ca1edd751 | JavaScript | adnenamdouni/Moyenne-VueJS | /moy2.js | UTF-8 | 561 | 3.203125 | 3 | [] | no_license | var total = 0;
var vm = new Vue({
el: "#app",
data: {
note: 0,
tableau: [
{ entree: 0 }
],
},
methods: {
stockernote() {
this.tableau.push({
entree: this.note
});
},
totalnote() {
this.tableau.forEach(elem => {
total += + elem.entree
})
... | true |
9f36c4d726c030c269fd7b0a45da3825b58d20ce | JavaScript | UD-UD/leetcode-patterns | /7_BFS/116_populating-next-right-pointers-in-each-node.js | UTF-8 | 4,310 | 3.5625 | 4 | [
"MIT"
] | permissive | const { buildTreeBFS, TreeNode } = require('../_utils');
/**
*
* Problem:
* Given a binary tree, connect each node with its level order successor. The last
* node of each level should point to a null node.
* https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/
*
*
* Time: O(n)
* Space... | true |
ae0bb1f2db761af3cb2fcbedaf6f5fd70da40e53 | JavaScript | Rootjang92/TIL | /javaScript/es6/valuable.js | UTF-8 | 335 | 3.546875 | 4 | [
"MIT"
] | permissive | let foo = 123;
{
let foo = 456;
let bar = 456;
}
console.log(foo); // 123
// console.log(bar); // reference error
var func = [];
for (let i = 0; i < 3; i++) {
func.push(function () { console.log(i); });
}
for (var j = 0; j < 3; j++) {
console.dir(func[j]);
func[j]();
}
// const MAXROWS = 10;
// if (rows >... | true |
a26dcbe696344c9ec26a6ee187e69bba5110e597 | JavaScript | ph1074384349/chat | /Public/biaoqing/sendTalks.js | UTF-8 | 981 | 2.640625 | 3 | [] | no_license | //查看结果
function replace_em(str){
str = str.replace(/\</g,'<');
str = str.replace(/\>/g,'>');
str = str.replace(/\n/g,'<br/>');
str = str.replace(/\[em_([0-9]*)\]/g,'<img src="face/$1.gif" border="0" />');
return str;
}
$(".photo").click(function(){
$(".imgbox").toggle();
});
$('.myfile').... | true |
02fa30aff6592c86b50052a644c2321986706434 | JavaScript | gopinathsjsu/team-project-techietribe | /public/js/recurringTransfer.js | UTF-8 | 2,745 | 2.609375 | 3 | [] | no_license | $(document).ready(function () {
getAccounts();
});
function getAccounts() {
$.ajaxSetup({
headers: {
"access-token": window.localStorage.getItem("access-token"),
},
});
$.get("/viewAccount/")
.done(function (data) {
console.log(data);
if (!da... | true |
5c5f43e95726578826a0afffef274a27cc71f142 | JavaScript | gobackk1/testrunner | /js/main.js | UTF-8 | 752 | 3.25 | 3 | [] | no_license | function isPast(date) {
if (!(date instanceof Date)||isNaN(date.getTime())) {
throw Error('引数がDate型ではありません');
return;
}
var now = Date.now();
return date.getTime() < now;
}
//期限と完了状態からステータスを文字列で返す
//@param due 期限
//@param closed 完了状態
function getStatus(due, closed) {
if (closed) {
r... | true |
c3663054ed67a5f6185a761bf33dc8435f122261 | JavaScript | YuShato/1474119-keksobooking-21 | /js/data.js | UTF-8 | 3,798 | 2.96875 | 3 | [] | no_license | 'use strict';
const card = document.querySelector(`#card`).content.querySelector(`.map__card`);
const popupPhoto = card.querySelector(`.popup__photo`);
const popupPhotosContainer = card.querySelector(`.popup__photos`);
const featuresContainer = card.querySelector(`.popup__features`);
const popupTitle = card.querySelec... | true |
e8ebcb0cc001884f952db3c7aa631013afe9f3a5 | JavaScript | artsmia/art | /fetch.js | UTF-8 | 1,381 | 2.5625 | 3 | [] | no_license | require('babel-polyfill')
var resolveHash = require('when/keys').all
function fetchComponentData(state, initialData) {
var promises = state.routes.filter((route, index, allRoutes) => {
// Don't `fetchData` twice for nested routes with the same `Handler`
// Prefer the parent
const prevRoute = index > 0 &&... | true |
2da6d21b9e4b1a4d7cc0c87f3aa2f088607587fa | JavaScript | kodiri/fit-your-goal | /src/logic/getIntensity.js | UTF-8 | 409 | 2.859375 | 3 | [] | no_license | import { filterIntensityByAge } from "./filterIntensityByAge";
import { filterIntensityByActivityLevel } from "./filterIntensityByActivityLevel";
export function getIntensity(age, activityLevel) {
let intensities = ['low', 'medium', 'high'];
intensities = filterIntensityByAge(intensities, age);
intensities... | true |
6ba87d5b791de80236bc8df9b094fc3299278907 | JavaScript | kopenhamn/study | /byTheme/NodeJS/helloapp/app.js | UTF-8 | 624 | 2.578125 | 3 | [] | no_license | const http = require('http');
const users = {
admin: 'admin',
test: 'test'
}
http.createServer(function(request,response) {
// response.setHeader("Content-Type", 'Access-Control-Allow-Headers', "text/html; charset=utf-8;");
response.writeHead(200, {
'Access-Control-Allow-Origin' : '*',
... | true |
8bf89529f2c5e021cc0916d435a93a87e8e011a4 | JavaScript | jetBBlack/quiz-app | /assets/js/handle.js | UTF-8 | 6,940 | 2.734375 | 3 | [] | no_license | const start_btn = document.querySelector(".start_btn button");
const info_box = document.querySelector(".info_box");
const exit_btn = info_box.querySelector(".buttons .quit");
const continue_btn = info_box.querySelector(".buttons .restart");
const quiz_box = document.querySelector(".quiz_box");
const option_list = doc... | true |
238bf82c05e22b1ac9b09f828badfae89d868879 | JavaScript | Stefan-Musteata/voyage | /js/main.js | UTF-8 | 3,671 | 3.078125 | 3 | [] | no_license | //Slider
var $slider = $('.slider');
var $slideBox = $slider.find('.slide-box');
var $leftControl = $slider.find('.slide-left');
var $rightControl = $slider.find('.slide-right');
var $slides = $slider.find('.slide');
var numItems = $slider.find('.slide').length;
var position = 0;
var windowWidth = $... | true |
49e6faf5c3a845785d30266348ce89b69b9cbaa1 | JavaScript | XiaYucca/- | /小奥新版/command/js/common_20161207.js | UTF-8 | 1,530 | 2.515625 | 3 | [] | no_license | $(function(){
function getIcon (div){
var $toolbox = $("#toolbox");
var $category = $toolbox.find("category");
var $obj1 = {},$obj2 = {},$obj3 = {};
for ( var i = 0 ; i < $category.length ; i++ ) {
var $name = $category[i].getAttribute("name");
var $i... | true |
627eb65816e08d4057afaab88deaded57648e071 | JavaScript | mike7silva/GOOGLE | /assets/javascript/scripts.js | UTF-8 | 424 | 2.5625 | 3 | [
"MIT"
] | permissive | function searchinit (form) {
var browser = document.getElementById("browser").value;
location.assign("https://www.google.com.mx/search?q="+browser);
document.getElementById("browser").value="";
}
document.querySelector('#browser').addEventListener('keypress', function keyupText(e) {
var key = e.which || e.keyCo... | true |
9f3d1371e8b18bc30b325e300ba4846db65fc97b | JavaScript | CharlesFricaud/projet_js | /projet_js-master/scripts/model.js | UTF-8 | 1,769 | 2.671875 | 3 | [] | no_license | var model = {};
model.recherche_courante = "";
model.recherches = [];
model.recherche_courante_news = [];
model.indexOfResultat = function (t, o){
try {
var limit = t.length;
} catch (e) {
var limit = 0;
}
var trouve = false;
var i = 0;
while( (!trouve) && (i<limit) ){
var c = t[i];
if ((c.titre ==... | true |
cd2881d75378795f5c4f465b09162305c1cc5d3e | JavaScript | agolebiewska/nodewpg | /js/index119.js | UTF-8 | 299 | 4.375 | 4 | [] | no_license |
const data = [42, true, function() {return 'The meaning of life is: '}];
if (data[1] == true) {
console.log(`${data[2]()} ${data[0]}`);
}
// If the second item from data is true then show the following output using the first and last items from the data array:
// The meaning of life is: 42 | true |
ff57889b040d462991152f4dd6f3cf4a5a74a4e6 | JavaScript | shay-23/javascript_progres | /level-1.js | UTF-8 | 1,049 | 3.984375 | 4 | [] | no_license | //Question 1
const cat = {
complain: "",
bark: function() {
console.log("Meow!");
}
}
cat.bark();
//Meow!
//Question 2
console.log(document.querySelector("h3"));
const heading = document.querySelector("h3");
console.log(heading);
//Question 3
heading.style.fontSize = "2em";
//Question 4
heading.... | true |
6f299d887037915b174f22417b6eb9dde17d6796 | JavaScript | IdarV/kibana-searchbar-fix-chrome-extention | /kibanasearchfix.js | UTF-8 | 600 | 2.84375 | 3 | [] | no_license | function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function kibanaSearchFix() {
let i = 0;
while (!document.getElementsByClassName("typeahead-items")[0] && i < 30) {
await sleep(1000);
i++;
console.log('waiting for search bar to be present ... | true |
20a498f90139f0a3551890632b1c0840498cbc04 | JavaScript | laith206/Bookmarker | /js/first.js | UTF-8 | 2,814 | 3.203125 | 3 | [] | no_license | var productNameIput = document.getElementById('productNameInpyt');
var producturl = document.getElementById('producturlInput');
var alerttttInput = document.getElementById("alertttt");
if (localStorage.getItem('ourbroduct') == null) {
productlist = [];
} else {
productlist = JSON.parse(localStorage.getItem(... | true |
c5c50faf7603fd1b95cee5801d1eeb29bb3a8f54 | JavaScript | michelle-ha/LazyPanda | /frontend/reducers/likes_reducer.js | UTF-8 | 923 | 2.515625 | 3 | [] | no_license | import { RECEIVE_LIKE, REMOVE_LIKE } from "../actions/like_actions";
import { RECEIVE_POST, RECEIVE_POSTS } from "../actions/post_actions";
import {RECEIVE_SUBPOST} from "../actions/subpost_actions"
const LikesReducer = (oldState = {}, action) => {
Object.freeze(oldState);
let nextState = Object.assign({}, ol... | true |
d0f1bf8b8871fdbb32d888a8d21c9cbc0265a3e0 | JavaScript | Lightnet/nexthypercoreauth | /pages/api/database.js | UTF-8 | 1,767 | 2.53125 | 3 | [] | no_license |
// notes:
// https://hypercore-protocol.org/guides/walkthroughs/p2p-indexing-with-hyperbee/
// A sub-database will append a prefix to every key it inserts.
// This prefix ensure that the sub acts as a separate "namespace" inside the parent db.
//const sub1 = db.sub('sub1')
//const sub2 = db.sub('sub2')
//await sub1.... | true |
062699c79536040e93f1c5eeffc2e38c8a68cc78 | JavaScript | silence717/Build-Your-Own-AngularJs-es2015 | /src/Expressions/lexer.js | UTF-8 | 5,765 | 3.40625 | 3 | [
"MIT"
] | permissive | /**
* @author https://github.com/silence717
* @date on 2017/1/17
* @desc [Lexer 获取最原始的字符串表达式,并返回该字符串解析的token数组]
*/
const ESCAPES = {'n': '\n', 'f': '\f', 'r': '\r', 't': '\t', 'v': '\v', '\'': '\'', '"': '"'};
const OPERATORS = {
'+': true,
'!': true,
'-': true,
'*': true,
'/': true,
'%': true,
'=': true,
... | true |
d04793f574953b6ac4578c5fe65b317847ed7cb2 | JavaScript | amusto/react-examples | /src/App.1.js | UTF-8 | 3,643 | 2.84375 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Toggle from './Toggle.js';
import LoginControl from './LoginControl.js';
import NameForm from './NameForm.js';
class Clock extends Component {
constructor(props) {
super(props);
this.state = {date: new Date()}... | true |
38dd8e46513cc7db07ffbe8cfd241446eb754da0 | JavaScript | smile2682/lotide | /without.js | UTF-8 | 1,336 | 3.796875 | 4 | [] | no_license | const eqArrays = function (arr1, arr2) {
if (arr1.length === arr2.length){
for (let i = 0; i < arr1.length; i++) {
if (arr1[i] !== arr2[i]) {
return false
}
}return true;
}return false;
}
const assertArraysEqual = function (actual, expected) {
if (eqArrays(actual,expected))
{
console.log... | true |
de4734574c96e5e228f37be3ac171e573140c007 | JavaScript | kormakurAtli-tskoli/FORR3JS05DU | /verkefni_1/lidur_2/main.js | UTF-8 | 223 | 3.046875 | 3 | [
"MIT"
] | permissive | var vorur = ["Hrísgrjón","Snakk","Mjólk","Egg","Banani"];
var string = "";
function test(){
for (var i = 0; i < vorur.length; i++){
string+=vorur[i] + "<br>";
}
document.getElementById("text").innerHTML = string;
} | true |
17bf93abc3234dfabbf63c9411642d2c8aa5022a | JavaScript | arpodol/javascript_frontend_problems | /requests/booking_app_node/public/javascripts/addSchedule.js | UTF-8 | 4,658 | 3.015625 | 3 | [] | no_license | function retrieveSchedules() {
var scheduleTally = {};
var url = "http://localhost:3000/api/schedules";
var request = new XMLHttpRequest();
request.timeout = 9000;
request.responseType = 'json';
request.open('GET', url);
request.addEventListener('load', function() {
var data = request.response;
... | true |
712508e4aab7e561d2aacb4b3748926f757e399e | JavaScript | lucasrrocha/curso-javascript | /js/main.js | UTF-8 | 3,481 | 3.796875 | 4 | [
"MIT"
] | permissive | //AJAX
// var xhr = new XMLHttpRequest();
// xhr.open('GET', 'https://api.github.com/users/lucasrrocha');
// xhr.send(null);
// xhr.onreadystatechange = function() {
// if (xhr.readyState === 4) {
// console.log(JSON.parse(xhr.responseText));
// }
// };
//PROMISES
// var minhaPromisse = function() {
// re... | true |
1f98ba28ac6c1065f7ae22c1caa18129110e24b2 | JavaScript | Hitman-lab/simon-game-mobile-start | /game.js | UTF-8 | 2,961 | 3.359375 | 3 | [] | no_license | let buttonColurs = ['red', 'blue', 'green', 'yellow'];
let gamePattern = [];
let userClickedPattern = [];
var level = 0;
let started = false;
/* --------------- For Mobile Version ----------------- */
function gameRestart() {
$('.game-start').add();
};
if ($(window).width() < 600) {
$('#level-title').text('Let... | true |
8dc9e2677c2416782528f716050f030f24cb44f4 | JavaScript | gnanadeep/Practice | /day16.js | UTF-8 | 1,138 | 4.03125 | 4 | [] | no_license | // /*************** Object destructering ************************/
// 1) var emp = {id: 1234, name: "Rajsekhar" ,address: {city: "Sydney", country: "Aus"}};
// i) Extract properties : id, name into local variables from the above object.
// ii) Write code to extract the id, name into local variables such as em... | true |
281c4879197528dc837d242a5904f821cc07ba2b | JavaScript | FHNW-SQL-Training-Game/FHNW-SQL-Training-Game-Task-2-SQL | /index.js | UTF-8 | 2,039 | 2.625 | 3 | [] | no_license | const path = require("path");
const fs = require("fs");
const utils = require("./utitilities");
// Consts
const DESCRIPTION_REGEX = /(?<=DESCRIPTION {)[^}]*(?=})/;
const TEST_REGEX = /TEST([\S\s]*?)RESULT/;
const TABLE_REGEX = /(?<=TABLE {)[^}]*(?=})/g;
const RESULT_REGEX = /(?<=RESULT {)[^}]*(?=})/;
const INPUT_ARG =... | true |
381f97367573f26475913be3be3489732550c43c | JavaScript | reactivepod/adventofcode | /03/magalhini/3.js | UTF-8 | 1,043 | 3.453125 | 3 | [] | no_license | const fs = require('fs');
const instructions = fs.readFileSync('./3.txt').toString('utf8').split('');
const checkHouseAt = ((house, year) => {
if (year.indexOf(house) === -1) year.push(house);
});
const onlyUnique = ((value, idx, self) => self.indexOf(value) === idx);
const move = ((val, grid) => {
if (val === '^'... | true |
8625406b39cad05b94ca368b37dd78c339b55b32 | JavaScript | clintandrewhall/review-waiting-list-bot | /src/Parser.js | UTF-8 | 1,108 | 2.734375 | 3 | [
"MIT"
] | permissive | 'use strict'
const _ = require('lodash')
const Condition = require('./Condition')
class Parser {
constructor(args) {
this.args = args
}
parse() {
return Condition.ACCEPTABLE_CONDITIONS.reduce((obj, key) => {
return {
...obj,
[key]: this.extract(key),
}
}, {})
}
extr... | true |
aeca2ffebb2f4b1188bd50c1da5d642941c9bc87 | JavaScript | https-crosssection-com/endo | /CrossSection-site-map/sheet-tab.js | UTF-8 | 1,357 | 3.265625 | 3 | [
"MIT"
] | permissive | var tabs = document.getElementById('tab-control').getElementsByTagName('a');
var pages = document.getElementById('tab-body').getElementsByTagName('div');
// ---------------------------
// ▼B:タブの切り替え処理
// ---------------------------
function changeTab() {
// ▼B-1. href属性値から対象のid名を抜き出す
var targetid = this.... | true |
dd95e300c2148f615295fc4b205b6f276358b358 | JavaScript | Lordjiggyx/Coding | /RESTful/MERN/client/src/Components/auth/Login.js | UTF-8 | 5,749 | 2.71875 | 3 | [] | no_license | import React, { Component } from 'react'
import {
Button,
Modal,
ModalHeader,
ModalBody,
Form,
FormGroup,
Label,
Input,
NavLink,
Alert
} from 'reactstrap';
import { connect } from 'react-redux';
//Bring in proptypes to set proptypes
import PropTypes from "prop-types"
//Bring... | true |
118bc8275a93a223e92298ed812372d774cc2b8b | JavaScript | jv-pinheiro/challenges_JS | /desafio4_Q1.js | UTF-8 | 330 | 3.9375 | 4 | [] | no_license |
var checaIdade = function(i){
return new Promise(function(maior, menor) {
setTimeout (function(){
if (i >= 18){
//sleep();
maior();
}else{
menor();
}
}, 2000);
});
}
checaIdade(53)
.then(function() {
console.log("Maior ou igual a 18.");
})
.catch(function() {
console.log("Menor que 1... | true |
e744d0758631f355ee55e9d5e236af524959a3b2 | JavaScript | PJ623/eloquent-javascript-exercises | /chapter-6/js/sequence-interface.js | UTF-8 | 1,076 | 3.796875 | 4 | [] | no_license | function ArraySeq(arr) {
this.arr = arr;
this.index = 0;
this.current = this.arr[this.index];
}
ArraySeq.prototype.next = function () {
if (this.index < this.arr.length) {
this.index++;
this.current = this.arr[this.index];
} else {
this.current = null;
}
}
function Rang... | true |
740b2d122eab92cc7e4e83c4e8419aebc7a93f95 | JavaScript | juanfdg/CCI-36-exame | /terrain.js | UTF-8 | 3,374 | 2.828125 | 3 | [] | no_license | // CHECK WEBGL VERSION
if ( WEBGL.isWebGL2Available() === false ) {
document.body.appendChild( WEBGL.getWebGL2ErrorMessage() );
}
// SETUP RENDERER & SCENE
const container = document.createElement( 'div' );
document.body.appendChild( container );
const canvas = document.createElement('canvas');
const context = ca... | true |
563e06465585faedcf51d693766821f70b9c231e | JavaScript | Camelliaguoqian/YiDeng_code | /jquery-record.js | UTF-8 | 1,849 | 4.09375 | 4 | [] | no_license | var createPerson = function(name,age){
//声明一个中间对象,该对象就是工厂模式的模子
var o = new Object();
//依次添加我们需要的属性和方法
o.name = name;
o.age = age;
o.getName = function(){
return this.name;
}
//return o;
}
//将构造函数以参数形式传入
function New(func){
//声明一个中间对象,该对象为最终返回的实例
var res = {};
if(func.prototype !== null)... | true |
e73e5db668ea43e6aab05741f5a08d7c65f5697c | JavaScript | LizTW/ericas-cupcakery | /index.js | UTF-8 | 646 | 2.84375 | 3 | [] | no_license | function cupcakeWarning() {
alert("Warning! Most Delicious Cupcakes!");
}
function tasteyCupcake() {
var popup = document.getElementById("chocolate");
popup.classList.toggle("show");
}
function tasteyCupcake2() {
var popup = document.getElementById("vanilla");
popup.classList.toggle("show");
}
function tast... | true |
ec636fb5ce608db62c8d1efce668ced344211b8e | JavaScript | dansteen/libRTMTasker | /rtmAddTask.js | UTF-8 | 874 | 2.84375 | 3 | [
"MIT"
] | permissive | // Adds a task using smartadd
// Prereqs:
// a local variable %newtask is set to a string containg the data for a new task in
// the format supported by RTM SmartAdd
// Result:
// a local variable named %newtask_id is set to the ID of the newly created task
if( typeof jQuery == 'undefined' ){
tk.flashLong... | true |
3c507ab399507bea6714fcb6c2b7040989edb927 | JavaScript | Tushar-Tilwani/stuff | /company-specific/apple/NestedIterator.js | UTF-8 | 1,725 | 4.21875 | 4 | [] | no_license | /**
* // This is the interface that allows for creating nested lists.
* // You should not implement it, or speculate about its implementation
* function NestedInteger() {
*
* Return true if this NestedInteger holds a single integer, rather than a nested list.
* @return {boolean}
* this.isInteger = fu... | true |
db7badc523e6bc92ef5a00da564a9da279d9f340 | JavaScript | ALE-MIO/Snake-2 | /docs/snake.js | UTF-8 | 2,453 | 3.453125 | 3 | [] | no_license | const canvas = document.getElementById('game');
const ctx = canvas.getContext('2d');
const ground = new Image();
ground.src = "snake-ground.png";
const food = new Image();
food.src = "food.png";
const snake_head = new Image();
snake_head.src = "snake.png";
var box = 24;
var score = 0;
var fish = {
... | true |
095a5b343433c4234ff5555df4fca0a17a292ac0 | JavaScript | WHATHELWHATHELWHATHEL/LeetCode | /1577004722764-algorithms-416-partition-equal-subset-sum.js | UTF-8 | 1,227 | 3.3125 | 3 | [
"MIT"
] | permissive | /**
* @param {number[]} nums
* @return {boolean}
*/
const createPartitionList = (paramOriginList, paramSubList) => {
let subList = [...paramSubList];
let originList = [...paramOriginList];
while(subList.length > 0) {
const firstValue = subList.shift();
const targetIndex = originList.findIndex(item => ... | true |
9105b9e566a02351a7610881ea20461414c96f07 | JavaScript | pb25193/Mead-JS | /notes-app-old/scripts/notes.js | UTF-8 | 2,703 | 2.625 | 3 | [] | no_license | // let notes = [
// {
// title: 'Blue Lights',
// body: 'Blue lights lights lights lights lights lights lights lights lights lights lights lights lights lights',
// tag: 'story'
// },
// {
// title: 'Bomb blast',
// body: 'boom boom boom boom boom boom boom boom boom ... | true |
8dab30ef4089de39fdf5f4d24c8d75487c4afe53 | JavaScript | annaKokodzei/compNuvem | /index.js | UTF-8 | 12,934 | 2.625 | 3 | [] | no_license | const express = require('express')
const app = express()
var bodyParser = require("body-parser");
const MongoClient = require('mongodb').MongoClient
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
const port = 3000
const url = "mongodb://localhost:27017"
const client = new MongoClient... | true |
642065cb7d1e2dc3bc62996137ef3bd6f10de43b | JavaScript | iDeeptiTiwari/react-todo | /src/MyComponents/AddTodo.test.js | UTF-8 | 4,128 | 2.609375 | 3 | [] | no_license | import { render, fireEvent, waitFor } from "@testing-library/react";
import AddTodo from "./AddTodo";
let todoFn;
beforeAll(() => {
todoFn = jest.fn();
});
describe("rendering tests", () => {
it("should render add to do form", () => {
const { getByRole } = render(<AddTodo addTodo={todoFn} />);
const form ... | true |
607c4ab9f9210718bf68c55ef6a2328476b709a8 | JavaScript | statox/p5-genetics | /app/Robot.js | UTF-8 | 1,528 | 3.09375 | 3 | [
"MIT"
] | permissive | function Robot(x, y, r, lifespan) {
this.initX = x;
this.initY = y;
this.pos = new p5.Vector();
this.lifespan = lifespan;
this.r = ROBOT_SIZE;
this.genes = new Genes(this.lifespan);
this.reset();
}
Robot.prototype.reset = function() {
this.pos.x = this.initX;
this.pos.y = this.init... | true |
28fadf983bf958281c8a59dd6f07f7730ba789ef | JavaScript | ranjithkumark8/sparkpeople_project-1 | /spinWheel/spin.js | UTF-8 | 6,765 | 2.625 | 3 | [] | no_license | var padding = { top: 20, right: 40, bottom: 0, left: 0 },
w = 500 - padding.left - padding.right,
h = 500 - padding.top - padding.bottom,
r = Math.min(w, h) / 2,
rotation = 0,
oldrotation = 0,
picked = 100000,
oldpick = [],
color = d3.scale.category20();
var data = [
{ "label": "p... | true |
462892597ee6e5bbd0a7644138216b19b3099731 | JavaScript | gaergdfg/Lenin-Bot | /index.js | UTF-8 | 3,498 | 2.75 | 3 | [] | no_license | // https://discordapp.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot
const Discord = require("discord.js")
const bot = new Discord.Client()
// Load all commands
bot.commands = new Discord.Collection()
const fs = require("fs")
const commandFiles = fs.readdirSync('./commands')
.filter(file => file.endsWith('.js'))
... | true |
cd02615569dc67e5a02507c50daeed7ade283f02 | JavaScript | LOVEKESHMADAAN/anonumous_discussion_system | /server/utils/message.test.js | UTF-8 | 807 | 2.71875 | 3 | [] | no_license | var expect = require('expect');
var {generateMessage,generateLocationMessage}=require('./message');
describe('generateMessage',() => {
it('should generate correct message object',() =>{
var from='Jen';
var text='Some Message';
var message=generateMessage(from,text);
console.log(message);
expect(t... | true |
dafe9009db70626077d452b47dcfaef237c9b5eb | JavaScript | nadineplank/Social-Network | /src/reducers.js | UTF-8 | 1,258 | 2.671875 | 3 | [] | no_license | export default function reducer(state = {}, action) {
if (action.type === "RECEIVE_FRIENDS") {
state = {
...state,
friends: action.friends
};
}
if (action.type == "ACCEPT_FRIEND_REQ") {
state = {
...state,
friends: state.friends.map(fri... | true |
868b6bf6544bd2fcced7b773809583c8e44e912c | JavaScript | hammeiam/table_tennis | /frontend/MatchWrapper.jsx | UTF-8 | 2,559 | 2.59375 | 3 | [] | no_license | import React, { Component, PropTypes } from 'react'
import Match from './Match'
class MatchWrapper extends Component {
constructor(props){
super(props)
this.state = {}
this.selectPlayer1 = this.selectPlayer1.bind(this)
this.selectPlayer2 = this.selectPlayer2.bind(this)
this.handleSubmit = this.ha... | true |
2b814183a15f8e6fe1b49b5db36c7db9d756c5d4 | JavaScript | spirite4059/wx_js | /public/react/js/img_down_controller.js | UTF-8 | 4,758 | 3.328125 | 3 | [] | no_license | /**
* Created by liu on 2016/8/18.
*/
//*****************************调用的例子*************************************************
//***图片数组:m0_imgs.push( {img_index:1, url:img1_url, ready:false, is_error:false, error_count:0, img:null} );
//*** 图片需要应该是从1开始,代码用该数值在取信息,不能随意放
//
// var succ... | true |
68199f50408cd8b782b98a8ac465087a9a12bbcf | JavaScript | JustDaile/Questionnaire-ReactJS | /src/helpers/shuffler.js | UTF-8 | 232 | 3.28125 | 3 | [] | no_license | // Shuffle an array
function shuffle(a) {
for (var i = a.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = a[i];
a[i] = a[j];
a[j] = temp;
}
return a;
}
export default shuffle;
| true |
7a7c3820b79774d269b783b4d012d6818a957dc4 | JavaScript | GustavAndreasson/aoc-2019 | /dag12.js | UTF-8 | 1,464 | 2.84375 | 3 | [] | no_license | //Part 1
let pos=[];
document.getElementsByTagName("pre")[0].innerText.split("\n").forEach(s=>{let e=s.match(/<x=([-0-9]+), y=([-0-9]+), z=([-0-9]+)>/);e&&pos.push([parseInt(e[1]),parseInt(e[2]),parseInt(e[3])])});
let vel = [[0,0,0],[0,0,0],[0,0,0],[0,0,0]];
let updateVel=()=>pos.forEach((p,i)=>pos.filter(p2=>p2!=... | true |
38703c8247a0e7caa2d83702ea47f8230bba4664 | JavaScript | rrdesouza/ContaNotas | /App.js | UTF-8 | 4,633 | 2.8125 | 3 | [] | no_license | /**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Image, TextInput, TouchableOpacity } from 'react-native';
type Props = {};
export default class App extends Component<Props> {
cons... | true |
65d310fb84de9a491a259eae2b0cd8beb2b7def4 | JavaScript | yuriechan/JS-algorithm-practice | /RepeatAString_8-9.js | UTF-8 | 481 | 3.609375 | 4 | [] | no_license | //function repeatStringNumTimes(str, num) {
// tmp = str;
// str = "";
// for (var i = 0; i < num; i++)
// {
// str += tmp;
// }
// return str;
//}
//
//console.log(repeatStringNumTimes("yurie", 3));
function repeatStringNumTimes(str, num) {
var tmp ... | true |
d8a65b0ccab6eebb76e031b2305e90661ad89ea1 | JavaScript | arbyte-br/Arbyte-Atividades | /turma-2/Yleus/Lista_14/E4.js | UTF-8 | 1,017 | 3.125 | 3 | [] | no_license | const rs = require('readline-sync')
const axios = require('axios')
class Usuario {
constructor(nome, cep) {
this.nome = nome
this.cep = cep
}
}
let usuario = new Usuario('Paulo', rs.question('Digite aqui seu cep: '))
buscaEndereco(usuario.cep)
function buscaEndereco(cep) {
console.log... | true |
5cf343a679e68f9f110d9e53c624d1b49652e7e6 | JavaScript | vtellier/pwa-training | /fetch-n-cache/my-service-worker.js | UTF-8 | 3,242 | 2.734375 | 3 | [] | no_license | const version = "1.1.0";
const cacheKey = "pwa-training-cache-1.1.0";
const toCache = [
"./img/punta-da-piedade.jpg",
"./hello.txt"
];
self.addEventListener('install', e => {
console.log('install event:', e);
// Here we should install all the elements we'll need to use the app offline.
e.waitUntil... | true |
f90074fa4cdacee2871077cb89be18ea85294e5d | JavaScript | RevzbyTemz/zc_plugin_deadlines | /frontend/src/api/utils/errorHandler.js | UTF-8 | 1,155 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | const errorHandler = (error) => {
switch (error) {
case error.response.status === 204:
return new Error({
message: 'No data found',
statusCode: 204,
headers: error.response.headers,
})
case error.response.status === 400:
return new Error({
message: 'Bad request due to invalid syntax',
... | true |
c2d61f6ac1d7fafdeb1f2fc011020d3dcc06dcb0 | JavaScript | ArPires/textSelectorExtension | /popup_state.js | UTF-8 | 1,249 | 2.703125 | 3 | [] | no_license | const stateObject = {
createFile: "block",
downloadFile: "hidden",
deleteFile: "hidden",
instructions: "hidden"
}
chrome.runtime.onMessage.addListener( (request, sender, sendResponse) => {
if(request.text === "getState") {
sendResponse(stateObject)
}
});
chrome.runtime.onMessage.addLis... | true |
8fa1676afc6499fb60bdca394ab30471b9791d10 | JavaScript | abhisheksv94/React-Tutorials | /Abhay Talreja tutorial/new_router/src/Submit.js | UTF-8 | 531 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
export default class Submit extends Component{
constructor(){
super();
this.state={};
this.submitRecipe=this.submitRecipe.bind(this);
}
submitRecipe(){
console.log('button clicked');
this.props.history.push(
'/'
... | true |
a2839bdd1e0710eb7cf481a8d44171b1ed8eeae1 | JavaScript | Jacksonlike/leetcode | /4.寻找两个正序数组的中位数.js | UTF-8 | 857 | 3.328125 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=4 lang=javascript
*
* [4] 寻找两个正序数组的中位数
*/
const { addListener } = require('process');
// @lc code=start
/**
* @param {number[]} nums1
* @param {number[]} nums2
* @return {number}
*/
var findMedianSortedArrays = function (nums1, nums2) {
const m = nums1.length;
const n = nums2.l... | true |
dab4a177604e9f38edcfce9ce69490733a710d39 | JavaScript | TrueCoders471/cas-project | /cas-project/src/components/loginPage/LoginPage.js | UTF-8 | 3,842 | 2.53125 | 3 | [] | no_license | import React from 'react';
import './loginPage-Styles.css';
/**
* controls Javascript behavior of The Account Creation Page
*/
class LoginPage extends React.Component {
drawLogBackground() {
return (<div id="loginBackgroundStretch" src>
<img className="background-image" src={require('./../.... | true |
e116f097dc5972df9e31b6a9e9cfd66df6b0e884 | JavaScript | aiduck/mall-servlet | /schemas/goodsSchema.js | UTF-8 | 709 | 2.515625 | 3 | [] | no_license | var mongoose = require('mongoose')
var Schema = mongoose.Schema;
//Schema: 一种以文件形式存储的数据库模型骨架,不具备数据库的操作能力
//Model: 由Schema发布生成的模型,具有抽象属性和行为的数据库操作对
//Entity: 由Model创建的实体,他的操作也会影响数据库
//Schema、Model、Entity的关系请牢记,Schema生成Model,Model创造Entity,Model和Entity都可对数据库操作造成影响,
//但Model比Entity更具操作性。
var produtSchema = new Schema({
... | true |
99da01181003c51b3915bd74d01f44a5c7e3d5d2 | JavaScript | windcaller31/algorithm_practise | /src/main/java/JavaScript/tree_level_visit/leet_code/leetcode-700.js | UTF-8 | 727 | 3.59375 | 4 | [] | no_license | /**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @param {number} val
* @return {TreeNode}
*/
var searchBST = function(root, val) {
var node = search_value(root,val);
if(node == null){
r... | true |
11cb0eb9243485aa2aa6a7e9df8fc4bd5132ea56 | JavaScript | adametsderschopfer/Nodarix | /server/core/HTTPServer.js | UTF-8 | 1,849 | 2.578125 | 3 | [
"MIT"
] | permissive | const http = require('http');
class HTTPServer {
vars = undefined;
constructor(params = {}) {
if (params.hasOwnProperty('vars') && Object.keys(params.vars).length) {
this.vars = this.vars || params.vars;
}
this.serverInstance = null;
this.beforeInit = this.beforeI... | true |
9e492ec8f507fe3b7448ca8af87ef0654ab18d9c | JavaScript | rbalonek/google-sheets-react-form | /src/App.js | UTF-8 | 3,524 | 2.640625 | 3 | [] | no_license | import React, {
useState,
// useEffect
} from "react";
import "./App.css";
// import { getAllSubmissions } from "./services/submissions";
function App() {
// const [submissions, setSubmissions] = useState([]);
const [data, setData] = useState({
name: "",
email: "",
message: "",
});
const { nam... | true |
5c01a9487a8c9adf2f099db1fe4eaeb1af3e656e | JavaScript | kennyki/nicknamer | /generate.js | UTF-8 | 1,713 | 3.1875 | 3 | [
"MIT"
] | permissive | const glob = require('glob')
const path = require('path')
const fs = require('fs')
const FOLDERS = [
'data/adjectives',
'data/nouns'
]
const OUTPUT_FILE = 'nicknames.json'
function getData(dir) {
return new Promise((resolve, reject) => {
glob(`${dir}/*.json`, (error, files) => {
if (error) {
r... | true |
8472da8a05ee95f62f71d3c0ed2edb78a69d7ed7 | JavaScript | edianibarrola/musicPlayer | /src/js/component/SongListMaker.js | UTF-8 | 454 | 2.59375 | 3 | [] | no_license | import React from "react";
import PropTypes from "prop-types";
export class SongListMaker extends React.Component {
render() {
return this.props.propSongList.map((song, index) => {
return (
<li key={index} onClick={() => this.props.propStartPlay(0)}>
{song.title}
</li>
);
});
}
}
SongListMake... | true |
8ebe3f00493d92cec592ad753d2668b53c79fed1 | JavaScript | ARLbenjamin/Generador-Nombres | /nombres/js/app.js | UTF-8 | 1,045 | 3.40625 | 3 | [] | no_license | document.querySelector('#generar-nombre').addEventListener('submit', function(e){
e.preventDefault();
//leer variables
const origen= document.querySelector('#origen').options[document.querySelector('#origen').selectedIndex].value;
const genero= document.querySelector('#genero').options[document.querySelector('#genero... | true |
b8b438d42971c96f5125ec4ce59fceb82b9bfa1e | JavaScript | Carlucio51/Primeira_Lista_Exercicios | /exe021/exe026/exe028/main.js | UTF-8 | 742 | 3.890625 | 4 | [] | no_license | /*Escrever um algoritmo que lê a hora de início e hora de término de um jogo, ambas
subdivididas em dois valores distintos: horas e minutos. Calcular e escrever a duração do
jogo, também em horas e minutos, considerando que o tempo máximo de duração de um
jogo é de 24 horas e que o jogo pode iniciar em um dia e term... | true |
ffa9528e7f2e2ae33a0536e942a4f8a1c0506e31 | JavaScript | MuruksMeyyappan/ReactHooks | /src/components/HookCounter2.js | UTF-8 | 720 | 2.890625 | 3 | [] | no_license | import React, {useState} from 'react'
function HookCounter2() {
const initinalCount = 0
const [count, setCount] = useState(initinalCount)
const incrementFive = () => {
for(let i = 0; i < 5; i++){
setCount(prevCount => prevCount + 1)
}
}
return (
<div>
... | true |
c427230cb2444b27893d461d5b69497a3bd727bb | JavaScript | abramclark/fiddle | /web/amazon-interview/phone1.js | UTF-8 | 843 | 3.984375 | 4 | [] | no_license | // Question: Given a list/array with at least one positive integer, find the contiguous
// sub-array with the largest sum and output the sub-array in a list/array
// Example input: [-2, 1, -3, 4, -1, 2, 1, -5, 4]
// Example output: [4, -1, 2, 1]
// return index of first greatest element in list l
var max = (l)=>{ var ... | true |
6e72bb4d14e4bc7c22a4549e03af3196473206aa | JavaScript | annegryomholt/javascript1_ma3 | /javascript-ma3-master/level1/question2/script.js | UTF-8 | 835 | 2.796875 | 3 | [] | no_license | //Console.log out elements in JSON file
{
"video": [{
"id": 12312412312,
"name": "Ecuaciones Diferenciales",
"url": "/video/math/edo/12312412312",
"author": {
"data": [{
"name_author": "Alejandro Morales",
"url": "/author/alejandro-morales",
"type": "master"
}]
}
}]
}
var ... | true |
3e2af115a1e7c901201fc27b799327c1679d5418 | JavaScript | hsmaheen/algoPrep | /challenges/Chapter_6_Recuresion_And_BackTracking/BackTracking/Word_Break/wordBreak.spec.js | UTF-8 | 783 | 2.90625 | 3 | [] | no_license | import { isWordBreakPossible } from './wordBreak';
test('should return false when the string cannnot be broken into words', () => {
const dict = ['cats', 'dog', 'sand', 'and', 'cat'];
const stringToFind = 'catsandog';
const res = isWordBreakPossible(stringToFind, dict);
expect(res).toBe(false);
});
test('shou... | true |
646f5cb74408d3f5aad81023d091c405d8f9d0dc | JavaScript | synesenom/ran | /src/dist/chi.js | UTF-8 | 1,200 | 3.015625 | 3 | [
"MIT"
] | permissive | import Distribution from './_distribution'
import Chi2 from './chi2'
/**
* Generator for the [$\chi$ distribution]{@link https://en.wikipedia.org/wiki/Chi_distribution}:
*
* $$f(x; k) = \frac{1}{2^{k/2 - 1} \Gamma(k/2)} x^{k - 1} e^{-x^2/2},$$
*
* where $k \in \mathbb{N}^+$. Support: $x > 0$.
*
* @class Chi
* ... | true |
6c0961d9a0b53bfa32f0fdd554bf7c438f0584f0 | JavaScript | cybye/WWM | /WerWirdMillionär/WebContent/js/geo.js | UTF-8 | 5,284 | 2.765625 | 3 | [] | no_license |
var GEO = function() {
var compassHeading =0.0;
var distance;
var angle;
var callback;
var onError;
var watcher;
var tLat;
var tLon;
var lat;
var lon;
function track(callback, error, lat, lon) {
this.callback = callback;
this.onError = error;
this.tLat = lat;
this.tLon = lon;
if(this.lat && t... | true |
1b596659fae5a147986648327f540aa6d7d0cd89 | JavaScript | guishuangwang/JWT-node | /JWT_server/user/users.js | UTF-8 | 494 | 2.78125 | 3 | [] | no_license | //用户登录信息保存,暂时只用数组记录
var USERS = [{
id: 1,
username: 'weichao',
password: 'weichao'
}, {
id: 2,
username: 'chaoge',
password: 'chaoge'
}];
module.exports = {
getUser: (usr, pwd) => {
console.log('usr:' + usr + 'pwd:' + pwd);
let user = USERS.filter((val, index, arr) => {
... | true |
75e75200acf7da82fb9a7a18ac1e564544517094 | JavaScript | letsbe7/rxjs-study | /src/ch01_creation/timer.js | UTF-8 | 479 | 2.890625 | 3 | [] | no_license | import { Observable } from 'rxjs/rx';
export default function main (...args) {
// 1초뒤 한번만 실행
const source = Observable.timer(1000);
const subscribe = source.subscribe(val => console.log(val));
// 1초뒤 한번, 그 다음에 2초마다 한번씩
const source2 = Observable.timer(1000, 2000);
const subscribe2 = so... | true |
785738e4fd90da57e02b9c236860dfe8e714864c | JavaScript | nagyist/phaser3-examples | /public/src/tweens/change texture after scale.js | UTF-8 | 1,679 | 2.90625 | 3 | [
"MIT"
] | permissive | class Example extends Phaser.Scene
{
constructor ()
{
super();
}
preload ()
{
this.load.image('back', 'assets/tweens/cardback.png');
this.load.image('front', 'assets/tweens/cardfront.png');
}
create ()
{
const card1 = this.add.image(180, 300, 'back');
... | true |
abd53d7cc2a0b09cd4a740159a610c49d87aa6a3 | JavaScript | szakalyzs/tictactoe | /js/scripts.js | UTF-8 | 1,837 | 3.3125 | 3 | [] | no_license | 'use strict';
let gameStatus = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']];
function initGame() {
let tableCells = document.querySelector('.game__board');
gameStatus = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']];
for (let i = 0; i < 3; i++) {
for (let j = 0; j < 3; j++) {
... | true |