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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8fddd8037af75591d40d59f7d35f0853cf117086 | JavaScript | simnalamburt/snippets | /js/subset.js | UTF-8 | 252 | 2.875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | function isSubset(parent, child) {
for (const elem of child) {
if (!parent.has(elem)) {
return false
}
}
return true
}
console.log(isSubset(new Set([1, 2, 3]), new Set([1])))
console.log(isSubset(new Set([1, 2, 3]), new Set([4])))
| true |
09f742c200b3aa19b264d1c0d3e8ff6b452872b0 | JavaScript | LTUC/amman-201d11 | /class-02/demo/js/app.js | UTF-8 | 3,131 | 4.3125 | 4 | [] | no_license | // alert('I am alive');
'use strict';
// Data tyes: Boolean, String and Number
var uName = 'razan';
var num1 = 5; //1.5 //.75
var isTrue = false;
// console.log(typeof uName); // string
// console.log(typeof num1); // number
// console.log(typeof isTrue); // bool
// IF conditional statement
// v... | true |
35001b1f4782d77f840d92f3d659cb8650a6c98c | JavaScript | Cyclokitty/hackreactorprep | /module1/getLongestWordOfMixedElements.js | UTF-8 | 842 | 4.25 | 4 | [] | no_license | function getLongestWordOfMixedElements(arr) {
if (arr.length === 0) {
return "";
}
var isThereAString = 0;
var longest = 0;
for (var i = 0; i < arr.length; i++) {
if (typeof arr[i] === 'string' ) {
isThereAString++;
if (arr[i].length > longest) {
longest = arr[i];
} else if (... | true |
6e21dedeb0356d4f577750242ba75b1003f1f00f | JavaScript | will-garrett/node-katas | /tictactoe/tictactoe.js | UTF-8 | 3,467 | 3.5625 | 4 | [] | no_license | /**
* tic tac toe, w/prime factorization
*
*/
var prompt = require('prompt-sync')();
var emoji = require("node-emoji");
class TicTacToe {
constructor() {
this.moves = 9;
this.board = new Board();
this.winner = null;
this.players = {
'X': 1,
'O': 1
};
this.current_player = 'X';... | true |
f6173e2e3500ccfaf2bde0bfdf898299a1d27a07 | JavaScript | loolooii/schiphol-flight-search | /src/index.js | UTF-8 | 677 | 2.796875 | 3 | [] | no_license | import Home from './pages/home';
// our routes go here
const routes = {
'/': Home
};
const router = async () => {
// footer, navbar, etc. can be rendered here too
// container to render main content of each page
const content = null || document.getElementById('page_container');
// if we have mor... | true |
3a0b658930b33766826e43a7c57d3ece97cf52f2 | JavaScript | LoraMS/Node.js-Express.js | /SummerPhotos/server/models/user-model.js | UTF-8 | 782 | 2.71875 | 3 | [
"MIT"
] | permissive | const emailRegex = /^([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}$/;
class User {
static isValid(model) {
return typeof model !== 'undefined' &&
typeof model.username === 'string' &&
model.username.length > 2 &&
emailRegex.test(model.email) &&
typeof model.passHash ==... | true |
db3cc8e084bd5eaf3f165b370d9b135844469c64 | JavaScript | davxe/javascript-programs | /rough/rough12.js | UTF-8 | 738 | 3.890625 | 4 | [] | no_license | const value='hiii how are you'
// function show(value)
// {
// const result=value.split('')
// let output=''
// for(let i=0;i<result.length;i++)
// {
// console.log('i->'+result[i])
// for(let j=0;j<result[i].length;j++)
// {
// console.log('j->'+result[i][j])
// ... | true |
e5abb64106d08454bc61ba7c4d8546896aabf25f | JavaScript | creatorChou/leetcodeAns | /page7/countSmaller.js | UTF-8 | 515 | 3.5625 | 4 | [] | no_license | /**
* 315. Count of Smaller Numbers After Self
* https://leetcode.com/problems/count-of-smaller-numbers-after-self/description/
*/
/**
* @param {number[]} nums
* @return {number[]}
*/
var countSmaller = function(nums) {
let result = [];
for (let i = 0; i < nums.length; i ++) {
result[i] = 0;
... | true |
d607d375571275726dccebdc0178268201545dd6 | JavaScript | JBHipple/CIS223-Javascript | /Final/Final1.js | UTF-8 | 3,000 | 3.828125 | 4 | [] | no_license | /* CIS 230 - W1
* Final - Part 1
* Joshua Hipple
*
* Filename: Final1.js
*/
// Global Variables
var firstName = "";
var lastName = "";
var emailAddress = "";
var sports = [];
var sportsOutput = "";
var color = "";
var searchEngine = "";
// This function runs when the submit button is clicked, calling other funct... | true |
c1b1588502c47ec979230c5c151aeccbd975428e | JavaScript | Kristinn-Kristinsson/Labb1Interaktiv | /src/labb.js | UTF-8 | 3,332 | 3.4375 | 3 | [] | no_license |
// modifiera sum() tills testet blir godkänt!
function sum(a, b) {
console.log(a)
console.log(b)
return a + b;
}
function myOwnMultiplyFunction(a, b) {
console.log(a)
console.log(b)
return a * b;
}
function round(a)
{
b = a.toFixed(0);
return parseInt(b)
}
function addingUp(a)
{
... | true |
eb86a8a608b8d375c8cea384dc93bfba035c4b63 | JavaScript | mariagus/calculator | /src/Calculator.js | UTF-8 | 1,934 | 2.8125 | 3 | [] | no_license | import React, { useState } from "react";
import "./Calculator.css";
import Button from "./components/Button";
function Calculator() {
const [output, setOutput] = useState("0");
function handleClick(label) {
if (output === "0") {
setOutput("");
}
if (label === "=") {
setOutput(eval(output.r... | true |
2f1cb2a386df0cb8e8afb0f54dd9b81d7d52aa7c | JavaScript | MusicTen/mmm | /js/baicaijia.js | UTF-8 | 3,542 | 2.71875 | 3 | [] | no_license | $(function(){
function renderTitle() {
$.ajax({
type: "get",
url: "http://127.0.0.1:9090/api/getbaicaijiatitle",
dataType: 'json',
success: function(info){
console.log(info);
var htmlStr = template('tmp',info);
$(".nav ul").html(htmlStr);
//数据请求成功后动态设置ul的宽度... | true |
41611e74d0e99c82ef607bff60596ec832545965 | JavaScript | lmammino/streams-workshop | /02-readable-streams/exercises/count-words.solution.js | UTF-8 | 638 | 3.171875 | 3 | [
"MIT"
] | permissive | export default async function countWords (srcStream) {
srcStream.setEncoding('utf8') // makes sure we process this as text (avoids multi-bytes errors)
let numWords = 0
let lastWordFromPreviousChunk = ''
for await (const chunk of srcStream) {
const words = (lastWordFromPreviousChunk + chunk.toString()).spl... | true |
af0e4dcd867f1e51e8007b2789e9cfc155622b38 | JavaScript | fgu-cas/arenomat | /lib/plugins/turntable.js | UTF-8 | 860 | 2.71875 | 3 | [
"MIT"
] | permissive | var five = require("johnny-five");
function Turntable() {
this.motor = new five.Motor({
pins: {
pwm: 11,
dir: 5,
cdir: 6,
threshold: 1
}
});
this.angle = 0;
/*
board.io.attachEncoder(0, 20, 20); // counter 0, counterA = pin 20, counterB = pin 20
board.io.on('encoder-report-0... | true |
d7ad58d248c165a5269dc27cf5a64fcc0ba97c3f | JavaScript | jennyma8/m3-2-node--url-params | /server.js | UTF-8 | 3,041 | 2.890625 | 3 | [] | no_license | 'use strict';
const morgan = require('morgan');
//##1.2 requiring the 'top50' file
const { top50 } = require('./data/top50');
//#2.1
const { books } = require('./data/books');
const PORT = process.env.PORT || 8000;
const express = require('express')
const app = express();
app.use(morgan('dev'));
app.use(express.... | true |
064c59f6ea5769df377309fe0f9eba94a06de8e8 | JavaScript | Melphi-JS/Botsitov2 | /comandos/avatar.js | UTF-8 | 551 | 2.65625 | 3 | [] | no_license | module.exports = (client, message, args) => {
const Discord = require("discord.js")
const usuario = message.mentions.users.first() || client.users.resolve(args[0]) || message.author;
const avatar = new Discord.MessageEmbed()
.setAuthor("Avatar de "+usuario.tag, usuario.displayAvatarURL({size: 2048, dynamic: t... | true |
09f4f7cc20b707f1d87329b7274c3a8b89e5af2a | JavaScript | Ashishpurbey/warHammer | /sastaProject/sastaScoreKeeper/rough.js | UTF-8 | 1,531 | 3.25 | 3 | [] | no_license | // buttons
const p1b = document.querySelector('#p1b')
const p2b = document.querySelector('#p2b')
const rst = document.querySelector('#reset')
const slct = document.querySelector('#pnt')
const vdct = document.querySelector('#verdict')
// score
const p1s = document.querySelector('#p1s')
const p2s = document.querySelecto... | true |
3c5450ceb77cb0499ef8248b99f9c886e47430f9 | JavaScript | vijay-khanna/containers-basics-and-beyond | /app-one/ver1/front-end/src/utils/forecast.js | UTF-8 | 6,783 | 2.578125 | 3 | [] | no_license | const URLPiArray = 'http://back-end-pi-array-service:90/pi'
var urlMotm = 'http://MOTMLBURL:91/motm'
const yargs = require('yargs')
const chalk = require('chalk')
var request = require('request');
var deasync = require("deasync")
var EventEmitter = require("events").EventEmitter;
var bodyem = new EventEmitter();
//var ... | true |
bd169e0c1992d51db8d6efce4cfa298dd34668f8 | JavaScript | bjorn-mozyakin/portfolio | /src/js/scripts-jq.js | UTF-8 | 2,103 | 2.546875 | 3 | [] | no_license | $(document).ready(function(){
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./service-worker.js')
.then(function(registration) {
console.log('ServiceWorker registration successful with scope: ', registration.scope);
})
.catch(function(err) {
console.log('... | true |
1190b43493f409b06ed14dc27180839278f41080 | JavaScript | cuong-nguyen/react-fundamentals-curriculum | /app/utils/api.js | UTF-8 | 333 | 2.609375 | 3 | [] | no_license | import axios from 'axios';
const APIKey = '919b22650ad488d7464f8588528ff38e';
const weatherURI = `http://api.openweathermap.org/data/2.5/forecast/daily?type=accurate&APPID=${APIKey}&cnt=5&q=`;
let api = {
getForecast: (city) => {
return axios.get(weatherURI + city)
.then(response => response.data);
}
}
export... | true |
c16c79296298ad6af72e4bb5d4ed538b7f84db62 | JavaScript | catdad/friendlyCast | /src/chromecast.js | UTF-8 | 19,650 | 2.84375 | 3 | [
"MIT"
] | permissive | /* jslint browser: true, devel: true, expr: true */
/* globals chrome, chromecast */
/*
* Copyright (c) 2014 Kiril Vatev
* The MIT License (MIT)
*/
//temp util - https://gist.github.com/catdad/1ea87248218969e57794
if (!window.console) { window.console = { log: function () {} }; } // console fix for IE8
if (!conso... | true |
a3cde6b475422f8a5f49b1854a89b7de9c5dc6b8 | JavaScript | saildrive/web-client | /src/javascript/components/Button/Button.js | UTF-8 | 1,174 | 2.609375 | 3 | [] | no_license | require("./styles/button.scss");
import React from "react";
export default class Button extends React.Component {
constructor(props) {
super(props);
this.getClassName = this.getClassName.bind(this);
this.onClick = this.onClick.bind(this);
}
render() {
return (
... | true |
7594fa2ebd8be90320d008d97d7cbb360ec5bfc8 | JavaScript | Kruhlmann/JSRunner | /classes/managers/powerup_manager.js | UTF-8 | 2,211 | 2.828125 | 3 | [] | no_license | function PowerupManager(player, VAR_LIB){
this.powerups = [];
this.internal_timer = 0;
this.collision = false;
this.player = player;
this.width = VAR_LIB.width;
this.height = VAR_LIB.height;
this.powerups.push(new Powerup(100, -64, 1, VAR_LIB));
this.xRanges = [];
this.yRanges = [];
for(var i = 0; ... | true |
798a57c99084e0328047603bb618bef07388da09 | JavaScript | timdose/Sketch-Hacks | /Sketch Hacks.sketchplugin/Contents/Sketch/Move Right.js | UTF-8 | 907 | 2.75 | 3 | [] | no_license | // Sets the font size of selected text fields + optional line height
var onRun = function (context) {
// old school variable
doc = context.document;
selection = context.selection;
var selectedLayers = [];
if (selection.count() > 0) {
if (selectedLayers.length > 0) {
/... | true |
e14332a947f2371ecb9dba656a4be215683bb819 | JavaScript | sourabhdesai/WaveFilter | /js/search_hit_emitter.js | UTF-8 | 511 | 2.59375 | 3 | [] | no_license | var EventEmitter = require('events').EventEmitter;
var HIT_EVENT_NAME = 'hit';
var SearchHitEmitter = function () {
this.emitter = new EventEmitter();
SearchHitEmitter.prototype.onHit = function(listener) {
this.emitter.on(HIT_EVENT_NAME, listener);
};
SearchHitEmitter.prototype.stopListening = function() {
... | true |
4e9323c2cf177f6c65c7d930a91e13f58b544dc5 | JavaScript | HZNU-Madison-Group/WXMINPROGRAM | /yuhandan/于晗丹实验报告/于晗丹 实验一——猜数字/miniprogram-5/pages/guess/guess.js | UTF-8 | 3,103 | 2.671875 | 3 | [] | no_license | // pages/guess/guess.js
Page({
/**
* Page initial data
*/
data: {
//clicked:[0,0,0],
//myColor:["red","gray"],
c: ["light gray", "light gray", "light gray", "light gray", "light gray", "light gray", "light gray", "light gray", "light gray", "light gray"],
targetNumber:'none',//当没有触发开始时,还没有产生随... | true |
5e0fa365016c8016acea374889e519e26e2c3638 | JavaScript | y-pandit/Codewars | /Challenge1.js | UTF-8 | 941 | 3.953125 | 4 | [] | no_license | /*
Description:
Jaden Smith, the son of Will Smith, is the star of films such as The Karate Kid (2010) and After Earth (2013). Jaden is also known for some of his philosophy that he delivers via Twitter. When writing on Twitter, he is known for almost always capitalizing every word.
Your task is to convert strings to ... | true |
af1530ff78e29d80821e78073385dfa8fa76e7ba | JavaScript | UserNameZee/team_gold_hw1 | /src/main/resources/static/js/game/chesspieces.js | UTF-8 | 3,538 | 2.96875 | 3 | [] | no_license | /*
* @author Zihao Zheng
*/
RANK_TO_NAME = [
"Boom",
"Spy",
"Scout",
"Miner",
"Sergeant",
"Lieutenant",
"Captain",
"Major",
"Colonel",
"General",
"Marshal",
"Flag"
]
TOTAL_PIECE_FOR_EACH_RANK = [
6, //B
1, //1
8, //2
5, //3
4, //4
4, //5
4,... | true |
4233226ea7932ae8e01b3104113dce4f70bc1eeb | JavaScript | jenwei/derby-tutorial | /src/components/simple-component/index.js | UTF-8 | 524 | 3.15625 | 3 | [] | no_license | // Components can be defined as simple Classes. We'll cover methods later on.
// Right now, I'm just going to keep it empty.
class SimpleComponent {}
// `name` helps us reference the component in our template. With this name, we
// can do in our HTML:
//
// <view is="simple-component"/>
//
// And this component will s... | true |
16a12f66f70d268c01f25b08f6abf8812c7f4db9 | JavaScript | IgorMCesar/desafio-stone-server | /middlewares/index.js | UTF-8 | 510 | 2.609375 | 3 | [] | no_license | // Responde an URL not found with 404 and send the error to the next function
function notFound(req, res, next) {
const err = new Error(`Not Found - ${req.originalUrl}`);
res.status(404);
next(err);
}
// Receives an error and send a response as json instead of HTML
function errorHandler(err, req, res, next) {
... | true |
ba8622aeec167fbfecc88a36281009f2b87fd3f1 | JavaScript | luizpericolo/p5js_art | /follow_mouse/models.js | UTF-8 | 1,272 | 3.5 | 4 | [
"MIT"
] | permissive | function Circle(position, radius) {
this._position = position;
this._radius = radius;
this.radius = function() {
return this._radius;
}
this.draw = function() {
ellipse(this._position._x, this._position._y, this.radius(), this.radius());
}
this.moveTowards = function(x, y)... | true |
3c1ffbb9a08302e414f8d217b7242f11acb7fbfb | JavaScript | mutanabbi/mtg | /deck-builder/js/hyper-geo.js | UTF-8 | 1,369 | 3.34375 | 3 | [] | no_license | /*
Population size N
Subpopulation size m
Sample size n
x value
*/
function hyp(x, n, m, nn) {
var nz = m < n ? m : n;
var mz = m < n ? n : m
var h = 1, s = 1, k = 0, i = 0;
while (i < x) {
while ((s > 1) && (k < nz)) {
h *= 1 - mz / (nn - k);
s *= 1 - mz / (nn - k);
++k;
}
h *= (n... | true |
6c45ba9301e57259c399439632d80918717bd913 | JavaScript | Driss-Marzouk/DiceeChallenge | /dicee.js | UTF-8 | 616 | 3.65625 | 4 | [] | no_license | // genarting random numbers between 1 and 2
var random_number1 = Math.floor(Math.random()*6)+1;
var random_number2 = Math.floor(Math.random()*6)+1;
document.querySelector(".img1").setAttribute("src","images/dice"+random_number1+".png")
document.querySelector(".img2").setAttribute("src","images/dice"+random_number2+".pn... | true |
32e4facc6382879fd5c46c7af994e8d0782ec08a | JavaScript | n1ckfg/poisson-disk-sampling | /src/implementations/fixed-density-2d.js | UTF-8 | 7,735 | 3.125 | 3 | [
"MIT"
] | permissive | "use strict";
/**
* The code below is experimental and not shipped to NPM.
*
* This is a baseline implementation for a 2d-only fixed density poisson disk sampling.
*
*/
var tinyNDArray = require('../tiny-ndarray').integer,
getNeighbourhood = require('../neighbourhood');
const epsilon = 2e-14;
/**
* FixedD... | true |
ca6d870a85de97facab3f4bb1acd3f32bb92f0e1 | JavaScript | LCamel/BuildYourOwnHaskellCompiler | /y.js | UTF-8 | 1,259 | 3.390625 | 3 | [
"MIT"
] | permissive | "use strict";
console.log(
(g => g(g))
(
f => x => (x == 0 || x == 1 ? 1 : f(f)(x - 1) + f(f)(x - 2))
)(6)
);
// f => x => y => (x == 0 ? y : f(f)(x-1)(y+1)) // add
/*
console.log(
(f => x => y => f(f)(x)(y))
(
f => x => y => (x == 0 ? y : f(f)(x-1)(y+1))
)(2)(3)
);
*/
/*
console.log(
(f => n =>... | true |
47b2cc4d0a3eabfa3320575b7e632389933495ff | JavaScript | AnlliGallardo/CampoEntrenamiento-Modulo2 | /Objetos/script.js | UTF-8 | 882 | 3.34375 | 3 | [] | no_license | const formulario = document.querySelector('#form');
formulario.addEventListener('submit', function localStorage(){
let email = document.querySelector('#inputEmail').value;
let password = document.querySelector('#inputClave').value;
if( (email == "") || (password == "")){
alert('Ingresar todos los... | true |
76238f19227f62e45635fd43f08d4af4c255405b | JavaScript | ginsengcompany/servizioTrasfusionale | /public/javascript/Menu.js | UTF-8 | 721 | 2.609375 | 3 | [] | no_license | $(document).ready(function () {
let token = GetURLParameter('token');
let uid = GetURLParameter('uid');
$("#homeAncor").attr("href","home?token="+token+"&uid="+uid);
$("#NuovaSacca").attr("href","nuovaSacca?token="+token+ "&uid="+uid);
$("#Trasfusioni").attr("href","trasfusioni?token="+token+ "&uid... | true |
641180cff3dc2f7362540f108f9aa69f922cf92f | JavaScript | uhgfel/SkrydzioPlanas | /Skaiciavimai/LektuvuParametrai.js | UTF-8 | 557 | 2.515625 | 3 | [] | no_license | //Galons per hour
var FuelConsumption;
//Knots
var CruisingSpeed;
function AircraftSelected(){
var SelectedValue = document.getElementById("AircraftSelector").value;
switch(SelectedValue){
case "C152":
FuelConsumption = 6;
CruisingSpeed = 90;
break;
case "C... | true |
34542f3d942d8e51976513808c103cc58e0edc73 | JavaScript | ashrafulislampro/Javascript-Problem-Solving | /vowelsAndConsonante.js | UTF-8 | 2,601 | 4.15625 | 4 | [] | no_license | // correct code
function vowelsAndConsonants(s){
let vowelList = 'aeiou';
let consonantList = '';
for(let letter of s){
vowelList.includes(letter)? console.log(letter) : consonantList += letter + '\n';
}
console.log(consonantList.trim());
}
var result = vowelsAndConsonants('javascriptloops... | true |
4ae2323c153b633027c7094a165100ff2bab9015 | JavaScript | evgeniypoznyak/javascript-algorithms-playground | /src/intervews/indeed/001-indeed.js | UTF-8 | 1,318 | 3.3125 | 3 | [] | no_license | // Indeed 1
const wordIsGreaterThanSize = (curr, size) => curr.length > size
const noMoreNextSteps = (next) => next === undefined
const vocabularyHaveValues = (result, counter) =>
result[counter] && result[counter].length > 0
const safeAddMoreToVocabulary = (vocabulary, counter, curr, size) =>
vocabulary[counte... | true |
34b409be72861638650d1ecf9cf0a3e4edbb5fc1 | JavaScript | dpwoert/HI-roadmap | /timeline/1976-concorde.js | UTF-8 | 1,497 | 2.578125 | 3 | [] | no_license | (function(){
var evt = new TimelineEvent(timeline);
var route, route2;
evt
.setDate(21,1,1976)
.marker('Concorde', 'aviation','.timeline__concorde')
.onActive(function(world){
//add test route
route = new Route(timeline.world());
route2 = new Route(timeline.world());
//create points
route
... | true |
b92a9751dc100382bc41f5414c580a9bb16a2ebe | JavaScript | sharann26/User-List-Server | /server.js | UTF-8 | 4,786 | 2.578125 | 3 | [] | no_license | const hapi = require('hapi');
const joi = require('joi');
const mongoose = require('mongoose');
const username = 'admin';
const password = 'a123';
const dbname = 'db';
/* Config server port and settings */
const server = new hapi.server({
host: 'localhost',
port: 3000,
routes: {
cors: {
... | true |
934f242dcb762d6d6c25559a73457782658e81dd | JavaScript | fish444556/JS_algorithm | /flatten.js | UTF-8 | 232 | 3.21875 | 3 | [] | no_license | /*
Flatten the array
Input: Array
Output: Array
Input: [1,2,3,4,[5,6,4,[7,8,9]]]
Output: [1,2,3,4,5,6,4,7,8,9]
*/
const flatten = arr => arr.reduce((acc, cur) =>
acc.concat(Array.isArray(cur) ? flatten(cur) : cur), []); | true |
03944707aaca21dfcc996f33c5caab828a5431c0 | JavaScript | yvvsra/fewpjs-iterators-fndcl-fnexpr-reduce-lab-recoded-istanbul-2019 | /index.js | UTF-8 | 168 | 2.84375 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | const batteryBatches = [4, 5, 3, 4, 4, 6, 5];
// Code your solution here
let totalBatteries=batteryBatches.reduce(function(total,batch){
return total+batch;},0);
| true |
f0e11e1f69542f6deae1121f6b162be698c00c7d | JavaScript | jjdm/plzsq | /lib/socket.js | UTF-8 | 3,150 | 2.609375 | 3 | [] | no_license | "use strict";
const WebSocket = require('ws');
const utils = require('./utils');
const log = utils.logger;
const CONFIGURATION_KEY = "io.jjdm.chapman.plzsq.WebSocketManager";
/**
* Used to handle inbound messages and provides a broadcase method.
*/
const WebSocketManager = function () {
log.info("Private WebSocke... | true |
b59c311526c370e839e7e94537a075154c8c526d | JavaScript | OriX0/JS_Restudy | /000专项训练/数据类型转换/008_数学运算符的类型转换.js | UTF-8 | 2,524 | 3.875 | 4 | [] | no_license | var b = {};
console.log(b - '2');
// NaN -2 NaN
console.log(b * '2');
console.log(b / '2');
console.log(b % '2');
console.log(b - []);
console.log(b - {});
// {} 转换全部为NaN NaN 进行数学计算结果均为NaN
var b = {
valueOf() {
console.log('valueOf');
return {};
},
toString() {
console.log('toString');
return 1... | true |
0388329b7a371f2e42151679560c8e575872ef0d | JavaScript | brbarnett/AdventOfCode2018 | /8b.js | UTF-8 | 1,570 | 2.921875 | 3 | [] | no_license | const fs = require('fs'),
_ = require('lodash');
class Solution {
run() {
const input = fs.readFileSync('./8.dat', 'utf8');
// const input = '2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2';
const result = this.solve(input);
console.log('Result:', result);
}
solve(input) {
... | true |
048921570415b5c819105f8933c8881575033996 | JavaScript | BoipeloM-coder/Simple-Calculator | /index.js | UTF-8 | 421 | 3.875 | 4 | [] | no_license | function multiply (num1,num2) {
let multiply= num1 * num2;
console.log(multiply);
}
multiply(7,8);
function difference (a , b) {
return a - b;
}
let subtraction = difference(15,3);
console.log (subtraction);
function addition ( num1, num2)
{
let addition = num1 + num2;
console.log (addition);
}
addition (10... | true |
603465a92d1c31cd6700c1ec307ee40bab402540 | JavaScript | deciree79/schoolwork | /webbutveckling/js/songFunctions.js | UTF-8 | 5,426 | 2.9375 | 3 | [] | no_license | /*
* För frmNewUpdateSong formuläret gäller att samtliga indata komponenter skall ha värden för att kunna spara en ny artist.
* Vid uppdatering av en redan befintlig post måste cboArtist, txtTitle, txtCount vara ifyllda.
*/
function validateNewUpdateSongFormData(theForm){
cboArtist = document.getElementById("cboA... | true |
a12882bb3082999533d3bb62c5babb0d80fe3af7 | JavaScript | DavideDaniel/Chat-App | /appClient.js | UTF-8 | 1,185 | 2.71875 | 3 | [] | no_license | // var WebSocket = require("ws");
var ws = new WebSocket("ws://localhost:3000");
//list of online users to display on the right hand side
var usersOnline = [];
var inset = document.querySelector("div.inset");
var ul = document.querySelector("ul#chat");
var userList = document.querySelector("#users");
var input = do... | true |
812b8bba9556ed03a1896c18549df053dd1a50a9 | JavaScript | pknavaneeth/patternprinting | /inverted_half_pyramid.js | UTF-8 | 276 | 3.140625 | 3 | [] | no_license | /*Expected Output
*****
****
***
**
* */
const pyramid_level = 5;
for(i=1;i<=pyramid_level;i++){
let star='*';
let output='';
for(j=pyramid_level;j>=i;j--){
output=output+star;
}
console.log(output);
};
| true |
075a73917f649457753eda16c208fa3d2f7c0f6c | JavaScript | tareq403/Candle-Puzzle | /candle_puzzle.js | UTF-8 | 3,026 | 3.28125 | 3 | [] | no_license | function bfs_search_for_all_unlit(initial_state, count) {
var checked_states = [];
var upper_limit = initial_state['candles'];
var bfs_queue = [initial_state];
while (bfs_queue.length > 0) {
var current_state = bfs_queue.shift();
var candles = current_state['candles'];
checked_s... | true |
3d5c4ddb253d412d6df19fcd300baee79fe61fe2 | JavaScript | willianferreirax/Curso-JS---Curso-em-video | /exercicios1/script.js | UTF-8 | 474 | 3.234375 | 3 | [
"MIT"
] | permissive | function carregar(){
var data = new Date()
var agora = data.getHours()
var msg = document.getElementById('msg')
var imagem = document.getElementById('imagem')
msg.innerHTML = `Agora são ${agora} horas`
if(agora <12){
imagem.src="images/morning.jpg"
}
else i... | true |
5e1fc0d1a53a26d23e9c6c5e49c7738601125037 | JavaScript | ryolambert/my-pwp-ryo | /public_html/js/overlay.js | UTF-8 | 6,168 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | class ShapeOverlays {
constructor(elm) {
this.elm = elm;
this.path = elm.querySelectorAll('path');
this.numPoints = 10;
this.duration = 800;
this.delayPointsArray = [];
this.delayPointsMax = 300;
this.delayPerPath = 250;
this.timeStart = Date.now();
this.isOpened = false;
this.isAnimating = false;
... | true |
473a79547b74153b266b78e0c14608faff16a999 | JavaScript | Rafiki5/Ships | /public_html/js/ships.js | UTF-8 | 3,879 | 2.921875 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
var canvas, context, stage;
var init, drawElement, fieldPress, fieldOver, fieldOut;
var fieldWidth = 40;
var fieldHeight = 40;
var actualFieldGraphics;
var mySea = [], enemySea = [];
init = function () {
//canvas = $('#canvas')[0];
canvas = doc... | true |
a433662f882d0148a61414b8dc2a5c04a1916d6b | JavaScript | elijahsamuels/algorithms | /Find the missing letter.js | UTF-8 | 2,383 | 4.65625 | 5 | [] | no_license | // #Find the missing letter
// Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array.
// You will always get an valid array. And it will be always exactly one letter be missing. The length of the array will always be at least 2.
// The array wi... | true |
38c2070514ac8e887b5c18f5c30887a8f653507b | JavaScript | swethamanur/js-code | /assignment-3/sum-pairs.js | UTF-8 | 566 | 4.3125 | 4 | [] | no_license | /*
Write a JavaScript program to find a pair of elements (indices of the two numbers) from a given array whose sum equals a specific target number.
Input: numbers= [10,20,10,40,50,60,70], target=50
Test Case :
pairElement(numbers, target);
Output: [3, 4]
*/
function pairElement(numbers,target){
var result = [];
if(... | true |
9d39da5f10c702638c5f3e5c3d74bd61fd5e1a7a | JavaScript | natureStory/naturestory.github.io | /node/index.js | UTF-8 | 2,188 | 2.875 | 3 | [] | no_license | const fs = require('fs');//引用文件系统模块
const showdown = require('../src/assets/js/showdown.min.js');
const config = {
articlesPath: '../src/data/articles',
articlesHtmlPath: '../src/pages',
articleTemplatePath: './article-template.html',
listDataPath: '../src/data/listData.json'
};
deleteHtml();
createHtm... | true |
53553240fa14db3114172e3f6bd24eea40aee6c3 | JavaScript | stefankeil/receptoo-api | /app/routes/recipes.js | UTF-8 | 1,149 | 2.53125 | 3 | [] | no_license | var Recipe = require('../models/recipe')
var recipes = {
getAll: function (req, res) {
Recipe.find(function (err, recipes) {
if (err) res.send(err)
res.json(recipes)
})
},
getOne: function (req, res) {
Recipe.findById(req.params.id, function (err, recipe) {
if (err) res.send(err)
... | true |
b14205f2a930fd579533ee5040294098f2fd38f5 | JavaScript | firstskytouch/Lambda-Backend | /appi/lambdas/users/_userId/worksheets/post/index.js | UTF-8 | 2,530 | 2.625 | 3 | [] | no_license | 'use strict';
const validator = require('./shared/validator.js');
const s3Methods = require('./shared/s3.js');
const s3Bucket = process.env.worksheetsBucket;
const dynamoMethods = require('./shared/dynamo.js');
const dynamoTable = process.env.worksheetsTable;
const dynamoTableUsers = process.env.usersTable;
const ke... | true |
297c22fe03f7ac3a7d9d24cd691647f3348a1239 | JavaScript | marssh/EightBall | /src/ResetQuestion.js | UTF-8 | 348 | 2.625 | 3 | [] | no_license | import React, { useState } from 'react';
export function ResetQuestion() {
const [color, setColor] = useState('black');
const [answer, setAnswer] = useState('Think of a question')
return (
<div>
<button onClick={() => {
setColor('black');
setAnswer('Think of a question');
}}>Rese... | true |
363a5fd0df6406ec20fcc13688f5818de29899ba | JavaScript | mschangtaitai/tutoFrontEnd | /src/reducers/publishers.js | UTF-8 | 2,986 | 2.59375 | 3 | [] | no_license | import { combineReducers } from 'redux';
import * as types from '../types/publishers';
import includes from "lodash/includes";
const byId = (state = {}, action) => {
switch(action.type) {
case types.PUBLISHER_FETCH_COMPLETED: {
const { entities, order } = action.payload;
const newS... | true |
877f72d69c4e0135353179085117ee121a06e70c | JavaScript | JekaBlack/Homework | /28.08.2020/script3_3/script3_3.js | UTF-8 | 280 | 3.234375 | 3 | [] | no_license | /* Напишите цикл с confirm, который продолжается при нажатии на Отмена и прерывается при нажатии на Ok. */
while (a !== true) {
var a = confirm("Наоборот");
if (a !== true) {
break;
}
}
| true |
029178f4b7a26cb76ef4a1c1d342663024ad79f0 | JavaScript | mishondrakis/Programming-Fundamentals-with-JavasScript | /05.Lab Functions and Arrow Functions/02. Square of Stars.js | UTF-8 | 326 | 2.984375 | 3 | [] | no_license | function sa(input) {
if (!isNaN(input[0])) {
for (let row = 0; row < Number(input[0]); row++) {
console.log("*" + " *".repeat(Number(input[0]) - 1));
}
}
else {
for (let row = 0; row < 5; row++) {
console.log("*" + " *".repeat(5 - 1));
}
}
}
sa(['... | true |
fd019baf836b938752ed87046c626a6b1862bba9 | JavaScript | KingAtoki/Data-Structures-II | /src/binary-search-tree.js | UTF-8 | 4,027 | 3.734375 | 4 | [] | no_license | // https://msdn.microsoft.com/en-us/library/aa289150(v=vs.71).aspx
/* eslint-disable global-require */
/* eslint-disable no-unused-vars */
/* eslint-disable no-trailing-spaces */
class BinarySearchTree {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
// Wraps the input... | true |
a13a3823cf96362253958771cff9a8411b492819 | JavaScript | squireaintready/Mizumi | /src/components/Form.js | UTF-8 | 841 | 2.53125 | 3 | [] | no_license | import React from "react";
import Inputs from "./Inputs";
import styled from "styled-components";
import Button from '@material-ui/core/Button';
let data = [
{
name:'Servers',
value:0,
},
{
name:'Bus boys',
value:0,
},
{
name:'Bus girls',
value:0,
},
{
name:'Total Tips',
... | true |
b7d14996ea1a60618f5714881a5bca80367bc972 | JavaScript | scottAF/ES6-playground | /code/dog.js | UTF-8 | 153 | 2.8125 | 3 | [] | no_license | "use srict";
class Animal {
eat() {
console.log("yum umm num");
}
}
class Dog extends Animal {
}
const d = new Dog();
d.eat(); | true |
d542a9eb6c39d2be1414467b0fd5a22701ac9105 | JavaScript | NurlybekOrynbekov/coursera-js | /Course-1/Week-3/Ex-1/index.js | UTF-8 | 1,922 | 3.703125 | 4 | [] | no_license | function add(value, type) {
if (isNaN(value) || value < 0) {
throw new TypeError('Wrong value');
}
if (type === 'years') {
this.date.setUTCFullYear(this.date.getFullYear() + value);
} else if(type === 'months') {
this.date.setUTCMonth(this.date.getMonth() + value);
} else i... | true |
e73724c9707e905869234ee5791d6ca3fe3b4916 | JavaScript | cooljoe95/App-Hw | /HW/w6/w6d5/vanilla-dom/script.js | UTF-8 | 2,008 | 3.09375 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", () => {
// toggling restaurants
const toggleLi = (e) => {
const li = e.target;
if (li.className === "visited") {
li.className = "";
} else {
li.className = "visited";
}
};
document.querySelectorAll("#restaurants li").forEach((li) => {
... | true |
233a9a91af8161ad95b4e6cc5602a72fb412855c | JavaScript | byrondevonwall/TIY-assignments | /2-week/in-class/inclass29.js | UTF-8 | 542 | 4.125 | 4 | [] | no_license | for(num = 0; num <= 20; num++){
if(num %2 === 0){
console.log(num + " is even");
}
else{
console.log(num + " is odd");
}
}
//exercise 2
function verbing(verb){
if(verb.length >= 2){
return(verb.concat("ing"));
}
else if(verb.length < 2 && verb.length > 0){
return(verb);
}
}
console.lo... | true |
77477351f5fce21d6f29dc7f7535c165a734b8d3 | JavaScript | Ceddyp19/fewpjs-iterators-fndcl-fnexpr-filter-lab-atx01-seng-ft-071320 | /index.js | UTF-8 | 373 | 3.203125 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Code your solution here
function findMatching(drivers, name){
return drivers.filter(driver => (driver === name || driver === name[0].toLowerCase() + name.slice(1)))
}
function fuzzyMatch(drivers, letters){
return drivers.filter(driver => driver.startsWith(letters))
}
function matchName(drivers, name){
ret... | true |
b5da236cc2001241258ec64ad7ef65a5924ad9fb | JavaScript | jandersonss/jobs-queue-manager | /example.job.js | UTF-8 | 1,068 | 3.5 | 4 | [] | no_license | /**
* ExemploJob - Arquivo de exemplo para execução das tarefas
* O gerenciamento das tarefas é feita a parte de Promises
* @param {* Execute quando finalizar todo o processo da tarefa} JobQueueResolve
* @param {* Execute caso uma ocorra um erro que impeça a conclusão da tarefa } JobQueueReject
*/
function Exem... | true |
8d3d82827a2f695f7e2c6122ff905467d33c4585 | JavaScript | userhao123/scientific-Research | /src/main/resources/static/lib/layui-v2.5.7/layui/camvas.js | UTF-8 | 5,638 | 2.859375 | 3 | [] | no_license | /*
实例化camvas配置参数
config = {
video:{width:Number(scale*4),height:Number(scale*3)},//视频比例4:3
canvasId:'canvas',//画布canvas节点ID
videoId:'v',//video节点ID
imgType:'png',//图片类型,/png|jpeg|bmp|gif/
quality:'1' //图片质量0-1之间
}
*/
window.URL... | true |
7da5c9959b60873d885d8cc96c0a59c2620877c5 | JavaScript | rajdeepdodiya/treasure-hunt | /AddNewCache.js | UTF-8 | 4,311 | 2.53125 | 3 | [] | no_license | import AsyncStorage from '@react-native-async-storage/async-storage';
import React, { useEffect, useState } from 'react';
import { SafeAreaView, Text, Button, TextInput } from 'react-native';
import { db } from './FirebaseManager';
import Styles from './Styles';
import * as Location from 'expo-location';
const AddNewC... | true |
ea56d388e4ed2543ba710f8762115a7162dbf58e | JavaScript | SharathPradeep/Ajax-Fetch-Basics | /Custom-HTTPLib-Fetch-Async-Await-16/easyhttp2.js | UTF-8 | 1,099 | 2.859375 | 3 | [] | no_license | class EasyHTTP{
// GET Request
async get(url){
const response= await fetch(url);
const data= await response.json();
return data;
}
// Make HTTP POST Req
async post(url,data){
const response= await fetch(url,{
method:'POST',
headers:... | true |
d76de2e5bf56f7757a303fba601a29a32c98770b | JavaScript | florent-engineering/anemomind | /src/device/anemobox/anemonode/test/timeest.js | UTF-8 | 2,737 | 2.671875 | 3 | [
"MIT"
] | permissive | var timeest = require('../components/timeest');
var assert = require('assert');
var should = require('should');
function MockChannel(sysSeconds, gpsSeconds) {
assert(sysSeconds.length == gpsSeconds.length);
this.sysSeconds = sysSeconds;
this.gpsSeconds = gpsSeconds;
this.offset = new Date(1467881037966);
}
Mo... | true |
370e18afff00e3632938370393748ff158fc96ed | JavaScript | ranizilpelwar/tic_tac_toe_client | /public/common/remove_elements.js | UTF-8 | 156 | 2.515625 | 3 | [] | no_license | class RemoveElements {
static at(elementToRemove) {
let parent = elementToRemove.parentElement;
elementToRemove.remove();
return parent;
}
} | true |
c6e5baae9ec186fb954cd0d664e31306dc813cfd | JavaScript | purebone00/Bone-bot | /commands/ping.js | UTF-8 | 226 | 2.671875 | 3 | [] | no_license |
module.exports ={
name: "ping",
cooldown: 0,
description: "Shows latency",
execute(message) {
message.channel.send(`Pong! Current latency ${Date.now() - message.createdTimestamp}ms.`).catch(console.error);
}
};
| true |
d55647bd87be7433f18ac8f98df4965db4ba2fc4 | JavaScript | snychka/javascript-operators-flight-manager | /logic/util.js | UTF-8 | 1,104 | 2.921875 | 3 | [] | no_license | function Util() {
function checkInput(i) {
if (!i || isNaN(i)) {
throw Exception();
}
}
function calculateTotalDistributedPassengers(
{
vipPassengersWithBusinessSeats, vipPassengersWithEconomySeats,
regularPassengersWithBusinessSeats, regularPassengersWithEconomySeats
}
) {
... | true |
88b4607e20434f9d1c159f4ede18632791352f42 | JavaScript | kristofferkarlsson93/portfolio2.0 | /src/components/Car.js | UTF-8 | 3,330 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import car from '../img/car.png';
import classNames from 'classnames';
import MaterialIcon from 'react-google-material-icons'
//import { CSSTransitionGroup } from 'react-transition-group' // ES6
//https://elrumordelaluz.github.io/csshake/
// window.onscroll = e => {}
export d... | true |
45012bfeeaaa0ec5acf09425aab77250738331c6 | JavaScript | ZantetsukenGT/automatic-bassoon | /public/index.js | UTF-8 | 920 | 2.703125 | 3 | [] | no_license | function setup() {
noCanvas();
}
function IniciarSesion() {
var usuarioText = document.getElementById("textBox1").value;
var passwordText = document.getElementById("textBox2").value;
if(usuarioText != "" && passwordText != "")
{
if(usuarioText == "ADMIN")
{
if(passwordText == "140918")
{
alert("Se... | true |
3bb144f511addbe94136e887b410c87348ec330b | JavaScript | JVSakura/Happy-Hollipays | /public/assets/js/tween/expo.js | UTF-8 | 474 | 2.890625 | 3 | [
"MIT"
] | permissive | const Expo = () => {}
Expo.easeIn = (t, b, c, d) => {
if (t==0) {
return b;
} else {
return c*Math.pow(2, 10*(t/d-1))+b-c*0.001;
}
}
Expo.easeOut = (t, b, c, d) => {
if (t==d) {
return b+c;
} else {
return c*(-Math.pow(2, -10*t/d)+1)+b;
}
}
Expo.easeInOut = (t, b, c, d) => {
if (t==0) {
return b;
}... | true |
95a6eff03be59bdb2249c8ef019e8284b815433b | JavaScript | katanka/JQSPA | /controller.js | UTF-8 | 1,325 | 2.78125 | 3 | [] | no_license | $(document).ready(function() {
var current_route;
var current_added_elements = [];
var hash = window.location.hash.substring(1);
if (hash in routes) {
load_route(hash);
} else {
load_route("home");
}
$(".link").click(process_click);
function load_route (route) {
$("#content").html("");
for (var i = ... | true |
daa24d936f4d778c186883e47181f89a72684c2c | JavaScript | kalii8/React-quizz | /src/question/question.js | UTF-8 | 1,609 | 2.8125 | 3 | [] | no_license | import React from 'react';
import './question.css';
export default class Question extends React.Component {
constructor(props){
super(props);
this.state = {
answer: 'none'
}
}
render(){
let yesClass = 'yes';
if(this.state.answer === 'yes')
... | true |
1805a249e01f764c421bce817d97f5890e040976 | JavaScript | MarcelGil82/ServiceNSWLesson7 | /ExerciseInheritance.js | UTF-8 | 5,856 | 4.28125 | 4 | [] | no_license | // 1. Create a class called Person with three properties called firstName, lastName and age. Include a constructor that assigns these values
// class Person {
// constructor(firstName, lastName, age) {
// this.firstName = firstName;
// this.lastName = lastName;
// this.age = age;
// }
//... | true |
66cdac80a9688cdaf5c58f48c1beb1bd8a009d95 | JavaScript | iganaskret/theswaplibrary | /script-book-offer.js | UTF-8 | 2,172 | 2.953125 | 3 | [] | no_license | let book = window.location.href.slice(window.location.href.indexOf("?") + 1);
console.log(book);
document.querySelector(".book-cover #book-cover-img").src =
"books/" + book + ".png";
let author, title, genre, hashtags, description;
if (book == "the-unsplash-book") {
author = "Dann Petty";
title = "The Unsplash... | true |
054b1d7a3a2979cf362db05db6f3b32dd3f31586 | JavaScript | irclausen/thepainteddesk | /js/script.js | UTF-8 | 2,753 | 2.953125 | 3 | [] | no_license | /* Author:
Ian Clausen
*/
var showNewImage = function(item) {
}
var swapImage = function(item) {
$('#primaryImage').hide(0, function() {
$('#primaryImage').removeClass();
if(item.hasClass('one')) {
$('#primaryImage').addClass('one');
} else if (item.hasClass('two')) {
$('#primaryImage').addClass('two');... | true |
f5f2bda202dc0f516b1d2a667903408f75ccb149 | JavaScript | jrob-io/louie.js | /louie.js | UTF-8 | 10,966 | 2.6875 | 3 | [] | no_license | (function() {
var Lua = {
_g: {},
run: function(){}
};
var Louie = function(scope) {
var blFunctions = null;
functions = {};
variables = {};
this._g = {player:{}, level:{}};
Lua._g = this._g;
this.stack = [];
};
var p = Louie.prototyp... | true |
3c97daed6d225362b1f44d9a232ad4cb12373c60 | JavaScript | xenonflash/animate-wave | /html/animateWave.js | UTF-8 | 2,715 | 3.234375 | 3 | [] | no_license |
function AnimateWave(id, padding, waveData) {
this.elem = document.getElementById(id);
if (!this.elem) throw new Error('element not found')
this.waveData = waveData;
this.timer = null;
var _canvas = document.createElement('canvas');
this.w = parseFloat(getComputedStyle(this.elem).width);
this.h = parseF... | true |
12bd3f75d36646cb40fc95058585b8e8b5ee9434 | JavaScript | chrisbradleydev/javascript-closures-and-callbacks | /src/08/02/index.js | UTF-8 | 1,322 | 3.0625 | 3 | [] | no_license | // Limit to a Single Shared Broadcaster Each New Event
import React from 'react';
import { render } from 'react-dom';
import { getURL, useBroadcaster, useListener } from '../../../lib/broadcasters';
import { map, mapBroadcaster } from '../../../lib/operators';
import { head, pipe } from 'lodash/fp';
const share = () ... | true |
c39b7de9efca6ae78718f98da5522572e606dfad | JavaScript | faityworld/html-version | /js/index.js | UTF-8 | 2,403 | 3.1875 | 3 | [] | no_license | window.onload = function() {
// fetch("https://en.wikipedia.org/w/api.php?origin=*&format=json&action=opensearch&search=dog")
//fetch("https://en.wikipedia.org/w/api.php?origin=*&format=json&action=query&generator=search&gsrlimit=10&exsentences=1&gsrsearch=dog")
document.getElementById('search').addEven... | true |
6507a8965f30e5557f8b46429366a0b0bfa831ac | JavaScript | kveola13/super-bassoon | /objects/objects.js | UTF-8 | 684 | 3.421875 | 3 | [] | no_license | let john = {
name: "John",
age: 28,
job: "Assassin",
presentation: function(style, timeOfDay){
if(style === "formal"){
console.log("Good morning, my name is " + this.name + " I\'m not working today.")
} else if (style === "friendly"){
console.log("Yeah, I\'m thinking I\'m not quite back yet. Have a nice "... | true |
b5e766d97bda4631c86665ba9714ee606bab7117 | JavaScript | zeaxhh/Mixed-Messages | /main.js | UTF-8 | 987 | 4.0625 | 4 | [] | no_license | //CodeAcademy Portfolio Project
//stores nested arrays neatly inside object properties
const foodGroups = {
Proteins: ["Steak", "Chicken", "Tofu", "Fish"],
Carbs: ["Jasmine Rice", "Lentils", "Black beans", "Sweet Potatoes"],
Veggies: ["Brocolli", "Mixed Veggies", "Asparagus", "Green Beans"],
};
//uses template ... | true |
22332c5604db513c17a984738ee74e3ea9bd9acb | JavaScript | suncire/platzi-curso-practico-javascript | /salarios.js | UTF-8 | 1,156 | 2.625 | 3 | [
"MIT"
] | permissive | const venezuela = [];
venezuela.push({
name: 'Rosita',
salary: 3,
});
venezuela.push({
name: 'Luisa',
salary: 1,
});
venezuela.push({
name: 'Juan',
salary: 5,
});
venezuela.push({
name: 'Otelo',
salary: 10,
});
venezuela.push({
name: 'Victor',
salary: 12,
});
venezuela.push... | true |
84d36e6ac8939d6126dc2f8dcac0525ff01f50c2 | JavaScript | hbshifat/react--tic-tac-toe | /src/shared/utils/index.js | UTF-8 | 1,091 | 3.890625 | 4 | [] | no_license | /**
* Write a helper function
* For Calcucate Winner
* @param {Array} squares
* @returns {string}
*/
export function calculateWinner(squares = []) {
// Declare combination list for find the winner
const lines = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],... | true |
03f0a38c5ffa304307a3d142575dea57c3e974d3 | JavaScript | Jiaming927/NodePractice | /FileUpload/server.js | UTF-8 | 1,487 | 2.984375 | 3 | [] | no_license | // The server, takes parameter, pass it to router
// All commented codes are previous versions, kept for reference
// Tried to write all the reasons for my codes so that I can remember what happened
var http = require("http");
var url = require("url");
function start(route, handle) {
function onRequest(request, re... | true |
daf881dce7e0a1f73447d1808b35ab89258a36b6 | JavaScript | Study-CCC/mystudy | /js/手写系列/eventEmitter.js | UTF-8 | 477 | 3.4375 | 3 | [] | no_license | class EventEmitter{
constructor() {
this.list = {}
}
on(event,fn) {
(this.list[event]||(this.list[event]=[])).push(fn)
}
emit(event) {
if (!this.list[event]) throw new Error(`${event} is not define`)
let args = Array.prototype.slice.call(arguments, 1)
this.list[event].forEach(fn=>fn.ap... | true |
070ee062a5721215a301abc912fd9c177fdf3044 | JavaScript | BoardHub/score | /js/data.js | UTF-8 | 1,487 | 2.6875 | 3 | [] | no_license | function processNSEData(key, data) {
var chart = charts[key];
chart.labels = data[0].symbol;
var dataset = { label : chart.dataset1label, data : [data[0].netPrice] };
for(var i = 1; i < data.length; i++) {
var row = data[i];
chart.labels = chart.labels + ',' + row.symbol;
dataset.data.push(row.n... | true |
6c408947030ab6f5917767d9ed600a7ebb45d499 | JavaScript | jx1am/blecollect | /bleCollect.js | UTF-8 | 3,001 | 2.53125 | 3 | [] | no_license | var noble = require('noble');
var mqtt = require('mqtt');
var client = mqtt.connect('mqtt://10.1.0.238:1883');
var devices = [
{ localName: 'BAT3.3' },
{ localName: 'BAT3.1' },
{ localName: 'BAT3.4' },
{ localName: 'BAT3.0' },
{ localName: 'BAT3.2' }
]
var state = 'closed'
var dataBuffer = {};
var uniqIds = []... | true |
e4687c107d718c8dcd4fc20730b498dfa85115df | JavaScript | poppinlp/leetcode | /30-Day LeetCoding Challenge/1.js | UTF-8 | 530 | 3.5625 | 4 | [
"MIT"
] | permissive | const singleNumber = nums => {
const arr = [];
for (const n of nums) {
const idx = arr.indexOf(n);
idx === -1 ? arr.push(n) : arr.splice(idx, 1);
}
return arr.pop();
};
const singleNumber = nums => {
const set = new Set();
for (const n of nums) {
set.has(n) ? set.delete(n) : set.add(n);
}
f... | true |