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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e28f2cc47e3b4a3323e9ecac4708ce05eb975c97 | JavaScript | nesror/incubator-weex | /runtime/shared/utils.js | UTF-8 | 1,943 | 2.796875 | 3 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ... | true |
1171499735bec81c3758ce998e46ce0c330a3825 | JavaScript | LaughSun0513/fp-learning | /part01/02 Maybe.js | UTF-8 | 883 | 4.15625 | 4 | [] | no_license | class Functor {
constructor(val){
this._val = val
}
map(fn){
return Functor.of(fn(this._val))
}
}
Functor.of = function (val) { //of写法
return new Functor(val)
}
//Functor.of(null).map(s=>s.toUpperCase()); //由于传入null导致后面的map无法生成新的容器函子
class Maybe extends Functor {
constructor(val... | true |
b015e5f1678d88d5baf72451e0494e87811a772a | JavaScript | JoshuaBevers/api-twippit | /index.js | UTF-8 | 772 | 2.546875 | 3 | [] | no_license | const express = require('express');
const bodyParser = require('body-parser');
const handler = require('./handler');
const cors = require('cors');
const app = express();
/**
* setting up middleware
*/
app.use(bodyParser.json());
app.use(cors());
/**
* testing web server to ensure it works on your machine
*/
app.... | true |
5937968571335496f0494d31df9b69daae9bd311 | JavaScript | treeandgrass/algorithm | /queue/fibo.js | UTF-8 | 430 | 3.625 | 4 | [] | no_license | function fibo(n) {
let m = [1, 1, 1, 0];
let r = [1, 1, 1, 0];
for (let i = 0; i < n; i++) {
r[0] = m[0] + m[2];
r[1] = m[1] + m[3];
r[2] = m[0];
r[3] = m[1];
m = r.slice(0);
}
return m[3];
}
console.log(fibo(0));
console.log(fibo(1));
console.log(fibo(2));... | true |
a1b08a6724c682aae70b755f1011e300b0c8fc7a | JavaScript | mccahan/geojson-clipping | /test/parse.test.js | UTF-8 | 7,532 | 2.71875 | 3 | [
"ISC"
] | permissive | /* eslint-env jest */
const parse = require('../src/parse')
describe('parse', () => {
describe('failure', () => {
test('empty object', () => {
const obj = {}
expect(() => parse(obj)).toThrow()
})
test('object with invalid type', () => {
const obj = { type: 234 }
expect(() => par... | true |
ca38a33ffa80b93bc5388d6fa87fd342200baf72 | JavaScript | dravenTherion/destructible_terrain | /source/renderer/fps.js | UTF-8 | 541 | 2.875 | 3 | [] | no_license | let lastCalledTime = 0,
fpsTotal = [],
delta = 0;
function renderFps()
{
if(!lastCalledTime) {
lastCalledTime = Date.now();
fpsTotal = [0];
}
else
{
delta = (Date.now() - lastCalledTime)/1000;
lastCalledTime = Date.now();
fpsTotal.push(1/delta);
... | true |
5259f983738e73d73e81e9f1437915aa6e201c46 | JavaScript | Studio-J-Designs/test | /styles/js/master.js | UTF-8 | 6,291 | 2.984375 | 3 | [] | no_license | // console.log('direction');
//
//
// function initMap() {
// var directionsService = new google.maps.DirectionsService;
// var directionsRenderer = new google.maps.DirectionsRenderer;
//
// var map = new google.maps.Map(document.getElementById('map'), {
// zoom: 6,
// center... | true |
69e14b8fbe0f3dcadb66c8c33349f808c27979e3 | JavaScript | weissreto/process-editor | /modules/Selection.js | UTF-8 | 4,800 | 2.703125 | 3 | [] | no_license | import { Decorator } from "./Decorator.js"
import { ALL, NONE, BOTTOM_CENTER, BOTTOM_LEFT, BOTTOM_RIGHT, CENTER_LEFT, CENTER_RIGHT, TOP_LEFT, TOP_CENTER, TOP_RIGHT } from "./Bounds.js";
export class Selection
{
constructor()
{
this.elements = [];
this.onChange = null;
}
dra... | true |
95c59e809939d6aba51eea74dcda970e34ac6239 | JavaScript | EvandroLG/data_structures_in_js | /binaryHeap/BinaryHeap.js | UTF-8 | 1,795 | 3.375 | 3 | [] | no_license | const BinaryHeap = () => {
const items = [];
return {
/*
* Adds new item to the Heap
* All parents items are larger than of their child items
* @params {*} value
* @returns {undefined}
*/
insert(value) {
items.push(value);
let i = items.length - 1;
while (i) {
... | true |
b297371e0ad025e962d78a202b3666161c8dc1fa | JavaScript | sabind/blackjack-js | /src/HumanPlayer.js | UTF-8 | 904 | 3.296875 | 3 | [] | no_license | var HumanPlayer = function(name) {
this.name = name;
this.hand = new Hand();
this.chips = 0;
this.chipsInPlay = 0;
};
HumanPlayer.prototype = new Player();
HumanPlayer.prototype.buyIn = function(chipsIn) {
this.chips += chipsIn;
};
HumanPlayer.prototype.chipCount = function() {
return this... | true |
183e9d923781c9d4ca4f30abc5aaa7eb18e8f064 | JavaScript | yonjah/juzz | /lib/types/date.js | UTF-8 | 2,574 | 2.703125 | 3 | [
"MIT"
] | permissive | 'use strict';
const debug = require('debug')('Juzz:Date');
const Moment = require('moment');
const Tools = require('../tools.js');
const { chance } = Tools;
Tools.setDebugColor(debug);
Tools.debug.date = debug;
const DateExample = {
getTime( val ) {
if (!val) {
return undefined;
}... | true |
c1117ecbb5a6659d6690f86a8d492739a1bea8ec | JavaScript | sergiogh7/sesion-31-ud30-javascript1 | /Ej7/script/codigo.js | UTF-8 | 108 | 3.515625 | 4 | [] | no_license | var numero = 5;
var resultado = 1;
for(var i=1; i<=numero; i++) {
resultado *= i;
}
alert(resultado); | true |
876d645cfa5951d54964e625152fa76f6af695a0 | JavaScript | realUnicorns/codingWithJS | /Chatbot/Asuna/rive.js | UTF-8 | 1,816 | 2.609375 | 3 | [] | no_license | let speech;
let speaking = false;
let xoff = 0;
let speechRec;
let bot;
let voi = "Microsoft Zira Desktop - English (United States)";
//let voi = "Google 日本語";
let pit = 2;
let output;
function setup() {
let canvas = createCanvas(200, 200);
speech = new p5.Speech();
speechRec = new p5.SpeechRec("en-US", triggerS... | true |
c782a0685f9e158fc0f4ce89593858f38d820093 | JavaScript | nodemules/nm-app-directory | /public/javascripts/nm.adx.filters.js | UTF-8 | 435 | 2.75 | 3 | [] | no_license | (function() {
var app = angular.module('nmAppDirectory')
app.filter('length', lengthFilter);
function lengthFilter() {
return function(input){
if (angular.isObject(input)) {
return Object.keys(input).length;
} else if (angular.isArray(input)) {
return input.length;
... | true |
525db62948f662860c79873c172559d8f0e30d24 | JavaScript | michalstanko/oversk-node | /scripts/log.js | UTF-8 | 316 | 2.640625 | 3 | [] | no_license | /*
Log message into file
*/
var fs = require('fs');
module.exports = function (path, msg) {
return new Promise(function (resolve, reject) {
fs.appendFile(path, "\r\n" + msg, function (err) {
if (err) {
reject(err)
} else {
resolve({
success: true,
message: msg
});
}
});
});
};
| true |
03d8c250c9f7a832da96ba85e79d756be35cc152 | JavaScript | ariebrainware/calcApps | /js/index.js | UTF-8 | 2,547 | 3.578125 | 4 | [] | no_license | const formAdd = document.getElementById('form-add')
const addResultField = document.getElementById('add-result-field')
const formSubstract = document.getElementById('form-substract')
const substractResultField = document.getElementById('substract-result-field')
const formMultiply = document.getElementById('form-multi... | true |
defd3d07b3a2f046a013b6c4d973c2588c45a028 | JavaScript | SamphorsKhlok/Leetcode | /CycleLinkedlist/CycleLinkedlist.js | UTF-8 | 799 | 3.859375 | 4 | [
"MIT"
] | permissive | // Given a linked list, determine if it has a cycle in it.
// Follow up:
// Can you solve it without using extra space?
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode} head
* @return {boolean}
*/
let backtrac... | true |
963c9dc69465f695e1048248fe9451fa158791da | JavaScript | yohannweber/auto-pong | /pong.js | UTF-8 | 14,147 | 2.921875 | 3 | [] | no_license | function objRaquettes(objRaquetteGauche, objRaquetteDroite ){
this.raquetteGauche = objRaquetteGauche;
this.raquetteDroite = objRaquetteDroite;
}
function objContext( ){
this.canvas = document.getElementById('mon_canvas');
if (!this.canvas)
{
alert("impossible de récupérer le canvas");
return;
}
this.contex... | true |
135b38dd7e0dfe957bce5e54601afa0117e027d4 | JavaScript | gonewayword/course.recast.ly.exercise | /src/components/App.jsx | UTF-8 | 2,340 | 2.671875 | 3 | [] | no_license | class App extends React.Component {
constructor(props) {
super(props);
this.grabYouTube = this.grabYouTube.bind(this);
this.onVideoSearch = this.onVideoSearch.bind(this);
this.onSearchClick = _.debounce(this.onSearchClick, 400);
this.options = {
key: window.YOUTUBE_API_KEY,
maxResults:... | true |
8c6a496af0797e468395cdcac7fb2347c0bcc447 | JavaScript | ToggyO/chat-concept | /src/utils/redis/redisHelpers.js | UTF-8 | 1,691 | 2.796875 | 3 | [] | no_license | /**
* Описание: Файл содержит функции хелперы для работы с redis
*/
import { redisClient } from 'launch/redis';
const redisHelpers = {};
/**
* Сохранение в redis произвольного типа данных
* @param {string} key - ключ для сохранения сущности
* @param {string|number|array|object} value - сохраняемое значение
* @r... | true |
987fe076228cb6596d255ca69f3b4b44b4ff2ba0 | JavaScript | wookets/javascript-examples | /global.js | UTF-8 | 174 | 2.8125 | 3 | [] | no_license |
awesome = "I am an awesome global var";
console.log(awesome);
console.log("Guy, it is soooo NOT cool to leave off var from your variable declarations and create globals."); | true |
3d8bcb8b7f661fddace63f7cf5498588544e4461 | JavaScript | fxisco/problems | /dashInsert/index.js | UTF-8 | 713 | 3.84375 | 4 | [] | no_license | const EVEN_TOKEN = "*";
const ODD_TOKEN = "-";
function DashInsertII(num) {
const result = [];
const digits = num.toString().split("");
for (let i = 1; i < digits.length; i++) {
const previousDigit = +digits[i - 1];
const currentDigit = +digits[i];
if (i === 1) {
result.push(digits[i - 1]);
... | true |
90644808ec0fe70a95be74a7cc3e6f7cfcdb32a6 | JavaScript | mjnrock/fuzzyknights-paco | /fk-paco/component/ComponentHunger.js | UTF-8 | 1,317 | 3.015625 | 3 | [] | no_license | import Component from "./Component.js";
import EnumComponent from "./EnumComponent.js";
class ComponentHunger extends Component {
constructor() {
super(EnumComponent.HUNGER, {
Hunger: 0,
MaxHunger: 100,
LastUpdate: Date.now(),
Duration: 100
}, {
... | true |
345d705ebb4129bbabb37cf40074a287106a78a5 | JavaScript | daniel-payne/eatanddo-bot | /dialogs/addFoodsDialog.js | UTF-8 | 2,442 | 2.5625 | 3 | [] | no_license | const builder = require('botbuilder')
const fetch = require('node-fetch')
const Promise = require('node-promise').Promise
const {entryDataRecognizer} = require('../recognizers/entryDataRecognizer')
module.exports.ADD_FOODS_DIALOG = 'ADD_FOODS_DIALOG'
module.exports.addFoodsDialog = [
(session, args) => {
c... | true |
e6847729263dbe5bb601e994997d1a947292b31c | JavaScript | EmileRouxTriton/player-sdk | /src/modules/Npe.js | UTF-8 | 5,609 | 2.609375 | 3 | [
"Apache-2.0",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var Platform = require('sdk/base/util/Platform');
define([
'dojo/_base/declare',
'dojo/_base/Deferred',
'dojo/_base/lang',
'sdk/base/util/XhrProvider',
'sdk/modules/base/CoreModule',
'sdk/modules/npe/Song',
], function ( declare, Deferred, lang, XhrProvider, coreModule, Song ) {
... | true |
b4828f6b2e428127bb345f0078df610e65c68d56 | JavaScript | pandey333/reactAssessment | /my-app/src/HomeShop.jsx | UTF-8 | 778 | 2.71875 | 3 | [] | no_license | import React from "react";
export default function ShopHome() {
const itemList = [
{ id: 1, item: "bag", price: 980 },
{ id: 2, item: "pen", price: 800 },
{ id: 3, item: "mobile", price: 10000 },
];
const [item, setItem] = React.useState([]),
addToCart = (e) => {
const list = JSON.parse(lo... | true |
5ca32054b05e6f27925b16e5455b4e83e3eb11bb | JavaScript | KaduCury/uc8-atividade-presencial-01 | /Inversao.js | UTF-8 | 116 | 2.953125 | 3 | [] | no_license | var valor=123
var c=Math.trunc(valor/100)
var d=Math.trunc((valor%100)/10)
var u=valor%10
console.log(u*100+d*10+c)
| true |
2d821feaa4e6fbe8534d6d09335406b25cd111fa | JavaScript | mattrussell2/cloudsurf-extension | /searchScript.js | UTF-8 | 3,091 | 3.140625 | 3 | [] | no_license | // searchScript.js
// this script allows for google search augmentation by
// 1. scraping the Google DOM for links
// 2. requesting data for those links from our database
// 3. inserting the appopriate emoticons next to each
// search result.
/*** Get the logged in user from the background.js script. ***/
chr... | true |
26d27a55187d2457856300f5abf8b5668cfd8337 | JavaScript | Hietamaki/AoC2020 | /3.js | UTF-8 | 437 | 3.3125 | 3 | [] | no_license | var input = document.body.getElementsByTagName("pre")[0].innerHTML
.trim().split("\n")
// 3-1
input.map((line, i) => line[i * 3 % input[0].length])
.filter(char => char == "#")
// 3-2
[[1,1], [3,1], [5,1], [7,1], [1,2]].reduce((acc, val) => (
input.map((line, i) => (
line[Math.floor(i * val[0] % (input[0].lengt... | true |
3cec9fd092fecaf697ce54827cbfad56c31ef117 | JavaScript | yenisbel/fullstackacademy | /workshops/13-recursion-ii/03-the-truth-counts/the-truth-counts.js | UTF-8 | 302 | 3.3125 | 3 | [] | no_license | // YOUR CODE BELOW
function theTruthCounts(nestArryValues) {
let counter = 0;
nestArryValues.forEach(element => {
if(Array.isArray(element)){
counter+= theTruthCounts(element);
} else if (element) {
counter ++;
}
});
return counter;
}
| true |
6bbeac906f52d6dc1b7344450d9785ab7272e8a3 | JavaScript | kimyeheun/Sharing_knowleadge | /user/static/user/js/script.js | UTF-8 | 627 | 2.859375 | 3 | [] | no_license |
window.addEventListener("DOMContentLoaded", (e) => {
e.preventDefault();
showPassword();
})
function showPassword() {
var inputs = document.getElementsByClassName("password-input");
document.getElementById("show-password-btn").addEventListener("click", (e) => {
e.preventDefault();
for ... | true |
19a2cea80e7931be5cc9aeb8cdb5cd33969cfa08 | JavaScript | Saeid-Zadran/SW-Praktikum-SS21 | /frontend/src/api/LearnGroupBO.js | UTF-8 | 1,442 | 2.9375 | 3 | [] | no_license | import BusinessObject from './BusinessObject';
/**
* Represents an LearnGroup object of a Person.
*/
export default class LearnGroupBO extends BusinessObject {
/**
* Constructs a new LearnGroupBO object with a given Name and PersonId .
*
* @param {String} aName - the name of this LearnGroupBO.
* @pa... | true |
d3a90f10f185080b616482d3b4f11c2fa3d588cb | JavaScript | SrEstroncio38/SrEstroncio38.github.io | /src/main/resources/static/src/states/createRoom.js | UTF-8 | 5,210 | 2.640625 | 3 | [] | no_license | Spacewar.createRoom = function(game) {
this.roomname
this.deletingText
}
function selectClassic(){
game.global.myPlayer.gamemode = "Classic"
}
function selectBattleRoyale(){
game.global.myPlayer.gamemode = "BattleRoyale"
}
function selectBattleRoyalePlus(){
game.global.myPlayer.gamemode = "Batt... | true |
9e025806c75169a17cbc00015c119d5f228e9299 | JavaScript | iamcutler/msa-agency | /app/assets/javascripts/angular/services/Staff.js | UTF-8 | 1,217 | 2.625 | 3 | [] | no_license | export default class StaffService {
// @ngInject
constructor($http, CommonService) {
this.$http = $http;
this.commonService = CommonService;
}
/**
* Get all staff members
*
* @returns {Promise}
*/
all() {
return this.$http.get('api/v1/staff')
... | true |
fa3ec40f4d092a590b05db1fd76ded37e7b90dea | JavaScript | lucapasquale/OneMarket | /src/routes/carts.js | UTF-8 | 4,323 | 2.53125 | 3 | [] | no_license | import joi from 'joi';
import models from '../models/models';
// METHODS
module.exports = [
// GET - Hello World
{
method: 'GET',
path: '/test',
handler(request, reply) {
return reply('Hello World!');
},
},
// GET - Obtem todos os produtos listados
{
method: 'GET',
path: '/pro... | true |
abe8f79368107c5fcb95c8ab67fe611c747ef0dc | JavaScript | Joelgiovanni/MERN-reduxAuth | /server/routing/routes.js | UTF-8 | 3,924 | 2.640625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const bcrypt = require('bcrypt');
const saltRounds = 12; // Salt rounds for hashing the password
const jwt = require('jsonwebtoken');
const keys = require('../config/keys');
const passport = require('passport');
// Validation for the Login and Registe... | true |
bbd06148331a143bd9a2fb709f415d9d70dcfd18 | JavaScript | kiahooper/the-odin-project | /weather/main.js | UTF-8 | 3,574 | 3.140625 | 3 | [] | no_license | const WeatherApp = (() => {
// DOM cache
const img = document.querySelector("img[id='gif']");
const input_city = document.querySelector("#city");
const input_country = document.querySelector("#country");
const btns = document.querySelectorAll("button");
// Event-listeners
btns.forEach((btn) =>
btn.a... | true |
7fdd9e99d172c166f3dd1bec4c095c076a6bfd84 | JavaScript | YamilaJS/spa-wpa | /src/models/ContentArticleModel.js | UTF-8 | 791 | 2.5625 | 3 | [] | no_license | import validator from '../utils/validator';
import { throws } from 'assert';
const defaultParam = {
content: []
}
function ContentArticleModel(param = defaultParam) {
this.buildWithDefaultValues()
this.validateParam(param)
this.setProps(param)
}
ContentArticleModel.defaultParam = {
content: [],
}... | true |
fd35ae2c2f411bf8f5a7397aeeb3b5e7d6a4344f | JavaScript | uebayasi/imi-enrichment-jsic | /main.js | UTF-8 | 1,959 | 3.171875 | 3 | [
"MIT"
] | permissive | const jsic = require("./lib/jsic.json");
// 与えられた文字列から bigram を作成
const bigram = function() {
const result = {};
Array.from(arguments).join(",").replace(/ /g, "").split(/[,、()。・,\n「」]/).forEach(a => {
a = a.trim();
for (let i = 0; i < a.length - 1; i++) {
const key = a.substring(i, i + 2);
if (... | true |
75b999d180e04260611af5ce72c12c6c68fba3ad | JavaScript | yocheveds/Train-Scheduler | /train.js | UTF-8 | 4,179 | 3 | 3 | [] | no_license | // 1.Initialize Firebase
// Initialize Firebase
var config = {
apiKey: "AIzaSyCmpVv4Bclqnu8BCihePcAoRlAk4mfkbPw",
authDomain: "yoyos-project.firebaseapp.com",
databaseURL: "https://yoyos-project.firebaseio.com",
projectId: "yoyos-project",
storageBucket: "yoyos-project.appspot.com",
... | true |
67cf614fe83c5abb8b8bb79ae6832a61e2a22d43 | JavaScript | doubleZ0108/my-WeChat-Mini-Program-study | /component/icon/icon.js | UTF-8 | 817 | 2.640625 | 3 | [] | no_license | // pages/icon/icon.js
Page({
/**
* 页面的初始数据
*/
data: {
icons:[
'success', 'success_no_circle', 'info', 'warn', 'waiting', 'cancel', 'download', 'search', 'clear'
],
color:"green"
},
iconClick:function(){
this.setData({ color: this.randcolor()})
},
randcolor:function(){
/*第一种... | true |
2c59f40be285f3f877531dc55c05237e95dad5ac | JavaScript | katebatrakova/lotide | /middleTest.js | UTF-8 | 518 | 2.5625 | 3 | [] | no_license | const assert = require('chai').assert;
const middle = require('../middle');
describe("#Middle array Testing", () => {
it("should return [7,8] for [5, 6, 7, 8, 9, 10]", () => {
assert.deepEqual(middle([5, 6, 7, 8, 9, 10]), [7, 8]);
});
it("should return [7] for [5, 6, 7, 8, 9]", () => {
assert.deepEqua... | true |
06e4939a2fe7bcf99f8bc86bf3c4e01d1d80bc09 | JavaScript | tommymarc/gafi | /node/11.stream3/7.object.js | UTF-8 | 819 | 3.03125 | 3 | [] | no_license | //对象流
let {Transform} = require('stream');
let fs = require('fs');
let rs = fs.createReadStream('./user.json')
//普通流里面放的是Buffer, 对象流里面放的是对象
let toJSON = Transform({
//可读流放对象模式
readableObjectMode:true, //就可以向可读流里放对象了
transform(chunk,encoding,cb){
console.log(chunk); //打印全部都是buffer
//向可读流里的缓存区... | true |
4df2ad0ea113e8552fbc8dba2bf2e91a86b55cae | JavaScript | Sebastian-Fitzner/mangony-hbs-helpers | /lib/simple-helpers/objToArr.js | UTF-8 | 333 | 2.9375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* Flatten object to array
* Returns array
*
* @author Sebastian Fitzner
*/
module.exports = objToArr;
module.exports.register = function (Handlebars) {
Handlebars.registerHelper('objToArr', objToArr);
};
function objToArr(obj, block) {
var arr = Object.keys(obj).map(function (key) {
return obj[key]
});
... | true |
55e9b8da5782d6710d00540ac32267c120622ee2 | JavaScript | ekater1na/PiskelClone | /src/scripts/index.js | UTF-8 | 6,067 | 2.671875 | 3 | [] | no_license | /* eslint-disable max-len */
/* eslint-disable no-param-reassign */
/* eslint-disable no-use-before-define */
export const PENCIL = 'pensil';
export const COLOR_PICKER = 'color_picker';
export const ERASER = 'eraser';
export const BUCKET = 'bucket';
export const state = {
penSize: 16,
frames: [],
activeFrame: 0,... | true |
b11765c11e75283ffbd0adf8179f8506ee13223b | JavaScript | Vylda/JAK | /util/utf8.js | UTF-8 | 1,452 | 3.21875 | 3 | [
"MIT"
] | permissive | /*
Licencováno pod MIT Licencí, její celý text je uveden v souboru licence.txt
Licenced under the MIT Licence, complete text is available in licence.txt file
*/
/**
* @namespace Kódování z/do UTF8
* @group jak-utils
*/
JAK.UTF8 = JAK.ClassMaker.makeStatic({
NAME: "JAK.UTF8",
VERSION: "1.0"
});
/**
* Převede ř... | true |
d076429c4e65244f4716aa46a78c1bd6009a6e01 | JavaScript | emacsway/TDOPjs | /test01.js | UTF-8 | 83 | 2.921875 | 3 | [] | no_license | var fun = function (x, y, z) {
return ((x * y) / z);
};
var wow = fun(2, 3, 4);
| true |
0e3f77d2e17c6add73fd8480bd2b8bf703c82cd2 | JavaScript | amazingamazon/donut-shop-alex | /donutshopfinal/shopsfinal.js | UTF-8 | 1,681 | 3.34375 | 3 | [] | no_license | //Donut Shop constructor
var DonutShop = function(shopName, minCustPH, maxCustPH, avgDonutsPerCust) {
this.shopName = shopName;
this.minCustPH = minCustPH;
this.maxCustPH = maxCustPH;
this.avgDonutsPerCust = avgDonutsPerCust;
this.donutsPerDay = 0;
this.donutsPerHour = [];
};
//this calculates donuts per ho... | true |
3de834ca96fbe2ac3d78c12a3bbfd1fc51dcc56a | JavaScript | F1LT3R/NodeJS-Web-Server | /app/quad/skin/js/core/fullScreenDisplay.js | UTF-8 | 781 | 2.828125 | 3 | [] | no_license | 'use strict';
module.exports = (function () {
var canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d'),
toResize = true;
function resize () {
if (toResize) {
console.log('Resizing canvas.');
canvas.width = window.innerWidth;
canvas.height = window.inn... | true |
41b4e46b3d8b1fa602dc9b2de446a8ecb2b864d8 | JavaScript | jhonacs2/jhona-FullStackOpen | /part6/reduxAnecdotes/src/components/AnecdoteList.js | UTF-8 | 1,982 | 2.53125 | 3 | [] | no_license | import React from 'react';
import { connect } from 'react-redux';
import { voteAnecdote } from '../reducers/anecdoteReducer';
const Anecdote = ({ anecdote, vote }) => {
return (
<li key={anecdote.id}>
<div>{anecdote.content}</div>
<div>
has {anecdote.votes}
<button onClick={vote}>vote... | true |
cf4e999ca9e6f8680423f370a9cbf70e1e56d882 | JavaScript | snakesilk/snakesilk-engine | /src/Collision.js | UTF-8 | 3,040 | 2.8125 | 3 | [] | no_license | const {Vector2} = require('three');
const BoundingBox = require('./BoundingBox');
const Entity = require('./Entity');
const {rectanglesIntersect} = require('./Math');
function zonesCollide(zone1, zone2) {
return rectanglesIntersect(
zone1.x, zone1.y, zone1.w, zone1.h,
zone2.x, zone2.y, zone2.w, zon... | true |
77af16105f1d68ceb524fe1dd1faf017a374a939 | JavaScript | zhoumingyuan42/ProjectHe | /about_me.js | UTF-8 | 1,614 | 2.640625 | 3 | [] | no_license | //jshint esversion:6
var windowHeight = $(window).height(),
gridTop = windowHeight * 0.35,
gridBottom = windowHeight * 0.55;
girdMiddle = windowHeight * 0.45;
$(window).on('scroll', function() {
// change formation property on scroll
$('h3').each(function(){
var formationTop = $(this).offset().top - $(... | true |
c21c5ae533318b548e4cd07f875f6e6fae112d5a | JavaScript | TeamWhite/EER | /js/main.js | UTF-8 | 169 | 2.640625 | 3 | [
"MIT"
] | permissive | function redirect(url,time) {
if (time === 0) {
window.location.href = url;
} else {
setInterval(function(){
window.location.href = url;
},time * 1000);
}
}
| true |
753f5ce3a50b6207e7d9c08d15d5e1984e9c5ac3 | JavaScript | liwanghonggc/Node | /day3/express-demo/app.js | UTF-8 | 655 | 2.84375 | 3 | [
"ISC"
] | permissive | var express = require('express');
//创建服务器应用程序,就是原来的http.createServer
var app = express();
// 在 Express中开放资源就是一个API的事儿
// 公开指定目录
// 只要这样做了,你就可以直接通过/public/xx的方式访问public目录中的所有资源了
app.use('/public/', express.static('./public/'));
app.use('/static/', express.static('./static/'));
app.use('/node_modules/', express.static(... | true |
12bf44d1ba691f81e5c48ab26c6a5726a41b1ab5 | JavaScript | alaindave/student-web-app | /src/Components/StudentList.jsx | UTF-8 | 4,074 | 2.84375 | 3 | [] | no_license | import React from "react";
import axios from "axios";
import Student from "./Student";
import "../student.css";
export default class StudentsList extends React.Component {
constructor(props) {
super(props);
this.state = {
students: [],
key_word: "",
tag_key_word: "",
studentsWithTags:... | true |
5499fde4dc079ee1269042512f60a29f6315b7f2 | JavaScript | edd88/node-por-hacer | /por-hacer/por-hacer.js | UTF-8 | 1,475 | 3.078125 | 3 | [] | no_license | const fs = require('fs');
let listadoPorHacer=[];
const guardarDB = () =>{
let data=JSON.stringify(listadoPorHacer);
fs.writeFile('db/data.json',data,(err)=>{
if (err) {
throw new Error('No se pudo grabar',err);
}else{
console.log('Archivo data.json guardado correctamente')
}
})
}
const cargarDB = ()... | true |
cf84fbc5d866d1e786a4898570ab1e45f3145589 | JavaScript | sdavara/sketchbook | /jquery-fade-toggle/scripts/main.js | UTF-8 | 162 | 2.71875 | 3 | [] | no_license | // Whenever my-button is clicked, fade in/out
// the container over 500 milliseconds
$('.my-button').click(function(event) {
$('.container').fadeToggle(500);
}); | true |
f50d7eda9f43e7137f069c13f1e5cad326ccaa48 | JavaScript | iceroad/node-benchoid | /lib/commands/run/walkthrough.js | UTF-8 | 939 | 2.703125 | 3 | [
"MIT"
] | permissive | const inquirer = require('inquirer');
function walkthrough(args) {
const d = new Date();
const questions = [
{
type: 'input',
name: 'runName',
message: 'Name for this run',
default: args.runName || d.toISOString().replace(/\..*$/, ''),
},
{
type: 'input',
name: 'run... | true |
cd3a77c587b709ae6ec8ed0dae0d30b955f559dd | JavaScript | opennem/opennem-fe | /data/transform/energy-12-month-rolling-sum.js | UTF-8 | 1,695 | 2.765625 | 3 | [
"MIT"
] | permissive | import subMonths from 'date-fns/subMonths'
import addMonths from 'date-fns/addMonths'
import isAfter from 'date-fns/isAfter'
import PerfTime from '@/plugins/perfTime.js'
import { isTemperature } from '~/constants/data-types'
const perfTime = new PerfTime()
export default function (data, keys) {
perfTime.time()
fo... | true |
7ffe0961911febe213737d2d532913a5d12abd5c | JavaScript | shlev/node | /tut/packages/singles/index.js | UTF-8 | 557 | 3.421875 | 3 | [] | no_license | const getMessage = (msg, callback) => {
setTimeout(()=> {
console.log(msg);
callback();
}, 1000);
};
const displayMessage = () => {
console.log("Display Message");
}
// getMessage("Get Message", displayMessage);
let promise = new Promise((resolve, reject) => {
setTimeout(() => resolve(... | true |
26f0dc62da61e6f8a6a9dc9b02ead9366fa7fce2 | JavaScript | namletneg/ADS | /js/ADS.js | UTF-8 | 48,625 | 2.8125 | 3 | [] | no_license | /**
* Created by Administrator on 2014/12/17.
*/
(function () {
//ADS命名空间
if (!window.ADS) {
window['ADS'] = {};
}
// nodeType常量
window['ADS']['node'] = {
ELEMENT_NODE: 1,
ATTRIBUTE_NODE: 2,
TEXT_NODE: 3,
CDATA_SECTION_NODE: 4,
ENTITY_REFERENCE_NODE... | true |
86afdb275a47135ba9a0259476081b9cfeec06d3 | JavaScript | Apokryphos/tic-tac-toe-fcc | /test/player-tests.js | UTF-8 | 555 | 2.8125 | 3 | [] | no_license | const test = require('tape');
const CellState = require('./../src/js/tic-tac-toe/cell-state.js');
const Player = require('./../src/js/tic-tac-toe/player.js');
test('Player constructor', (t) => {
t.plan(7);
t.doesNotThrow(() => new Player(CellState.X));
t.doesNotThrow(() => new Player(CellState.O));
t.throws((... | true |
56102dab9c99ac7f26bcd5d78eb0caefbb56d424 | JavaScript | qlint/emis-wip | /src/overviews/ajax/js.js | UTF-8 | 2,628 | 3 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
//this gets the select options based on another select
$("#classes").change(function() {
var class_id = $(this).val();
if(class_id != "") {
$.ajax({
url:"ajax/get_examTypes.php",
data:{c_id:class_id},
type:'POST',
success:function(response) {
var resp = $.... | true |
908b6b49a31349062d979dc522cddbef537e5fa7 | JavaScript | mlong01/comp20-projects-mlong | /School_Work/duckhunt/duckhunt/game.js | UTF-8 | 1,249 | 3.109375 | 3 | [] | no_license | // Your work goes here...
function draw() {
canvas = document.getElementById('game');
if (canvas.getContext) {
ctx = canvas.getContext('2d');
var img = document.getElementById("spSheet");
//ctx.drawImage(img, srcXCoord, srcYCoord, srcWidth, srcHeight,
// xCoord, yCoord, width, height)
//tree ... | true |
e549856be2242d65e4d9b70067e0ee7fcb4f66c4 | JavaScript | jaironalves/gameloan | /src/Web/ReactSPA/src/services/sessionService.js | UTF-8 | 1,575 | 2.6875 | 3 | [] | no_license | import BaseService from './baseService'
import decode from 'jwt-decode'
/**
* Session Service Class
*/
class SessionService extends BaseService {
constructor() {
super()
this.TOKEN_KEY = `@app-auth-token`
this.USER_KEY = `@app-auth-user`
this.BASE_PATH = 'api/session'
}
authenticate = (data) =... | true |
b1be930cefffb389a357cdbfd37e35bac0c89c41 | JavaScript | jakub-gawlas/withTags | /src/withTags/getMatches.test.js | UTF-8 | 4,208 | 3 | 3 | [] | no_license | import getMatches from './getMatches';
describe('getMatches', () => {
it('should return no matches', () => {
const pattern = /#test/g;
// array ['#test'] not passing test, beacuse is cast to string '#test'
const texts = [null, 123, NaN, { '#test': '#test' }, '', 'test', '✌️', 'test#tes✌️t'];
cons... | true |
cc5b0d69ad71ae61a32d06bd397735d35d3efb81 | JavaScript | w1t2h3/Vue_study | /05_shoppingcar/main.js | UTF-8 | 2,667 | 3.046875 | 3 | [] | no_license | var app1 = new Vue({
el:"#app",
data:{
list:[
{
id:1,
name:'房租水电',
price:900,
count:1
},
{
id:2,
name:'生活费',
price:1000,
count:1
... | true |
aa7bde0c738019871e06a8a4cc92aba2b11cf3fd | JavaScript | sushitrash06/Array_js | /reduce1.js | UTF-8 | 336 | 3.546875 | 4 | [] | no_license | var numbers = [1, 2, 3, 4, 5];
var total = 0;
numbers.forEach(function (number) {
console.log(total += number);
});
numbers.forEach(function (number) {
test = total += number;
});
var total2 = [1, 2, 3, 4, 5].reduce(function (previous, current) {
return previous + current;
}, 0);
console.log(test);
cons... | true |
82ab7cee748c2b5570a1226094dd42417fed98e0 | JavaScript | Sporium/javascript-codewars | /39-Object extend/app.js | UTF-8 | 926 | 3.8125 | 4 | [] | no_license | let extend = function() {
let objectsFirstInstance = {};
// For every argument
for (let a in arguments) {
// Check if the argument is of type object
if (typeof arguments[a] === "object") {
// For every value on that object
for (let o in arguments[a]) {
// Check if the key-value pair al... | true |
2cb26e089c52a551f1b85e7009c589183a58938a | JavaScript | morganemottey/netflix-clone | /src/actions/movies.js | UTF-8 | 1,457 | 3.125 | 3 | [] | no_license | import { ADD_MOVIE , REMOVE_MOVIE , GET_MOVIES , GET_NUMBERS} from './index'
export const addMovie = movie => {
let movies = JSON.parse(localStorage.getItem('movies'))
if (movies) { // nous vérifions si notre tableau contient des films
movies = [...movies, movie]
} else { // sinon on lui ajoute des... | true |
df073d081732588f3d15eb0e4c4cefb2caee8437 | JavaScript | laraharrow/playTime | /JSON.js | UTF-8 | 1,221 | 4.5625 | 5 | [] | no_license | /*
Describe what JSON format is:
JSON = JavaScript Object Notation
is a light-weight format for transferring data, used to faster and easly transfer data
between programs or form an API, it is mainly used because its easy for humans to understand
and its easy for computers to parse and generate.
*/
// in the co... | true |
c77d53a1c866e661d35da794280067f72f596b35 | JavaScript | YuliyaVolkova/frontend_portfolio | /src/app/components/blur.js | UTF-8 | 716 | 2.5625 | 3 | [] | no_license | 'use strict';
///*------------------------------------
///* blur bg to feeds-form
///*-------------------------------------
const blurResize = (() => {
const body = document.body,
wrapper = body.querySelector('.c-feeds-form-bg'),
blurForm = body.querySelector('.c-feeds-blured');
const setBg = () => {
... | true |
6b637e0ca3b6c967e1c2ebf943cd43e03ed4aca9 | JavaScript | SmokeyRider/pwa-example | /sw-v0.js | UTF-8 | 1,199 | 2.546875 | 3 | [
"MIT"
] | permissive | var staticCacheName = 'myNewsSite-v0';
self.addEventListener('install', function (event) {
console.log('ServiceWorker (' + staticCacheName + '): install called');
event.waitUntil(
caches.open(staticCacheName).then(function (cache) {
return cache.addAll([
'/',
'index.html',
'manife... | true |
d72673793684a6ba0c5a5702be0a47e2598c406d | JavaScript | seek-ER/javascript-basic | /__tests__/pieceOfCake/strings_spec.js | UTF-8 | 2,708 | 3.421875 | 3 | [] | no_license | describe('for strings', () => {
it('should get character at certain position', () => {
const string = 'Hello';
const characterWithinRange = string[1];
const characterOutOfRange = string[10];
// <--start
// Please write down the correct value. You should write the final result directly.
const ... | true |
8df5cd4d9d1e249d3c3f62dab14e949c6eca8f30 | JavaScript | BastienCodeur/intro2 | /src/index.js | UTF-8 | 2,513 | 2.625 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import NavBar from "./composants/NavBar";
import AcceuilPage from "./pages/AccueilPage";
import {BrowserRouter, Switch, Route} from "react-router-dom";
import PaysPage from "./pages/PaysPage";
import ContactPage from "./pages/ContactPage";
import AboutPage fr... | true |
e7305df431c80ef52df906375f3cae073bca888d | JavaScript | endojs/endo | /packages/test262-runner/test262/test/built-ins/RegExp/unicode_restricted_incomple_quantifier.js | UTF-8 | 1,204 | 2.671875 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-ecma-no-patent"
] | permissive | // Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: B.1.4 is not applied for Unicode RegExp - Incomplete quantifiers
info: |
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
are not applied... | true |
b7d60fe011dfe5acea363847c84f92a0aa59ab58 | JavaScript | dmxj/thegirl | /app/proxy/shopCart.js | UTF-8 | 2,771 | 2.65625 | 3 | [] | no_license | var ShopCartModel = require('../models/shopCart');
var GoodModel = require('../models/good');
//获取某人购物车的数量
exports.fetchShopCartNumByUid = function(uid,callback){
ShopCartModel.count({author:uid},function(err,total){
if(err){
return callback(0);
}
return callback(total);
})... | true |
633a6148391deb07651dc477e89405c2d2ea5417 | JavaScript | gsmuralee/deep-object-find | /index.js | UTF-8 | 508 | 2.921875 | 3 | [
"MIT"
] | permissive | 'use strict'
const deepObjectFind = (...args) => {
try{
const [object, getValue, setValue] = args;
const keys = getValue.split(".");
return keys.reduce((ob, cv, ci, arr) => {
if (setValue && ci === arr.length-1){
ob[cv] = setValue;
return object;
... | true |
16e4ed6953bd46e5935bb10e3802e00472e94de4 | JavaScript | vrunda-vs/Node_Assignment_1 | /exm.js | UTF-8 | 3,119 | 2.671875 | 3 | [] | no_license | const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.writeHead(200,{'Content-Type':'text/html'});
var cars = [
{
"name":"Toyata",
"model": "Sedan",
"Price": 500000.00,
"ManufacturingYear": new Date('2017-0... | true |
968734afcef5f6d6a36193c0185e01ecb4116216 | JavaScript | brucemcpherson/xmlJsonTest | /Code.gs | UTF-8 | 3,228 | 2.5625 | 3 | [] | no_license | var URL = "https://script.google.com/macros/s/AKfycbzNhEv3Nb38Tr277Ws0rUMGjXutkrGzEtLXfdX8XxThU8SUa-c/exec";
function doSomeTests () {
// json to xml
Logger.log (tester("http://www.omdbapi.com/?s=star%20wars&r=json"));
// xml to json
Logger.log (tester("http://www.omdbapi.com/?s=star%20wars&r=xml"));
}
... | true |
a75a480fc0e4b7004c2be150bc2d9497f32e1ced | JavaScript | arnavdesk/cart | /src/App.js | UTF-8 | 2,200 | 2.59375 | 3 | [] | no_license | import React from 'react';
import Cart from "./Cart";
import Navbar from "./Navbar";
class App extends React.Component {
constructor() {
super()
this.state = {
products: [
{
price: 56999,
title: "Phone",
qty: 1,
img: 'https://www.gizmochina.com/wp-content... | true |
de1148bdafc74d70a4c41d21de4a10ad4d3eef66 | JavaScript | JaimieGarcia/html-test | /Week_2/homework/javascript-hw/script.js | UTF-8 | 488 | 3.796875 | 4 | [] | no_license | // Test copy
console.log("Hello world");
console.log("My name is Jaimie");
// Challenge 1: Do you need more coffee?
let y = 1;
if (y < 3) {
console.log("Yes, I'll take another cup of coffee.");
} else if (y > 2) {
console.log("I think I'm okay for now.");
}
// Challenge 2: Does your car need an oil chang... | true |
49651a1b53031b5afdd3accdde7bd3315c7f8553 | JavaScript | ahmadhah/JavaScript | /Session-7/index.js | UTF-8 | 4,092 | 3.9375 | 4 | [] | no_license | // ******** String **********
// Examples 1
// var a = "string text"
// console.log(a)
// // ******************
// // Examples 2
// var longText = "Lorem ipsum dolor sit amet \n consectetur adipisicing elit." +
// "Quas assumenda laboriosam accusamus. Dolorem nemo error, dicta corrupti sit \t repellendus, iste bla... | true |
cb001807639fa97811bfa1ec5654d39bbda8fed9 | JavaScript | sideshows/Git_hub | /pp-ver0.2/script.js | UTF-8 | 8,985 | 2.609375 | 3 | [] | no_license | //-------------- Movie search ------------------------
$('#search').submit(function(e) {
e.preventDefault();
var $results = $('#results-tv'),
tv = $('#tv-search').val();
var url = 'http://api.themoviedb.org/3/',
mode = 'search/tv?query=',
tvName = '&query='+encodeU... | true |
5b034f1143b2bd81ad5fc52d184d602552d8a908 | JavaScript | brianmacdonald-ml/volleyball | /statseasy/Contents/Resources/build/StatEasy/WEB-INF/StatEffects/Basketball/setLineup.js | UTF-8 | 1,130 | 2.625 | 3 | [] | no_license |
function execute() {
var prefix = !!relevantStat.opponentStat ? "their" : "our";
var allPlayers = relevantStat.event[prefix + "Season"].allPlayers;
var playerIdToNumberMap = {};
for (var i = 0; i < allPlayers.size(); i++) {
var playerInSeason = allPlayers.get(i);
playerIdToNumberMap[playerInSeason.player.id]... | true |
3e4b27347c565dc99a408c8de3487746bfb79524 | JavaScript | mritzing/genArt | /tiledStars/test.js | UTF-8 | 1,582 | 3.59375 | 4 | [] | no_license |
function init (){
var canvas = document.createElement('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
console.log(canvas.width);
var body = document.getElementsByTagName("body")[0];
body.appendChild(canvas);
context = canvas.getContext('2d');
context.rect(0, 0, canvas.width, c... | true |
8c7c48fb44ddc93cff773d2eb501da594614b6cb | JavaScript | Ga8/TMT | /frontend/src/model/meeting.js | UTF-8 | 306 | 2.890625 | 3 | [] | no_license | // eslint-disable-next-line no-unused-vars
class Meeting {
constructor(title, opportunities ){
this.title = title;
this.name = name;
this.opportunities = opportunities;
}
addOpportunity(opportunity){
this.opportunities.put(opportunity);
}
}
| true |
3a5eebf66289510233966bd42e765480988fd179 | JavaScript | RadekaD/JavaScript-Head-First | /ch1/code.js | UTF-8 | 3,390 | 3.484375 | 3 | [] | no_license |
// var word = "bottles";
// var count = 99;
// while (count > 0) {
// console.log(count + " " + word + " of beer on the wall");
// console.log(count + " " + word + " of beer");
// console.log("Take one down, pass it around");
// count--;
// if (count > 0) {
// console.log(count + " "... | true |
1669e2c52e239be033d8659df0c7017b2ed30c13 | JavaScript | joshrudi/softwareEngineeringProject | /client/js/validate.js | UTF-8 | 979 | 2.59375 | 3 | [] | no_license | function write_cookie(cookie) {
document.cookie = cookie.id_token + "||||" + cookie.user_id;
}
function read_cookie() {
var guk = document.cookie.split(" ");
var actual_cookie = guk[guk.length-1];
var bits = actual_cookie.split("||||");
var cookie = {
id_token: bits[0],
user_id: bits[1],
}
return cookie;... | true |
8f36d824106359386da40b73791f110696124f41 | JavaScript | Yadio-Team/yadiogroupproject | /src/Components/Spotify.js | UTF-8 | 705 | 2.578125 | 3 | [] | no_license | // const Spotify = require("spotify-api.js");
// const client = new Spotify.Client();
// client.login('4e6e6f8d0c44a05969f59e1f9923d96', '6ea7643063d54381be57faa6160712bd').then(async () => {
// console.log(await client.shows.get('id'));
// });
// const search = await client.search('Sports', { limit: 20, type: ['... | true |
abab2ca320ed3f8174655637771cff9207f9a834 | JavaScript | ralucas/coding-exercises | /recursion/main.js | UTF-8 | 2,090 | 4.40625 | 4 | [] | no_license | // 1. Write a JavaScript program to calculate the factorial of a number. Go to the editor
// In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! = 5 x 4 x 3 x 2 x 1 = 120
var factorial = function(num) {
if (num ===... | true |
53ba3803991b102a39b19ddc343488c79befd083 | JavaScript | dspizzirri-ge/cur-node-ejemplos-teoricos | /es6/promesas.js | UTF-8 | 411 | 3.453125 | 3 | [] | no_license | const promesa = new Promise((resolve, reject)=>{
const numero = Math.random().toFixed(2)*100;
const resto = numero%2
const esPar = resto == 0;
setTimeout(()=>{
if(esPar)
return resolve(true);
return reject(false);
}, 2000);
});
promesa
.then((data)=>console.log(`Prom... | true |
77d160c92d281e31307fb67b3a557afee59d5f54 | JavaScript | operator-playground-io/etcd-sample | /backend/dbController.js | UTF-8 | 4,482 | 2.65625 | 3 | [] | no_license | const { Etcd3 } = require('etcd3');
const defaultItems = require('./default_shopping_items');
const io = require('./socket');
const host = process.env.DB_HOST;
console.log('db host: ', host);
let client;
if ( host ) {
client = new Etcd3({hosts:host});
} else {
client = new Etcd3();
}
console.log('Created an ... | true |
4ce0fc798c13b09e02fdaf6da091a0d0bb468346 | JavaScript | m-gamao/redux-index-codealong-v-000 | /src/components/todos/CreateTodo.js | UTF-8 | 1,405 | 3.203125 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // 4. Each time we submit a todo, we want to clear out the input.
// each time we submit a form, we call handleSubmit. Inside that handleSubmit function
// let's reset the component's state by changing our function.
// Each time we submit a todo, we want to clear out the input. So each time we submit a fo... | true |
eb66d8ffdb335e69c019b0951a0b0d7db56ad903 | JavaScript | mscerutti/gilded-rose-javascript | /spec/gilded_rose_spec.js | UTF-8 | 4,896 | 3.015625 | 3 | [] | no_license | 'use strict'
describe("Gilded Rose", function() {
xit("should do something", function() {
console.log('test')
update_quality()
expect(true).toEqual(false)
});
describe('When update quality is called', () => {
it('Then the quality of a normal item decreases by 1', () => {
// let item = ne... | true |
a563193a75a5739b8e0a8f3220dc1a48098b4ce8 | JavaScript | wolf-dominion/javascript-arrays-lab-js-intro-000 | /index.js | UTF-8 | 1,219 | 4.53125 | 5 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var kittens = ["Milo", "Otis", "Garfield"] //define your array here
// Add your functions and code here
function destructivelyAppendKitten(name) // adds element to end of original array PUSH
{
kittens.push("Ralph");
}
function destructivelyPrependKitten(name) // adds element to begining of original array ... | true |
85b6d33cbcbc9f0559b22aeed3f1c2f5b4d8f3cb | JavaScript | HashirSadaf/level-1-coding-challenges | /task106.js | UTF-8 | 238 | 3.34375 | 3 | [] | no_license | let array = ["I", "am", "the", "greatest", "human", "ever", "if", "you", "think", "differently", "you", "are", "incredinly", "wrong"];
let sorted = array.sort(function (a, b){
return b.length - a.length;
});
console.log(sorted[0]); | true |
4ac372f063646b723ab57d0c35523800ff059ffb | JavaScript | silvertakana/Markov-chain- | /script.js | UTF-8 | 396 | 2.984375 | 3 | [] | no_license | var m
function generate(){
var minimum = document.getElementById("minimum").value
m = new Mchain();
text = document.getElementById("myText").value
m.train(text);
console.log(m)
let k = m.words[0]
let result = k
for(let i =0;true;i++){
k = m.generate(k)
result = result +""+k
if(k === m.words[m.words.length-1]... | true |
080ce7d27c84b32af9b0670f5904c877931bc565 | JavaScript | yfyf510/webgps-1 | /WebContent/js/map/google/js/map-google.js | UTF-8 | 3,347 | 2.515625 | 3 | [] | no_license | // JavaScript Document
window.mapobject = window.google || {};//设置全局的命名空间
mapobject.maps = google.maps || {};
mapobject.maps.MapTypeId = google.maps.MapTypeId||{};
mapobject.maps.initMap = function(id, jindu, weidu, zoom){
this.MAP_CENTER_LAT = weidu;
this.MAP_CENTER_LNG = jindu;
this.MAX_ZOOM = zoom;
this.contai... | true |
0b2d5f9f8266b2a757a8c72ccbde2aefdd06e8f7 | JavaScript | brettjonesdev/Stork | /routes/news.js | UTF-8 | 2,633 | 2.53125 | 3 | [
"MIT"
] | permissive | var _ = require("underscore");
var events = require("events");
var mongoose = require('mongoose');
var Status = require("../models/Status");
var Comment = require("../models/Comment");
exports.getNewsItems = function(req, res) {
var babyCode= req.query.babyCode;
var statusQuery = Status.find({babyCode:babyCode... | true |