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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
709b71282aa325a507694215d8400bd7f8c6fc9a | JavaScript | Moussi/NodeJsJumpStart | /callbacks/callback.js | UTF-8 | 431 | 2.65625 | 3 | [] | no_license | var fs=require("fs");
var http=require("http");
var text
fs.readFile("input.txt",function (err, data) {
if(err){
console.log("error");
console.log(err);
}else{
console.log(data.toString());
text=data.toString();
}
});
http.createServer(function(request,response) {
response.writeHead(200, {'Content-Type': '... | true |
80becc89dddb58115b1ea6dc44af49936980b55a | JavaScript | TaylorSwanson/DiffSync | /server/modules/Document.js | UTF-8 | 5,110 | 2.734375 | 3 | [] | no_license | /**
* Document object
* @module Document
*/
var dmp = require("./DiffMatchPatch.js");
var throttle = require("./throttle.js");
var Client = require("./Client.js");
var Shadow = require("./Shadow.js");
function Document(originalContent) {
this.content = originalContent || "";
this.syncedShadow = new Shadow... | true |
57590a4ee0da4205b776c8ccf52703e2c8cf40b5 | JavaScript | omegak911/TrackYoScore | /server/database/src/Histories/HistoryCtrl.jsx | UTF-8 | 2,910 | 2.65625 | 3 | [] | no_license | import {
addHistoryHelper,
addUserHistoryHelper,
addConfirmationHelper,
removeUserConfirmationHelper,
addUserConfirmationHelper,
fetchConfirmationHelper,
removeConfirmationHelper,
fetchHistoryHelper,
validateConfirmationHelper }
from './HistoryHelper';
import { updateUserHelper } from '../Use... | true |
d31eececf9177b32720b11f17bd89ef626ea1092 | JavaScript | abu-nofal/FOOD-JO | /queu-hup.js | UTF-8 | 1,910 | 2.578125 | 3 | [
"MIT"
] | permissive | "use strict";
const http = require("http").createServer();
const uuid = require("uuid").v4;
const io = require("socket.io")(http, {
cors: { origin: "*" },
});
const msgQueue = {
orders: {},
};
http.listen(8080, () => console.log("listening on http://localhost:8080"));
const FOOD = io.of("/food");
FOOD.on("conn... | true |
706896c299ec7f4e341261961124c0e877685dfc | JavaScript | TheNova22/algorithms | /leetcode/JavaScript/No441.arranging-coins.js | UTF-8 | 741 | 3.75 | 4 | [] | no_license | /**
* Difficulty:
* Easy
*
* Desc:
* You have a total of n coins that you want to form in a staircase shape,
* where every k-th row must have exactly k coins.
* Given n, find the total number of full staircase rows that can be formed.
* n is a non-negative integer and fits within the range of a 32-bit signed in... | true |
966aaad4244583550ce68b2974687482bba60c33 | JavaScript | shainaveloz/collision-detect | /myapp/public/javascripts/cannonCollisionDetection.js | UTF-8 | 1,588 | 2.984375 | 3 | [] | no_license | var world;
var mass;
var body;
var shape;
var timeStep = 1/60;
var camera;
var scene;
var renderer;
var geometry;
var material;
var mesh;
initCannon();
initThree();
function initCannon(){
world = new CANNON.World();
world.gravity.set(0,0,0);
world.broadphase = new CANNON.NaiveBroadphase();
world.solver.iterat... | true |
e051df67b8b736fc1376575dd4e348350dd94868 | JavaScript | VividLiu/LeeCode_Practice | /Crack_Coding_Interview/46_permutation/permutation_dfs.js | UTF-8 | 1,030 | 3.671875 | 4 | [] | no_license | /**
* dfs: Keep an array of visited.
* If not visited, set visited[i] to true and jadd the current character in existing perm, and go deep.
* when it comes back to the same node back from recursion, remove the character and reset visited[i] to false.
* Time complexity: O(n^n)
* Reference: https://leetcode.com/pro... | true |
482f278509f07e924e4d5364b3a54360aec3a857 | JavaScript | mmarev/Metro-UI-CSS | /source/components/colors/colors.js | UTF-8 | 46,858 | 2.65625 | 3 | [
"MIT"
] | permissive | /* global Metro */
(function(Metro, $) {
'use strict';
var Types = {
HEX: "hex",
HEXA: "hexa",
RGB: "rgb",
RGBA: "rgba",
HSV: "hsv",
HSL: "hsl",
HSLA: "hsla",
CMYK: "cmyk",
UNKNOWN: "unknown"
};
Metro.colorsSetup = function (option... | true |
277eabde57a2ae370fc6974e1087277ffe2f2129 | JavaScript | OscarSantiago45/Curso_Practico_JavaScrip | /figuras.js | UTF-8 | 3,600 | 3.65625 | 4 | [
"MIT"
] | permissive | //Codigo del cuadrado
function PerimetroCuadrado(lado){
return lado*4;
}
function AreaCuadrado(lado){
return lado*lado;
}
//Codigo del Triangulo
function perimetroTriangulo(lado1,lado2,base){
resultado= lado1+lado2+base;
return resultado;
}
function calcularAlturaI(lado1,lado2,base){
if(lado1===... | true |
d9397728d49ff34156159cfaca91f44a79cf21f4 | JavaScript | nitinsh99/nfl-rushing | /client/src/utils.js | UTF-8 | 3,703 | 2.5625 | 3 | [] | no_license |
import React from 'react';
import { Button, Icon, Input } from 'antd';
import { stringify } from 'qs';
import { CONSTANTS } from './constant';
const { PLAYER_API_PATH } = CONSTANTS;
/**
* Util function to add sorting button to select columns in the table
*/
export const addSorterToColumns = (columns = [], column... | true |
033bef8ca2b378dd16a72feba3ea484cf8e87aa2 | JavaScript | MattReisdorf/StageCoach | /routes/api/venueRoutes.js | UTF-8 | 2,444 | 2.609375 | 3 | [] | no_license | const router = require("express").Router();
const { captureRejectionSymbol } = require("events");
const { Venue, Show, Artist } = require("../../models");
const sequelize = require('sequelize');
// get all venues
router.get("/", async (req, res) => {
try {
const venueData = await Venue.findAll();
res.status(... | true |
4f7b3c8e57e6c4fa5c3aa065e2ca8afd630fa5c9 | JavaScript | heliotherapyy/interviewCake | /others/sumCombinations.js | UTF-8 | 1,119 | 3.421875 | 3 | [] | no_license | // elements unique
function findCombinations(array, total){
var result = [];
var cache = {};
var step = findMin(array);
initialize(cache, step, total);
while (step <= total) {
var index = contains(array, step);
if (index === -1) {
step++;
continue;
} else {
if (step === array[index]) {
cache[step... | true |
1dcf3f7e2c35b19c38546c700ccff28cd3b3d5de | JavaScript | nikolaskurniadi/fundamental | /do_while_loop.js | UTF-8 | 226 | 3.28125 | 3 | [] | no_license | var number = 1
do {
if(number % 2 == 0){
console.log(`${number} adalah bilangan GENAP`);
} else {
console.log(`${number} adalah bilangan GANJIL`);
}
number++
} while (number <= 10); | true |
a5d49174b148724c7bb9d3bee63a0beab4c8be1e | JavaScript | CBMVC/CBMVC-Framework-with-Titanium | /Resources/app/modules/util.js | UTF-8 | 5,251 | 2.75 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | /**
* @file overview This file contains the core framework class CBMVC.
* @author Winson winsonet@gmail.com
* @copyright Winson http://www.coderblog.in
* @license MIT License http://www.opensource.org/licenses/mit-license.php
*
* @disclaimer THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "A... | true |
97a4aa305ee7c73732ad74b180b949d85771897c | JavaScript | grant-c-wilhelm/Assignments | /prereact/NPM/example.js | UTF-8 | 116 | 2.5625 | 3 | [] | no_license | var myArray = ['apple', 'balloon', 'car', 'ball']
function myFunction() {
console.log('hello world')
}
| true |
89f10a431388a80b0f0bfdc14f68c3807c628ade | JavaScript | a1044187112/pure | /caoxieOA/js/lib/jchGrid/jsh.jGrid.js | UTF-8 | 148,642 | 2.5625 | 3 | [
"MIT"
] | permissive | ///<reference path="../../typings/jquery/jquery.d.ts"/>
"use strict";
//jch基础类库,实现对JS的扩展
var jch;
(function (jch) {
var Core;
(function (Core) {
//是否为IE浏览器
Core.isIE = !$.support.radioValue;
//是否为IE6,IE7,IE8
Core.isIE678 = !$.support.leadingWhitespace;
//是否为IE6,IE7
... | true |
165babfa0b9760e5e886ed3bbf0232a980a1dfb2 | JavaScript | bombadillo/backbone-skeleton | /js/controllers/home-controller.js | UTF-8 | 5,533 | 2.578125 | 3 | [
"MIT"
] | permissive | app.HomeController =
{
// You can put variables here (controller attributes) which you can use in controller scope
// as follows: "this.variableName".
/*----- Template Demo Specific ------*/
// Object containing required plugins.
oRequiredPlugins:
{
'jQuery': {'test': 'jQuery', 'info': 'A JavaScript fr... | true |
e8b33029178c363930ca2385d8f4eed2efb2e62d | JavaScript | LeoLiangZhang/Priv.io | /lib/sqs.js | UTF-8 | 3,965 | 2.625 | 3 | [] | no_license | function addZero(n) {
return ( n < 0 || n > 9 ? "" : "0" ) + n;
}
var sqs = (function(){
/////////////////// Auth /////////////////////////////////////////////////////
//Date.prototype.toISODate =
// new Function("with (this)\n return " +
// "getFullYear()+'-'+addZero(getMonth()+1)+'-'" +
// ... | true |
0630b4401fda2d36b188c4b654baaab7280a59a0 | JavaScript | chekwube/Node-Blog | /server.js | UTF-8 | 13,302 | 2.8125 | 3 | [] | no_license | // import your node modules
const express = require("express");
const cors = require("cors");
// database helpers
const posts = require("./data/helpers/postDb.js");
const users = require("./data/helpers/userDb.js");
const tags = require("./data/helpers/tagDb.js");
// server.get('/api/users')
// server.get('/api/posts'... | true |
b9cf20954dd3060083d23ef3abec77e27b6fbb9d | JavaScript | davidgomes/pentagine.js | /lib/Animation.js | UTF-8 | 2,314 | 3 | 3 | [
"MIT"
] | permissive | import Sprite from 'Sprite';
class Animation {
options; // .frames, .frameDuration, .x, .y, .game
currentTick;
lastTick;
diffTick;
curFrame;
curSprite;
sprites;
x;
y;
bouncingDirection;
constructor(options) {
this.options = options;
this.curSprite = new Sprite(options.game,
... | true |
3379b1a96cece80293266f5ea0263698a3208a67 | JavaScript | andybateman/MacPhersonMosaic | /js.js | UTF-8 | 814 | 3.171875 | 3 | [] | no_license | var colours = ['Red', 'Green', 'Blue', 'Purple'];
function readyForCount() {
var ul = document.getElementById("countResults");
ul.innerHTML = '';
colours.forEach(function(colour) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(colour + ": " + countColours(colour)));
ul.append... | true |
54f07ced4a2f05b20d6f12accf221c151ddc35b8 | JavaScript | allen-hu-666/rxjs-study-notes | /src/api-demo/observable-ins-method/combine.js | UTF-8 | 1,983 | 3.671875 | 4 | [] | no_license | /**
* @name combineAll 等到主Observable完成后
* public combineAll(project: function): Observable
* http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html#instance-method-concat
*/
//combineAll();
function combineAll() {
//Map two click events to a finite interval Observable, then apply combineAll
var c... | true |
1d9cec96209ef54a15ecc6e01eff25a76646c89f | JavaScript | AAI-USZ/FixJS | /input/100+/after/ed9011dad0518b10b53e0956fde53469b99aa779_2_4.js | UTF-8 | 1,121 | 3 | 3 | [
"MIT"
] | permissive | function(particle){
//check to see if the conditions are right to spawn a particle
decay_energy = 0;
if(this.charge < 0 && ( this.Z != 0 || this.N != 0 )){ //if the charge is negative
if(Math.random() < 0.01){
electrons--;
tempParticle = new nucleotron.Particle(type, 0, 0, 1);
this.spawnParticles(tempPart... | true |
7afb965490daab22d67301806de9f0815259f688 | JavaScript | rulylarios/TriviaGame | /assets/javascript/app.js | UTF-8 | 15,528 | 2.9375 | 3 | [] | no_license |
window.onload = function(){
var correct = 0;
var incorrect;
var unanswered;
$("#time").html("<br>")
$("#question").html("<br>");
//$(".progressBarClass").html("")
$("#a").html("<br>")
$("#b").html("<button>Start</button>")
$("#c").html("")
$("#d").html("")
var questions = {
question1:{
question:"What... | true |
0735ea6e50be18e87088ebc64d10cf1a75290a38 | JavaScript | DNIStream/dni.bot | /app/chatListeners/chatListenerBase.spec.js | UTF-8 | 5,661 | 2.5625 | 3 | [
"MIT"
] | permissive | 'use strict';
const ChatListenerBase = require("./chatListenerBase");
const NotImplemented = require("@errors/notImplemented");
const faker = require('faker');
var theoretically = require("jasmine-theories");
describe("chatListenerBase init()", () => {
let logger;
let actionHandlerResolver;
let messageResolver;... | true |
c7db761376326d9a2cfad02650d52cd556576245 | JavaScript | ihomway/LearningJaveScript | /GettingStarted/es6/math.js | UTF-8 | 1,427 | 3.515625 | 4 | [
"MIT"
] | permissive | // const x = 19.51;
// console.log(x.toFixed(3));
// console.log(x.toFixed(2));
// console.log(x.toFixed(1));
// console.log(x.toFixed(0));
// const x = 3800.5;
// console.log(x.toExponential(4));
// console.log(x.toExponential(3));
// console.log(x.toExponential(2));
// console.log(x.toExponential(1));
// console.log... | true |
a0db69d927eba27f2ba44c7d134a67b7da007b00 | JavaScript | Gperry22/CLI-HANGMAN | /Index.js | UTF-8 | 3,004 | 3.4375 | 3 | [] | no_license | var inquirer = require("inquirer");
var Word = require("./Word.js");
var clear = require("clear");
var guessesLeft;
var lettersGuessed = [];
var randomNumberToPickWord;
var randomWordChosen;
var hintForUser;
var currentWord;
var wordBank = [
"bug",
"dove",
"snake",
"donkey",
"pitbull",
"e... | true |
3af6fd5f1c4d8d058701a64b2e8c2cbbc90a7a93 | JavaScript | finsyn/swedish-finance-strings | /format.spec.js | UTF-8 | 650 | 2.75 | 3 | [
"MIT"
] | permissive | const { fixedStr } = require('./format')
const t = require('tap')
t.test('should generate fixed-length left aligned strings', t => {
const strings = [
['hejsan', 'he...'],
['SEK' , 'SEK '],
[' hej' , ' hej'],
['a' , 'a ']
]
strings.forEach(([input, ans]) => {
t.equals(fixedStr(i... | true |
5f4bf750ad71b4d9090d75cc2004a4c280c01cfa | JavaScript | yasmenmohamed00/Javascript-Apps | /Notes-App/app.js | UTF-8 | 3,097 | 3.5 | 4 | [] | no_license | //Define UI Vars
let list = document.querySelector('.list');
let addItem = document.querySelector('#add');
let noteDate = document.querySelector('.date');
let body = document.querySelector('body');
loadEventListener();
// Load all Event Listeners
function loadEventListener() {
// Add a new note by clicking the pl... | true |
747c3e62e4020194a3874ecfe70fe66d0f733197 | JavaScript | sharadJay/datastructures-algorithms-javascript | /datastructures/Queues/queuesUsingString.js | UTF-8 | 1,027 | 3.484375 | 3 | [] | no_license | function Queue() {
this.storage = "";
}
Queue.prototype.enqueue = function (value) {
if (!value) return;
this.storage = this.storage.concat(`${value},`);
};
Queue.prototype.dequeue = function () {
if (this.count() > 0) {
var indexOfDelimiter = this.storage.indexOf(",");
var elementToBe... | true |
e1369c9010c63b19d30996005fa91172859135e5 | JavaScript | ritagouveia22/react-weather-app | /src/Header.js | UTF-8 | 2,648 | 3.234375 | 3 | [] | no_license | import React, { useState } from "react";
import axios from 'axios';
import "./Header.css"
export default function Header() {
let [city, setCity] = useState("Lisbon")
let [temp, setTemp] = useState(null)
let [dayOfWeek, setDayOfWeek] = useState(null)
let [month, setMonth] = useState(null)
let [day, setDay] ... | true |
e7576fc647047b8977ee91bdb50879099421cc68 | JavaScript | kunRoja/Cypress-Automation-Framework | /cypress/integration/webdriver-ui/js-Alert.js | UTF-8 | 2,602 | 3.078125 | 3 | [] | no_license | /// <reference types="cypress"/>
describe(" Handling js alerts " ,() => {
it("Scenario1 - confrim js alert contains correct text ",()=> {
cy.visit("http://www.webdriveruniversity.com/")
cy.get('#popup-alerts').invoke('removeAttr','target').click({force : true})
cy.get('#button1').click()
... | true |
a4277c755972182a0cc4107706549c0e1dabb282 | JavaScript | JuKad/vanilla-weather-app | /script.js | UTF-8 | 3,073 | 3.578125 | 4 | [] | no_license | function formatDate(timestamp){
let date= new Date(timestamp);
let hours = date.getHours();
if (hours < 10) {
hours = `0${hours}`;
}
let minutes = date.getMinutes();
if (minutes < 10) {
minutes = `0${minutes}`;
}
let days = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Fri... | true |
fdfe58b86ee918d8a2ba3922785555c61c81169a | JavaScript | conorcussell/exercises | /value/index.js | UTF-8 | 234 | 3.171875 | 3 | [] | no_license | function value(arg) {
var val = arg;
while (!isValue(val)) {
val = val();
}
return val;
}
var isValue = function(val) {
return !!(val && typeof val === 'number' || typeof val === 'String');
}
module.exports = value;
| true |
6b74d59778696eb7cc2200b9a1eb4d8c50d77c19 | JavaScript | Sahil-N/Inventory-manager | /index.js | UTF-8 | 1,307 | 2.703125 | 3 | [
"MIT"
] | permissive | var mysql = require('mysql');
var inquirer = require('inquirer');
var Table = require('easy-table')
var connection = mysql.createConnection({
host : 'localhost',
port : 3306,
user : 'root',
password : 'password',
database : 'marketplace'
});
function start() {
var query = connection.query('s... | true |
d6637f4657651f3d36453c6306f4fffffd31ca24 | JavaScript | Amit16110/Dsa | /Array/RotateArray.js | UTF-8 | 467 | 4.09375 | 4 | [] | no_license | // Method 2 efficient take less space but not so efficient.
const leftRotate = (arr, n, d) => {
for (let i = 0; i < d; i++) {
leftRotateByOne(arr, n);
}
return arr;
};
const leftRotateByOne = (arr, n) => {
let temp;
temp = arr[0];
for (let i = 0; i < n - 1; i++) {
arr[i] = arr[i + 1];
}
arr[n... | true |
64a9e697f00215f28474e4ad1242956eea41ebe8 | JavaScript | Jomsou/FE-Learning-Note | /路线篇/数据结构与算法/01-基础数据结构、排序与查找/03-基础数据结构的应用/01-数制转换.js | UTF-8 | 749 | 3.765625 | 4 | [] | no_license | var Stack = require('../data-structures/02_Stack');
/***
* 利用栈来做数制转换
* @param number 待转换的数字,十进制数
* @param base 要转换成的进制(10进制以内)
*/
var numericalTransform = function (number, base) {
if (typeof number !== 'number' || typeof base !== 'number') {
console.log('Parameter error!');
return -1;
... | true |
d89de675750ce5298e3f53022bd9b6ac0a5120c8 | JavaScript | babiesinspace/JavaScript-practice | /Github-Api/script.js | UTF-8 | 1,160 | 2.921875 | 3 | [] | no_license | let myHandle = $("#handle")
let myAvatar = $("#avatar")
let repoList = $("#repos")
let followerList = $("#followers")
$.ajax({
url: "https://api.github.com/users/babiesinspace",
success: function(response){
$(myHandle).text(response.login)
$(myAvatar).attr("src", response.avatar_url)
repoList = respons... | true |
7ea40249dffcecb551ce3a7aea4dcbebe9f1a7ff | JavaScript | ChrisHAdams/youtube-jukebox | /src/javascript/__tests__/cleanse-string.test.js | UTF-8 | 732 | 2.734375 | 3 | [
"MIT"
] | permissive | import CleanseString from '../cleanse-string';
test(`Cleanse String should replace & with & `, () => {
expect(CleanseString('Adam & the ants')).toBe('Adam & the ants')
})
test(`Cleanse String should replace " with ' `, () => {
expect(CleanseString('String containing "quoted string".')).toBe... | true |
0740eaa14f946cea71760bb182a53ee1d5b495c7 | JavaScript | snehal1791/cat-clicker-with-knockout | /js/app.js | UTF-8 | 2,355 | 3.078125 | 3 | [] | no_license | var initialCats = [
{
clickCount: 0,
name: 'Tabby',
imgSrc: 'img/4154543904_6e2428c421_z.jpg',
imgAttribution: 'Flickr',
nicknames: ['Smiley']
},
{
clickCount: 0,
name: 'Kitty',
imgSrc: 'img/434164568_fea0ad4013_z.jpg',
imgA... | true |
fc73e53acb1ceb382e4063e31b9b55e1db86054d | JavaScript | alexsharabayko/diploma | /js/field.js | UTF-8 | 2,271 | 2.640625 | 3 | [] | no_license | var app = app || {};
(function () {
var template = document.q('#field-template', true).innerHTML,
objTemplate = '<div class="obj"></div>';
var Field = function (count, radius, wrapper) {
wrapper.innerHTML = template;
Object.defineProperties(this, {
wrapper: {
... | true |
2b7c8c0e6ade2aa6e655eeec3b386a85717cbb5b | JavaScript | anahit9975/my-progect | /public/script.js | UTF-8 | 1,666 | 3.0625 | 3 | [] | no_license | var socket = io.connect('http://localhost:3000');
socket.on('matrix', gcel)
socket.on('nerkir', colors)
function setup() {
n = 30;
side = 30;
frameRate(2);
createCanvas(n * side, n * side);
}
function gcel(matrix) {
// console.log(count);
for (var j = 0; j < matrix.length; j++) {
fo... | true |
a33bcdf876e628520dc946c0f62e5e35ea9842e2 | JavaScript | ianarawjo/lcalcgame | /src/frame/reductstage.js | UTF-8 | 4,830 | 2.90625 | 3 | [] | no_license | /** A subclass of Stage that assumes Nodes are Expressions
and allows for saving state. */
class ReductStage extends mag.Stage {
constructor(canvas=null) {
super(canvas);
this.stateStack = [];
this.environment = new Environment();
}
// Save state of game board and push onto undo... | true |
f23c0e8f90ea2b3c81183ea0be5031e813177b60 | JavaScript | HristoNakov13/SoftUni-Javascript | /Essentials/Objects&DOM/03. Number-Convertor/solution.js | UTF-8 | 1,671 | 3.28125 | 3 | [] | no_license | function solve() {
let ELEMENTS = {
numberInput: document.getElementById("input"),
selectMenuConvertTo: document.getElementById("selectMenuTo"),
convertBtn: document.getElementsByTagName("button")[0],
result: document.getElementById("result"),
};
let binaryOption = createCon... | true |
696dacb1681ff896bbd50cfe8b32d778200bde0f | JavaScript | ggguille/tNodeJsMC-Assignment-2 | /lib/server/httpServer.js | UTF-8 | 1,897 | 2.78125 | 3 | [] | no_license | /**
* HTTP Server Builder
*/
'use strict';
// Dependencies
const http = require('http');
const https = require('https');
const HandlerManager = require('./httpRequestHandler').HandlerManager;
class HttpServer {
constructor(id, handlerManager, ssl = null) {
this.id = id;
this.handlerManager = han... | true |
5345144639ffb651f0d17b7f5db5fce6afb471f6 | JavaScript | BenDev33/JavaScript_Library | /4-loops/01-forLoops.js | UTF-8 | 619 | 3.75 | 4 | [] | no_license | // for (var i = 0; i < 10; i++) {
// console.log(i)
// }
// Challenge by 2's
// for (var i = 0; i < 21; i+=2) {
// console.log(i)
// }
// Challenge from 10 to 0
// for (let i = 10; i >= 0; i--) {
// console.log(i)
// }
// Challenge from 0 to -24 by 2's
// for (let i = 0; i >= -24; i-=2) {
// console.... | true |
e457f9c1256bcb388d1b31ac3517846ff0776551 | JavaScript | shoesCodeFor/TriviaJS | /assets/js/app.js | UTF-8 | 3,636 | 3.5 | 4 | [] | no_license | /**
* X-Files trivia game - By Schuyler Ankele
*/
var seconds;
var intervalID;
var qNumber = 0;
var correct = 0;
var incorrect = 0;
var currentQuestion;
var gameover = false;
var timerLength = 20;
// Application flow
// Intro - Switch Backgrounds
// User clicks start (startGame) startTimer
const startGame = ()=>{... | true |
d988150f2f5657be9d8f8fd229ea0a7bf8d4f7dd | JavaScript | SophieMdl/manage-favorites-restaurants | /client/js/tab-filter.js | UTF-8 | 352 | 2.921875 | 3 | [
"MIT"
] | permissive | const itemsFilter = document.getElementsByClassName('item-filter')
for (let item of itemsFilter) {
item.addEventListener('click', (e) => {
for (let item of itemsFilter) {
if (item.classList.contains('active')) {
item.classList.remove('active')
}
}
const that = e.currentTarget
that... | true |
a292af22309372514d99d992db60fd56087c8562 | JavaScript | paulywh/adminconfig | /portal/js/login.js | UTF-8 | 274 | 2.640625 | 3 | [] | no_license | function checkattr()
{
var username = $("#username").val();
var password = $("#assword").val();
if(!/^[A-Za-z0-9]+$/.test(username) || !/^[A-Za-z0-9]+$/.test(password)){
alert("请输正确的用户名密码");
return false;
}
return true;
}
| true |
1c22fdff1b1b7f51ec705a7ee6ca909172bf9764 | JavaScript | theguriev/mind-maps-ext | /src/fe/src/utils/clockIndex.js | UTF-8 | 2,042 | 2.921875 | 3 | [] | no_license | export const RIGHT_SIDE = 1
export const LEFT_SIDE = -1
export const UP_SIDE = 10
export const DOWN_SIDE = -10
export const HAVHE_CHILDREN = 100
export const NO_CHILDREN = -100
/**
* Calculating clock index. This is to prevent use to much Switch cases or if's.
*
* 11 = Right side up.
* 9 = Left side up.
* -9 = Ri... | true |
dd4e0f61d8be62eb74c2b399267a3be4f45a5d8e | JavaScript | hezaltin/typescript-project | /dist/basics.js | UTF-8 | 412 | 3.6875 | 4 | [] | no_license | "use strict";
function add(num1, num2, showresultPrint, resultText) {
const addNumber = num1 + num2;
if (showresultPrint) {
return resultText + addNumber;
}
else {
return addNumber;
}
}
const number1 = 5;
const number2 = 3.4;
const printResult = true;
const resultPrint = 'The Result ... | true |
7aece155960e4e45e68f5bd6b2a3ef1e1f4d2b3c | JavaScript | timjacksonm/Battleship | /src/Components/Home/index.js | UTF-8 | 2,372 | 2.71875 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from 'react';
import Grid from '../Grid';
import Gameboard from '../../Data/Gameboard';
import { getRandomPlacements } from '../../Helpers/helpers';
import './index.css';
const player = Gameboard('Player1');
const computer = Gameboard('Computer');
const {
submarine1,
submarine2... | true |
2d7605fe8dd17aaff4e4ccb328d825d0e92fdcf0 | JavaScript | baurine/rxjava-study | /other-langs/stream.js | UTF-8 | 510 | 4.09375 | 4 | [] | no_license | // simple
let r = [1,2,3,4,5,6,7,8,9].filter(i=>i>5).map(i=>i*10).reduce((a,b)=>a+b, 0)
console.log("Final result: " + r)
// log
r = [1,2,3,4,5,6,7,8,9]
.filter(i => {
console.log("Filter: " + i + " > 5 --> " + (i > 5))
return i > 5
})
.map(i => {
console.log("Map: " + i + " * 10 --> " + ... | true |
51ac54651d96f71ab01b8672ff432da5b5953a29 | JavaScript | hechtoid/my-full-stack | /frontend/components/artist/artist_add.jsx | UTF-8 | 4,093 | 2.578125 | 3 | [] | no_license | import React from 'react';
import { withRouter } from 'react-router-dom';
class ArtistAdd extends React.Component {
constructor(props) {
super(props);
this.state = {
artist_name: this.props.location.state ? this.props.location.state.artist_name : '',
date_released: '1973',
... | true |
cfe2265ee5bef42dd22542c76b1556633e037e78 | JavaScript | qh4r/nodeFun | /lololodash/p7.js | UTF-8 | 538 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | var _ = require('lodash');
var worker = function(items){
var output = [];
_(items).reduce(function(sum, item, key){
if(!sum.length){
var out = [];
out[sum.article] = sum.quantity;
sum = out;
}
sum[item.article] = sum[item.article] || 0;
sum[item.article] += item.quantity;
return sum;
})
.map(functio... | true |
1721b8d9d562bcd8b7b9e67f4d896386e036ee1b | JavaScript | LINCREy/myapps | /dist/js/app.js | UTF-8 | 536 | 2.609375 | 3 | [] | no_license | var module1;
(function (module1) {
var foo = /** @class */ (function () {
// JQueryオブジェクトを受け取る
// Jは大文字
function foo(element) {
this.element = element;
}
// 色を変更する
foo.prototype.color = function (color) {
this.element.css('color', color);
... | true |
da62317ba3fea397db38db1a4c61cb525ad115b1 | JavaScript | milemu23/Munksgard_Michelle_WPF | /Functions/Function Invocation/js/script.js | UTF-8 | 289 | 3.5625 | 4 | [] | no_license | //Functions - Function Execution
function outptMsg(){
console.log("Hello World!");
}
function calcArea(){
var width = 20;
var height = 30;
var area = width * height;
console.log(area);
}
//call a function to be used
calcArea();
outptMsg();
calcArea();
calcArea(); | true |
1af469222409352aa8f1f698d177dfbb8134ce95 | JavaScript | Kasemer/colorclick | /colorClick.js | UTF-8 | 1,361 | 3.3125 | 3 | [] | no_license |
// let body =document.querySelector(".body");
// let button =document.querySelector('button');
// button.onClick=function() {
// body.classList.remove('purple');
// }
// let body =document.querySelector('.body');
// let button =document.querySelector('button');
// button.onclick = function() {
// body.classList.t... | true |
7a2f43659d99fc4b612dbe832336e076405b07b7 | JavaScript | dancojocar/exam0206a | /server/src/index.js | UTF-8 | 3,638 | 2.625 | 3 | [] | no_license | const Koa = require('koa');
const app = new Koa();
const server = require('http').createServer(app.callback());
const WebSocket = require('ws');
const wss = new WebSocket.Server({server});
const Router = require('koa-router');
const cors = require('koa-cors');
const bodyparser = require('koa-bodyparser');
app... | true |
1491eb94c833f00559fcc973f055f66fb837c107 | JavaScript | siddhuth/login-register | /public/js/controllers/profileController.js | UTF-8 | 3,701 | 2.78125 | 3 | [] | no_license | function ProfileController() {
// bind event listeners to button clicks //
var that = this;
this.attemptLogout = function () {
$.ajax({
url: "/logout",
type: "POST",
data: {logout: true},
success: function (data) {
window.location.href... | true |
c05b801e448d866b4e58bf0034e157f812e7ec83 | JavaScript | joseenrique-dev/challange-weather-app | /src/services/getDays.js | UTF-8 | 704 | 3.296875 | 3 | [] | no_license |
/**
* Get most recent 5 days from list.
*
* @param {Array} listForecast
*/
const getDays = listForecast => {
let arrayDays = []
if( listForecast.length !== 0 ){
let lastDate = listForecast[0].dt_txt.split(" ")[0]
for(let i = 0; i < listForecast.length; i++){
let val... | true |
b2716c337552ee470a9632959b9cb176397eef2d | JavaScript | vexleet/JS-Core | /JS-Fundamentals/Strings-And-Regex/RestaurantBill-06.js | UTF-8 | 429 | 3.359375 | 3 | [] | no_license | function solve(array) {
let products = [];
let productPrices = 0;
for(let i = 0; i < array.length; i++){
if(i % 2 === 0) {
products.push(array[i]);
}
else{
productPrices += Number(array[i]);
}
}
console.log(`You purchased ${products.join(', '... | true |
7f0973a732f356e4d53de450ca8f2b150766ab97 | JavaScript | nikolasagl/test-dev | /public/assets/js/$_main.js | UTF-8 | 6,046 | 2.578125 | 3 | [] | no_license | $(document).ready(function() {
setTable()
$.get("marcas", function(data) {
var options = ''
$.each(data, function(key, value) {
options += '<option value="'+value.id+'">'+value.nome+'</option>'
})
$('.select-marca').append(options)
})
$('#cadastrar-btn').on('click', function() {
c... | true |
f3b542d977ac0b722fe5fdb8745f39b03197b35c | JavaScript | eddycaldas/movie-crud | /public/edit.js | UTF-8 | 1,154 | 2.828125 | 3 | [] | no_license | $(() => {
const id = getIdFromQuery();
getOne(id)
.then(newMovie => {
console.log(newMovie)
$('#img').attr('src', newMovie.url);
$('#url').val(newMovie.url);
$("#title").val(newMovie.title)
$('#director').val(newMovie.director);
$('... | true |
b1892cb97e39faec71d5eaf228d711381f597dc5 | JavaScript | wfh-plink/plink | /main/packages/redux-toolkit-observable/es/resource-map.js | UTF-8 | 1,978 | 3.09375 | 3 | [
"MIT"
] | permissive | /**
* The place to store Redux-toolkit unfriendly objects
*
* 1. When we design state structure, remember immerJS (depended by Redux-toolkt) does not perform well on
* complicated object,
* ideally we only put "data" in Redux store, including string, number, boolean, Map, Set, and array/object of them,
* ImmerJS ... | true |
92d771941258a929e968e9d6bf881074254ca227 | JavaScript | Jaciky/topic-circle | /js/guid-page/index.js | UTF-8 | 397 | 2.59375 | 3 | [] | no_license | $(function(){
//导航切换
var nd_nav = $(".J_nav");
nd_nav.on("click","li",function(){
navTab($(this));
})
})
/**
* navTab 导航切换方法
* cur 当前dom
*/
function navTab(cur){
if(!cur.hasClass("active")){
cur.parents().find("li").removeClass("active");
cur.addClass("active");
$("section.mt98").hide();
$("se... | true |
86f89350d894f1b4e44266ea2cd65f9150ebd24c | JavaScript | 1823yangxiaoyun/demo-node | /07-module/02-export-var.js | UTF-8 | 273 | 2.6875 | 3 | [] | no_license | #!/usr/bin/node
function circle (radius){
function area(){
return Math.PI*radius*radius;
}
function circumference(){
return 2*Marh.PI*radius;
}
return {
area: area,
circumference:circumference
}
}
console.dir(module);
module.exports=circle;
| true |
b637a6eebb692ed8c37c57d93141b6a553aec668 | JavaScript | cienbiswas/p5-Projects | /Snake/scripts/sketch.js | UTF-8 | 4,724 | 3.125 | 3 | [] | no_license | let rgb;
let snake;
let scl;
let food;
let movingSpeed;
let difficulty;
let difficultySpeed;
let accelerationInterval;
let easyB;
let mediumB;
let hardB;
let highScore;
let waitingForKey;
let gameRunning;
function setup(){
createCanvas(600, 600);
rgb = 51;
scl = 20;
setDifficulty(2);... | true |
7aa445dfd8b810e2f684074ee18455c6282899c6 | JavaScript | luddepantzar/Qbena-apartment | /formEN.js | UTF-8 | 2,095 | 2.8125 | 3 | [] | no_license | function validateForm() {
var name = document.getElementById('name').value;
if (name == "") {
document.getElementById('status').innerHTML = "You need to enter a name.";
return false;
}
var email = document.getElementById('email').value;
if (email == "") {
document.getElemen... | true |
bae06499b95778afc58fb992a883c26555349013 | JavaScript | oluwadareseyi/the-shoppies | /src/pages/home.jsx | UTF-8 | 8,048 | 2.546875 | 3 | [] | no_license | import axios from "axios";
import React, { useEffect, useState } from "react";
import useDebounce from "../hooks/useDebounce";
import Loader from "../components/loader";
import useLocalStorage from "../hooks/useLocalStorage";
import { Link } from "react-router-dom";
const Home = () => {
const [titleInput, setTitleIn... | true |
1ed44656fad75b702c4c8233bcec70d0e9138e9e | JavaScript | nkartovskaya/nkartovskaya.github.io | /js_main/lesson6/task1_extra/js.js | UTF-8 | 1,050 | 4.34375 | 4 | [] | no_license | /**
Sortirovka puzyr'kom
*/
//creating array
var array = [1, 6, 2, 89, 51, 32, 46, 0, 1, 0, 2, 10];
//creating function for sorting array
function sortBubble(array) {
//defining variable temp for exchange items
var temp = 0;
//loop for decreasing part of array, which is checked
for (var i = 0; i < a... | true |
95f57279a60a8540a67fbf09c0cf8a2b0a55b0b9 | JavaScript | SimonHlf/xcxLng | /pages/driverQz/filter.js | UTF-8 | 2,590 | 2.53125 | 3 | [] | no_license | const app = getApp();
const util = require('../../utils/util');
Page({
data : {
jzType : '',
jzYear : '',
wage : '',
jzTypeArr : ["A1","A2","A3","B1","B2","C1","C2","C3","C4","D","E","F","M","N","P"],
jlYear : [
{"id" : "1-3","name" : "1-3年"},
{"id" : "3-5","name" : "3-5年"},
{"id" : "5-10","name" : ... | true |
f0d60888b6cd02fe726791f919ae56811ea0a351 | JavaScript | jeremypokeefe/markdown2scorm | /assets/libscorm/library/template/DebugConsole.js | UTF-8 | 2,976 | 2.78125 | 3 | [] | no_license | "use strict";
/*jslint browser: true */
function DebugConsole(iconDiv, showDebugLines, errorImg) {
this._iconDiv = iconDiv;
this._logDbg = showDebugLines;
this._errorImg = errorImg;
this._wnd = null;
this._visible = false;
this._lines = [];
this._hasErr = false;
if(this._iconDiv !== nu... | true |
ef3c1ddba1357700f67f151ce0e5414cb15df75c | JavaScript | Rtheodor/apinodejs | /src/app/controllers/PerfilController.js | UTF-8 | 2,611 | 2.515625 | 3 | [] | no_license | import * as Yup from 'yup';
import bcrypt from 'bcryptjs';
import User from '../models/User';
import config from '../../config/config';
class PerfilController{
async show(req, res){
User.findOne({_id: req.userId }, '_id emailTutor namePet createdAt updatedAt fileName').then((user) => {
var url... | true |
4999fb0fd67265846631382ba0a31348702060dd | JavaScript | Bumsykool/bootcamp1 | /app/library2.js | UTF-8 | 467 | 2.625 | 3 | [] | no_license | module.exports = {
findMinMax : function (arr) {
var res = [];
var len_min = arr.length,len_max = arr.length, min = Infinity, max = -Infinity;
while (len_min--) {
if (arr[len_min] < min) {
min = arr[len_min];
}
}
res[0] = min;
while (len_max--) {
if (arr[len_max] > ma... | true |
12c8594a743ac77a6615382bf0b7e00ed40baea1 | JavaScript | albert85/Population-Management-System | /server/src/models/city.js | UTF-8 | 802 | 2.609375 | 3 | [
"MIT"
] | permissive |
module.exports = (sequelize, DataTypes) => {
const City = sequelize.define('City', {
name: {
type: DataTypes.STRING,
allowNull: false,
},
males: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
},
females: {
type: DataTypes.INTEGER,
allowNul... | true |
508739e05c9058a980a7cd0eb11f1191341d7ced | JavaScript | idmontie/nft-examples | /packages/nfts/test/Color.test.js | UTF-8 | 2,784 | 2.640625 | 3 | [] | no_license | const { expect } = require('chai');
const Color = artifacts.require('./Color.sol');
contract('Color', (accounts) => {
let contract;
before(async () => {
contract = await Color.deployed();
});
describe('deployment', () => {
it('deploys successfully', async () => {
const ad... | true |
71560469d6b7768d1b752a558da0f20936060310 | JavaScript | robertkoszegi/sei-42-by-topic | /reactJs/tutorials/sei-cafe-5-events/completed_code_alternate/sei-cafe/src/components/OrderDetail/OrderDetail.jsx | UTF-8 | 1,099 | 2.609375 | 3 | [] | no_license | // When using JSX, React must be in scope
import React from 'react';
import LineItem from '../LineItem/LineItem';
function OrderDetail(props) {
// this is a normal javascript comment intended to inform you that
// you can do calculations and do normal javascript ABOVE the return statement!
let todaysDate = (new ... | true |
e60c56db915b70947ff7f205e73d412f2be01a2c | JavaScript | BlinkZF/Es6 | /es6/1-3章节/2-spreedrest.js | UTF-8 | 2,887 | 3.859375 | 4 | [] | no_license | // function sum() {
// console.log(arguments);
// let arg = Array.prototype.slice.call(arguments,0);
// let arg1 = [].slice.call(arguments,0);
// let arg2 = arguments.slice(0)
// // 这里的[] == Array.prototype;
// // 这里的slice.call()的方法,是截取数组
// console.log(arg)
// console.log(arg1)
// ... | true |
c3ab80d5e3c9c80965783c7b4dfd71aedce49c0f | JavaScript | koenongena/advent-of-code-2020 | /day19.js | UTF-8 | 2,603 | 2.90625 | 3 | [] | no_license | import {readLinesForDay} from "./fetchFile.js";
import R from 'ramda';
import {parseInteger} from "./utils/numbers.js";
const collapseDoubleSpaces = R.pipe(R.trim, R.replace(/ +/g, ' '));
const mapRule = (s) => {
const [id, specification] = R.split(": ")(s);
return {id: parseInteger(id), specification: R.repl... | true |
f6980d96680af71daf044796c379fa78f1f47ad1 | JavaScript | saggie/webpad | /public/js/loader.js | UTF-8 | 1,239 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | const loader = (() => {
const contents = document.getElementById('contents');
const clearContents = () => {
while (contents.firstChild) {
contents.removeChild(contents.firstChild);
};
};
const loadText = async id => {
return fetch('__articles/' + id)
.then(res => res.text());
};
c... | true |
434b3e7702b89646d7b8ca9efc5612e66afc76a2 | JavaScript | garethfentimen/hanoibox | /app/commands/category/dataCleaner.js | UTF-8 | 515 | 2.578125 | 3 | [] | no_license | 'use strict';
let dataCleaner = function () {
let guaranteeNumber = (value) => {
if (Number.isNaN(value) || typeof value === 'string') {
return parseInt(value, 10);
}
else {
return value;
}
}
return {
cleanseCategory: (data) => {
... | true |
bf7db65e6ec2142507baf8baa0ef6765ae45da0b | JavaScript | Mikkelmbk/Firebase-Todo-App | /assets/js/auth.js | UTF-8 | 5,724 | 2.8125 | 3 | [
"MIT"
] | permissive | // Login section starter
const loginForm = document.querySelector('#login-form');
let formErrorMessage = document.querySelector('.form-error-message');
loginForm.addEventListener('submit', (event) => {
event.preventDefault();
formErrorMessage.innerHTML = "";
const email = loginForm.Email.value;
const password = log... | true |
e2b95b0aac969b866bef7ff54d1f6a853b50b195 | JavaScript | Dadinel/pt.stackoverflow.com | /js/440964/fs_open_read_file_utf8.js | UTF-8 | 271 | 3.15625 | 3 | [] | no_license | const fs = require('fs');
const contents = fs.readFileSync('myfile.txt', 'utf8');//permitir ler o arquivo desejado
const matches = contents.match(/\n/g);//identifica o '\n' no arquivo
const count = matches.length;//indica a qtd de '\n' no arquivo
console.log(count);
| true |
3a0a3baf3f951bf5a96f354a9fec8d155289e276 | JavaScript | cesutherland/GhostTrain | /lib/send.js | UTF-8 | 3,117 | 2.578125 | 3 | [] | no_license | var Request = require('./request');
var Response = require('./response');
var parseURL = require('./url').parse;
var each = require('foreach-shim');
/**
* Called from `GhostTrain#send`, makes the request via the routing service.
* Takes a verb, url, optional params, and a callback that passes in an `err` object
* a... | true |
98234d1d1203b001c88f00078b51c04a23eec954 | JavaScript | leonxlin/botcity | /bot.js | UTF-8 | 2,727 | 3.03125 | 3 | [] | no_license | function Bot () {
}
Bot.prototype.setCell = function(cell) {
if (this.cell) {
this.cell.content = null;
}
cell.content = this;
this.cell = cell;
}
Bot.prototype.place = function(cell) {
this.pic = new Kinetic.Group({
x: cell.center().x,
y: cell.center().y,
rotationDeg... | true |
0f736fc81db22bb388d4cde52084b66924672905 | JavaScript | rosele13/lab-react-ironcontacts | /starter-code/src/App.js | UTF-8 | 2,953 | 2.890625 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Actor from './Actor';
import Actors from './contacts.json';
class App extends Component {
state = {
Actors: Actors,
filteredActors : Actors.slice(0,5)
}
//get a random actor from the total Actor list
addRandom = (()=>{
var randomIn... | true |
c48a56a6302dffc27b567c522858bb1a3636d955 | JavaScript | YESEUL-SUH/MiniProject | /Mini_Project/WebContent/js/validCheck.js | UTF-8 | 1,575 | 3.796875 | 4 | [] | no_license |
//일반적으로 유효성 검사를 하는 매서드
//함수 형태로 정리해서 쓰기위해 만듬
//.jar(lib)
//범용적으로 사용 해야 하기 때문에 문제가 있을 때 반환 값을 true로 해야한다.
function isEmpty(input) {
return !input.value; // 값이 없음을 나타냄
}
// <input>, 글자 수(최소 글자수보다 적으면 true)
function lessThan(input, len){
return input.value.length < len;
}
//<input>을 넣으면 : a12ㅋb23
... | true |
be63d49e40d34697209c8dcd9a3ae8ca77cc3623 | JavaScript | oscarsalomon89/RestApp-MEAN | /routes/users.js | UTF-8 | 2,028 | 2.671875 | 3 | [] | no_license | var User = require('../models/user');
var bcrypt = require('bcrypt-nodejs');
/* GET users listing. */
exports.store = function(req,callback){
if(req._id == null){
//Inserta
//encriptacion del password
var salt = bcrypt.genSaltSync();
var password_hash = bcrypt.hashSync(req.password,salt);... | true |
cf7f756e34f78747f79f951bc4b399a42ea3d4c0 | JavaScript | vibertthio/beact | /src/utils/animations/patatap/moon.js | UTF-8 | 3,041 | 2.75 | 3 | [
"MIT"
] | permissive | import {
TWO_PI,
min,
lerp,
} from 'config/animation.config';
/**
* Animation #19, Moon
* @param {objct} Two
* @param {object} two instance of two
* @param {object} TWEEN the library for tweening
* @param {object} colors color palette
* @param {array} animations It's the stack of animations
* @param ... | true |
04ed1aaa6bd3c5a0b1ff7c906046ea9a619f40ce | JavaScript | khaot0m/apps | /DontReact/my-app/src/reducers/hacDetailsReducer.js | UTF-8 | 507 | 2.59375 | 3 | [] | no_license |
const initialState ={
fetchingData :true,
hackDetails :[]
}
const detailsReducer = (state=initialState, action) =>{
switch(action.type){
case "DETAILS_FETCH_CALL":{
return { ...state,
fetchingData : true
}
}
case "DETAILS_FETCHED":{
return {
... | true |
c534a011e953e4608a6135684b796c4605f5cb77 | JavaScript | Cyclokitty/hackreactorprep | /module1/removeNumbersLargerThan.js | UTF-8 | 275 | 3.65625 | 4 | [] | no_license | function removeNumbersLargerThan(num, obj) {
for (var item in obj) {
if (obj[item] > num) {
delete obj[item];
}
}
return obj;
}
var obj = {
a: 8,
b: 2,
c: 'montana'
};
removeNumbersLargerThan(5, obj);
console.log(obj); // --> { b: 2, c: 'montana'
| true |
0a23c568315b3ae5ca581d1c59a27aecc9ea5013 | JavaScript | sxia1/SoftDev02 | /09_svg/svg01.js | UTF-8 | 962 | 2.984375 | 3 | [] | no_license | var pic = document.getElementById("vimage")
var prevX = -1;
var prevY = -1;
pic.addEventListener('click', function(e){
var x = e.offsetX;
var y = e.offsetY;
console.log(x, y);
//CIRCLE
var c = document.createElementNS(
"http://www.w3.org/2000/svg", "circle");
c.setAttribute("cx", x);
c... | true |
c626538ec1960b9c0b5a69f7a19f3040a4b802ab | JavaScript | Dsx875438615/MD-don-t-step-white | /js/play.js | UTF-8 | 2,974 | 3.203125 | 3 | [] | no_license | var clock=null;//定时器操作
var state=0;//0初始化 1暂停 2失败
var speed=10;
/*
初始化
*/
function init(){
for(var i=0;i<4;i++){
crow();//预留最后一行没有黑块,不然刚开始就over了
}
$('main').onclick=function(ev){
judge(ev);
}
}
/*
judge
*/
function judge(ev){
if(state == 2){
alert('你已经输啦');//输了之后不能再点
... | true |
ca1fad51980f6aec050c0ef8184cf4d3ae19a63b | JavaScript | mmiahASC4/mohinur | /userApi - Copy.js | UTF-8 | 316 | 2.625 | 3 | [] | no_license | const userURL = "https://randomuser.me/api/"
function setup (){
$.getJSON(userURL,
// print user's name
function (data) {
console.log(data.results[0].name.first)
// $('body').append ('<h1>Users name is.</h1>')
}
)
}
$(document).ready(setup)
| true |
edd5c8fa7b376a040cead664d5fa8b71aa5b7e0c | JavaScript | pallavi17bhatt/js-playground | /AutocompleteWithJavaScript/js/app.js | UTF-8 | 424 | 2.9375 | 3 | [] | no_license | function billingFunction(){
var billingName=document.getElementById('billingName');
var billingZip=document.getElementById('billingZip');
var isAddressSame=document.getElementById('same').checked;
if(isAddressSame) {
billingName.value=document.getElementById('shippingName').value;
billingZip.value=docum... | true |
dafdde6df18b02109a39ee46d69c7ba94c5b5859 | JavaScript | claujf/pte-training-centre | /js/RECORDER.JS BACKUP FILES/timer.js | UTF-8 | 944 | 3.578125 | 4 | [
"MIT"
] | permissive | var prepCounter; // preparation time 3 seconds
var count; // answer time 40 seconds
var myTimer;
var prepCount;
function prepTimer(){
prepCounter = 4;
count = 41;
prepCount = setInterval(startTimer,1000);
function startTimer(){
prepCounter--;
if (prepCounter <= 0 ){
clearInterval(prepCount);
document.getE... | true |
da600f2d2e8c384bd32144f5d7a657b7704d9cda | JavaScript | SenaBel/tutorialJavaScript | /highOrderFunctions/aulas/reduce/03-reduce.js | UTF-8 | 448 | 3.3125 | 3 | [
"MIT"
] | permissive | /*
01) Verificando o array shopCart, qual o valor total desse carrinho de compras?
*/
const {shopCart} = require('../../data')
const resultShopCart = shopCart.reduce((acc, item) => {
return acc + item.quantity * item.unitPrice
}, 0)
console.log(resultShopCart)
/*
02) Mostre a quantidade total de produtos do car... | true |
6c3616417d34e2648c05f8d4952baa851eca217a | JavaScript | SanaNasar/JavaScript_Challenges | /parkingLot.js | UTF-8 | 802 | 3.984375 | 4 | [
"MIT"
] | permissive | // Build a parking lot using javascript
var parkingLot = function(spaces) {
if (spaces < 1) {
return "it's not possible to have this little spaces!";
}
this.spaces = spaces;
this.occupied = 0;
if (this.spaces > this.occupied) {
this.full = false;
} else {
this.full = true;
}
};
parkingLot.pro... | true |
232f4c89a1415d68bad248da1645a33c01ee660d | JavaScript | wiseshrimp/space-invaders-2 | /player.js | UTF-8 | 2,694 | 3.296875 | 3 | [] | no_license | const PLAYER_VELOCITY = 4
const PlayerDirection = {
Left: 'left',
Right: 'right',
None: 'none'
}
class Player {
constructor(props) {
this.isReady = false
this.containerEl = props.containerEl
this.velocity = PLAYER_VELOCITY
this.isShooting = false
this.canvas = props.canvas
this.contex... | true |