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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8f09b8c79d0fd7d40c34f13361e7e12ce13c5c76 | JavaScript | dominic-davies/modern-javascript | /basics/temp-conversion.js | UTF-8 | 547 | 4.15625 | 4 | [] | no_license | // fahrenheit to celsius and fahrenheit to kelvin
let fahrenheit = 32; // 0c 273.15k
let celsius = ((fahrenheit - 32) * 5) / 9;
let kelvin = ((fahrenheit + 459.67) * 5) / 9;
console.log('celsius is: ', celsius);
console.log('kelvin is: ', kelvin);
// let celsius = ((fahrenheit - 32) * 5) / 9;
// console.log(celsius... | true |
7bdbd1b91d5f3965367d595a18ecc870087cd8b0 | JavaScript | samakunchan/pbsimulator | /public/js/socket/clientController.js | UTF-8 | 1,426 | 2.765625 | 3 | [] | no_license | var socket = io.connect('http://localhost:1000');
//socket.emit("coCtrl", "Connection a controlleur.pug <=> socket.io réussi.")
class ControllerHandler {
godSelectedPlayer1(data){
socket.emit("godSelected1", document.getElementById("" + data.name + "1").value);
}
}
let player = new ControllerHandler();
socket.o... | true |
2971ad1cab0f89b136b7cb0f986ad4b80cdf34a4 | JavaScript | AliDickson/chio_easy_fashion | /js/index.js | UTF-8 | 904 | 3.78125 | 4 | [] | no_license | $("#check-more").on("click", function() {
let randomNumber1 = Math.floor(Math.random() * 52) + 1;
let randomImage1 = "style" + randomNumber1 + ".jpg";
let randomSourceImage = "image/" + randomImage1;
let changeImage = document.querySelectorAll(".imag")[0];
changeImage.setAttribute("src", randomSourceImage);
l... | true |
a704f257cbb7103605427060915e8e17256de678 | JavaScript | zhangst23/tutorial | /JS/introToJS/读书笔记/《编写可维护的javascript》读书笔记.js | UTF-8 | 3,473 | 3.90625 | 4 | [] | no_license | // 《编写可维护的javascript》读书笔记.js
//1.0
null 是一个特殊值,但我们常常误解它,将它和 undefined 搞混,在下列场景中应当使用null
- 用来初始化一个变量,这个变量可能赋值为一个对象
- 用来和一个已经初始化的变量比较,这个变量可以是也可以不是一个对象
- 当函数的参数期望是对象时,用作参数传入
- 当函数的返回值期望是对象时,用作返回值传出
还有下面一些场景不应当使用null
- 不要使用 null 来检测是否传入了某个参数
- 不要用 null 来检测一个为初始化的变量
//eg
//好的用法
var person = null;
//好的用法
function getPe... | true |
1f30963ebbab5452b887232c0368b1dd97c170b3 | JavaScript | kwanghyunkang/kh | /d_coding/js/src/js_007_function_01.js | UTF-8 | 1,141 | 4.34375 | 4 | [] | no_license | // js/src/js_007_function_01.js
var i = 10;
var j = 3;
// var k = i + j;
// console.log(k);
// var k;
function plusFn(a, b){
var k = a + b;
// console.log( k );
return k;
}
var r = plusFn(1, 5);
var ab = plusFn(4, 3);
var ac = plusFn(i, j);
var ad = plusFn(j, j);
var ae = plusFn(i, i);
console.log( ab + ac +... | true |
2f6e8b54fd3a03835666fe6fd6ffd263d072b4e1 | JavaScript | eelanagaraj/Simpl | /calling and video screen.js | UTF-8 | 2,027 | 3.078125 | 3 | [
"MIT"
] | permissive | window.onload = callClock();
function callClock() {
var secs = 0;
builtInClock = setInterval(function() {
secs ++;
document.getElementById("secs").innerText = secs % 60;
document.getElementById("mins").innerText = parseInt(secs / 60);
}, 1000);
}
window.onload = callClock1();
... | true |
e5f02ed434074fc6b58b176447a2749e25b5a0ef | JavaScript | tharrington1/xml2dom | /index.js | UTF-8 | 1,482 | 2.703125 | 3 | [
"MIT"
] | permissive | var Process = require('./lib/xml2json'),
expat = require('node-expat');
var defaults = {
/**
* For every value encountered (attribute or text value), this conversion
* function will be called with that value along with the name of the
* attribute this value belongs to and the containing element name. In... | true |
ec30d85a4cd1f740bb4b923ea77d97cb0c81b743 | JavaScript | Wi0/corona-tracker | /src/components/Chart/LineGraph.js | UTF-8 | 2,984 | 2.65625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import {
LineChart,
Line,
CartesianGrid,
XAxis,
YAxis,
Legend,
ResponsiveContainer,
Tooltip,
Text
} from "recharts";
const RenderLineChart = ({ data, deletedCountry }) => {
let [dataArray, setDataArray] = useState([]);
let [dataTitle, setDataTit... | true |
ab19ef81c9e913f237168ab183b2eb6837bc20c2 | JavaScript | mishal1/battleships | /test/unitTests/cellSpec.js | UTF-8 | 1,082 | 2.875 | 3 | [] | no_license | var Cell = require('../../src/cell');
describe ('Cell', function(){
var cell;
beforeEach(function(){
cell = new Cell();
});
it('has no ship when initialised', function(){
expect(cell.hasShip).toBe(false);
});
describe('place ship', function(){
beforeEach(function(){
cell.placeShip();... | true |
2a8a678fbf7ce1dec8842e4852dd0665d40d8805 | JavaScript | solayman-bd/ahnaf_vai_node | /routes/albumRoute.js | UTF-8 | 3,043 | 2.546875 | 3 | [] | no_license | const albumRoute = require("express").Router();
const albumModel = require("../models/albumModel");
const { responseGenerator } = require("../utils");
//post
//demo url:http://localhost:8800/album?name=solayman2&description=hi&year=2022
albumRoute.post("/", async (req, res) => {
const { authorization } = req.headers... | true |
26271f6dbfc410501368f8afd82fa949a84dd539 | JavaScript | Faycel-Arab/boardgame.io | /src/ui/hex-utils.test.js | UTF-8 | 2,967 | 2.578125 | 3 | [
"MIT"
] | permissive | /*
* Copyright 2018 The boardgame.io Authors
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/
import {
getAllNeighbors,
getDistance,
getRange,
getReachable,
createCoordinate,
} from './hex-utils';
tes... | true |
875e9d709afa8f0c347edb640e0f6b0a8eac7336 | JavaScript | niazpour/cssipractice | /functions.js | UTF-8 | 1,621 | 3.625 | 4 | [] | no_license | function timestwo(a){
return (a*2);
}
function timessix(a){
return a * (timestwo(2) + 2);
}
function roll(){
return Math.floor(Math.random()*6)+1;
}
function mouse(){
var text = "ELEPHANTBEARMOUSECOW"
text1 = text.substring(0,12);
text2 = text.substring(17,20);
text3= text.substring(12,17).toLowerCase();
text... | true |
de4d01825f073219b42bae7d65ea154d19b34d58 | JavaScript | ColinFendrick/ramda-basics | /examples/call.js | UTF-8 | 248 | 3.359375 | 3 | [] | no_license | // The call() function invokes a provided function on arguments separated by comma.
import { call, repeat, add } from '../index.js';
const res = call(add, 1, 2);
console.log(res);
console.log(call(repeat, 'x')(5));
call(console.log, [1, 2, 3]);
| true |
83a2412b3167790e2fddd94278a8218180a6a86c | JavaScript | luongnv89/Web-Apps | /boxfoto/boxfoto.js | UTF-8 | 1,467 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | var photoDOM = '<div class="col-xs-6 col-md-3 col-xs-12"> <a href="#" class="thumbnail"> <img src="" class="photo"> </a> </div>';
function doFirst () {
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia;
video = document.getEl... | true |
f2d01a8aa6dd7e705fb1f254373778b42029aa32 | JavaScript | bjw-fightword/bjw-fightword.github.io | /js/project3d.js | UTF-8 | 935 | 2.875 | 3 | [
"MIT"
] | permissive |
document.addEventListener('readystatechange',function(){
if(document.readyState==='complete'){
var slides=document.querySelectorAll('#slides .samples')
var arrs=['slides-1','slides-2','slides-3','slides-4','slides-5','slides-6','slides-7','slides-8','slides-9']
lunbo=function(){
arrs.push(arrs.shift());
for(va... | true |
c9888a0ee3e2b027ab2612468dcc8ef122c52f52 | JavaScript | chaoky/Screeps-with-friends | /withdraw.js | UTF-8 | 756 | 2.5625 | 3 | [
"MIT"
] | permissive | var withdraw = {
run: function(Creep){
var structure = Creep.pos.findClosestByPath(FIND_MY_STRUCTURES, {
filter: (s) => (s.structureType == STRUCTURE_SPAWN
|| s.structureType == STRUCTURE_EXTENSION
|| s.structureType == STRUCTURE_CONTAINER)
&& s.energy <= s.energyCapacity
});
... | true |
84e5171414766cc2edc6f60dd2df40d480e89dbd | JavaScript | PoolC/Haribo | /src/hooks/useInput.js | UTF-8 | 484 | 2.546875 | 3 | [] | no_license | import { useCallback, useState } from 'react';
export default (initialValue = null, condition) => {
const [value, setValue] = useState(initialValue);
const [error, setError] = useState(false);
const handler = useCallback(
(e) => {
setValue(e.target.value);
if (!condition(e.target.value)) {
... | true |
96e6836a9fd23c53572b505108e873351224391b | JavaScript | Cyrus-Kiprop/codewars_milestones | /square_digits.js | UTF-8 | 315 | 3.5625 | 4 | [] | no_license | function square_dig(num) {
let arr = [];
((num.toString()).split('')).forEach(element => {
(arr.push(Math.pow(element, 2)));
});
return Number(arr.join(''));
}
console.log(square_dig(9999));
let str1 = '4567'
console.log(str1.split(''));
str1.split('').forEach(keys=> console.log(keys));
| true |
b733f43e4cc35be81d31dc7a687eecd3a6327c5f | JavaScript | dreamingrainbow/NMI-DirectPay-GWAPI | /gwapi.test.js | UTF-8 | 490 | 2.640625 | 3 | [
"MIT"
] | permissive | const { gwapi } = require("./gwapi");
describe("Gateway API Test Suite", () => {
var gw = new gwapi(() => {
return "Test Callback.";
});
it("Class Initializes", () => {
expect(gw).toBeDefined();
expect(gw).toBeInstanceOf(gwapi);
});
it("Callback Works", () => {
expect(typeof gw.cb).toBe("fun... | true |
4739d1f65aeb53d9e7a29e66d0070463633b1d85 | JavaScript | andrewd1137/WebCalculatorApp | /calcMain.js | UTF-8 | 7,286 | 4 | 4 | [] | no_license | let currentNumber = "";
let savedNumber = 0;
let currentOperation = "";
let negativeNumberCheck = false;
let lastButtonPressed = "";
let numberButtonClicked = function(number) {
lastButtonPressed = "number";
let numberClicked;
//used to take the leading 0 out of the number when a user clicks a number.
... | true |
77eda06fca03ba19f1404a75190421a83f42c671 | JavaScript | bigcheese420/ahumanpeople | /mozarella/script.js | UTF-8 | 5,783 | 2.9375 | 3 | [] | no_license | var coins = 0; // COINSSSSS5SSSS!1!!!!!!!!
var cropName = ["rice", "wheat", "soybean", "sesame", "millet"];
var cropAmountCurrent = [0, 0, 0, 0, 0];
var cropAmountSold = [0, 0, 0, 0, 0];
var peasantsPerCrop = [0, 0, 0, 0, 0];
var numPeasants = 0;
var numUnemployed = 0;
var peasantCost = Math.floor(5 * Math.pow(1.1, n... | true |
b5e33dff1b0428a9054bdfca4d6c9b2c7b6fec3f | JavaScript | Aniyora/-BATMAN-BEGINS | /Umbrella.js | UTF-8 | 467 | 2.671875 | 3 | [] | no_license | class Umbrella{
constructor(x,y){
var opt={
isStatic:true
}
this.umbrella=Bodies.circle(x,y,50,opt);
this.radius=50;
this.image=loadImage("Walking Frame/walking_1.png")
World.add(world, this.umbrella);
this.batmanImg=loadImage("Bestman-01.png");
... | true |
520a1d3f1af75d7252fdc757383281cc547203e8 | JavaScript | souky/SVN | /clockSystem-V2.0.0/src/main/webapp/static/jy/js/common/jry-Plug-in.js | UTF-8 | 10,259 | 2.53125 | 3 | [] | no_license | var JRYTable = {
version : '1.0.0',
$ : window.jQuery
};
//table表单
JRYTable = (function($){
//定义模板
TEMPLATE = {
title : '<tr><td><input type="checkbox" class="" data-select="0"></td><td>全选</td><td class="counts"></td><td onclick="typeJRY()"><div><div class="imgDelete"><img src="img/delete.png"></d... | true |
a684a7ced986f9ed1ac2f2658112f9a54a55a6af | JavaScript | miki79/weather | /src/handler.js | UTF-8 | 866 | 2.53125 | 3 | [] | no_license | const { getCoordinates } = require('./ip');
const { getWeather } = require('./weather');
module.exports.weather = (event, context, callback) => {
const callbackHandler = (body, statusCode = 200) => {
const response = {
statusCode,
headers: {
'Access-Control-Allow-Origin': 'https://miki.me.uk'... | true |
e37134eef34ed64fa2d3b2bcd71ea8dd39e62a3a | JavaScript | Psychotheus/help-me | /src/index.js | UTF-8 | 843 | 2.875 | 3 | [
"MIT"
] | permissive | module.exports = function count(s, pairs) {
let count = 0;
let totients = [], nontotients = [];
let pairsCount = pairs.length;
for (let j = 0; j < s.length; j++) {
let totientNumber = 1;
let notTotient = 1;
const zero = s[j] == '0'? 1: 0;
for (let k = 0; k < pairsCount; k++) {
let p ... | true |
53bf079b3fee57869d1800f50aadf45c207c2882 | JavaScript | DiesIrae/fvu.js | /query.js | UTF-8 | 3,100 | 2.65625 | 3 | [
"MIT"
] | permissive | //--------------------------------------------------------------
// query.js
//--------------------------------------------------------------
//
// Query the fvu-mongo database using input filters and extract
// the proportions of each damage type.
//
// Collection = {
// exam_month: '2',
// exam_year: '2000',
/... | true |
825533a6bb8887862260bc09464e2092d8f667a4 | JavaScript | AlwaysTraining/patnlp-hsm | /hsm/html/filter.js | UTF-8 | 8,158 | 2.625 | 3 | [] | no_license | /*
* This file is provided for custom JavaScript logic that your HTML files might need.
* Maqetta includes this JavaScript file by default within HTML pages authored in Maqetta.
*/
require(['dojo/store/JsonRest'], function(JsonRest){
filter_name_store = new JsonRest({
target: 'filter'
});
});
require(["dojo/re... | true |
60562acb15707c61a9bb5e0678e11b280f89e545 | JavaScript | kmotovilkov/JavaScript-Advanced | /01.BasicSyntax,ConditionalStatementsAndLoops-Lab/09.WordsUppercase.js | UTF-8 | 228 | 3.234375 | 3 | [] | no_license | function solve(words) {
words = words
.split(/\W+/)
.filter(word => word.trim().length > 0)
.map(e => e.toUpperCase()).join(', ');
console.log(words);
}
solve('Hi, how are you?');
solve('hello'); | true |
562cbe33f3f09bfcc780fce6b055528058c33a31 | JavaScript | kostennykovAlex/goIt | /js/toNumber.js | UTF-8 | 4,962 | 4.03125 | 4 | [] | no_license | //------------TO NUMBER------------
// ЛЮБОЕ СТРОЧНОЕ ЗНАЧЕНИЕ К ЧИСЛУ
let value = 'Bla Bla Bla'
// 1-й способ
let toNumber = Number(value)
console.log(`${value}, через конструктор Number() :`, toNumber)
console.log(
`тип данных ${value}, через конструктор Number() :`,
toNumber,
typeof toNumber,
)
// 2-й спос... | true |
8352d06c8bcdb090e249b3f70f5a22c1938b83f9 | JavaScript | DewitteRuben/Sudoku | /web/assets/js/hintSetup.js | UTF-8 | 3,817 | 2.984375 | 3 | [
"MIT"
] | permissive | var hintSettingsObject;
var changeButtonLayout = function () {
if (hintSettingsObject.showValidValues) {
$("button#toggleValidValues").addClass("highlight");
}
if (hintSettingsObject.autoFillNotes) {
$("button#toggleAutoFill").addClass("highlight");
}
};
var loadSetupFromLocalStorage =... | true |
497fc123fd915c84016336fc39f2eb54794c74e4 | JavaScript | mekhovov/mekhovov.github.com | /js/map.js | UTF-8 | 4,513 | 2.5625 | 3 | [] | no_license | // http://hpneo.github.io/gmaps/examples.html
var map_data = [];
// map init
var map = new GMaps({
div: '#map',
zoom: 11,
lat: 53.5510846,
lng: 9.99368179999999
});
function find_me(){
GMaps.geolocate({
success: function(position) {
map.setCenter(position.coords.latitude, position.coords... | true |
fba016f1b6aabfb24a92efa7c9fa7cd59234b6ab | JavaScript | f/yarn | /src/util/yarn-version.js | UTF-8 | 1,497 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | /**
* Determines the current version of Yarn itself.
* @flow
*/
import {readJson} from './fs';
import fs from 'fs';
import path from 'path';
// This will be bundled directly in the .js file for production builds
const {version, installationMethod: originalInstallationMethod} = require('../../package.json');
expor... | true |
e5f75930e084da2c92914ac912381d58ce6b6d19 | JavaScript | Dagothig/node-bang | /server/game/hand.js | UTF-8 | 2,554 | 2.5625 | 3 | [] | no_license | const misc = aReq('server/misc'),
Card = aReq('server/game/cards/card');
module.exports = function Hand(game, player, cards) {
return misc.merge(cards.draw(player.stat('initCards')), {
drawFromPile: function(amount) {
this.add(cards.draw(amount || 1), { from: 'pile' });
},
/... | true |
0f10ce5543cf31376715beb7c338f7154f669877 | JavaScript | noshbar/project-GRR | /search.js | UTF-8 | 2,242 | 2.96875 | 3 | [] | no_license | function makeLocalCopyLink(href)
{
var linkSup = $("<sup>").text('(local copy)');
var localItem = $("<a>");
localItem.append(linkSup);
localItem.attr('href', href);
return localItem;
}
function onShowItem(id)
{
clearContent();
$.post("getItems.php",
{
itemId: id
}, func... | true |
3b579721dc3ac8927a1b68bb568a4450cb4d975b | JavaScript | doelmi/maze-generation-algorithm | /js/algorithm/HuntAndKill.js | UTF-8 | 1,591 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | class HuntAndKill extends Matrix {
constructor(n) {
super(n);
this.name = "Hunt and Kill";
}
hunting(rooms) {
for (let cell of rooms) {
if (cell.status == 0) {
let neighborIndex = [...cell.neighborIndex];
while (neighborIndex.length > 0) {
let random = this.randomInt(0... | true |
858ab3f33c98043ebfd6ca712598af8bf6c24f77 | JavaScript | vy3191/reducer-todo | /reducer-todo/src/reducers/reducer.js | UTF-8 | 2,223 | 2.875 | 3 | [] | no_license |
// export const initialState = [
// {item: 'Learn about HTML5',
// completed: false,
// id: Date.now()
// },
// {item: 'Learn about CSS3',
// completed: false,
// id: Date.now()
// },
// {item: 'Learn about JavaScript',
// completed: false,
// id: Date.... | true |
e7d838327ffe52c113719493b7ae7942dba3bafd | JavaScript | luckyan315/lumap | /util/logger.js | UTF-8 | 2,199 | 2.890625 | 3 | [] | no_license | /**
* logger module
* Copyright (c) 2013, guanglin.an (lucky315.an@gmail.com)
*/
"use strict";
var slice = Array.prototype.slice;
var unshift = Array.prototype.unshift;
var logger = exports = module.exports = function(type) {
var args = slice.call(arguments, 1);
var level = logger.levels[type];
//coloring... | true |
ef13bc3db8212ce3fea72a30d1cf899483afadcb | JavaScript | moonorongo/orangeJS | /js/class.tile_map.js | UTF-8 | 11,827 | 2.65625 | 3 | [] | no_license | /*
* Declares {@link TileMap} class etc.
* @file class.tile_map.js
* @version 0.1
*/
/**
* @class TileMap
* Un TileMap es un mapa armado con caracteres, como se armaban en las viejas consolas y computadoras, en el que se pueden definir areas transitables
* las cuales serán utilizadas por A* para el calculo del... | true |
3b712d471fcb7d65052cdb06b0b739ffb6d1fde7 | JavaScript | wu-ToStar/Web-base | /计算机网络/跨域/CORS/server.js | UTF-8 | 956 | 2.625 | 3 | [] | no_license | let express = require("express");
let CONFIG=require("./config")
const bodyParser = require("body-parser");
app = express();
app.listen(CONFIG.PORT, () => {
console.log("OK!");
});
app.use(bodyParser.urlencoded({ extended: true }));
// app.use(session(CONFIG.SESSION));
app.use((req, res, next) => {
const { ALLOW_... | true |
eb4d0e93c69bde99756db6cce73f006e325082fa | JavaScript | corvofeng/hexo-script-tiny | /src/js/flow.js | UTF-8 | 3,489 | 2.578125 | 3 | [] | no_license | "use strict";
// vim: ts=2 sw=2 sts=2 et:
/*
*=======================================================================
* Filename: flow
*
* Version: 1.0
* Created on: October 04, 2019
*
* Author: corvo
*=======================================================================
*/
import { AddOnload, ... | true |
61f8053fc47bba32a2ac61cf2c11014176f0296e | JavaScript | kamal336/javascript-practice | /apply-js-concept/factorial-revarse.js | UTF-8 | 232 | 3.953125 | 4 | [] | no_license | let factorial = 1;
function factorialIncrement(number){
for(let i = number; i >= 1; i--){
factorial = factorial * i;
}
return factorial;
}
let factResult = factorialIncrement(5);
console.log(factResult);
| true |
263fd10e68567f17d76116ef1915205ac16958d1 | JavaScript | mwfister/redux-twitter | /src/components/Nav.js | UTF-8 | 748 | 2.65625 | 3 | [] | no_license | import React from "react";
import { NavLink } from 'react-router-dom'
import PidgeonLogo from '../media/Pidgeon.png'
export default function Nav(props) {
return (
<div className="nav">
<ul>
<li>
<NavLink exact to="/" activeClassName="active">
Timeline
</NavLink>
... | true |
fcc619469591fa8b553b03426a4bbe952f96f722 | JavaScript | kelvinjhwong/javascript-exercises | /javascript-oop-exercises/01_05_school.js | UTF-8 | 4,453 | 3.203125 | 3 | [] | no_license | function createStudent(name, year) {
return {
name: name,
year: year,
courses: [],
info: function () {
console.log(`${this.name} is a ${this.year} year student`);
},
addCourse: function (course) {
this.courses.push(course);
},
listCourses: function () {
return this... | true |
6ee108ae43e8ce379f0827cf22c9b13ed9277cec | JavaScript | liudonghua123/alita | /src/tran/addWXPrefixHandler.js | UTF-8 | 5,036 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
* Copyright (c) Areslabs.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import traverse from "@babel/traverse";
import {RNCOMPSET} from "../constants";
import * as t from "@babel/types";
import {RNWXLIBMaps} from "../util/u... | true |
82f5db1bc75503b3b2d3d96d0c37d563df62f1e6 | JavaScript | Odinokun/delfispa | /src/js/map.js | UTF-8 | 4,998 | 2.53125 | 3 | [] | no_license |
// ***************************************//
// ********CUSTOM MAPS & filter **********//
// ***************************************//
// ********** AHTUNG ************
// порядок городов (coords) не менять!!!!
// это важно для правильного выбора селекта
// ********** AHTUNG ************
var coords = [
//all germa... | true |
bca19f2d584730f6850a5bf88d9c09e9912757fa | JavaScript | Advertsk/css | /vzor/money management calculator_files/mmc.js | UTF-8 | 1,370 | 2.625 | 3 | [] | no_license | /*
* file: mmc.js
* author(s):
* copyright: (C) 2013
* description: javascript file for money management calculator window
*/
/* function vertically centers inside parameters fieldset */
$.fn.verticalCenter = function ()
{
innerElementHeight = $(this).height();
outerElementHeight = $(this).parent().parent... | true |
5caa6407b10b166bd513329e666f0b269c9ab602 | JavaScript | nueng1996/xojs_verstanalone | /stan-alone/index.js | UTF-8 | 6,788 | 3.125 | 3 | [] | no_license |
let tableCreate = (rowcol) => {
let body = document.getElementsByTagName('body')[0];
let oldtbl = document.getElementsByTagName('table')
if (oldtbl.length !== 0) {
body.removeChild(body.childNodes[body.childNodes.length - 1]);
}
let tbl = document.createElement('table');
let numid... | true |
db1e1ecb447d6e2fbdc2a49a25fe77667d4ee852 | JavaScript | raghuk46/employee-manager | /server/utils/utils.js | UTF-8 | 5,074 | 3.046875 | 3 | [
"MIT"
] | permissive | import moment from 'moment-business-days';
/**
*
* @param start
* @param end
* @param holidays
* @returns {number}
*/
export const calculateWorkdaysInTimePeriod = (start, end, holidays) => {
moment.updateLocale('us', {
holidays: holidays,
holidayFormat: 'DD/MM/YYYY'
});
return moment(start).busines... | true |
ac6941a1f60ba76eea8f89949f695e0fb21dd3e5 | JavaScript | ecmarsh/algorithms | /exercises/subarraySum.js | UTF-8 | 3,178 | 3.953125 | 4 | [
"MIT"
] | permissive | /**
* Subarray Sum Equals K
*
* Given an array of integers and an integer k,
* find the total number of contiguous subarrays
* whose sum equals k.
*
* @example
* Input: [1,1,1], k=2
* Output: 2
*
* Constraints:
* - `-1000 <= nums[i] <= 1000`, and `1 <= i <= 20000`
* - `-1e7 <= k <= 1e7`
*
*/
/**
* Cons... | true |
d52812de89fb25391053cb5a876ea83047010a35 | JavaScript | victory21th/Dim---Node.js | /public/app/files/service/Files.js | UTF-8 | 2,465 | 2.53125 | 3 | [] | no_license | (function(){
'use strict';
angular
.module('files')
.factory('Files', Files);
Files.$inject = ['HearstAPI', 'CONFIG', '$q'];
/**
* @name Files
* @desc API for files
* @memberOf files
*/
function Files(HearstAPI, CONFIG, $q) {
var Files = {};
/**
* @name getFiles
* @desc Get all files stored ... | true |
9791e8a274a4f4f92db872190997865f679a4c44 | JavaScript | JOSHZOL/water-tank | /main.js | UTF-8 | 8,370 | 2.890625 | 3 | [] | no_license | let graphItem = document.querySelector('#template').content.querySelector('.graph-item');
let results;
let waterDepth;
let numberOfTanks = 2;
let averageUsage;
let dailyResults = 0;
let weeklyResults = [];
let distanceToEmpty = 232; // in cm
(function getData() {
$.getJSON('https://api.thingspeak.com/channels/95... | true |
4e0ccba2e6b4f481ffeeb7b711657859ededc77d | JavaScript | yektaokdan/quiz-app | /quiz_app/app.js | UTF-8 | 3,502 | 3.3125 | 3 | [] | no_license | function Question(text, choices, answer) {
this.text = text;
this.choices = choices;
this.answer = answer;
}
//Soru prototipi
Question.prototype.checkAnsver = function (answer) {
return this.answer === answer;
}
//Soru constructor
function Quiz(questions) {
this.questions = questions;
this.so... | true |
80cb5cf65e2d67c3a6cfec53522a1398157864ac | JavaScript | DSPdav/Refactory-DavidSarono-FE | /03.js | UTF-8 | 529 | 2.9375 | 3 | [] | no_license | const searchWords = [`aku`, `ingin`, `dapat`];
const sentence = `Aku ingin begini
Aku ingin begitu
Ingin ini itu banyak sekali
Semua semua semua
Dapat dikabulkan
Dapat dikabulkan
Dengan kantong ajaib
Aku ingin terbang bebas
Di angkasa
Hei… baling baling bambu
La... la... la...
Aku sayang sekali
Doraemon
La... la..... | true |
593c3f3c7d112fb31308b06fe0534e900a161f61 | JavaScript | LuauLuau97/PhaserTwoPlayerGame | /game.js | UTF-8 | 4,265 | 2.625 | 3 | [] | no_license | var width = 960;
var height = 540;
var game = new Phaser.Game(width, height, Phaser.AUTO, '',
{
preload: preload,
create: create,
update: update
});
var p... | true |
91219b5501bf397d59a252368a3888fb2b4a5114 | JavaScript | sarinac/spotify-flowers | /app/static/js/worker.js | UTF-8 | 1,575 | 2.625 | 3 | [] | no_license | if( "function" === typeof importScripts) {
importScripts("https://d3js.org/d3.v4.min.js");
onmessage = (event) => {
// scale for petal size
let petalSizeScale = d3.scaleQuantize()
.domain([d3.min(event.data.notes, d => d.loudness_sections), 0])
.range([25, 20, 18, 15, ... | true |
a66d144786e5aaea65a7f1f037a985e3d8099edf | JavaScript | AjBreidenbach/abreidenbach.com | /connect/src/game-state.js | UTF-8 | 2,562 | 3.046875 | 3 | [] | no_license | export default class GameState {
constructor(controllers) {
this.turn = -1
this.stacks = [0, 0, 0, 0, 0, 0, 0]
//this.pieces = []
//console.error(controllers)
this.controllers = controllers
this.board = new Array(42)
}
reset() {
this.stacks = [0, 0, 0, 0, 0, 0, 0]
this.board.... | true |
bc1e60b82914b6c8334f1cce655c9acd9f437478 | JavaScript | oanaCristeaC/call-api-app | /imports/api/wolves.js | UTF-8 | 1,504 | 2.78125 | 3 | [] | no_license | /**
* wolves.js
* - contains the methods (server side functions)
* - makes http requests to the Wolfpack APIs
* - that are related to Wolves
*/
import {
Meteor
} from "meteor/meteor";
import {
HTTP
} from "meteor/http";
import {
check
} from "meteor/check";
// Authentification requ... | true |
4bd47065de31aeddae390aba24add5e8dca7b869 | JavaScript | adri994/Javascript_Dorian | /Clase 2 Funciones/4-Ejercicio/Dorian/index.js | UTF-8 | 2,172 | 4.6875 | 5 | [] | no_license | /*
Crea una clase Libro
La clase libro tendr� t�tulo, autor, a�o y g�nero.
Crea un m�todo que devuelva toda la informaci�n del libro
Pide 3 libros y gu�rdalos en un array
Los libros se introducir�n al arrancar el programa pidiendo los datos con prompt.
Validar que los campos no se introduzcan vac�os
Validar que el a�o... | true |
84f4ca8efa3b4f16832ef65fb75bde91691fe88a | JavaScript | perfect199399/wechat_Vlog | /utils/base64.js | UTF-8 | 934 | 2.671875 | 3 | [] | no_license | function getPicBase64(tempFilePath){
return new Promise(function (resolve, reject) {
wx.getFileSystemManager().readFile({
filePath: tempFilePath,
encoding: "base64",
success: function (data) {
// console.log(data); //返回base64编码结果,但是图片的话没有data:image/png
resolve(data);
}
}... | true |
c4e11910db8597bc9332152e0a0118f9decffe82 | JavaScript | WonJW/momentum-clone-2021 | /js/backgroud.js | UTF-8 | 1,647 | 2.859375 | 3 | [] | no_license | const backgroundImage = [
"man-utd.jpg",
"man-city.jpg",
"ac-milan.jpg",
"barca.jpg",
"chelsea.jpg",
"leicester.jpg",
"liverpool.jpg",
"munchen.jpg",
"psg.jpg",
"real.jpg"
];
const slogans = [
{
slogan: "Glory Glory Manchester United!",
teamName: "Manchester ... | true |
dacc49d7943f91aaa39e1403355a04c88364acbf | JavaScript | shazi57/leetCode | /problems/intervalIntersection.js | UTF-8 | 948 | 3.328125 | 3 | [] | no_license | const intervalIntersection = (intervalA, intervalB) => {
if (intervalA.length === 0 || intervalB.length === 0) {
return [];
}
// for each interval as rangeA in intervalA
// for each interval as rangeB in intervalB
// if minA <= minB && maxA <= maxB
// add minA to the array
// else if minA >= minB && ... | true |
cb1667a643c399860784f40acd781d756ff15cda | JavaScript | lsw159134/azikezhi | /src/main/webapp/js/searchSupplierResult.js | UTF-8 | 686 | 2.828125 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
var len = $(".pages").length;
var page = len / 10;
if(len % 10 > 0){
page += 1;
}
for(var i = 0; i < 10; i++){
$(".pages").eq(i).css('display','block');
}
for(var i = 1; i <= page; i++){
$(".page").append("<li>"+i+"</li>");
}
... | true |
c2f0e19f863efdf839b39efae4157aac3845eba6 | JavaScript | bstefanescu/npm-ws | /index.js | UTF-8 | 554 | 2.71875 | 3 | [
"MIT"
] | permissive | const process = require('process');
const Workspace = require('./workspace.js');
function now() { // timestamp in ms
const hrTime = process.hrtime();
return hrTime[0] * 1000 + hrTime[1] / 1000000;
}
const start = now();
const promise = Workspace.run(process.cwd(), process.argv.slice(2));
if (!promise) {
console.... | true |
02d51d1186f97ed7d4f0558b84e9b839a90e07d8 | JavaScript | orest-orest/month-task | /src/App.js | UTF-8 | 1,812 | 2.703125 | 3 | [] | no_license | import React from 'react';
import MonthList from './MonthList'
import MonthInfo from './MonthInfo'
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
data: [],
monthNames: ["January", "February", "March", "April", "May", "June",
... | true |
62c0378ecf2086b0800f9d709d554b06cf080cd9 | JavaScript | punitcodes/nex-bridge | /changelly/express/methods/getCurrencies.js | UTF-8 | 763 | 2.59375 | 3 | [] | no_license | const axios = require("axios");
const getCurrencies = () => {
return new Promise((res, _rej) => {
axios
.get(`https://api.n.exchange/en/api/v1/currency/`)
.then(({ data }) => {
const currenciesArray = data.reduce((coinsList, coin) => {
const {
code,
is_crypto... | true |
0a4e318142058308e5a22e1ed5a64fd2b612293a | JavaScript | Gandalfthegreat/algorithm008-class02 | /Week_01/977.有序数组的平方.js | UTF-8 | 1,041 | 3.578125 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=977 lang=javascript
*
* [977] 有序数组的平方
*
* https://leetcode-cn.com/problems/squares-of-a-sorted-array/description/
*
* algorithms
* Easy (71.17%)
* Likes: 84
* Dislikes: 0
* Total Accepted: 34K
* Total Submissions: 47.8K
* Testcase Example: '[-4,-1,0,3,10]'
*
* 给定一个按非递减顺... | true |
104583d769454f8adb54ddb1fdb9c356d3eceb39 | JavaScript | pascal-p/javascript-exercism | /matching-brackets/matching-brackets.spec.js | UTF-8 | 2,201 | 3.453125 | 3 | [] | no_license | import { isPaired } from './matching-brackets';
describe('Matching Brackets', () => {
test('paired square brackets', () => {
expect(isPaired('[]')).toBe(true);
});
test('empty string', () => {
expect(isPaired('')).toBe(true);
});
test('unpaired brackets', () => {
expect(isPaired('[[')).toBe(fal... | true |
61e4ee3aa907f06c3c695293ea346c4d4020813e | JavaScript | cmattey/geddit | /controllers/goals.js | UTF-8 | 2,428 | 2.53125 | 3 | [
"MIT"
] | permissive | const goalsRouter = require('express').Router()
const Goal = require('../models/goal')
const Table = require('../models/table')
const User = require('../models/user')
const jwt = require('jsonwebtoken')
const config = require('../utils/config')
goalsRouter.get('/', async (request, response) => {
try{
const go... | true |
899235947820b826bfa24733dadb2128081cfad4 | JavaScript | qwop/userscript | /monolith/109/75587.user.js | UTF-8 | 2,113 | 2.6875 | 3 | [] | no_license | // ==UserScript==
// @name DSSaveLastClick
// @namespace DS
// @author Bananaz
// @description Speichert den Zeitpunkt des letzten Klicks und die Anzahl der Angriffe zu diesem Zeitpunkt
// @include http://de*.die-staemme.de/game.php*
// ==/UserScript==
/// ------------------... | true |
84aa61be24e7587a50d41355c16eebb4622149cf | JavaScript | bitfinexcom/bfx-hf-chart | /src/components/Chart/lib/draw/y_axis.js | UTF-8 | 1,603 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | import _max from 'lodash/max'
import _min from 'lodash/min'
import drawLine from './line'
import formatAxisTick from '../util/format_axis_tick'
import CONFIG from '../config'
/**
* Renders a Y-axis at the specified X coord with dynamic tick rendering based
* on the provided candle dataset.
*
* @param {HTML5Canva... | true |
d330c1c0e4a026bf02ba9ed71f98871d8a29031b | JavaScript | Mitscherlich/Play-with-Algorithms-JS | /src/05-Binary-Search-Tree/02-Binary-Search-Tree-Basics.js | UTF-8 | 5,568 | 3.546875 | 4 | [
"MIT"
] | permissive | const assert = require('assert')
/**
* @class 二分搜索树的节点
* @member {*} key 节点的键
* @member {*} value 节点的值
*/
class Node {
constructor (k, v) {
if (k instanceof Node) {
// 如果第一个参数是一个 Node 则拷贝一份
this.key = k.key
this.value = k.value
this.left = k.left
this.right = k.right
} else ... | true |
bc2c51efd93a8bd7282e401c1dc171938a7f9316 | JavaScript | 007minoyon/14-APPLY-JAVASCRIPT-CONCEPTS | /factorialWhile.js | UTF-8 | 193 | 3.734375 | 4 | [] | no_license |
function fact(){
var i = 1;
var factorial = 1;
while(i <= 5){
factorial = factorial*i;
i++;
}
return factorial;
}
var result = fact(5);
console.log(result); | true |
c5fc04c45fb02a619754f17660479ce56ee13c07 | JavaScript | Quart2629/space-ball | /frontend/src/components/session/login_form.js | UTF-8 | 4,273 | 2.5625 | 3 | [] | no_license | import React from "react";
import { withRouter, Link } from "react-router-dom";
import NavBarContainer from "../main/navbar/navbar_container";
class LoginForm extends React.Component {
constructor(props) {
super(props);
this.state = {
username: "",
password: ""
};
this.handleSubmit = th... | true |
2210f7a23aa5c0ba1aa6da5f261fb482733e1950 | JavaScript | eiryu/r-isucon-2018-winter | /nodejs/public/js/chat.js | UTF-8 | 3,068 | 2.78125 | 3 | [
"MIT"
] | permissive | const chatForm = document.getElementById("chat-form");
if (chatForm) {
const ws = new WebSocket(`ws://${location.host}/ws/notification`)
const groupname = document.title;
const username = (document.getElementById("_username") || {}).value;
const chatList = document.getElementById("chat-list") || {};
ws.onme... | true |
b5e27099318cf839e7f3763ab0e81cd286ff8cf3 | JavaScript | nick8292/CMPT120-Project-2 | /functions.js | UTF-8 | 5,199 | 2.5625 | 3 | [] | no_license | var space="\n------------------\n";
var score = 0; var local1 = 0; var local2 = 0; var local3 = 0; var local4 = 0; var local5 = 0; var local6 = 0; var local7 = 0; var local8 = 0; var local9 = 0 ;
var position=0;
var gun = false;
var handcuffs = false;
var keys = false;
var inventory = "";
function process()
{
var com... | true |
b676bf04aad827bc5bd254db9bbf33ab4d98a230 | JavaScript | silveste/learning-stuff | /html-and-css3/html5_canvas/javascripts/script.js | UTF-8 | 1,077 | 3.3125 | 3 | [] | no_license | // Checking if browser support canvas element
var drawLogo = function(ctx){
//Creating gradients
var gradient = ctx.createLinearGradient(0,0,0,40);
gradient.addColorStop(0, "#AA0000");
gradient.addColorStop(1, "#FF0000");
ctx.fillStyle = gradient;
ctx.strokeStyle = gradient;
ctx.lineWidth = 2;
ctx... | true |
ea8a6d88b9308a2d33096f4dfeeb3c302fe0c2fd | JavaScript | bensonruan/Sentiment-Analysis | /js/sentiment-analysis.js | UTF-8 | 7,205 | 2.625 | 3 | [
"MIT"
] | permissive | const HOSTED_URLS = {
queryTwitter: window.location.protocol + '//'+ window.location.hostname + '/js/sentiment/queryTwitter.php?q=',
model: 'https://storage.googleapis.com/tfjs-models/tfjs/sentiment_cnn_v1/model.json',
metadata: 'https://storage.googleapis.com/tfjs-models/tfjs/sentiment_cnn_v1/metadata.jso... | true |
e0b27aa82fa8aa3a7df369ca090b73c678c9a6aa | JavaScript | frasnym/Crawl-Job-Vacancy-at-Cermati-Karir | /detail.js | UTF-8 | 897 | 2.671875 | 3 | [] | no_license | async function getDetail(browser, url) {
const page = await browser.newPage();
await page.goto(url);
const posted_by = await page.$eval(
".details-title",
(el) => el.textContent
);
const location = await page.$eval(
"span.job-detail",
(el) => el.textContent
);
const getList = async (page, selector) =>... | true |
1d1af39087d7051cef5e2fc37011d0d911c17080 | JavaScript | tomrom95/ece_inventory | /src/components/user/EditUsers.js | UTF-8 | 4,780 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
import UserSelect from './UserSelect.js';
import UserProfile from './UserProfile.js';
import '../../App.css';
class EditUsers extends Component {
constructor(props) {
super(props);
this.state = {
userIdSelected: null,
usernameSelected: nu... | true |
282002b2577604f7a0d291e244cdad198e68b4c0 | JavaScript | fourprofessionalguys/SDC-REI-product-wrapper | /db/redis/redisDataGenerator.js | UTF-8 | 973 | 2.578125 | 3 | [] | no_license | const fs = require('fs');
const process = require('process');
const data = require('./../buildFakeData.js').REDIS;
const FILE_NAME = process.argv[2];
function buildFile(name, data) {
let wStream = fs.createWriteStream(`${name}.txt`);
// console.log(data[name], 'data');
if (name === 'image' || name === 'product'... | true |
c218b1ac546c0461630e9a7729192f62c36177c4 | JavaScript | jonas-thuvesson-winberg/web-component-dev-talk | /src/components/hello-world/index.js | UTF-8 | 524 | 2.59375 | 3 | [] | no_license | import helloWorldTemplate from "./index.html";
class HelloWorldComponent extends HTMLElement {
#shadowRoot;
constructor() {
super();
this.#shadowRoot = this.attachShadow({ mode: "closed" });
const templateRoot = document.createElement("template");
templateRoot.setAttribute("class", "hello-world-tem... | true |
dec3f87fbc3d41c6fedf275133f7b62e6c0e0625 | JavaScript | jjtuttle/js-examples-mod1 | /merge-sort.js | UTF-8 | 1,819 | 4.125 | 4 | [] | no_license | // Merge Sort out-of-place
// Do not modify the original array
function mergeSort(arr) {
// Check if the input is length 1 or less
// If so, it's already sorted: return
if (arr.length <= 1) return merged;
// Divide the array in half
let midIdx = Math.floor(arr.length / 2);
// Recursively sort th... | true |
ccfe01d3d9b9058d731e7bbce4a5b8883f9d71eb | JavaScript | sriramede9/JavascriptSyntax | /classes.js | UTF-8 | 1,034 | 4.28125 | 4 | [] | no_license | class Person {
constructor(fname, lname, dob) {
this.fname = fname;
this.lname = lname;
this.dob = new Date(dob);
//console.log(this.dob);
}
greet = function() {
return `Hello ${this.fname} What's up`;
};
getAge = function() {
const temp = Date.now() - this.dob.getTime();
const ... | true |
f2016c26d95152623dbcca950417f4771513a039 | JavaScript | ldw0810/nodejs | /test/helloworld.js | UTF-8 | 104 | 3.234375 | 3 | [] | no_license | let a = "Hello";
let greet = (name) => {
console.log(a + ", " + name + "!");
}
module.exports = greet; | true |
42d78a4a774dc5d2b5a03fb911b12257e5afd5f0 | JavaScript | jasperzm/Mosh-note | /JSreview/String method.js | UTF-8 | 507 | 3.75 | 4 | [] | no_license | //String Primitive;
const message='h1';
//String object
const message='This is my first message'
message.includes('my')// true;
message.endsWith('my');
message.startsWith('my');
message.indexOf('my') //8
message.replace('first','second');
message.toUpperCase();
message.toLowerCase();
message.trim()//delete s... | true |
096585e20adf0a8175547a859e956866f2ce0196 | JavaScript | erashish455/story_telling | /main.js | UTF-8 | 2,440 | 3.15625 | 3 | [] | no_license | function pass() {
const rbs = document.querySelectorAll('input[name="yesno"]');
let selectedValue;
for (const rb of rbs) {
if (rb.checked) {
selectedValue = rb.value;
break;
}
}
let first_animal = document.getElementById("first_animal_name");
let second... | true |
aa74af8eae2c5f068bedc46fdf351e7972d53588 | JavaScript | ps0305/Javascript-Algorithms-And-Data-Structures | /leetcode/expressive-words/index.js | UTF-8 | 849 | 3.640625 | 4 | [] | no_license | /**
* @param {string} S
* @param {string[]} words
* @return {number}
*/
var expressiveWords = function(S, words) {
const map = createStretchyMap(S);
let nWords = 0;
for (const word of words) {
if (isStretchy(map, S, word)) {
nWords += 1;
}
}
return nWords;
};
function isStretchy(m1, S, word... | true |
9e5f58d73d96d8fbefd6937cdb6edad255c4a5b7 | JavaScript | cape-io/boat-data | /src/nmea/decode.test.js | UTF-8 | 2,066 | 2.625 | 3 | [] | no_license | import {
compareChecksum, decode, getDataChecksum, getInfo, getNameTalkerFields,
getTalker, isEncapsulatedData, splitDataChecksum,
} from './decode'
import { ais1, ais2, ais3, gpgga, ais1decoded, ais2decoded } from './mock'
/* globals describe test expect */
const ais1res = {
fields: '!AIVDO,1,1,,A,B5Ndh@P00Nm... | true |
ee28d3266fd06f9079232687f3c04756300aa1a7 | JavaScript | JulHorn/mock_proxy_chrome_plugin | /lib/uiNavigation.js | UTF-8 | 2,711 | 2.734375 | 3 | [
"MIT"
] | permissive | // Constructor to init stuff
var UiNavigation = function() {
if (window.uiNavigation) {
return window.uiNavigation;
}
this.buttonSelector = 'nav button';
this.allContainer = [];
this.init();
this.bindEvents();
// Create pane objects for later navigation
this.panes = {
'PaneMockList': new PaneMockList(),... | true |
06d52c98bfab5cd87971e54caaaa856e103b93f7 | JavaScript | Danielevan2/bintangbintangan | /bintang.js | UTF-8 | 1,558 | 3.71875 | 4 | [] | no_license | function segitiga(x){
var bar = 0
for(var d = 0 ; d < x ; d++){
if(d % 2 !== 0){
bar += 1
}
}
var hasil = ''
for (var i = 0 ; i <= x ; i++ ){
var bt = ''
if(i % 2 !== 0){
for(var r = bar ; r > 0 ; r-- ){
bt += ' '
}
for(var j = 0 ; j < i... | true |
804f50160fa9a95a641fd37e41c49f23a4439731 | JavaScript | afl0r3s/DogMania | /client/src/2_reducers/index.js | UTF-8 | 3,919 | 2.765625 | 3 | [] | no_license | import {
GET_BREEDS,
GET_BREEDS_NAME,
ERROR_SEARCH,
GET_DETAIL,
FILTER_SOURCE,
SORT_GENERAL,
GET_TEMPERAMENTS,
GET_BREEDTEMPERAMENT,
POST_BREED,
LOADING,
} from '../1_actions/actionTypes'
const initialState = {
breedsAll: [], //array de razas que tendra toda la info y no se usara para filtrados
breeds:... | true |
5ef92d1a959c74af2475b188301780bfc7dc417a | JavaScript | reflective-dk/re-stream-util | /lib/split-chunker.js | UTF-8 | 881 | 2.90625 | 3 | [] | no_license | "use strict";
var through2 = require('through2');
module.exports = splitChunker;
function splitChunker(split, discardSplit) {
var pattern = split instanceof RegExp ? split : new RegExp(split);
var buffer = '', afterSplit;
return through2(function(chunk, enc, callback) {
buffer += chunk;
w... | true |
123a82ed0a28434e52a7b0aa85d209aa1dce1b19 | JavaScript | KatieLars/recursion-lab-v-000 | /index.js | UTF-8 | 1,725 | 4.28125 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | function printString(string) {
console.log(string[0])
if(string.length > 1) {
let newString = string.substring(1, string.length)
printString(newString)
}else{
return true
}
}
//lesson I learned: you can't store immutable things in variables in recursive functions
//let or another declaration will c... | true |
597aaca095444cc59a749236b7df7b58256f6be2 | JavaScript | ger100/tr36 | /js/test.js | UTF-8 | 1,989 | 3.390625 | 3 | [] | no_license | //get data from json file, from server
function getServerData(url) {
let fetchOptions = {
methode: "GET",
mode: "cors",
cache: "no-cache",
};
//ide a return kerult be
return fetch(url, fetchOptions).then(
response => response.json(),
err => console.error(err)
... | true |
7f9b341abee180d5a3459966862bc36e9ec7922d | JavaScript | thatsprettyfaroutman/brinkiton | /shared/Game/index.js | UTF-8 | 3,429 | 2.75 | 3 | [] | no_license | import './index.css'
import React, { Component } from 'react'
import {
Engine,
Render,
World,
Bodies,
Body,
SAT,
Composite,
Vector,
} from 'matter-js'
class Game extends Component {
ref = null
engine = null
bones = []
componentDidMount() {
this.init()
}
init() {
// create an eng... | true |
75106dac95691ad8127b6ba171e53c2eae472a60 | JavaScript | Abhishek047/news-flash | /src/GlobalState/GlobalState.js | UTF-8 | 3,290 | 2.640625 | 3 | [] | no_license | import {createContext, useReducer} from 'react'
import axios from 'axios'
import AppReducer from './AppReducer'
const initialState = {
//FILTERS
news:[],
loadingNews: true,
filters : [
{
name: 'general',
value: true,
},
{
name: 'business',
... | true |
cf084a2c925b380bc1aa8abacfbbb0b3e91022d4 | JavaScript | SarahMBeecroft/liri-node-app | /liri.js | UTF-8 | 3,895 | 3.28125 | 3 | [] | no_license | // Uses .env to hide sensitive data
require("dotenv").config();
// Project variables
//===============================================//
var keys = require("./keys.js");
var fs = require("fs");
var Spotify = require("node-spotify-api");
var spotify = new Spotify(keys.spotify);
var axios = require("axios");
var moment ... | true |
626d876e15a5320ed0af2484bfafec290a65e86b | JavaScript | akelshareif/express-joblySB | /models/jobModel.js | UTF-8 | 4,037 | 2.90625 | 3 | [] | no_license | const db = require('../db');
const ExpressError = require('../helpers/expressError');
const partialUpdate = require('../helpers/partialUpdate');
/** Class containing CRUD methods for jobs table */
class Job {
static async getAll({ search = null, min_salary = 0, min_equity = 0 }) {
/**
* Given req... | true |
ac310b28fa750d75f495edc5874bcdcc34321cd6 | JavaScript | ciclo-urbano/Ciclo-Urbano | /client/src/utils/filters.js | UTF-8 | 686 | 3.015625 | 3 | [] | no_license | export const priceLow = arr => {
let filteredBikes = arr.filter((bike) => bike.price < 201)
return filteredBikes.sort((a, b) => a.price - b.price)
}
export const priceMed = arr => {
let filteredBikes = arr.filter((bike) => bike.price > 200 && bike.price < 401)
return filteredBikes.sort((a, b) => a.price - b.pri... | true |
f1ccde3e62c9d9f00c91dad427d16579abf036e9 | JavaScript | abdih17/DataStructures-and-Algorithms | /strings/challenge-problems/mutation.js | UTF-8 | 342 | 3.328125 | 3 | [
"MIT"
] | permissive | var output;
function mutation(str) {
var letters = str.split('');
var newWord = letters.filter( val => {
return letters.indexOf(val) % 2 === 0;
});
output = newWord.join('x');
}
mutation('Brian Nations');
// TODO: find the issue in this logic
console.log('Output: ', output); // Output: BxixnxNxtxixoxn... | true |