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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c9f91e4e5b2eef5adbbc4b655905ae59f6b6619b | JavaScript | guendolkim/guendolkim.github.io | /js/mypage.js | UTF-8 | 1,952 | 2.953125 | 3 | [] | no_license | 'user strict';
// profile
const mrKim = document.querySelector('nav> ul> li:nth-child(1)');
const profile = document.querySelector('.profile');
mrKim.addEventListener('click',()=>{
console.log("profile click");
if(profile.style.display == 'flex'){
profile.style.display ='none';
}else{
profile.style.disp... | true |
b5586b37919185647825264ade8c804b9aeb276a | JavaScript | olgaialanskaia/todos | /resources/js/index.js | UTF-8 | 9,285 | 3.203125 | 3 | [] | no_license | // Create needed constants
const list = document.querySelector('ul');
const todoInput = document.querySelector('#td-input');
const form = document.querySelector('form');
const submitBtn = document.querySelector('.td-btn--adding');
// Create an instance of a db object for us to store the open database in
let db;
windo... | true |
5878465374dbc8e3abaeed1b40af56ed5e6cb9cc | JavaScript | kevinmeredith/react-counter-learning | /src/components/Todos.js | UTF-8 | 1,739 | 2.640625 | 3 | [] | no_license | import {addTodo, deleteTodo} from "../actions/actionCreators.js";
import React from 'react';
import { connect } from 'react-redux';
export class Todos extends React.Component {
constructor() {
super();
this.state = {
inputText: ''
};
}
handleChange(e) {
this.set... | true |
2809515473c50e5807e12d809ba73d2c4f51ed6d | JavaScript | Xiaolong96/code | /react/hook/小型 redux 实现.js | UTF-8 | 1,305 | 3.375 | 3 | [] | no_license | /**
* 管理包含多个子值的复杂 state 对象 ==> useReducer
* 组件树共享 ==> createContext、useContext
* 不仅能获取共享数据,还要能修改 ==> Provider value { state, dispatch }
*/
import React from "react";
// context.js
export const Context = React.createContext(null);
export const initialState = {
value: 0,
};
export function reducer(state, action... | true |
f00963790b62757473dc0c02284f97ed537f6a93 | JavaScript | nicolaslabellaciancio/background-generator | /script.js | UTF-8 | 974 | 3.4375 | 3 | [] | no_license | const color1 = document.getElementById('color1');
const color2 = document.getElementById('color2');
const css = document.querySelector('h3');
const body = document.querySelector('body');
const button = document.querySelector('button');
console.log(body);
console.log(color1);
console.log(color2);
setGradient();
functi... | true |
bdc3784d8610ef56f10fbefe958c9f7e2ccfe47b | JavaScript | ranand16/interview-algo-practice | /majorityElement.js | UTF-8 | 708 | 3.8125 | 4 | [] | no_license | function majorityElement(array) {
if(!array.length) return 0
let majorityElement = null;
let majorCount = 0;
for (let i = 0; i < array.length; i++) {
const element = array[i];
if(!majorityElement) {
majorityElement=element
majorCount++
} else if(majorityE... | true |
608edf969c4848156f6db0f0b41188c8a56a30a0 | JavaScript | khailegend/muster-reactjs- | /src/redux/reducers/dataTeachers.js | UTF-8 | 796 | 2.640625 | 3 | [] | no_license | import * as teacherConstants from './../constants/actionFetch';
const initialState = {
dataTeachers: []
};
const Reducer =( state = initialState , action) => {
switch(action.type){
case teacherConstants.FETCH_TEACHERS: {
return {
...state,
dataTeachers: [],
... | true |
52f32b5e2870341d86821a61ff2e3a39276f47ee | JavaScript | saminCSE/Form-Validation | /validation.js | UTF-8 | 8,803 | 3.03125 | 3 | [] | no_license | $(document).ready(function () {
$("#fnameError").hide();
$("#lnameError").hide();
$("#unameError").hide();
$("#emailError").hide();
$("#numError").hide();
$("#passError").hide();
$("#cpassError").hide();
$("#urlError").hide();
// errors are all false
let error_fname = false;
let error_lname = fal... | true |
50465823f203f8efe8545adad7c8832df29e87ea | JavaScript | rachel-lynch-lin/u_web_dev_bootcamp | /javascript_basics_arrays/array_iteration.js | UTF-8 | 1,118 | 5.3125 | 5 | [] | no_license | // Array Iteration
// Use a for loop to iterate over an array
// Use forEach to iterate over an array
// Compare and contrast for loops and forEach
// For loop - use array's length property to loop over the array
var colors = ["red", "orange", "yellow"];
for(var i = 0; i < colors.length; i++) {
console.log(... | true |
2fbb2e3a0cbbe0b788d59a1c8c7c89385eae067a | JavaScript | hashtag-include/arewegood-sdk-js | /lib/uncaught-handler.js | UTF-8 | 1,281 | 3.09375 | 3 | [] | no_license | // takes things to bind to the uncaught handler instance
// returns a function that should be attached (by the consumer)
// to process.on('uncaughtException');
//
// opts:
// {
// logger:ExceptionLogger, //arewegood logger we log to
// console:Object, //Console-like object that we .error to
// exitCod... | true |
d738b72c322950c2165672be48d761be45dd0e69 | JavaScript | ragranadosu/Laboratorio_05_00138816 | /ejercicio2.js | UTF-8 | 320 | 3.25 | 3 | [] | no_license | var sortMio = function(array) {
var aux1;
for(i = 0;i < array.length-1 ; i++){
for(j = 1; j < array.length ; j++){
if(array[i] > array[j]){
aux1 = array[j];
array[j] = array[i];
array[i] = aux1;
}
}
}
return array;
} | true |
33fc00d816ffeecafd9584748371beb80f2f4c7b | JavaScript | abzico/qcloudbackup | /index.js | UTF-8 | 5,676 | 2.546875 | 3 | [
"MIT"
] | permissive | /**
* Author: haxpor
* Link: https://github.com/haxpor/qcloudbackup
* It can be used as it is, otherwise see README.md on github.
*/
'use strict';
require('./promise-retry.js');
var exec = require('child_process').exec;
const wechatNotify = require('wechat-notifier');
// define storageIds we're interested in
var... | true |
5ddc39d7f27d1a3ce742562ddd8f79bcd9ff8b3b | JavaScript | Xc-10/-dialog | /main.js | UTF-8 | 960 | 2.875 | 3 | [] | no_license | function showdialog(dialog) {
dialog.removeAttribute('style')
const timer = setTimeout(() => {
dialog.classList.add('is-show')
clearTimeout(timer)
}, 20)
}
function closedialog(dialog) {
dialog.classList.remove('is-show')
const timer = setTimeout(() => {
dialog.setAttribute('style', 'display:none... | true |
3c10c7f3895b3ddc01805be3da75f1fd6414bf8a | JavaScript | Oleksandr-Heleta/webRTC | /script.js | UTF-8 | 5,664 | 2.6875 | 3 | [] | no_license | const startButton = document.getElementById('start');
const recordButton = document.getElementById('record');
const playButton = document.getElementById('play');
const downloadButton = document.getElementById('download');
const screenButton = document.getElementById('screen');
const snapshotButton = document.getElement... | true |
476beaa193680b9041d476cbfe2d2ce6024d65bd | JavaScript | kuanglinfeng/Interview | /类型判断/type.js | UTF-8 | 535 | 2.734375 | 3 | [
"MIT"
] | permissive | function type(target) {
const map = {
'[object Number]': 'number',
'[object String]': 'string',
'[object Boolean]': 'boolean',
'[object Array]': 'array',
'[object Object]': 'object',
'[object Date]': 'date',
'[object RegExp]': 'regexp',
'[object Error]': 'error',
'[object Symbol]':... | true |
6a27b5b171f98ffc8a2abf2bcf35bf17e8f8c35c | JavaScript | davidserna2005/ERS_App | /routes/userRouter.js | UTF-8 | 2,114 | 2.578125 | 3 | [] | no_license | const ersServices = require('../services/ERS_services');
const express = require('express');
const bcrypt = require('bcrypt');
const router = express.Router();
//Block Autheticates and LogIn user.
router.post('/login',(req,resp,next)=>{
const user = req.body;
ersServices.readUser(user.username)
.then(dat... | true |
1c3859e909834c763e0f2a9efe7a660bee874144 | JavaScript | bibiwatson/HackerRank-Solutions | /10 Days of Javascript/Day 1 Functions/solution.js | UTF-8 | 713 | 3.4375 | 3 | [] | no_license | 'use strict';
const readline = require('readline');
let inputString = []
let currentLine = 0;
let max = 1;
let i = 0;
const rl = readline.createInterface({
input : process.stdin,
output : process.stdout
});
rl.on('line', (el) => {
i++;
inputString.push(el.replace(/\s\s+/g, '... | true |
62006d557921c74afda5e5a5193c56cd0f2ca794 | JavaScript | truckhiem/AspireDemo | /src/stores/CreditStore/reducers.js | UTF-8 | 572 | 2.5625 | 3 | [
"MIT"
] | permissive | import {ActionNames} from './action.types';
const initialState = {
spendingLimit: 0,
isSpendingLimitEnable: false,
};
export const creditStore = (state = initialState, action) => {
switch (action.type) {
case ActionNames.SET_SPENDING_LIMIT:
const {limitValue} = action;
return {
...state,... | true |
1eaf95127d7d4881b187f16c5d6ae646ffe222e2 | JavaScript | josecarlos88/HyperStudio-1 | /StopLight1970s.js | UTF-8 | 242 | 2.546875 | 3 | [] | no_license | function setup() {
createCanvas(600,600);
noStroke();
}
function draw() {
background(204);
fill(255,20,20,160);
ellipse(300,200,200);
fill(20,244,40,160);
ellipse(300,400,200);
fill(222,244,40,160);
ellipse(300,300,200);
}
| true |
f85266190ed207908c9cd7adf5ca644c81756355 | JavaScript | ThomasR/nonogram-solver | /test/runTestsOnJSON.js | UTF-8 | 1,091 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | const fs = require('fs');
const expect = require('expect');
const asciify = line => line.join('').replace(/0/g, '░').replace(/-1/g, 'x').replace(/1/g, '█');
const formatTitle = (title, hints, line) => {
let result = [title];
result.push(`[${hints.join('|')}]`);
result.push(asciify(line));
return result.join('... | true |
5d9fd8b70de82e74880b872ab7e98d27c7b8e0c7 | JavaScript | student0b4dc0d3/Node.js | /week3/homework/ex04-handlebars-fun/app.js | UTF-8 | 1,265 | 3.265625 | 3 | [
"CC-BY-4.0"
] | permissive |
{
'use strict';
const hndlBars = require("handlebars");
const template = hndlBars.compile('{{hbPrefix}} is great to {{hbSuffix}}');
const prefixes = [ "shark", "popcorn",
"poison", "fork", "cherry", "toothbrush", "cannon" ];
const suffixes = [ "watch movie with", "spread so... | true |
ac63ad09fa8088ee01e3f8ecac3e8c66673fd78d | JavaScript | joseeandre/front-MyWallet | /src/components/Login/SignUp.js | UTF-8 | 3,380 | 2.53125 | 3 | [] | no_license | import styled from "styled-components";
import { Link, useHistory } from "react-router-dom";
import React, { useState } from "react";
import Loading from "../Loading/Loading";
import axios from "axios";
export default function SignUp() {
const [email, setEmail] = useState("");
const [name, setName] = useState("");... | true |
68ed2159894b2d58bf78dfcb5097c54229440b13 | JavaScript | wjy18666/react-antd-temp | /src/utils/request.js | UTF-8 | 3,892 | 2.53125 | 3 | [] | no_license | /*
* @Descripttion:
* @version:
* @Author: Jianyong Wang
* @Date: 2020-03-31 15:45:14
* @LastEditors: Jianyong Wang
* @LastEditTime: 2020-04-01 11:43:36
*/
import { useReducer } from 'react'
import { message } from 'antd'
import axios from 'axios';
// 设置request opt
function setRequestOpt(opt) {
let { formD... | true |
be2304dc41217adea6c34d7e02a44e7c5a0c5f05 | JavaScript | directmapping/jDirectMapWeb | /jDirectMapWeb/war/jquery_jdirectmap/dynatree/jquery.jdirectmap.treeprocessor.js | UTF-8 | 7,455 | 2.578125 | 3 | [] | no_license | /*
* jDirectMapTreeProcessor Class
* version: 1.0 (03-18-2012)
*
* Copyright (c) 2012 Michal Skackov (directmapping.appspot.com/jdirectmap)
*
* @requires jQuery v1.7.1 or later
* @requires jsTree 1.0-rc1 or later
*
* @extending UIMTreeProcessor version: 1.0 (11-16-2010) Copyright (c) 2010 Vlad Sham... | true |
8bac5a1538b703c561323e2a1eae1d381530858d | JavaScript | kvitkovsky1302/nodejs-homework | /contacts.js | UTF-8 | 1,330 | 2.671875 | 3 | [] | no_license | const fs = require("fs").promises;
const path = require("path");
const chalk = require("chalk");
const crypto = require("crypto");
const contactsPath = path.join(__dirname, "./db/contacts.json");
async function listContacts() {
const data = await fs.readFile(contactsPath, "utf-8");
const allContacts = JSON.parse(... | true |
9ed609a52577447901173ce0d926858a6be2a4d9 | JavaScript | jidemobell/simonApp | /read.js | UTF-8 | 1,809 | 3.109375 | 3 | [] | no_license | //keep this script//
/*
theGame: function(array,color){
array = this.savedCompPattern;
color = this.colorPos;
// buttonClicked = false;
this.turn =1;
// this.playColorArray(this.colorPos,this.allSound);
// this.soundChooser(this.colorP... | true |
e3f080ad441e05d0cbccabb211618a0fc5211712 | JavaScript | mohamed25-dev/ProShop | /backend/common/response/success.js | UTF-8 | 151 | 2.5625 | 3 | [] | no_license | exports.success = (res, obj = null, status = 200) => {
if (obj) {
res.status(status).send(obj);
} else {
res.status(status).send();
}
};
| true |
ecde8edf458c8b3e76e5c4d61766967d48be3d88 | JavaScript | Numb4r/regex-training | /bordas/bordas.js | UTF-8 | 262 | 3.203125 | 3 | [] | no_license | const texto = "Romario era um excelente jogador\n, mas hoje e um politico questionador"
console.log(texto.match(/r/gi))
console.log(texto.match(/^r/gi))//inicio de linha
console.log(texto.match(/r$/gi))//fim de linha
console.log(texto.match(/^r.*r$/gi))//dotall
| true |
393f2752e72492071e82d29cace9cac13bfac52b | JavaScript | sisufuyu/AudioPlayer | /js/script.js | UTF-8 | 12,034 | 2.53125 | 3 | [] | no_license | (function($){
function AudioPlayer(player){
this.player = player;
this.myAudio = this.player.find("#myAudio");
this.audioNode = this.myAudio[0];
this.cdNode = this.player.find(".CD");
this.PlayNode = this.player.find(".play");
this.pointer = this.player.find(".pointer... | true |
b889f49368e68ff31b2a14b410589265e3da2e2b | JavaScript | The-Pavel/js-puzzle | /lib/puzzle.js | UTF-8 | 2,697 | 3.78125 | 4 | [] | no_license | // function to move a clicked cell; the function moveCell is passed as a callback to the event on line 37
const moveCell = (event) => {
console.log(event.currentTarget)
// calling the checkFunction to see if the currently clicked cell can move
if (checkFunction(event)) {
// 5. if it is: add empty class to cli... | true |
3617392c871000f8a5707f20da643ec3eb352dbb | JavaScript | DJSavvyRad/Savannah_VM364 | /VM364_Canis/Assets/_Scripts/Safehouse_Door.js | UTF-8 | 2,379 | 2.515625 | 3 | [] | no_license | #pragma strict
static var myGlobals : GameObject;
static var Key_Collector : Key_Collector;
var doorFrame : GameObject;
var animator: Animator;
var win : boolean;
var doorOpen : boolean;
var lockedSound : AudioClip;
var unlockedSound : AudioClip;
//Win Variables
static var curTime : float;
static var highScore : fl... | true |
6071b449a71ac62b5b94bcd1bdfc9abafd07c978 | JavaScript | Gael123/rails-heroes-for-hire | /app/javascript/components/date_form_select.js | UTF-8 | 993 | 2.515625 | 3 | [] | no_license | const log = console.log;
import flatpickr from 'flatpickr';
import "flatpickr/dist/themes/dark.css";
const formatNumber = (num) => {
return num.toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')
}
const dateFormSelectInit = () => {
flatpickr(".datepicker", {
altInput: true,
mode: "range",
... | true |
914d8e33e34cb6bad25f8de7b69696c1a15c0fd0 | JavaScript | myousufkhan360/crypto-codex | /tmsplus/js/nfendorsement.js | UTF-8 | 49,174 | 2.578125 | 3 | [] | no_license | $("#txtMileage").keypress(function (event) {
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
if((keyCode>=65 && keyCode<=90) || (keyCode>=97 && keyCode<=122))
return false;
else return true;
});
$("#txtResidenceNum").keypress(function (event) {
var keyCo... | true |
e7b41cdbaf7aed24d10e0a656c7c31408310e9fe | JavaScript | mvchan/fso2020_part7 | /bloglist/frontend/src/reducers/loginReducer.js | UTF-8 | 374 | 2.703125 | 3 | [] | no_license | const reducer = (state = null, action) => {
console.log('login state now: ', state)
console.log('login action: ', action)
switch (action.type) {
case 'SET_LOGIN':
return action.data
default:
return state
}
}
export const setLogin = user => {
return {
type: 'SET_LOGI... | true |
bf7b2b5e5a9824d2e18c7d492afd59e5a1c9d450 | JavaScript | eric-codes/EricCodes2 | /eric-codes-app/app.module.js | UTF-8 | 6,180 | 2.546875 | 3 | [] | no_license | /**
* @file The main app script for the theme.
* @author Eric Cheung
* @version 1.0.0
*
*
* @namespace Directives
*
*
*/
/**
* @namespace Controllers
*/
/**
* @namespace Services
*/
if (window.Debug == true) {
window.Log = {
Msg: function(msg) {
console.log(msg);
},
... | true |
c07ed99b801f8e197facdc8faac58a19c3d1ec2b | JavaScript | PiyushGargOfficial/SportStop | /backend/middlewares/userMiddleware.js | UTF-8 | 1,164 | 2.578125 | 3 | [] | no_license | const { User } = require("../db/models/user");
const { genNewUserID, updateUserID } = require("./userIdMiddleware");
const findUser = async (data) => {
const userExist = await User.findOne({ email: data, isDeleted: false });
return userExist;
};
const addUser = async (data) => {
const newId = await genNewUserID... | true |
fd50ea5d952947bd521e09e63368748d004f3055 | JavaScript | FatimaAbdimalik/js_practice_march2020 | /challenges/week10.js | UTF-8 | 6,834 | 3.875 | 4 | [] | no_license | /**
* This function takes a number, e.g. 123 and returns the sum of all its digits, e.g 6 in this example.
* @param {Number} n
*/
const sumDigits = (n) => {
// if (n === undefined) throw new Error("n is required");
let arr = n
.toString()
.split("")
.map((p) => parseInt(p))
.reduce((a, b) => a + ... | true |
274638497a4fe2c00c81f7f9dba293c2704e95a4 | JavaScript | sa1omon/playlist | /platforms/android/assets/www/js/facebookToDB.js | UTF-8 | 1,772 | 2.53125 | 3 | [] | no_license | /**
* Created by ziv on 26/7/2015.
*/
var mongoAccessLayer = require('./mongoAccessLayer.js');
function FacebookToDB() {
};
FacebookToDB.prototype.validateUser = function (loginInput, callback) {
//check user according to email
mongoAccessLayer.findUser('users', loginInput.user_name, function (err, data) {... | true |
356c534fb9195bb761a05cf2217dbb77b64a3196 | JavaScript | irangareddy/JavaScript | /02Intermediate/trelloV3.js | UTF-8 | 704 | 3.34375 | 3 | [] | no_license | let myTodos = {
day:'Monday',
meetings: 0,
meetDone: 0,
addMeeting: function(meet=0){
this.meetings = this.meetings + meet
},
doneMeeting: function(meet=0) {
this.meetDone = this.meetDone + meet
},
summary: function(){
this.meeti... | true |
9e8935c96f649a9b607b893149394e9a74639911 | JavaScript | mjrafi01/Pin-Matcher | /script.js | UTF-8 | 2,178 | 3.359375 | 3 | [] | no_license |
document.getElementById("matched").style.display="none";
document.getElementById("notMatched").style.display="none";
function setTriedTime(num) {
if (num>=0) {
document.getElementById("times").innerText=num;
} else {
document.getElementById("chanceLeft").innerText="No Chance Left!!";
}
}
function getTr... | true |
7c056a46a5fab4ff241dff3310f10394948cd4d6 | JavaScript | gao182/website-test | /musicPlayer/js/index.js | UTF-8 | 8,272 | 2.578125 | 3 | [] | no_license | function $(select) {
return document.querySelector(select);
}
function $$(select) {
return document.querySelectorAll(select);
}
var audioObj = new Audio();
var sortInt = 0;
var musicObj = [];
var setTime;
//通过ajax获取json数据
function getMusiclist(callee){
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://gao1... | true |
49464353e51bc5546f0bba4f05edc3ae9e5a6309 | JavaScript | damon-shaw/damon-shaw.github.io | /classes/landscape.js | UTF-8 | 842 | 3.09375 | 3 | [] | no_license | function Mountain(xInc, yMin, yMax, color) {
this.xinc = xInc;
this.ymin = yMin;
this.ymax = yMax;
this.color = color;
this.points = [];
this.xstart = random(0, 5);
this.generatePoints = function() {
this.points = [];
let xoff = this.xstart;
for (let x = 0; x < wid... | true |
7ea4a2ff06588402a3e3daf68c6c21ca1d63ab0a | JavaScript | laurastromboni/lab-express-cinema | /starter_code/models/Movie.js | UTF-8 | 692 | 2.578125 | 3 | [] | no_license | const mongoose = require("mongoose");
const Schema = mongoose.Schema;
// create model's schema using the Mongoose "Schema" class
const moviesSchema = new Schema({
// document stucture & rules defined here
title: { type: String, required: true, },
director: { type: String, required: true, },
stars: { type: Ar... | true |
1f369705bcd3ba21fd83833f64e5662bc54b0efc | JavaScript | GaneevAlex/Frontend-Tasks | /js/tableSorting.js | UTF-8 | 3,900 | 3.59375 | 4 | [] | no_license | /**
* Сортирует данные по активному столбцу
* @param table
*/
function tableSorting(table) {
const th = table.getElementsByTagName('th');
const thCount = th.length;
let lastClickElement = null;
for (let thIndex = 0; thIndex < thCount; thIndex++) {
th[thIndex].onclick = function() {... | true |
22f09da27bde565fadad0f1aacb4d29ea7fa12f3 | JavaScript | abbotto/elemint | /src/method/descend.js | UTF-8 | 1,897 | 3.34375 | 3 | [
"MIT"
] | permissive | /**
* @memberof $
* @method $.descend
*
* @description
* Find all the matched descendants at each level of depth relative to the subject.
* Will return `n` levels of descendants until the limit is reached.
*
* @return {Array} An array of descendants that match the given selector.
* @param {Array|Element} targe... | true |
d8851f963ef5c5040d6187a85ca37ebb03d27195 | JavaScript | chiel/informal | /src/pagers/numbered.js | UTF-8 | 465 | 2.578125 | 3 | [] | no_license | 'use strict';
/**
* Numbered page tabs
*/
var Numbered = function(spec){
if (!(this instanceof Numbered)) return new Numbered(spec);
this.spec = spec;
this.build();
};
/**
*
*/
Numbered.prototype.build = function(){
this.wrap = document.createElement('ul');
var i, html = [];
for (i = 0; i < this.spec.lengt... | true |
d83ada293783a5f8aba71ba7e2833f6ac82ac615 | JavaScript | ifpb/ls-solutions | /ecma/function-calc/manuel.lucena/function-calc.mjs | UTF-8 | 453 | 3.4375 | 3 | [] | no_license | function calc (operand1, operand2, operator) {
switch (operator) {
case '+':
return operand1 + operand2;
case '-':
return operand1 - operand2;
case '*':
return operand1 * operand1;
case '/':
return operand1 ... | true |
43b1aad7eac42517860530ab9f0951bafbbbf05f | JavaScript | MateusGabi/MyLib | /dist/all.js | UTF-8 | 535 | 2.53125 | 3 | [] | no_license | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var all = function all(rule) {
return function (array) {
if (!(rule instanceof Function)) {
throw new TypeError('First param should be a Function');
}
if (!(array instanceof Array)) {
throw new TypeError('Second p... | true |
4de2b3d7534cc41b7b0c5dd3fb1c0e835a328067 | JavaScript | audishos/koho-challenge | /modules/processTransactionList.js | UTF-8 | 5,917 | 2.71875 | 3 | [] | no_license | const {
DAILY_LOAD_COUNT_LIMIT,
DAILY_AMOUNT_LIMIT,
WEEKLY_AMOUNT_LIMIT,
MILLISECONDS_PER_DAY,
MILLISECONDS_PER_WEEK,
} = require('./constants');
function processTransactionList(transactionList = []) {
const resultList = [];
const pushResult = (accepted, { id, customer_id }) =>
resultList.push({ id,... | true |
58b926b96a8d1b0140d31fab8ba00acf1d6e6301 | JavaScript | axhaxh/exam | /es6-master/prepare/day01/app2/src/hello.js | UTF-8 | 126 | 3.25 | 3 | [] | no_license | let arr = [1,2,3]
arr.forEach((item,index)=>{
console.log(item+":"+index);
});
console.log(Array.from('hello'));
| true |
462a22b817fed1fc668431056e338bd9e9986080 | JavaScript | future4code/Magali-Silva | /semana10/labex/projeto-labex/src/screens/TripDetailsPage/TripDetailsPage.js | UTF-8 | 2,220 | 2.5625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import Axios from 'axios';
import { useParams } from 'react-router-dom';
import { useChangePageTitle } from '../../hooks/useChangePageTitle'
import { useProtectPage } from '../../hooks/useProtectPage'
import { baseUrl } from '../../constants/axiosConstants'
import { d... | true |
8ea2f37c0405d22200d7d6c4c1743decec74ef60 | JavaScript | joaomlneto/advent-of-code | /2022/25/main.js | UTF-8 | 1,134 | 3.484375 | 3 | [
"MIT"
] | permissive | const fs = require("fs");
const filename = "input.txt";
const file = fs.readFileSync(filename).toString("utf8");
console.log("filename:", filename);
const snafuNumbers = file.trim().split("\n");
const snafuDigitValue = (snafuDigit) =>
({
"=": -2,
"-": -1,
0: 0,
1: 1,
2: 2,
}[snafuDigit]);
co... | true |
371c335a3e4a8c6f6b6ab552aef5585a71f51e96 | JavaScript | m-aitken/WDI_12_HOMEWORK | /Matthew/wk06/5-fri/citipix/js/main.js | UTF-8 | 935 | 3.734375 | 4 | [] | no_license | var cities = ["Austin", "Los Angeles", "New York", "San Francisco", "Sydney"]
var option = document.getElementById("city-type")
for (var i=0; i<cities.length; i++) {
var select = cities[i];
var element = document.createElement("option");
element.textContent = select;
element.value = select;
option.appendChil... | true |
7b265b29672e752235682580415791c4c18dfacf | JavaScript | asehlers/classwork | /class-11/03-CharacterCreate/characterRPG.js | UTF-8 | 1,949 | 3.71875 | 4 | [] | no_license | function Character(name, profession, gender, age, strength, hitPoints){
this.name = name;
this.profession = profession;
this.gender = gender;
this.age = parseInt(age);
this.strength = parseInt(strength);
this.hitPoints = parseInt(hitPoints);
this.currentHP = this.hitPoints;
this.printStats = function(){
conso... | true |
38b34690d2c816dbbe4f6df6cabe1a69874965cc | JavaScript | shevictory/js-intro | /js/DOM.js | UTF-8 | 925 | 2.6875 | 3 | [] | no_license | const h1IdElement = document.getElementById('pageHead');
const userInfoClassElement = document.getElementsByClassName('userInfo');
const liElenent = document.getElementsByTagName('li');
const namedElement = document.getElementsByName('firstName');
const selectorElement = document.querySelector('li');
const selectorAll... | true |
a63ae86fc3cb26c992ca0cd899327eb180edbbcf | JavaScript | sharlotta93/Week-06-Day-02-Lab | /specs/paint_specs.js | UTF-8 | 887 | 2.78125 | 3 | [] | no_license | const assert = require('assert');
const Paint = require('../models/paint.js')
describe('Paint', function () {
let paint;
beforeEach(function () {
paint = new Paint(5)
});
it('should have litres of paint', function () {
const actual = paint.amount;
const expected = 5;
assert.strictEqual(actua... | true |
09a2cb98b9eaa9613153099b4cc6df316a06d6d3 | JavaScript | m4tty-d/stock-trader | /client/src/store/modules/stocks/mutations.js | UTF-8 | 1,121 | 3.15625 | 3 | [
"MIT"
] | permissive | const updateStocks = (state, newStocks) => {
state.stocks = newStocks
}
const changeStockPrices = state => {
let max = 500
let min = 5
for (let key in state.stocks) {
if (state.stocks.hasOwnProperty(key)) {
state.stocks[key].price =
Math.floor(Math.random() * (max -... | true |
0c1d652bb92014148a1bcd8c81ddbe455034ff51 | JavaScript | be-cool/friend-finder | /app/routing/apiRoutes.js | UTF-8 | 918 | 2.890625 | 3 | [] | no_license | // pull in the linked routes to our dummy data arrays
var friends = require("../data/friends");
module.exports = function(app) {
app.get("/api/friends", function(req, res) {
res.json(friends);
});
app.post("/api/friends", function(req, res) {
var match = {
name: "",
photo: "",
fDiffere... | true |
72be557f403ca5307ab1ab37bcb401d01608ce26 | JavaScript | OndraZizka/JS-neural-networks | /lib.cSet.js | UTF-8 | 2,588 | 2.9375 | 3 | [] | no_license | /*** -*- Mode: Javascript; tab-width: 2;
The contents of this file are subject to the Mozilla Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
... | true |
6bf5dfcd8b42ef32de548596d75dd3eda793a450 | JavaScript | tingzhouu/jsplayground | /scopes_and_closures/closure/closure_loops.js | UTF-8 | 806 | 4.25 | 4 | [] | no_license | // prints out 6 for every iteration
// because 'var' keyword is used for declaration,
// all console.log statements reference to the same variable i
for (var i = 1; i <= 5; i++) {
setTimeout(function timer(){
console.log('i', i);
}, i * 1000);
}
// we can use a IIFE to create a new scope for each iteration
// ... | true |
8298724937412da6144f5d1ca654ed7b4d73a59d | JavaScript | andreasfrank/homebridge-parrot-flower | /src/services/StatusService.js | UTF-8 | 1,517 | 2.671875 | 3 | [
"MIT"
] | permissive | 'use strict';
const moment = require('moment');
let Characteristic;
const preferredFormat = 'L LT';
class SensorStatusService {
constructor(log, api, name, device) {
this.log = log;
this.name = name;
this._device = device;
Characteristic = api.hap.Characteristic;
this._createService(api.hap... | true |
05e456079aa998429955bc3d403c8e2b9dd455ab | JavaScript | tomerrajuan/petition | /utils/bc.js | UTF-8 | 1,073 | 2.625 | 3 | [] | no_license | // const bcrypt = require('bcryptjs');
// const { promisify } = require('util');
//
// const hash = promisify(bcrypt.hash);
// const genSalt = promisify(bcrypt.genSalt);
// var spicedPg = require("spiced-pg");
// var bc = spicedPg("postgres:postgres:postgres@localhost:5432/petition");
//
// // WILL BE CALLED IN... | true |
cfb0e4c891947a6b8711c06b59353bc463291d97 | JavaScript | nickfloros/stream-log-playback | /src/log-time-series.service.js | UTF-8 | 1,064 | 2.859375 | 3 | [
"MIT"
] | permissive | 'use strict';
const {
Transform,
} = require('stream');
/**
* fires events based on time difference between
* successive entries.
*/
module.exports = class LogTimeSeries extends Transform {
/**
* default constuctor
* @param {object} params
* @params {number} params.timeResolution allows to control
* ... | true |
ec713b4e572d14bc81ab5c249e3b1fcd354a8942 | JavaScript | Arun-42/stealth-tasks | /src/components/sidebar.js | UTF-8 | 1,759 | 2.671875 | 3 | [] | no_license | import React, { useState } from "react";
import "./sidebar.css";
import EditIcon from "@material-ui/icons/Edit";
import TextField from "@material-ui/core/TextField";
import FolderIcon from "@material-ui/icons/Folder";
const Folders = ({ folderArr }) => {
return folderArr.map((folder) => <Folder folder={folder} />);
... | true |
8ce8e46f2eab01adc7d14f36dbdf92c569094f8f | JavaScript | ZMArmin/first-project | /js/addshop.js | UTF-8 | 1,379 | 2.6875 | 3 | [] | no_license | class AddShop {
constructor() {
this.inputName = document.querySelector("#inputName");
this.inputPrice = document.querySelector("#inputPrice");
this.inputNum = document.querySelector("#inputNum");
this.addbtn = document.querySelector("#addShopBtn");
this.init();
}
ini... | true |
c6aeb40ab1b85fbfdb9389ca6c7725227626b689 | JavaScript | brunogamacatao/healthtracker | /src/scripts/collections/trackedfoods.js | UTF-8 | 999 | 2.6875 | 3 | [] | no_license | Healthtracker.Collections = Healthtracker.Collections || {};
(function () {
'use strict';
/**
* This is a mock implementation of a collection, intended to store the
* selected foods in browser's local storage. It simulates the way a
* collection, connected to a RESTful webservice behaves.
*/
Health... | true |
6771ffece96c07f8d37a0eb4ecf078506c4c9edf | JavaScript | Rahaf-r/witp2019-We-Ignite-Tech-CV-base | /src/cvadd.js | UTF-8 | 4,612 | 2.65625 | 3 | [
"MIT"
] | permissive | import React, { useState } from 'react'
import CvShow from './cvshow'
// to add new CVs
const CvAdd = (listOfCV) => {
const [newName, setName] = useState('')
const [newAge, setAge] = useState('')
const [newSkill, setSkill] = useState('')
const [newEducation, setEducation] = useState('')
const [newEmail, setE... | true |
e049e46f87da8f9be3e311fb8b8886f2236749af | JavaScript | allandhir/college-statistics | /backend/models/StudentModel.js | UTF-8 | 2,747 | 2.546875 | 3 | [] | no_license | // Database
import Database from "../classes/Database";
import mongoose, { Schema } from "mongoose";
// Logger
import Logger from "../classes/Logger";
const ObjectId = mongoose.Types.ObjectId;
const studentModel = {
/**
* Init schema
*/
init() {
const db = Database.getConnection();
/**
* Stude... | true |
448d030c9203d9ce539206a9b180bbc95a741712 | JavaScript | renancvalladao/cod3r-curso-web-moderno | /JavaScript - Exercícios/Lista 1/exerc36.js | UTF-8 | 375 | 4 | 4 | [] | no_license | function multiplicaVetor(vetor, num) {
for(let i = 0; i < vetor.length; i++) vetor[i] *= num
console.log(vetor)
}
function multiplicaMaiorCinco(vetor, num) {
for(let i = 0; i < vetor.length; i++) {
if(vetor[i] > 5) vetor[i] *= num
}
console.log(vetor)
}
let vetor = [1, 2, 3, 4, 5, 6]
m... | true |
5eef067d96eb4c473d554cc7e0a3369325d57cb1 | JavaScript | AndhikaJeremia/Poke_app | /src/actions/pokedexAction.js | UTF-8 | 4,100 | 2.65625 | 3 | [] | no_license | import AsyncStorage from '@react-native-async-storage/async-storage'
import axios from 'axios'
export const getAllPokemon = (otherlink) => {
return async(dispatch) => {
try{
let link = 'https://pokeapi.co/api/v2/pokemon/?offset=0&limit=10'
if (otherlink) {
link = oth... | true |
20b124af029071621928424eaa4da0a5fb9ea095 | JavaScript | BrunoMarini/Fixit_SERVER | /scripts/mapScript.js | UTF-8 | 23,744 | 2.59375 | 3 | [] | no_license | let map, heatMap, cluster, geocoder;
let pointInfo;
let points, resolvedPoints;
let idToBeDeleted = undefined;
let markers = [];
let resolvedMarkers = [];
let infoWindows = [];
let adminToken = undefined;
let showResolved = false;
let mapStyleClear =
[{
"featureType": "poi",
"elementType": "labels.text",
"s... | true |
3a9d142a3b41ff6aec2b7ad8c5c4fb3f32809277 | JavaScript | Ghislainbatatu/estudotsc | /index.js | UTF-8 | 469 | 3.390625 | 3 | [] | no_license | "use strict";
function somar(a, b) {
return a + b;
}
;
console.log(somar(7, 9));
function sub(a, b) {
return a - b;
}
console.log(sub(9, 4));
var Identidade = /** @class */ (function () {
function Identidade(primeiroNome, segundoNome, anos) {
this.nome = primeiroNome;
this.sobrenome = segund... | true |
16c05ee0e7fb00dcfafccfa08a9586f34997e5c9 | JavaScript | aweary/swc | /crates/swc_ecma_transforms_base/tests/resolver/minifier/9/output.js | UTF-8 | 246 | 2.609375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var o__1 = 0;
function f__1() {
try {
throw 1;
} catch (c__3) {
try {
throw 2;
} catch (o__2) {
var o__2 = 3;
console.log(o__2);
}
}
console.log(o__2);
}
f__1();
| true |
e96c5539856e82544df280f588e3653deaf2c865 | JavaScript | makebrainwaves/BrainWaves | /app/experiments/custom/content_background.js | UTF-8 | 1,196 | 2.59375 | 3 | [
"MIT"
] | permissive | export const background = {
first_column_statement: `Did you know that we spend more time looking at
faces than any other type of stimuli? Faces contain a lot of information
that is relevant to our day-to-day lives.
For example, by looking at someone’s face we can assess their emotional
state. This has led re... | true |
f77def731779d9303c902d2d681222aa41bd69e5 | JavaScript | rnguyen17/instaweather | /app/components/weather/weather.js | UTF-8 | 1,502 | 2.5625 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import './weather.css';
export default class WeatherForm extends React.Component {
constructor(props) {
super(props);
this.state = {
cityToSearch: '',
currentCityInput: ''
}
this.resetCityInput = (e... | true |
50ef6fa23b3c6fe40dbef61f4802d2a777ae7288 | JavaScript | mitzey234/quickdrop | /client/src/modules/packetTracker.js | UTF-8 | 1,838 | 3.03125 | 3 | [] | no_license | //The packet manager is responsible for keeping track of the packets we have received
//and the packets that appear to have timed out.
//All of the code below to the footer is key to the packet manager's
//Packet tracking, which keeps track of already received packets for resume capability
var arr = {};
var high = 0... | true |
8854ec426e827ebbdf716317cf23c5dc10174e94 | JavaScript | divyakancharla/Divya | /AngularIntroo/MyScript.js | UTF-8 | 4,393 | 3.09375 | 3 | [] | no_license | // //console.log("Heloo World");
// // let mystring:string;
// // let mynum:Number;
// // let mystatus:boolean;
// // mystring="Jigel";
// // mynum=420;
// // mystatus=true;
// // console.log(mystring);
// // console.log(mynum);
// // console.log(mystatus);
// // let mydata:any;
// // mydata="hello132";
// // console.... | true |
6345089540d681d4378f71cacf2a9ec87fda0f36 | JavaScript | santoshkumar964887/React-monsterMiniProject | /src/App.js | UTF-8 | 913 | 2.921875 | 3 | [] | no_license | import React, { Component } from "react";
import "./App.css";
class App extends Component {
constructor() {
super();
this.state = {
list: [],
serch: "",
};
}
componentDidMount() {
fetch("https://jsonplaceholder.typicode.com/users")
.then((response) => response.json())
.th... | true |
3261d1b92cb93fc996e41d1cf2da2f3bd4c537c8 | JavaScript | SnowpawStudios/SnowSite | /Quote Display/app.js | UTF-8 | 967 | 3.34375 | 3 | [] | no_license | const quotes = [
{
name: "Stephen King",
quote: "Get busy living or get busy dying"
},
{
name: "Dr. Seuss",
quote: "Don't cry because it's over, smile because it happened."
},
{
name: "Oscar Wilde",
quote: "Be yourself; everyone else is already taken."
},
{
name: "Albert Einstein",
quote: "Two th... | true |
b01dcd62cca64546ae0e13fcc3aa1938000e3e14 | JavaScript | secretrobotron/web-paper | /public/src/draggable.js | UTF-8 | 2,434 | 2.609375 | 3 | [] | no_license | define([], function(){
var TRANSFORM_PROPERTY = (function(){
var div = document.createElement( "div" );
var choices = "Webkit Moz O ms".split( " " ).map( function( prefix ) { return prefix + "Transform"; } );
for ( var i = choices.length; i >= 0; --i ) {
if ( div.style[ choices[ i ] ] !== undefine... | true |
61a5239e178665b54e367e96fea020ce4bba8ec0 | JavaScript | himamovic1/dream-hotel | /js/validation/crudValidation.js | UTF-8 | 1,408 | 3.109375 | 3 | [] | no_license | function validatePrice(priceInput) {
var pattern = /^[0-9]+(\.|,)?[0-9]{0,2}$/;
if(!pattern.test(priceInput.value)) {
priceInput.setCustomValidity('Cijena nije validna. Cijena mora biti pozitivan broj sa do dva decimalna mjesta.');
return false;
}
else
priceInput.setCustomValidity('');
return true;
}
fun... | true |
3d314a718af3e3d94aa47cc029a26b3e85dd12ef | JavaScript | fredyw/react-todo | /src/TodoItem.js | UTF-8 | 2,166 | 2.671875 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
class TodoItem extends Component {
constructor(props) {
super(props);
this.state = {edit: this.props.item.task.length === 0};
this.handleCheck = this.handleCheck.bind(this);
this.handleClick = this.handleClick.bind(this);
this.handleEdit = this.handleEdit... | true |
d94e77a26fa9f551caf355ff56d4a64a99484673 | JavaScript | honghainguyen777/Codewars | /kata6/Counting Duplicates.js | UTF-8 | 991 | 4.3125 | 4 | [] | no_license | // Counting Duplicates
// Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits.
function duplicateCount... | true |
0f3d33c918104f534703f9835b44f95bca729748 | JavaScript | irationsal/connectfour | /app.js | UTF-8 | 14,986 | 3.703125 | 4 | [] | no_license | //Global Variables
let board = [];
let foundWinner = false
let heightLimit = 6
let defaultRowLimit = 7
let winCondition = 4
let twoPlayer = false
let rowWinCoords = []
let forwardSlashWinCoords = []
let backwardSlashWinCoords = []
let columnWinCoords = []
let potentialCompWinCoords = []
let potentialPlayerW... | true |
1c3c4e2ff41ba9efca6e10d100386f04cd0df26e | JavaScript | mephessivolc/simplexPO | /core/static/js/new_scripts.js | UTF-8 | 1,966 | 2.84375 | 3 | [
"MIT"
] | permissive | // <script language="javascript">
var input = 1;
var var_x = 0;
var count_restri = 0;
function objetiva(campo) {
document.getElementById("aqui").innerHTML+="<div><h2>Maximização </h2> </div> <br> z= ";
var i;
if (campo != 0){
for (i=1; i<=campo; i++) {
if (i == campo){
docum... | true |
09e08ece9cca03f738280e02bfec902edf07966b | JavaScript | brownman/calculator | /interface/server.js | UTF-8 | 1,504 | 3.390625 | 3 | [] | no_license | 'use strict'
/**
* A web-server interface for serving a math calculation service for a givven user input.
* A valid input is a stringified math expression.
*/
const calculator = require('../src/calculator.js')
//const logger = require('../utils/logger.js')
const express = require('express')
const app = express()
c... | true |
5dbf348d73c8c6e6c81ad53b5d2c76138a500aa2 | JavaScript | FlorianBouron/bing-scraper | /index.js | UTF-8 | 1,056 | 2.546875 | 3 | [] | no_license | var casper = require('casper').create({
verbose: true,
logLevel: 'error',
pageSettings: {
loadImages: false,
loadPlugins: false,
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36'
},
clientScripts: ['vendor/jquery.j... | true |
a9450e1098d69fa0df4c3d3b95c0d53cb439ea05 | JavaScript | bdawar/quizzy | /src/App.js | UTF-8 | 2,930 | 2.796875 | 3 | [] | no_license | import React, { Component } from "react";
import QuestionTemplate from "./components/QuestionTemplate";
import AlertModal from "./components/Modal";
import "./App.css";
import { API_FETCH_ENDPOINT, API_SUBMIT_ENDPOINT } from "./config";
class App extends Component {
constructor(props) {
super(props);
//initi... | true |
2d9b68df14ea2425ce979c39fc265854ec2b9747 | JavaScript | saraio/crawler | /server.js | UTF-8 | 1,537 | 2.78125 | 3 | [] | no_license |
const express = require('express')
const util = require('./app/utility')
const db = require('./app/connection')
const dao = require('./app/dataUtil')
const app = express()
const port = 3001
//app.use(express.static(__dirname))
/**
* home page.
* loads the db.
* serving the index.html from the current directory on... | true |
4a8805855ea618df37e7a3f1db71cfd100361d5e | JavaScript | frozan/docker | /OrgRestAPI/organization.js | UTF-8 | 5,131 | 2.640625 | 3 | [] | no_license | /*eslint no-undef: "error"*/
/*eslint-env node*/
/*eslint no-prototype-builtins: "error"*/
const dbconnection = require('./connection');
module.exports = class {
//Retrieve all the organization names from database
all(callback) {
dbconnection.query('SELECT org_name FROM organizations ORDER BY org_name... | true |
5a320fcf28adb071c70e71dabeb290cd39f87334 | JavaScript | wanspaul/drone | /src/reducers/Person.js | UTF-8 | 3,685 | 2.53125 | 3 | [] | no_license | import update from 'react-addons-update';
import * as personTypes from '../actions/PersonTypes';
const initialState = {
input_person: {
name: '',
phone: '',
group: 'g'
},
person_list: [],
person_info: {},
point_use_list: [],
point_use: 0,
modal_show: false
};
functi... | true |
b4998f069767a17fffe9736f2951cc60c6acfcac | JavaScript | kylepeterson/forecast | /src/components/WeatherSnippet.jsx | UTF-8 | 1,377 | 2.84375 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
const propTypes = {
date: PropTypes.string,
high: PropTypes.number,
low: PropTypes.number,
weather: PropTypes.string,
iconUrl: PropTypes.string,
metric: PropTypes.bool,
};
const defaultProps = {
date: '1/1',
high: 0,
low: 0,
weather: '... | true |
9f942bc50a44d054c9a2bcf97de42c142c73b75b | JavaScript | konradszafranski/restaurant-frontend | /jsScripts/basketJS/buildBasketContent.js | UTF-8 | 1,615 | 3.25 | 3 | [] | no_license |
function build(mainElement, selectedDishes) {
selectedDishes.forEach((dish) => {
mainElement.appendChild(buildBasketElement(dish));
});
}
function buildBasketElement(dishElement) {
const basketElement = document.createElement("div");
basketElement.classList.add("content");
basketElement.appendChild(b... | true |
63cde50781c2391173101b6c949659810f5fc113 | JavaScript | chrisdakin/ttt | /server/routes/game.js | UTF-8 | 1,585 | 2.671875 | 3 | [] | no_license | module.exports = function (app, games) {
app.post('/game', function (req, res) {
res.setHeader('Content-Type', 'application/json');
const newGame = createGame();
res.end(JSON.stringify(newGame));
});
app.get('/game', function (req, res) {
res.setHeader('Content-Type'... | true |
c7796d2e887dc76a61d66279dc8a993736555a52 | JavaScript | abhiram227/game | /game_page.js | UTF-8 | 2,435 | 3.28125 | 3 | [] | no_license | var player1_name = localStorage.getItem("player1_name")
var player2_name = localStorage.getItem("player2_name")
var player1_score=0
var player2_score=0
document.getElementById("player1_name").innerHTML=player1_name+": "
document.getElementById("player2_name").innerHTML=player2_name+": "
document.getElementById("p... | true |
8c9c6b73cb885824bfb5c50425e7174800e227d7 | JavaScript | maxim1006/react-main | /server/server-http.js | UTF-8 | 915 | 2.984375 | 3 | [] | no_license | const http = require('http');
const PORT = process.env.PORT || 3001;
const measure = async () =>
new Promise(res => {
setTimeout(res, 2000);
console.log('measured');
});
// запуск сервера через http
(async () => {
// каждый раз когда дергаю запрос на этот сервер то будет дергаться эта фун... | true |
c210afc06574bd40d5cf53957d2ee0dd80e31447 | JavaScript | cqzyl/methods.js | /methods/cqAlert.js | UTF-8 | 2,192 | 2.8125 | 3 | [] | no_license | /*
## cqalert
> cqalert(msg)
- arguments:
```
> msg: String 提示字段
```
*/
function cqAlert (str) {
return cqAlert.start(str)
}
cqAlert.alert_dom = document.getElementById('cq_alert');
var alert_dom = document.createDocumentFragment()
var style_dom = document.createElement('style')
var dialog_dom = doc... | true |
af3ea863c51a838d27ea0514ef799d1e4c446508 | JavaScript | Saurav109/buddy | /functions/index.js | UTF-8 | 947 | 2.625 | 3 | [] | no_license | const functions = require('firebase-functions');
// // The Firebase Admin SDK to access the Firebase Realtime database.
// const admin = require('firebase-admin');
// admin.initializeApp();
//count all node in likedBy then write count in likes node
exports.countLikes = functions.database.ref('/feed/{pushId}/likedBy')
... | true |
25531341f45372169fd4cccbd37edf86b91c6646 | JavaScript | syoichi/taberareloo | /src/lib/command_queue.js | UTF-8 | 1,266 | 2.5625 | 3 | [
"CC-BY-2.5",
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | // -*- coding: utf-8 -*-
/*global Deferred:true, maybeDeferred:true*/
(function (exports) {
'use strict';
function Command(callback, df) {
this.callback = callback;
this.df = df;
}
function CommandQueue(interval) {
this._commands = [];
this._runId = null;
this._interval = (interval == null... | true |
d72ecf45c93874e2f8862c34985aa5bd4e9e3d99 | JavaScript | anryyett/anryyett.github.io | /GoIT/javaScript/home/lesson4/task3.js | UTF-8 | 164 | 2.53125 | 3 | [] | no_license | /**
* Created by Elena on 10/11/2015.
*/
function checkStr(str){
if(str.length <= 20){
return str;
}
return str.slice(0, 17)+ '...';
} | true |