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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c1be311e074692e154c4919db6e5e4570e9ff937 | JavaScript | AVu120/countdown-timer | /src/components/App/App.js | UTF-8 | 3,998 | 2.71875 | 3 | [
"MIT"
] | permissive | import moment from "moment";
import React, { useEffect, useState } from "react";
import Countdown from "../Countdown/Countdown";
import Inputs from "../Inputs/Inputs";
import css from "./App.module.css";
import Title from "../Title/Title";
const App = () => {
const [eventName, setEventName] = useState("");
const [... | true |
b5dab3fdbe6533d396f5978bda13b25fcca6de58 | JavaScript | pradeepmvn/spark-standalone | /OperationalView/app.js | UTF-8 | 3,238 | 2.546875 | 3 | [] | no_license | // Import express
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
// Load config for RethinkDB and express
var config = require("config.js");
var r = require('rethinkdb');
app.use(express.static('public'));
app.use(bodyParser());
// Middleware that will create a conne... | true |
fe6e327d1023f081b7cdd901958bc8198b3c8415 | JavaScript | Ashwanthparamasivam/Running-Man | /sketch.js | UTF-8 | 294 | 3.390625 | 3 | [] | no_license | var weight = [35,38,42,45,43,34,36,41,48,32];
function avg_weight(){
var tot=0;
for (var i=0;i<weight.length;i=i+1){
tot=tot+weight[i]
}
var avg = tot /weight.length;
console.log(avg);
}
function setup() {
createCanvas(400,400);
avg_weight();
}
function draw()
{
background(30);
}
| true |
76d9fe52e79e06c61420f7c02aca4f41a48fddff | JavaScript | 153734009/AnolePHP | /public/dist/jquery.zigzag.js | UTF-8 | 17,408 | 2.59375 | 3 | [
"MIT"
] | permissive | /*!
* ===================================================
* zigzag.js 0.8.1207
* jQuery zigzag Plugin (Tools) 基于jQuery的静态工具类
* Requires jQuery v2.0 or later
* jQuery Form v3.50 or later
* Copyright (c) 2014
*
* Project repository: https://github.com/153734009/zigzag
* --Dual licensed unde... | true |
fd2d86d8ce462a089ef2db28fd0e5f81fab1f3b2 | JavaScript | nchen123/lotide | /assertObjectsEqual.js | UTF-8 | 1,551 | 3.703125 | 4 | [] | no_license | const assertObjectsEqual = function(actual, expected) {
const inspect = require('util').inspect; // <= add this line
// console.log(`Example label: ${inspect(actual)}`);
if (Object.keys(actual).length !== Object.keys(expected).length) {
return (`Assertion Failed: ${inspect(actual)} !== ${inspect(expected)}`);... | true |
c094385762413f0ff2a21932bcbbc73618d4ad93 | JavaScript | Goncalo28/Surf-Game | /components/index.js | UTF-8 | 7,616 | 3.0625 | 3 | [] | no_license | document.getElementById('game-board').style.display = 'none';
document.getElementById('score-div').style.display = 'none';
document.getElementById('high-score').style.display = 'none';
let surfer;
let currentGame;
let difficulty;
let foamObstacle = new FoamObstacle(280);
let audio = new Audio('./assets/powerup.wav');
... | true |
e90ead4f903859f0f7d820b97be58086349851d5 | JavaScript | Congenica/Genoverse | /test/View/render-scalebar.js | UTF-8 | 3,536 | 2.609375 | 3 | [
"BSD-2-Clause"
] | permissive | 'use strict';
describe('Correctly render scalebar:', function () {
afterEach(afterTest);
var track = { _testClass: Genoverse.Track.Scalebar };
var width = 1000;
function doTest(end, labelFunction) {
return testTrackRenderStatic(undefined, track, getInstructions(end, width, labelFunction), { end: end, chr... | true |
b1dc2ff6a59cf1a2535bd8fdb4644153e663cf9a | JavaScript | alvarovazquez/podcaster | /src/js/main.js | UTF-8 | 20,665 | 2.609375 | 3 | [
"MIT"
] | permissive | /* globals $ */
/* globals page */
/* globals Handlebars */
/* Model classes */
class Episode {
constructor(id, title, publishDate, description, duration, media) {
this.id = id;
this.title = title;
this.publishDate = publishDate;
this.description = description;
this.duration = duration;
this.media = media... | true |
b42d424ddef4f99496fca5c251464ade7642778d | JavaScript | iqbaliamal/VSGA2020 | /Pertemuan-5/math/konstantalain.js | UTF-8 | 283 | 2.71875 | 3 | [] | no_license | // Selain menyediakan fungsi-fungsi matematika, objek Math juga menyediakan
// konstanta seperti PI, E, LN10, dll. yang bisa kita manfaatkan untuk perhitungan
// rumus tertentu.
Math.E();
Math.PI();
Math.SQRT2();
Math.SQRT1_2();
Math.LN2();
Math.LN10();
Math.LOG2E();
Math.LOG10E(); | true |
7c0160db8e491c6a4a0c8468aa3d20b34edd82be | JavaScript | megapers/COMP3793_Assign1_MVC | /wwwroot/js/site.js | UTF-8 | 1,287 | 2.984375 | 3 | [] | no_license | const uri = 'api/books';
let titles = [];
let book = {};
function getItems() {
fetch(uri)
.then(response => response.json())
.then(data => _displayItems(data))
.catch(error => console.error('Unable to get items.', error));
}
function getItemsbyId(id) {
var url = "https://localhost:500... | true |
f7cc93d039386309b5188891f9a677f75ab8a4cc | JavaScript | AlexTask/AlexTask.github.io | /olds/huffman.js | UTF-8 | 3,067 | 3.171875 | 3 | [] | no_license | (function() {
String.prototype.replaceAll = function(search, replace) {
return this.split(search).join(replace);
}
const topairs = freqs =>
Object.keys(freqs).map(c => [c, freqs[c]]);
//Frequency table
function freq (text) {
return text.split('').reduce((fs, c) =>
fs[c] ? (fs[c] = fs[c] + 1, fs... | true |
b214ad0effbda04ee57fc8b76bf1c352d36349e7 | JavaScript | upupming/algorithm | /leetcode/contest-284/6031. Find All K-Distant Indices in an Array.js | UTF-8 | 418 | 3.234375 | 3 | [
"MIT"
] | permissive | /**
* @param {number[]} nums
* @param {number} key
* @param {number} k
* @return {number[]}
*/
const findKDistantIndices = function (nums, key, k) {
const ans = []
for (let i = 0; i < nums.length; i++) {
let ok = false
for (let j = 0; j < nums.length; j++) {
if (nums[j] === key && Math.abs(i - j)... | true |
c83e96e2fc370e9f553988d914d7db663ec92357 | JavaScript | HarryShot/HarryShot.github.io | /facility-test/script/mobile_menu_button.js | UTF-8 | 371 | 2.515625 | 3 | [] | no_license | (function ($) {
$(function () {
$('.icon').on('click',function () {
$(this).closest('.main_menu').toggleClass('menu-open');
});
if($(window).width()<=480){
$('.main_menu').on("click","a",function (e) {
$(this).closest('.main_menu').toggleClass('menu-op... | true |
bb7332a1dd882bc9fb538c6334356cb01417f2d5 | JavaScript | seyikeye/d3ay | /app/binary.js | UTF-8 | 1,129 | 3.34375 | 3 | [] | no_license | Array.prototype.toTwenty = function () {
for (var i = 1; i <= 20; i++){
this.push(i);
}
return this;
};
Array.prototype.toForty = function () {
for (var i = 2; i <= 40; i+=2){
this.push(i);
}
return this;
};
Array.prototype.toOneThousand = function () {
for (var i = 10; i <= 1000; i+=10){
this.push(i)... | true |
0ae7633b4e12894bc26d49a517dc62edadff6e5a | JavaScript | doyinr6/merrydot.github.io | /assets/js/service.js | UTF-8 | 854 | 2.515625 | 3 | [] | no_license |
$(document).ready(function(){
$(".button").click(function(){
var value = $(this).attr("data-filter");
if (value == "all") {
$(".filter").show("1000");
}
else{
$(".filter").not("." +value).hide("1000");
$(".filter").filter("." +value).show("1000");
}
/... | true |
a2839796eef1c89898b0fedf7b93f920c98abbc2 | JavaScript | ferdy123-cyber/my-app-asessment | /index.js | UTF-8 | 1,111 | 2.609375 | 3 | [] | no_license | const express = require("express");
const app = express();
const cors = require("cors");
const port = 5000;
const { sequelize } = require("./database/models");
const userRouter = require("./routes/user");
const dataRouter = require("./routes/data");
const dailyDataRouter = require("./routes/dailyData");
app.use(cors(... | true |
e058f8ffac5c4c7dd9d5b9d9d178cc965dcae3c1 | JavaScript | MegDeri/redux27-7 | /src/comments.js | UTF-8 | 1,091 | 2.8125 | 3 | [] | no_license | import {ADD_COMMENT, REMOVE_COMMENT, EDIT_COMMENT, THUMB_UP_COMMENT, THUMB_DOWN_COMMENT} from './actions'
const comments = function(state = [], action) {
switch (action.type) {
case ADD_COMMENT:
return [{
id: action.id,
text: action.text,
votes: 0
}, ...state]; // does this add only "comments... | true |
351be5cdac4db204b3cfe6b5235003e44bbd38a8 | JavaScript | pzambao/tic-tac-toe-with-oo-js | /script/script.js | UTF-8 | 5,761 | 3.484375 | 3 | [] | no_license | // variáveis globais essenciais para o sistema de encerramento de partida
var vez = 0;
var vencedor = false;
var velha = false;
//Inicia a função JogoDaVelha
const jogoDaVelha = new JogoDaVelha();
jogoDaVelha.init();
function JogoDaVelha() {
//declaração dos atributos(caracteristica)
const tabuleiro = new Tabulei... | true |
a12b294f4b61e3016e457d43fd24b60d416e71df | JavaScript | metamorphe/symbiot-app | /server/public/js/main.js | UTF-8 | 8,168 | 2.78125 | 3 | [] | no_license | /*
* main.js
*
* Documentation coming soon.
*
*/
function Entry(address, brightness, parentDom) {
this.address = address || 0;
this.brightness = brightness || 0;
this.MIN_BRIGHTNESS = 0;
this.MAX_BRIGHTNESS = 100;
this.parentDom = parentDom;
this.rootDom = null;
this.entryTopDom = nu... | true |
40d2fb93a3d0bafbc5905157051e0497eeaff21b | JavaScript | BradNeuberg/rsh | /impl/shim/latest/examples/lib/x/x_dom.js | UTF-8 | 4,036 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | // x_dom.js, X v3.15.2, Cross-Browser.com DHTML Library
// Copyright (c) 2004 Michael Foster, Licensed LGPL (gnu.org)
// IE doesn't define DOM constants for W3C Node object, so you have to hard
// code constants. This creates Node object on browsers without for easier
// coding when working with nodeType attribu... | true |
07a362729ef66f8a6da8c3a6a7184f631103e780 | JavaScript | dongaifeng/tucao_backed | /app/extend/context.js | UTF-8 | 254 | 2.546875 | 3 | [] | no_license | 'use strict';
// 给ctx添加自定义方法 ctx.bar()
module.exports = {
bar(param) {
// this 就是 ctx 对象,在其中可以调用 ctx 上的其他方法,或访问属性
},
// 属性添加用get
get name() {
return 'aaa';
},
};
| true |
ba49417dd9dcd54084ee360d944bf4374107a741 | JavaScript | livingkurt/node_store | /client/src/utils/HelperFunctions.js | UTF-8 | 1,015 | 2.84375 | 3 | [] | no_license | export default {
capitalizeFirsts: (str) => {
var splitStr = str.toLowerCase().split(' ');
for (var i = 0; i < splitStr.length; i++) {
// You do not need to check if i is larger than splitStr length, as your for does that for you
// Assign it back to the array
splitStr[i] = splitStr[i]... | true |
5552937fdf8e09d66998c5c14dea0a1d70babb6b | JavaScript | milan-janecek/javascript-info-in-nodejs | /04-data-types/09-Object-keys-values-entries/01-Object-keys-values-entries.js | UTF-8 | 383 | 4.0625 | 4 | [] | no_license | 'use strict';
const user = {
name: 'John',
age: 30,
};
// loop over keys
for (const key of Object.keys(user)) {
console.log(key); // name, age
}
// loop over values
for (const value of Object.values(user)) {
console.log(value); // John, 30
}
// loop over values
for (const entry of Object.entries(user)) {
... | true |
10015ee830382e8250746e6b28bac2e14949179f | JavaScript | corzopabloariel/rig | /public/js/client.js | UTF-8 | 2,195 | 2.515625 | 3 | [
"MIT"
] | permissive | const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000,
timerProgressBar: true,
onOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
});
function enviar(e... | true |
a8dd02040d0509bc09f9354508317764a3d0a632 | JavaScript | mohamedhayibor/lucky | /game.js | UTF-8 | 1,153 | 3.578125 | 4 | [] | no_license | var main = function () {
// the user guesses
var userGuess1 = document.getElementById("guess1").value;
var userGuess2 = document.getElementById("guess2").value;
var userGuess3 = document.getElementById("guess3").value;
// the computer's lucky number
var magicNumber = Math.ceil(Math.random() * 1... | true |
16080a56dc4d30a15b03b0761c6cae079fb192c3 | JavaScript | arien98/1039823-code-and-magick-19 | /js/setup.js | UTF-8 | 4,421 | 2.9375 | 3 | [] | no_license | 'use strict';
var WIZARD_NAMES = [
'Иван',
'Хуан',
'Себастьян',
'Мария',
'Кристоф',
'Виктор',
'Юлия',
'Люпита',
'Вашингтон'
];
var WIZARD_SERNAMES = [
'да Марья',
'Верон',
'Мирабелла',
'Вальц',
'Онопко',
'Топольницкая',
'Нионго',
'Ирвинг'
];
var WIZARD_COAT_COLORS = [
'rgb(101, 137,... | true |
6a99cb600a28dc9ad54d00efd62dd7db3ae1c942 | JavaScript | Washikarei/bot-washi | /.gitignore/index.js | UTF-8 | 4,437 | 2.765625 | 3 | [] | no_license | /* Bibliotheque discord.js */
const discord = require('discord.js');
/* Variables */
const bot = new discord.Client();
const PREFIX = "/";
/* Evenement / Code */
bot.on('ready', () => {
//bot.channels.get("450336414891245569").send("Prêt à tester ! Sempai ;)");
console.log("Je suis l'early Access!");
... | true |
4a4876141f2fda96a4c56b0c731439d515cc828b | JavaScript | soumyaranjan333/Emplyoee-Details | /src/App.js | UTF-8 | 1,914 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react'
import AddEmployee from './AddEmployee'
import './App.css'
import Button from './Button'
import Employee from './Employee'
class App extends Component {
state = {
employees: [
{ name: "Soumya", age: 28, address: "Cuttack", department: "Production", salary: 30000, ... | true |
a3911ef6cfe47108425e4f9c1d65032027c62226 | JavaScript | NICKIEFRAUSTO/hystericalyrical | /server.js | UTF-8 | 3,000 | 2.671875 | 3 | [] | no_license | const express = require("express");
const morgan = require("morgan");
const mongoose = require("mongoose");
const bodyParser = require("body-parser");
const cookieParser = require("cookie-parser");
const session = require("express-session");
const PORT = process.env.PORT || 3001;
const router = require("./routes/login-... | true |
0dd40c083c3cf86a59d1b3780e98211a7f000aec | JavaScript | BaditaGeorge/trainingRepo | /miniSnake/snake.js | UTF-8 | 7,214 | 3.140625 | 3 | [] | no_license | let gameBoard;
let gameDivs = [];
let gameMatrix = [];
let snake = [];
let dir = 'd';
let rows_Nr = 18;
let cols_Nr = 36;
let bonusX, bonusY;
const UP = 'u';
const DOWN = 'd';
const LEFT = 'l';
const RIGHT = 'r';
function createBoardGame() {
gameBoard = document.createElement('div');
gameBoard.style.position =... | true |
d339a9c3af828de9d11bd640c0fb090f245f3f5c | JavaScript | ashmitmittal/WebDevFrontEnd | /js oops/inheritance.js | UTF-8 | 801 | 3.140625 | 3 | [] | no_license | function Vehicle(make,model,year) {
this.make = make;
this.model = model;
this.year = year;
this.isRunning = false;
}
Vehicle.prototype.turnOn = function() {
this.isRunning = true;
}
Vehicle.prototype.turnOff = function() {
this.isRunning = false;
}
Vehicle.prototype.honk = function() {
i... | true |
f6d03370c504430bb6b2473faf048b3e0ba2ac76 | JavaScript | sam3970/Nodejs | /study/ex2.js | UTF-8 | 1,307 | 2.859375 | 3 | [] | no_license | const obj ={
outside:{
inside:{
key:'value',
},
},
};
console.time('time');
console.error('err');
console.table([{name : 'sam3970', country : 'seoul',code : '02' }, {name:'test',country:'daegu',code:'053'}]);
console.dir(obj, {colors:true,depth:2});
console.dir(obj, {colors:false,depth:1});
console.dir(obj,... | true |
a040b92b9eb222af50e24a805aa2056e8b6f763e | JavaScript | karayusuf/breakout | /lib/elements/brick.js | UTF-8 | 633 | 2.734375 | 3 | [] | no_license | var Breakout;
if ( Breakout === undefined ) {
Breakout = {};
}
Breakout.brick = function(paper, x, y, color, points) {
var brick = paper.rect(x, y, 50, 10).attr('fill', color);
brick.hit = function() {
brick.remove();
}
return brick;
}
Breakout.redBrick = function(paper, x, y) {
return this.brick(pa... | true |
a07a091ad86f02dfa4f9b4121dca58ae5ebc09ae | JavaScript | calvinrzachman/js-blockchain-development | /wallet/transaction-pool.test.js | UTF-8 | 3,482 | 3.03125 | 3 | [] | no_license | // Jest Unit Test - Transaction Pool Class
const TransactionPool = require('./transaction-pool');
const Transaction = require('./transaction');
const Wallet = require('../wallet');
const Blockchain = require('../blockchain');
describe('Transaction Pool', () => {
let txPool, transaction, wallet, bchain;
befor... | true |
67109ae517dbf1aa95039d801abc7dcd63a435ea | JavaScript | vanessajay/linux | /4linux/451 e 455 - Linux System Administration/aula 09/lintargzip.php_arquivos/buzzwidget.js | UTF-8 | 2,172 | 2.65625 | 3 | [] | no_license | // chama o widget de rt
// buzzvolume.com inspired by all startups in the twitter plataform.
// avoiding document.write() -- ninja style, you will see (and if you can see you can copy)
// TODO: a lot.
(typeof __buzzScriptCounter != 'number') ? __buzzScriptCounter = 0 : ++__buzzScriptCounter;
(function(){
var src = ... | true |
b46e29610047e435b0025b9bb8ffb0ec3fc9f0fa | JavaScript | vnikonov63/birthday-reminder | /routes/admin.js | UTF-8 | 3,537 | 2.53125 | 3 | [
"MIT"
] | permissive | const express = require("express");
const cookieParser = require("cookie-parser");
const Student = require("../models/students");
const router = express.Router();
const dayjs = require("dayjs");
const Admin = require("../models/admin");
function checkAuth(req, res, next) {
if (req.session.user) next();
else res.re... | true |
ad8740b4f97d64a252956b82e67fa7d7a368f07b | JavaScript | vpurush/memory_game | /src/memory_game/memory_game.component.test.js | UTF-8 | 1,423 | 2.734375 | 3 | [] | no_license | import React from 'react';
import '../testSetup';
import { shallow } from 'enzyme';
jest.mock('./memory_game.service.js');
import MemoryGame from './memory_game.component';
import MemoryGameService from './memory_game.service';
test('startNewGame method must invoke GetImages method in the service', () => {
const... | true |
73321e4103383723d7298c941464fdf8dce435f9 | JavaScript | AustinPaley/Age-of-Code-Lyt3 | /age-of-code-frontend/index.js | UTF-8 | 18,642 | 2.953125 | 3 | [] | no_license | let permissions = []
let allButtons = [];
document.addEventListener('DOMContentLoaded', function () {
// GLOBAL CONSTANTS
const mainContainer = document.getElementById("main-container");
const userWindow = document.getElementById("user-window");
const userName = document.getElementById("user-name");
const use... | true |
d5c70169baf5bf252be3564c419f5b7f0a07d9fc | JavaScript | yurifardel/api-app-nextjs | /pages/buscar.js | UTF-8 | 1,521 | 2.75 | 3 | [] | no_license | import Head from "next/head";
import styles from "../styles/Home.module.css";
import { useState } from "react";
//client side render
export default function Buscar() {
const [searchText, setSeachText] = useState();
const [movieList, setMovieList] = useState([]);
const handleSearch = async () => {
if (search... | true |
e8d3a7410b62d4eac3a6b389b8a439902c478b4a | JavaScript | pehedepa/kender | /Skylab-Coders/0-PreCourse/airlines-proj/airlines-pro.js | UTF-8 | 10,746 | 3.015625 | 3 | [
"MIT"
] | permissive | // DECLARACION VARIABLES GLOBALES
let user = '';
let root = false;
let flights = [
{ id: 00, to: 'Bilbao', from: 'Barcelona', cost: 1600, scale: false },
{ id: 01, to: 'New York', from: 'Barcelona', cost: 700, scale: false },
{ id: 02, to: 'Los Angeles', from: 'Madrid', cost: 1100, scale: true },
{ id: ... | true |
64ed7dcfd0e29e7872b974150053bd9e213f263d | JavaScript | glendyco/Practica1SA | /test/test.js | UTF-8 | 1,439 | 2.96875 | 3 | [] | no_license | var assert = require('assert')
const fetch = require("node-fetch")
describe('Prueba funcion suma',async function() {
it('El resultado de la suma debe ser 5', async function() {
let resultado = await fetch('http://localhost:3000/sum/3/2')
.then(response => response.json())
... | true |
9d7f25c47a32392ad021190b6032decd4c3d9977 | JavaScript | simran-grewal/CodingWithJavaScript | /Narcissistic.js | UTF-8 | 2,022 | 4.15625 | 4 | [] | no_license | /*
A Narcissistic Number is a number which is the sum of its own digits, each raised to the power of the number of digits.
*/
function isNarcissistic(n){
return n === +n.toString().split('').reduce((s, v, i, arr) => s + Math.pow(v, arr.length),0)
}
// no strings!
function isNarcissistic(n) {
const exp = Math.... | true |
f20c6b86ec17db25a5b1780399c176856ebb73ce | JavaScript | macsen110/yao-easy-router | /index.js | UTF-8 | 6,180 | 2.515625 | 3 | [] | no_license | /**
* 简易路由系统
* 上手快
* 配置简单
*/
(function(win, factory) {
if (typeof exports === "object") {
module.exports = factory();
} else if (typeof define === "function" && define.amd) {
define(factory);
} else {
win.EASY_ROUTER = factory();
}
})(this, function() {
var APP = {};
var _tools = {
setPa... | true |
54ffeb8b7507be09b67ee5fe3e4ddf10387bc98e | JavaScript | nirdavid/new-cloud-nirda | /src/handlers/s3-json-logger.js | UTF-8 | 2,693 | 2.640625 | 3 | [
"MIT-0"
] | permissive | // Create clients outside of the handler
// Create a client to read objects from S3
const AWS = require('aws-sdk');
//const FiboStorage = require('@fibotax/fibo-storage');
const PiDb = require('@fibotax/pi-db');
const crypto = require("crypto");
const { defActionContext, srcBucketName, dstBucketName, tableName } = req... | true |
ec255fdce891135e8334122db982ed3199d4cc01 | JavaScript | marekventur/promise-spin-wait | /index.js | UTF-8 | 678 | 2.609375 | 3 | [
"MIT"
] | permissive | "use strict";
module.exports = function spinner(fn, opts) {
opts = opts || {};
var timeout = opts.timeout || 5000;
var message = opts.message || "Timeout";
var interval = opts.interval || 100;
var startTime = Date.now();
return Promise.resolve()
.then(fn)
.then(result => {
if ... | true |
af04466d77e727c7b50322c64b2089c221e96b29 | JavaScript | evanyuchuan/evanyuchuan.github.io | /schedules.js | UTF-8 | 7,478 | 2.625 | 3 | [] | no_license |
var normal0 = {
name: "Period 0",
beginning: "0:01",
warningBellOne: 0,
warningBellTwo: "6:47",
warningBellTwoName: "3 min bell",
bell: "6:50",
end: "7:45",
enabled: false,
};
var normal1 = {
name: "Period 1",
beginning: "7:45",
warningBellOne: "7:45",
warningBellOneName: "10 min bell",
warningBellTwo: "... | true |
7fefe89e20601018c4c7ecc21a611cd33f56c22e | JavaScript | keelybrennan4/Eat-Da-Burger | /controllers/burgers_controller.js | UTF-8 | 935 | 2.796875 | 3 | [] | no_license | var express = require("express");
var router = express.Router();
// Import the model burger.js to use its database functions.
var burger = require("../models/burger.js");
//render index within views folder
router.get("/", function(req, res){
burger.all(function(burger_data){
console.log(burger_data);
... | true |
af27a6190364630a37495a550ae0d0f01aaa121b | JavaScript | gbmahili/RCB-Network-Final | /model/Users.js | UTF-8 | 1,321 | 2.578125 | 3 | [] | no_license | // Require mongoose
const mongoose = require("mongoose");
// Instanciate our schema
var Schema = mongoose.Schema;
// Create a new article from our schema
var UserSchema = new Schema({
firstName: {
type : String
},
lastName: {
type: String
},
UserProfilePicture: {
ty... | true |
1f96a16f550eea21d68ea740427b95b70e50742f | JavaScript | vlasov-n-n/local-dir-manager-app | /api/helpers/getFilesStat.js | UTF-8 | 980 | 2.609375 | 3 | [] | no_license | import {getAllFileColors, setNewFileColors} from './fileTypeColors';
import getRandomColor from './getRandomColor';
/**
* @param {Array} array
* @return {Array<StatItem>}
*/
export default (array) => {
const fileColors = getAllFileColors();
const filesStatistic = [];
/**
* Array group by type
* @type {... | true |
b69dc8c3d822242d6b43b38f806e91c357724a8b | JavaScript | imclab/itunesVisualization | /visualization/graphBuilder.js | UTF-8 | 3,794 | 2.703125 | 3 | [] | no_license | function GraphBuilder(settings) {
var graph = Viva.Graph.graph(),
renderer,
undrawedItems,
drawedItems,
showOnlyFreeItems = false;
var graphics = Viva.Graph.View.svgGraphics();
graphics.node(function(node) {
var ui = Viva.Graph... | true |
665969871ab89c91ce8b0339bdf625ed44a1a2b3 | JavaScript | nartvt/chat-message-app | /public/js/index.js | UTF-8 | 3,113 | 2.625 | 3 | [] | no_license | const socket = io();
const { name, room } = $.deparam(window.location.search);
socket.on('connect', () => {
console.log('Connected to the server');
socket.emit("newUser", {
name,room
})
})
socket.on('disconnect', () => {
console.log('Disconnected from the server');
})
// socket.on('sendEmailFromServer', (... | true |
7662eb21a0550b9634b301d37f7689ad54888bfa | JavaScript | rpbouman/xmlazy | /tests/dom/TextNode.test.js | UTF-8 | 5,645 | 2.96875 | 3 | [
"MIT"
] | permissive | import * as xmlazy from '../../src/xmlazy.js';
describe('Text', () => {
const text = 'world';
let
staxStringReader, staxResult,
xml, elementNode, textNode
;
beforeAll(() => {
xml = `<hello>${text}</hello>`;
staxStringReader = new xmlazy.StaxStringReader(xml, {chainNodes: true});
staxRes... | true |
f843fcc2c8c0a986621cc70c2b1186cdb8e25502 | JavaScript | Hanyauku123/Portafolio_PW0219_00353817 | /Laboratorios/Laboratorio5/Script/ejercicio7.js | UTF-8 | 401 | 3.484375 | 3 | [] | no_license | function fibonacci(){
var n = 0;
var arreglo7 = [];
var num7 = parseInt(prompt('Ingrese un numero: '));
for (n; n < num7; n++) {
if (n == 0) {
arreglo7.push(0);
}
else if(n == 1){
arreglo7.push(1);
}
else{
arreglo7.push(ar... | true |
e663cedc84b586866fb0cb193b4fbd23b87d6bdf | JavaScript | ivanbacher/html-structure-prototype-1 | /public/lib/IndentedTreeLayout.js | UTF-8 | 2,129 | 2.8125 | 3 | [] | no_license |
function calculateLayout(ast, dim) {
var nodeWidth = 60;
var nodeHeight = 20;
var nodesList = [];
var nodeHash = {};
var path = [];
var startX = (-dim.width/2) + nodeWidth/2;
var startY = (dim.height/2) - nodeHeight/2;
//calc positions
trav( ast );
return { arr: nodesList, hash: nodeHash, ast: ast };
... | true |
1a3643f130ff51554049c33efb1b71cd7450ee5b | JavaScript | shmilyvidian/algorithm014-algorithm014 | /Week_04/search-in-rotated-sorted-array.js | UTF-8 | 1,047 | 3.640625 | 4 | [] | no_license | // 33. 搜索旋转排序数组
var search = function (nums, target) {
if (!nums || nums.length === 0) return -1;
let start = 0;
let end = nums.length - 1;
let mid;
while (start <= end) {
mid = Math.ceil((start + end) / 2);
// 首尾中全部验证
if (nums[mid] === target) return mid;
if (nums[start] ===... | true |
33c98d64b662cd84fcd745b126c9267daa4294c4 | JavaScript | wildfireone/robotdance | /steering.js | UTF-8 | 3,683 | 2.75 | 3 | [] | no_license | // Constructor
function Steering(sender,address,LeftMotor, RightMotor) {
// always initialize all instance properties
this.address = address;
this.currentSpeed = 2;
this.leftPort = LeftMotor.port;
this.rightPort = RightMotor.port;
this.sender =sender
}
// class methods
Steering.prototype.move = function(di... | true |
4c558379a5e64890b22f0a1d99005a5a8c071c5f | JavaScript | ranvijay07/project34 | /sketch.js | UTF-8 | 1,678 | 2.984375 | 3 | [] | no_license | const Engine=Matter.Engine
const Bodies=Matter.Bodies
const World=Matter.World
var world,engine;
var hero,ground;
var b1;
var b2;
var b3;
var b4;
var b5;
var b6;
var b7;
var b8;
var b9;
var b10;
var b11;
var b12;
var b13;
var b14;
var b15;
var b16;
var b17;
var b18;
var b19;
var b20;
var monster;
function preload() ... | true |
7d91a89da77850e87e185991880c401266668031 | JavaScript | tikerola/dating-app | /front-end/src/reducers/mail.js | UTF-8 | 1,026 | 2.703125 | 3 | [] | no_license |
const initialState = {
inbox: [],
sent: [],
countOfUnread: 0
}
export default (state = initialState, action) => {
switch (action.type) {
case 'FETCH_INBOX':
return {
...state,
inbox: action.inbox
}
case 'FETCH_SENT':
return {
...state,
sent: action.se... | true |
2018943b4cc0ad41a1c33a16523395fbf09274f6 | JavaScript | firstkiadityaf12/RestAPI_NodeJs | /Praktikum_RestApi/praktikum2no2.js | UTF-8 | 2,926 | 2.9375 | 3 | [] | no_license | const express = require("express") //ambil library express js
const bodyParser = require("body-parser") // ambil library body-parser
const cors = require("cors") // ambil library cors
const app = express()
//----> pemanggilan fungsi <----
// penggunaan body-parser untuk ekstrak datarequest berformat JSON
app.use(bo... | true |
e9bb23addcad6710e24e8f992f761d550be07dbb | JavaScript | RedwanSharafatKabir/JavaScript | /Basic JS and HTML/conditional statement.js | UTF-8 | 545 | 3.484375 | 3 | [] | no_license |
!function () {
'use strict'; /* "use strict" is used to make the variables in strict mood &
it will show an error for the undeclared variables. */
if (true === false) {
console.log('We can not see this.');
}
else {
console.log('We can see this.');
}
... | true |
5a5a3971d18df7e13152a933cb7851f038f721fb | JavaScript | KirillSerchenko/ExamFront | /src/store/reducers/reducer.js | UTF-8 | 809 | 2.9375 | 3 | [] | no_license |
const initialState={
servers:[],
isFetching:false,
buttonClicked:false,
}
const reducer = (state=initialState,action) => {
switch (action.type){
case("setServers"):{
const servers = []
action.payload.forEach(server => servers.push(server))
... | true |
ed2b6a7357b6b13ea3bb76df6bbbb92227417dee | JavaScript | nguni52/pearson | /daassets_repo/interactivetool/questions/A10_002.js | UTF-8 | 3,790 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | // JavaScript Document
var quiz = {
// Put category here
multi: [{
ques: "<strong>Question 1</strong><br/>The maps that these questions are based on are …",
ans: "thematic maps.",
ansSel: ["political maps.", "physical maps."]
}, {
ques: "<strong>Ques... | true |
6b478b522e11fa7e81acea3aec886d70ba746416 | JavaScript | chirag3003/formica | /frontend/src/Redux/Reducers/example.reducer.js | UTF-8 | 314 | 2.59375 | 3 | [
"MIT"
] | permissive | import { EXAMPLE_ACTION } from "../ActionTypes";
export const example = (
state = {
exampleState: 1,
},
action
) => {
switch (action.type) {
case EXAMPLE_ACTION: {
return {
...state,
exampleState: state.exampleState + 1,
};
}
default:
return state;
}
}; | true |
bc19ef7056a24a851dc20586ac5f9f8ae325f786 | JavaScript | Fridolph/Fridolph | /30秒学会一个知识点/Adapter/flip.js | UTF-8 | 455 | 3.703125 | 4 | [] | no_license | // Flip将函数作为参数,然后将第一个参数作为最后一个参数。返回一个接受可变输入的闭包,并拼接最后一个参数,使其成为应用其余参数之前的第一个参数。
const flip = fn => (first, ...rest) => fn(...rest, first)
let a = { name: 'John Smith' };
let b = {};
const mergeFrom = flip(Object.assign);
let mergePerson = mergeFrom.bind(null, a);
mergePerson(b); // == b
b = {};
Object.assign(b, a); // ==... | true |
9d83e4daf562d020b1c77ca762daefc5478a8710 | JavaScript | tormic/js-beatles-loops-lab-bootcamp-prep-000 | /index.js | UTF-8 | 603 | 3.234375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | function theBeatlesPlay(musicians, instruments){
var array = [];
for (let i = 0; i<musicians.length;i++) {
var musician = musicians[i]
var instrument = instruments[i]
array.push(`${musician} plays ${instrument}`)
}//end for loop
return array
}//end function
function johnLennonFacts(facts) {
var i... | true |
e782e351c97117bbd8645e13c3c3d7cf209a0529 | JavaScript | anquangvinh/data | /angular/googleApp/location/map.js | UTF-8 | 8,386 | 2.59375 | 3 | [] | no_license | 'use strict';
angular.module('mapGoogle.map', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/location/map', {
templateUrl: 'location/map.html',
controller: 'mapcontrolCtrl'
});
}])
.controller('mapcontrolCtrl', ['$scope', '$location', function($scope,... | true |
3fc68d3baaa7eb321ad85348db836ea3b5c9dd3a | JavaScript | MikeG212/sleepytetris | /js/scoreboard.js | UTF-8 | 144 | 3.09375 | 3 | [] | no_license | let score = 0;
const scoreBoard = document.getElementById("scoreBoard");
function updateScore() {
scoreBoard.innerHTML = `Score: ${score}`;
}
| true |
20d8ce28518683d6352e8fab88b99868b8cb174a | JavaScript | anthonyzamarro/fcc-recipe-box | /src/index.js | UTF-8 | 8,891 | 2.59375 | 3 | [] | no_license | import React, { Component } from "react";
import ReactDOM from "react-dom";
import Content from "./components/content.js";
import ContentRecipe from "./components/contentRecipe.js";
import Sidebar from "./components/sidebar.js";
import SidebarItem from "./components/sidebarItem.js";
import AddRecipe from "./components/... | true |
dccb331b7b06be431cceb11f7bc399f2229a12c1 | JavaScript | smbachman/rain | /app/tuples.js | UTF-8 | 2,434 | 3.25 | 3 | [] | no_license | (function (Rain) {
function defineTupleProperties(t) {
Object.defineProperties(t, {
x: { get: function() { return this[0]; } },
y: { get: function() { return this[1]; } },
z: { get: function() { return this[2]; } },
w: { get: function() { return this[3]; } },
type: { get: () => 'T... | true |
061f737648118d41ccaad8d344edacf93e7636a5 | JavaScript | canorga8634/assignment-6 | /js/06-odd-or-even.js | UTF-8 | 264 | 3.53125 | 4 | [] | no_license | var x;
var y;
for(x = 0; x <= 15; x += 1) {
for(x = 0; x <= 15; x +=1) {
if(x % 2 == 0) {
window.document.write(x + " is even<br>");}
else {
window.document.write(x + " is odd<br>");}
}
}
| true |
7ab0d1e370a9614fa19fb57ad01a1eeb9ef97ad4 | JavaScript | biancaiordache/takeaway-challenge | /jasmine/spec/featureSpec.js | UTF-8 | 274 | 2.625 | 3 | [
"MIT"
] | permissive | 'use strict';
describe('Feature Test:', function(){
var menu;
beforeEach(function(){
menu = new Menu();
dishes = "Pizza £7.99, Pasta £10.99";
});
it('returns a list of dishes with prices', function(){
expect(menu.all()).toContain(dishes);
});
});
| true |
d032be6362be48f2b38f773ec4b9bd95bbe37bd6 | JavaScript | bugsbycarlin/Bugsby.net | /Game/secondending.js | UTF-8 | 1,643 | 2.859375 | 3 | [] | no_license | function SecondEndingInit()
{
backgroundScrollX = 0;
backgroundScrollY = 0;
Separation = 0;
AnimationCounter = 0;
Phase = 0;
PhaseTimer = 0;
CreditScroll = 580;
Fade = 1;
}
SecondEndingPhaseLengths = [50,50];
function SecondEndingUpdate()
{
PhaseTimer++;
if(PhaseTimer >= SecondEndingPhaseLengths[Pha... | true |
10e682c49956776f03075c51d98e75ca9e1cf067 | JavaScript | jpkraemer/brackets-typeInference | /src/TypeInformationHTMLRenderer.js | UTF-8 | 3,221 | 2.71875 | 3 | [] | no_license | /*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $, brackets, Mustache */
define(function (require, exports, module) {
"use strict";
var _ = require("./lib/lodash");
var marked = require("./node/node_modules/marked/lib/marked");
/**
* Render a sin... | true |
58f7dd5e74660c6722eebf7de8f09da2c3234c13 | JavaScript | Cassandra112/441 | /HW-5/main.js | UTF-8 | 962 | 3.5 | 4 | [] | no_license | var imageLight = ["light1", "light2", "light3", "light4", "light5", "light6", "light7", "light8", "light9", "light10"];
var blankImagePath = "blank.jpg";
var actualImages = new Array();
function printBlanks()
{
createRandomImageArray();
for(var i = 0; i < imageLight.length; i++)
{
document.getElem... | true |
392bfbd02b1a75fffa2bc0f8e4a4bb41cac5b930 | JavaScript | jay3sh/hnopennewtab | /hnnewtab.js | UTF-8 | 304 | 2.578125 | 3 | [
"MIT"
] | permissive |
(function () {
var athings = document.getElementsByClassName('athing');
for(var i=0; i<athings.length; i++) {
var athing = athings[i];
var atitle = athing.getElementsByClassName('title')[1];
var aa = atitle.getElementsByTagName('a')[0];
aa.setAttribute('target','_blank');
}
})();
| true |
49d1ab9d2aecf10f5beeddad358f2868534e96b7 | JavaScript | davidrevo/Noteboard-React-Project | /src/Note.js | UTF-8 | 3,029 | 2.703125 | 3 | [] | no_license | import React from 'react'
import ReactDOM from 'react-dom'
import createReactClass from 'create-react-class'
import $ from 'jquery'
import './App.css'
var Note = createReactClass({
getInitialState(){
return {
editing: false,
pos: {
x: this.randomBetween(0, window.innerWidth / 3 - 150, 'px'),
... | true |
96df717a0638410c8122cf7f6ea2748f293bea50 | JavaScript | shashwatsirjam/calculator | /app.js | UTF-8 | 1,249 | 3.40625 | 3 | [] | no_license |
var screen = document.querySelector('#screen');
var btn = document.querySelectorAll('.btn');
for (item of btn)
{
item.addEventListener('click' ,(e)=>{
btntext = e.target.innerText;
if(btntext=='×')
{
btntext='*';
}
... | true |
d4e9ad8b6d15a3888bedb502db7e55d73b056721 | JavaScript | takelo/jme | /space-invaders/scripts.js | UTF-8 | 10,736 | 3.09375 | 3 | [] | no_license | console.log("yelllow");
const canvas = document.querySelector("canvas");
const c = canvas.getContext("2d");
canvas.width = innerWidth;
canvas.height = innerHeight;
class Player {
constructor() {
this.velocity = {
x: 0,
y: 0,
};
this.rotation = 0;
const image = new Image();
image.s... | true |
39a4a70016df4fb0a3850bfe4c8ec3df9e9248fd | JavaScript | theomarkkuspaul/Tic-Tac-Toe | /js/game.js | UTF-8 | 663 | 3.5 | 4 | [
"MIT"
] | permissive |
var Game = function(players = [new Computer, new Human]){
this.board = new Board,
this.players = players,
this.turn = this.players[1],
this.winner = null
};
Game.prototype.switchTurn = function() {
if(this.turn.piece.symbol == 'X'){
this.turn = this.players[0]
} else if(this.turn.piece.symbol == 'O'){... | true |
87e85fb1637ca61ae5c0e20c2e12add81bc7d3c4 | JavaScript | agusnotti/TPE-WEB2 | /js/admin.js | UTF-8 | 2,897 | 2.890625 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', function() {
//### PRODUCTO
let inputNombre = document.getElementById('nombre-tabla');
let inputDescripcion = document.getElementById('descripcion-tabla');
let inputTamano = document.getElementById('tamaño-tabla');
let inputPrecio = document.getElement... | true |
2e65f96d7cb1139a01c488cd4c1a3a6eda728179 | JavaScript | xiaoPxie/wx-miniprogram | /pages/cart/index.js | UTF-8 | 4,073 | 2.53125 | 3 | [] | no_license | // pages/cart/index.js
import { showModal, showToast } from "../../utils/axyncWx"
Page({
/**
* 页面的初始数据
*/
data: {
address: {},
cart: [],
allChecked: false,
totalPrice: 0,
totalNum: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
onShow: function() {
/... | true |
2619ae1df5028022846a95499eb5c1882e633ac1 | JavaScript | Toinane/ac-new-horizon-calculator | /getimages.js | UTF-8 | 568 | 3.09375 | 3 | [
"MIT"
] | permissive | const arr = [];
(() => {
const total = 50;
async function getImage(i) {
if(i > total) return;
const img = document.querySelector('.media img').src.replace(/(\/revision.*)/gm, '');
const a = document.createElement("a");
a.href = img;
a.target = "_blank"
... | true |
c4f63243248739eac28aebd34685e4e40539a93b | JavaScript | thgala/wavepuzzle_spa | /src/wpApp/modules/layout/components/responsive/index.js | UTF-8 | 2,054 | 2.53125 | 3 | [] | no_license | import { LG, MD, SM, XS, XSS } from "./../../constants";
import './index.scss';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import bem from 'react-bem-classes';
@bem({
block: 'responsiveGrid',
})
export default class Responsive extends Component {
constructor(props){
super(pr... | true |
896b8700b5460e50cf7570c835398c6fa7a6bdd9 | JavaScript | ignas-seskauskas/altmp-js-3dtext-spawner | /client.mjs | UTF-8 | 3,120 | 2.703125 | 3 | [] | no_license | import alt from "alt";
import game from "natives";
let TEXT3D_LIST = [];
let findUnusedText3DID = () => {
for(let i = 0; i < TEXT3D_LIST.length; i++)
if(TEXT3D_LIST[i] === undefined) return i;
return TEXT3D_LIST.length;
};
/**
* Function is borrowed & edited from: https://forum.altv.mp/index.php?/t... | true |
29ff930bcfd706819e8d2fd05b7184cafa39250d | JavaScript | LarissaAzevedo/GufosReact | /gufos/src/assets/pages/Categorias/Categorias.js | UTF-8 | 13,022 | 2.890625 | 3 | [] | no_license | import React, { Component } from 'react';
import Header from '../../components/Header/header';
import Footer from '../../components/Footer/footer';
// import { Link } from 'react-router-dom';
// import dos componentes da biblioteca Material Design Bootstrap React
import { MDBContainer, MDBBtn, MDBModal, MDBModalBody, ... | true |
ec94367a0a2273ac4afff5d697aebaebc98f8701 | JavaScript | alihalim6/leaguehut-baseball | /app/modules/gamePlay/services/battingService.js | UTF-8 | 20,449 | 2.546875 | 3 | [] | no_license | /**
* Generates all of the properties of the batting result of a pitch thrown.
*/
module.exports = function(module){
module.service('battingService', ['appUtility', 'gamePlayService', 'appConstants', 'battingConstants', 'pitchConstants', 'baseRunningService', function battingService(appUtility, gamePlayService, appC... | true |
d7555bdbb1bfb4a97f226d73c9fbb8e0750d56f7 | JavaScript | karmodaniel/estudos-javascript | /esnext/set.js | UTF-8 | 397 | 3.640625 | 4 | [] | no_license | //Não aceita repetição/não indexada
const times = new Set()
times.add('Vasco')
times.add('São Paulo').add('Santos').add('Bahia')
times.add('Flamengo')
times.add('Vasco')
console.log(times)
console.log(times.size)
console.log(times.has('Flamengo'))
times.delete('Vasco')
console.log(times)
const nomes = ['Daniel', 'Dav... | true |
3a3dc97e04e502754d088c7fe9f543fa748fcd32 | JavaScript | KondayyaDevarakonda/JavaAndDocker | /reactmicroservies/src/utility/SortUtitlityService.js | UTF-8 | 656 | 2.796875 | 3 | [] | no_license | // Function for sorting table items
import React from 'react';
class SortUtitlityService {
compareBy(key, ascDesFlag) {
return function (a, b) {
if (ascDesFlag === true) {
if (a[key] > b[key]) {
return -1;
}
} else {
... | true |
9f27990a9f19cf5d5d19d16ada151fbe6ac882b2 | JavaScript | wanghuadong-anhuidaxue/EnDSM | /static/dist/geotools.min.js | UTF-8 | 1,126 | 2.6875 | 3 | [] | no_license | /*!
* geotools v1.0.2
* https://github.com/myspace-nu
*
* Copyright 2018 Johan Johansson
* Released under the MIT license
*/
"use strict";
function geotools() {
var s = this;
return this.position = function (t, i, h) {
return "object" == typeof t ? (this.latitude = t.latitude, this.longitude = t... | true |
78cbf9624d310fdb818c28c438c5ac3f576771ab | JavaScript | CGally/Platformer | /scripts/classes/hazards/Spike.js | UTF-8 | 1,166 | 3.46875 | 3 | [] | no_license | class Spike {
constructor(point1X, point1Y, point2X, point2Y, point3X, point3Y, type) {
this.point1X = point1X;
this.point1Y = point1Y;
this.point2X = point2X;
this.point2Y = point2Y;
this.point3X = point3X;
this.point3Y = point3Y;
this.type = type;
if(point2X < point1X) {
this.x... | true |
9cf17ebadd7b0e9fd814e6705fe8145a744ea605 | JavaScript | valkheim/transform.js | /tests/core/utils.test.js | UTF-8 | 2,328 | 2.65625 | 3 | [] | no_license | import {
jsonGetByPath,
jsonSetbyPath,
jsonRemoveKeysContaining,
cleanObject
} from "../../sources/core/utils.js";
import CONSTANTS from "../../sources/core/constants.js";
describe("jsonGetByPath", () => {
it("simple, depth = 0", () => {
const j = { foo: "bar" };
expect(jsonGetByPath(j, "foo")).toStr... | true |
f1407fb4d18d814bdf579272bceaff1063f9e921 | JavaScript | Bloomca/github-users-explorer | /app/static/index.js | UTF-8 | 295 | 2.96875 | 3 | [
"MIT"
] | permissive | const input = document.getElementById("search");
const link = document.getElementById("search-link");
input.addEventListener("input", e => {
const value = e.target.value;
link.setAttribute("formaction", makeLink(value));
});
function makeLink(username) {
return `/users/${username}`;
}
| true |
de172f42239d0bca3281102db64d4055650c7265 | JavaScript | Crazy-Unicorn/Arcomagic | /WebApplication1/web/keyboard.js | UTF-8 | 12,714 | 2.5625 | 3 | [] | no_license | function keyboardPage() {
var name = "";
var backgroundColor = "black";
var keyColor = "white";
clearElements();
canvas.addEventListener('mousedown', mouseKeybHandler);
function mouseKeybHandler (event) {
for (var i in buttons) {
if (typeof buttons[i].events[even... | true |
6ece14b966e9fb60c452f73502a9d1fd609e1a3f | JavaScript | Leil-ish/enroot-client | /src/garden-helper.js | UTF-8 | 563 | 2.5625 | 3 | [] | no_license |
export const findPlant = (plants=[], plantId) =>
plants.find(plant => plant.id === plantId)
export const findTask = (tasks=[], taskId) =>
tasks.find(task => task.id === taskId)
export const getTasksForPlant = (tasks=[], plantId) => (
(!plantId)
? tasks
: tasks.filter(task => task.plantId === plantId)
)
export... | true |
0ee133a39eb55e47ae2aedb7fbec93ef9a32382f | JavaScript | angelah1994/holbertonschool-higher_level_programming-1 | /0x13-javascript_objects_scopes_closures/6-square.js | UTF-8 | 490 | 2.765625 | 3 | [] | no_license | #!/usr/bin/node
const square = require('./5-square');
class Square extends square {
constructor (size) {
super(size, size);
}
charPrint (c) {
let charPrint;
if (c && typeof c === 'string') {
charPrint = c;
} else {
charPrint = 'X';
}
for (let row = 0; row < this.height; row++)... | true |
70cf1990faebb69b54f3e1ad66d942396c21db85 | JavaScript | n-bryant/drafty | /src/utils/getWeightedRandomCardId.js | UTF-8 | 778 | 3.59375 | 4 | [] | no_license | /**
* gets a weighted random card id from a list of cards
* @param {Object} cards - a list of cards
* @param {Number} totalWeight - total weight of card weightings
* @returns {String} - a card id
*/
function getWeightedRandomCardId(cards, totalWeight) {
let total = 0;
const cardIds = Object.keys(cards);
cons... | true |
94c3995b78b60ebb90af841baaa628e644686da8 | JavaScript | 123cmp/boxmate | /test/ValidatorTest.js | UTF-8 | 6,228 | 2.515625 | 3 | [] | no_license | var Validator = require("../modules/utils/Validator").Validator,
assert = require("chai").assert,
expect = require("chai").expect;
var conditions = {
"required": {"value": true, "message": "required false"},
"type": {"value": "string"},
"maxLength": {"value": 25, "message": "too long"},
"minLen... | true |
3b07c80382e91fe4ea94c1cb19b3d5da95f0d7be | JavaScript | Thorbur/xkcd-wiki-pwgen | /xkcd-wiki-pwgen.js | UTF-8 | 8,777 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | /***
Generates a easy human memorizable password from random words of a random Wikipedia article.
Idea taken from http://jsfiddle.net/HMJJg/
***/
let ajaxQ = [];
function removeHTMLSection(text, beginIdentifier, baseTag, endTag) {
// NOTE: Could be also done by parsing the input in the DOM, but that would be a... | true |
306160a465e9616c84b1385c349e51eaf5df4a14 | JavaScript | ukeh/assignment2 | /public/js/signup.js | UTF-8 | 1,404 | 3.265625 | 3 | [] | no_license | function validateForm(){
//alert("yoyo");
var firstName=document.getElementById("firstname").value;
var lastName=document.getElementById("lastname").value;
var email=document.getElementById("inputemail").value;
var number=document.getElementById("phone").value;
var check=document.getElementsByNa... | true |
55e44bc2e6fa69b336ebe5a8c668dbcef0093480 | JavaScript | KshitijV97/JavaAss | /TypeScript and Angular/ts_assignments/sum5digit.js | UTF-8 | 200 | 3.734375 | 4 | [] | no_license | var num = 12345;
function sumof5(num) {
var sum = 0;
for (var i = 0; i < 5; i++) {
sum = sum + num % 10;
num = Math.floor(num / 10);
}
console.log(sum);
}
sumof5(num);
| true |