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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bd349dfad985b313c661775f19b20115861d201e | JavaScript | kslbusarin/Day-10 | /Nodejs/libs.test.js | UTF-8 | 1,348 | 2.765625 | 3 | [] | no_license | const libs = require('./libs');
describe('absolute', () => {
it('absolute - should return a positive number if input is positive', () => {
});
it('absolute - should return a positive number if input is negative', () => {
const input = -1;
const result = libs.absolute(input);
expect... | true |
2980981197678f573e3ee226bc29ba363d544949 | JavaScript | PermLara/trello-start | /column.js | UTF-8 | 4,654 | 3.03125 | 3 | [] | no_license | class Column {
constructor(id = null, columnTitle = '') {
this.notes = []
const instance = this
const element = this.element = document.createElement('div')
element.classList.add('column')
element.setAttribute('draggable', 'true')
if (id) {
element.setAttribute('data-column-id', id)
} else {
e... | true |
b1f890f3348afeaca1f3e55d02fd6a6c13aa977c | JavaScript | effyfan/Nature_of_Code_2018 | /NOC_midterm_flow_field_2018_03_06_21_31_18/flowfield.js | UTF-8 | 2,567 | 3.546875 | 4 | [] | no_license | class FlowField {
constructor(r) {
// How large is each "cell" of the flow field
this.resolution = r;
// Determine the number of columns and rows based on sketch's width and height
this.cols = width / this.resolution;
this.rows = height / this.resolution;
this.field = this.make2Darray(this.co... | true |
a839fcf8ee5431e27a80ef718dd86a9512ca541b | JavaScript | RhysBaker/DAT-405 | /exercises/linear movement/sketch.js | UTF-8 | 364 | 3.65625 | 4 | [] | no_license | // Where is the circle
var x;
var y;
let size = 50;
function setup() {
createCanvas (500, 500);
// Starts in the middle
x = 0;
y = height / 2;
frameRate(60);
}
function draw() {
background(200);
// Draw a circle
stroke(50);
fill(100);
ellipse(x, y, size, size);
x = x + 10;
// Reset to the... | true |
eb5dc286a34363e7873417b27295baec067ecbc8 | JavaScript | squirmsound/js-design-patterns | /src/client/js/studies/total-sales-prompt/index.js | UTF-8 | 630 | 5.0625 | 5 | [] | no_license | // Create a function called totalSales(). The function will use a loop to ask the user to enter amounts until they enter the word "done". The body of the loop will add the input amount to a variable called totalSales. When the loop ends the function should display the value of totalSales in an alert.
function totalSal... | true |
abf863cc2169300b1be9b79d22b77d34e8cc99b4 | JavaScript | vic012/digital-house-fullstack | /node-intro/aula09/servidor.js | UTF-8 | 389 | 2.671875 | 3 | [] | no_license | const express = require('express');
const porta = 3000;
const app = express();
app.get('/', (req, res) => res.send('Olá você está na rota home'));
app.get('/users', (req, res) => res.send('Olá você está na lista de usuários'));
app.get('/Sobre', (req, res) => res.send('Olá você está página sobre'));
app.listen(porta,... | true |
e34011eab2eccc479f61ba15420f2f720f110f5a | JavaScript | footerbird/butler-baidu | /pages/filter.sjs | UTF-8 | 1,018 | 2.59375 | 3 | [] | no_license | var domain_format = function(value){
return value.replace(getRegExp(/\./,'g'), '_')
}
var number_format = function(value){
return parseInt(value, 10).toLocaleString()
}
var date_format = function(value){
return value.trim().substring(0, 10)
}
var format_marksort_cnchar = function(num){
var cnchar = [
'一'... | true |
8f3b5e6e05d3e05958f1a1614df15982323a3885 | JavaScript | ronin-22/profile-page | /dist/js/main.js | UTF-8 | 1,035 | 3.421875 | 3 | [] | no_license | const menuBtn = document.querySelector(".menu-btn");
const hamburguer = document.querySelector(".menu-btn__burger");
const nav = document.querySelector(".nav");
const menuNav = document.querySelector(".menu-nav");
// returns an array of all items within this class
const navItems = document.querySelectorAll(".menu-nav__... | true |
87bc3b2afa4b977acc0eacb2326201b5043d6021 | JavaScript | wangxiaochuang/my-vue-template | /src/plugins/auth/storage/session-storage.js | UTF-8 | 509 | 2.671875 | 3 | [] | no_license | export default class SessionStorage {
constructor (namespace) {
this.namespace = namespace || null
}
setItem (key, value) {
window.sessionStorage.setItem(this._getStorageKey(key), value)
}
getItem (key) {
return window.sessionStorage.getItem(this._getStorageKey(key))
}
removeItem (key) {
... | true |
d56e7c7bec862f72ec512cf893be34cd26fbec08 | JavaScript | dgf-555/react-exercise-form | /src/components/MyProfile.js | UTF-8 | 2,080 | 2.71875 | 3 | [] | no_license | import React, {Component} from 'react';
import './myProfile.less';
class MyProfile extends Component {
constructor(props){
super(props);
this.state = {
name: '',
gender:'male',
description:'',
checked: false,
};
console.log('执行了constructor')
this.handleChange = this.handle... | true |
b7d95dd05f745a832fcf6c4feb48da48fb19ae41 | JavaScript | sonvv95/core-ui | /src/test/object/table.jsx | UTF-8 | 2,566 | 2.78125 | 3 | [] | no_license | import React, { useState } from "react";
import "./table.scss";
const columns = [
{
title: "Name",
dataIndex: "name",
render: (text) => <a href="#">{text}</a>,
},
{
title: "Age",
dataIndex: "age",
},
{
title: "Address",
dataIndex: "address",
},
];
const data = [
{
key: 1,
... | true |
93b2a1c48167275cbc6595752e747afea9f822d4 | JavaScript | shlensky/algorithms | /search/kmp.js | UTF-8 | 1,615 | 3.75 | 4 | [] | no_license | /* Реализация поиска подстроки с помощью алгоритма КМП (Кнута-Морриса-Пратта) */
function buildP(pattern) {
let j = 0;
let i = 1;
let p = [0];
while (i < pattern.length) {
if (pattern[j] === pattern[i]) {
p[i] = j + 1;
j++; i++;
} else {
if (j === 0) ... | true |
bcd8bc66a330324e78cc1663d2be391e67571fa3 | JavaScript | Sam-Devs/Weight-Converter | /script.js | UTF-8 | 328 | 2.78125 | 3 | [] | no_license |
function converter() {
let get = document.getElementById.bind(document);
let lbsInput = get('lbs-input');
let kgsInput = get('kgs-input');
let convertButton = get('convert-button');
convertButton.addEventListener('click', function() {
kgsInput.value = (lbsInput.value * 0.4535).toFixed(2)
});
};
conve... | true |
de4701c5b69324123ce8b8d4d26656a66c94fed2 | JavaScript | belo32/gallery-viewer | /gallery-viewer.js | UTF-8 | 1,381 | 2.703125 | 3 | [] | no_license | /**
* JQuery script for loading images from the facebook page album providing the album id as follows:
* <div class="fb-album" data-id="{ALBUM_ID}"></div>
* images will be added in the following format <div class="fb-image"><img src="{image_source}"/>
* Author: Bilal Al-Hajjar
*/
var facebookUrl = "https://graph.facebo... | true |
a84dbe68a7c161e0e9954a3534a94b81856d0ef0 | JavaScript | JFingert/various_exercises | /speaker.js | UTF-8 | 508 | 2.828125 | 3 | [] | no_license | var http = require('http');
var url = require('url');
var say = require('say');
console.log("open http://localhost:8124/?text=hellohiyo");
console.log("press CTRL + C to quit.");
http.createServer(function(request, response) {
var text = url.parse(request.url, true).query.text;
if (text === undefined){
t... | true |
c3fdd5e5b74be3528b2d97f0ba587695bb5563b5 | JavaScript | ReBootKAMP-ME/rbk-toy-problems | /twoForOne/twoForOne.js | UTF-8 | 1,056 | 4.46875 | 4 | [] | no_license | /*
Problem 1:
The makeLooper() function takes a string (of non-zero length) as an argument.
It returns a function. The function it returns will return successive characters
of the string on successive invocations. It will start back at the beginning of the string
once it reaches the end.
For example:
var abc = makeLo... | true |
d02f09848f4d03a0d923031ea13247998601c0a5 | JavaScript | Richlee2016/Study | /vue/11.mvvm/Dep.js | UTF-8 | 608 | 3.296875 | 3 | [] | no_license | function Dep () {
this.subs = []
}
// bbbbbb=>发布这个函数
Dep.prototype.addSub = function (sub) {
this.subs.push(sub)
}
// cccccc=>触发这个函数
Dep.prototype.notify = function () {
this.subs.forEach(sub => sub.update())
}
// Watcher 就是 上方 添加进入数组的sub 只是 watcher有个 update方法
// aaaaaa=>订阅 一个 fn 函数
function Watcher (fn) {
... | true |
8e65f1156ff730e06dc8a049984f072fd78f27c0 | JavaScript | brettimus/midst-diet | /index.js | UTF-8 | 2,649 | 2.65625 | 3 | [] | no_license | const fs = require('fs');
const { EditorState, convertToRaw, convertFromRaw } = require('draft-js');
const { map, has, pick, filter, omitBy, uniq, isEmpty, keys, reduce, isEqual, difference } = require('lodash');
let filename = process.argv[2];
console.log('filename', filename);
const file = fs.readFileSync(filename |... | true |
f26990ffddb2fb118c07d861911af5f4185c0060 | JavaScript | fcomabella/adonis-tap-manager | /src/test/unit/country.spec.js | UTF-8 | 3,735 | 2.609375 | 3 | [] | no_license | 'use strict'
const chai = use('chai')
const should = chai.should()
const Country = use('App/Model/Country')
use('co-mocha')
describe('Country model', function () {
beforeEach(function* () {
yield Country.create({
name: 'Catalunya'
})
})
afterEach(function* () {
yield use('Database').table('ci... | true |
db31bb647e578b4e79745c9b0addf0eb3422b636 | JavaScript | donaldshen/vue-blog | /src/assets/cookieUtil.js | UTF-8 | 1,134 | 2.84375 | 3 | [] | no_license | function get (name) {
const cookieName = `${encodeURIComponent(name)}=`
const cookieStart = document.cookie.indexOf(cookieName)
if (cookieStart > -1) {
let cookieEnd = document.cookie.indexOf(';', cookieStart)
if (cookieEnd === -1) {
cookieEnd = document.cookie.length
}
return decodeURIComp... | true |
be2fbd04bf7726d188aa7401761c9024b77caa20 | JavaScript | SlimJed/Andela-HomeStudy | /Day 1/dataTypes/src/dataType.js | UTF-8 | 1,664 | 4.46875 | 4 | [
"MIT"
] | permissive | 'use strict';
/*
Write a function called *dataTypes* to compare and return results, based on the argument supplied to the function. Follow through the test to produce the perfect function that accounts for all expectations.
For strings, return its length.
For null or undefined return string 'no value'
For booleans retu... | true |
887552a5fce221fd2e66a43db22ca3bf4d928e78 | JavaScript | edgarbrignoni/react-todolist | /src/js/component/demo.jsx | UTF-8 | 1,124 | 3 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
function CreateTable() {
let table = [];
// Outer loop to create parent
for (let i = 0; i < 3; i++) {
let children = [];
//Inner loop to create children
for (let j = 0; j < 5; j++) {
children.push(<td>{`Column... | true |
0b052c7f8e742e917d5a6166e1f6ad1ff14a2728 | JavaScript | Dabou7/REACT---meteo | /src/Api.js | UTF-8 | 2,592 | 2.59375 | 3 | [] | no_license | import React,{useState, useEffect} from "react";
import Weather from './Weather';
import sun from './icons/sun.svg';
import cloudy from './icons/cloudy.svg';
import cloudySun from './icons/cloudy-sun.svg';
import thunder from './icons/thunder.svg';
import windy from './icons/windy.svg';
import rainy from './icons/rainy... | true |
30f941e299b55a7c0d1553eed8414074d2030743 | JavaScript | ajibadeabd/-trivia-api | /src/controller/quizController.js | UTF-8 | 525 | 2.515625 | 3 | [] | no_license | const quizServ = require('../services/quizServices');
const response = require('../utility/response');
class quizcontroller{
async getQuestion(req,res){
let data = await quizServ.getQuestion(req,res)
res.status(200).json(response(true,'Ten random question has ben fetch succefully',data))
}
asy... | true |
98723d78650e7c5f84d2f068ffd410c674628f7d | JavaScript | dymissy/trainstatus-slack | /src/parser/trainNumber.js | UTF-8 | 302 | 2.625 | 3 | [] | no_license | const querystring = require('querystring');
module.exports = (slackBody) => {
const items = querystring.parse(slackBody);
if (!items.text || isNaN(parseInt(items.text))) {
throw new Error('Train number is required. Please provide a valid train number.');
}
return parseInt(items.text);
}
| true |
318ca0dab3b5f91afcac6a2761454929f15ab2f9 | JavaScript | haxsscker/abc.parent | /abc.web/src/main/webapp/Js/moneyManage/RechageAndToCashSuccess.js | UTF-8 | 1,431 | 2.609375 | 3 | [] | no_license | $(function () {
var Dialog;
MyAction.Init();
$("#submit").click(MyAction.SubmitData);
});
var MyAction = {
// 页面初始化
Init : function() {
var Message =GetRequest('Message');
var status =GetRequest('status');
var returnMessage;
switch (status) {
case "cz": {
... | true |
0cd955bf185a0194297773bcec9a1d86405f57c0 | JavaScript | balatska/beetroot_lesson23 | /6_converter.js | UTF-8 | 828 | 4.03125 | 4 | [] | no_license | // Написать конвертор валют.
// Пользователь вводит количество USD,
// выбирает, в какую валюту хочет перевести EUR, UAN или AZN, и получает в ответ соответствующую сумму.
let summ = prompt("Введите сумму (USD)");
let convert = prompt("В какую валюту хотите перевести (EUR, UAH, AZN)?");
let eurExchangeRate = 0.91;
... | true |
5f4ae9c12664ad32e2e8b4f4ce39db4eae2875f9 | JavaScript | diazvic/grillaJS | /index.js | UTF-8 | 470 | 3.65625 | 4 | [] | no_license |
const array= ["🍇", "🍈" ,"🍉", "🍊","🍋","🍌","🥭" ,"🍍","🍎","🍒","🫐"]
const generarGrilla = (array)=>{
let resultado =""
for (let i = 0; i < array.length; i++) {
resultado = resultado + `<div class="items">${array[i]}</div>`
}
return resultado
}
const grilla = document.querySelector(".gril... | true |
bdf0bad0eb4c8205841fc66be5eeb4f611393b23 | JavaScript | clairesay/studbud | /public/main.js | UTF-8 | 6,238 | 3.125 | 3 | [] | no_license |
////////// MEDIA QUERIES https://www.w3schools.com/howto/howto_js_media_queries.asp ///////////////
// test for tablet
function mediaQueryTablet(query) {
if (query.matches) { // If media query matches
deviceSize = 'tablet'
} else {
deviceSize = 'desktop'
}
}
var tablet = window.matchMedia(... | true |
89603f9b88f1b31b2777ceead17bf731031f0115 | JavaScript | JYisus/sqli-vulnerable-backend | /src/controllers/LoginController.js | UTF-8 | 705 | 2.6875 | 3 | [] | no_license | import UserLogin from "../news/application/UserLogin.js"
export default class LoginController {
constructor(repository) {
this.UserLogin = new UserLogin(repository)
}
async run(req, res) {
try {
console.log(req.body)
console.log("akjsdhf")
const {email, ... | true |
1f6a8cf358c9686655d2ae36ee70a2f3b46ee312 | JavaScript | muhammadpauzi/bloxy-web-app | /validators/signup.js | UTF-8 | 954 | 2.546875 | 3 | [] | no_license | const { check } = require('express-validator');
const User = require('../models/User');
module.exports = [
check('username')
.not()
.isEmpty()
.withMessage('The username must be required.')
.not()
.isUppercase()
.withMessage('The username may only contain lowercase c... | true |
046745422c26c662d5dfe65976beb8670143b8a2 | JavaScript | VinicSilva/typescript-basic | /generics.js | UTF-8 | 510 | 3.609375 | 4 | [] | no_license | // let myArray: Array<number> = [];
// function funcao(array: Array<number>) {
// }
function funcao(param) {
return param;
}
var variable = funcao(2);
var Lista = /** @class */ (function () {
function Lista() {
this.items = [];
}
Lista.prototype.add = function (item) {
console.log("add "... | true |
73be9acfbfbfb9e6dfb259a90d82f18f497f236d | JavaScript | UANDES-4103-201910/lab-assignment-8-ibparrague | /app/assets/javascripts/keyboard.js | UTF-8 | 2,133 | 3.125 | 3 | [] | no_license | $(document).ready(function(){
class KeyboardController {
constructor(id_target) {
this.target= $(id_target);
this.element = document.getElementById("targetelement");
this.shift = 0
}
toggleKeyboard(){
var k = document.getElementById("kcontainer")
if (k.style.display == ... | true |
46f207beea0812ebd21697c74e4936e4db663ee1 | JavaScript | babylu/visualizationFinalProject | /public_html/js/slider.js | UTF-8 | 2,076 | 2.78125 | 3 | [] | no_license | // tick formatter
var formatter = d3.format(",.2f");
var tickFormatter = function(d) {
// console.log(d);
formatDate = d3.time.format("%b-%d");
var timeScale = d3.time.scale().domain([new Date('2015-07-05'),new Date('2016-04-03 00:00:00')]).ticks(d3.time.week,1);
return formatDate(timeScale[d... | true |
ae22eee8aa5e17c26b8cdddca37531afc2d8b1c5 | JavaScript | throneteki/throneteki | /test/server/integration/takecontrol.spec.js | UTF-8 | 32,904 | 2.671875 | 3 | [
"MIT"
] | permissive | describe('take control', function() {
integration(function() {
describe('when using an attachment to take control', function() {
beforeEach(function() {
const deck1 = this.buildDeck('stark', [
'Sneak Attack', 'A Noble Cause', 'Valar Morghulis',
... | true |
e40adf3cc239e6d447d264da75779ca602c541bc | JavaScript | tannermwilson/ASTBPractice | /t_target.js | UTF-8 | 533 | 3.09375 | 3 | [] | no_license | // Target class - contains all data and functionality regarding game target
class t_target {
constructor() {
this.pos = createVector(0, height/4);
}
respawn(){
this.pos.x = 0;
this.pos.y = Math.floor(Math.random() * (height - 60)) + 30;
}
move(vel){
this.pos.add(vel... | true |
933dd37c31c60f4b67cb7cffb8ba22a83ace3d5d | JavaScript | lionmoroz/Face-detector | /face-background/server2.js | UTF-8 | 578 | 2.6875 | 3 | [] | no_license | const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors());
database = {
users:[{
id: '123',
name: 'John',
email: 'john@gmail.com',
password: 'fuck_you',
entries: 0,
joined: new Date()
}],
}
app.get('/', (req, res)=>{
res.send('Good job');
})
app.get... | true |
a6901beb2759c7c08b14bcd59e3845857364c852 | JavaScript | betharley/Jogo-Plataforma | /js/cenario.js | ISO-8859-2 | 641 | 3.125 | 3 | [] | no_license |
//CLASSE CENARIO
function Cenario(contexto, largura, altura){
this.figure = imgCenario;
this.figure2 = imgCenario2;
this.figure3 = imgCenario3;
this.ctx = contexto;
this.largura = largura;
this.altura = altura;
this.x = 0;
this.y = 0;
}
//MTODO DO CENARIO
Cenario.prototype = {
desenhar: ... | true |
561706db10f40b3f58104a14f7b0a888c75c7822 | JavaScript | terrancehanlon/Final-Zombie-Game | /src/models/TowerCrate.js | UTF-8 | 604 | 2.765625 | 3 | [] | no_license | export default class TowerCrate extends Phaser.Sprite{
constructor(game, x, y, img, amount, pickedUp){
super(game, x, y, img);
this.game.physics.enable(this, Phaser.Physics.ARCADE);
this.amount = amount;
this.pickedUp = pickedUp;
this.speed = 9;
}
create(){
}
isPickedUp(speed){
th... | true |
b238d01b34fdd9340b84a20571a5491fdd5b805c | JavaScript | PPEProjects/ppe | /ppe_fe_admin/src/components/Search.js | UTF-8 | 383 | 2.65625 | 3 | [
"MIT"
] | permissive | const Search = (column, keyword, list) => {
if (column === "contents[0].name")
return list.filter((item) =>
(item.contents[0].name ?? ``).toLowerCase().includes((keyword ?? ``).toLowerCase())
);
return list.filter((item) =>
(item[column] ?? ``).toLowerCase().includes((keyword ?? ... | true |
1610373a292a3b5da915920a707384fa9d562ca8 | JavaScript | Jhonatanmizu/exercicios-web | /array/filter1.js | UTF-8 | 511 | 3.125 | 3 | [] | no_license | const produtos = [
{nome:"Notebook", preco:2000, fragil:true},
{nome:"Ipad Pro", preco:4500, fragil:true},
{nome:"Copo de vidro", preco:12.49, fragil:true},
{nome:"Copo de plástico", preco:10, fragil:false},
]
/*console.log(produtos.filter(function(p) {
return p.fragil !== true
}))*/
const fragil =... | true |
5e37c8c8f4ec6764159e335d041c1605796d349d | JavaScript | ejsongs/school_data | /포트폴리오/cook/js/menu.js | UTF-8 | 755 | 2.71875 | 3 | [] | no_license | var listlength = $(".menuList li").length;
var firstSlice = $(".menuList li").slice(4).css("display" , "none");
var menulistBoxli = $(".menulistBox > li");
console.log(listlength);
// 4개를 제외한 모든것을 dis :none;
$(".menuList li").slice(4).css("display" , "none");
$(".menuListBox > ul > li").click(function(){
var first = ... | true |
0c9ace5bfa16e706d7c224c9eae639a9d80e375f | JavaScript | 184455/leet-code-abner | /71-367. 有效的完全平方数.js | UTF-8 | 1,261 | 4 | 4 | [] | no_license | /**
* 给定一个 正整数 num ,编写一个函数,如果 num 是一个完全平方数,则返回 true ,否则返回 false 。
进阶:不要 使用任何内置的库函数,如 sqrt 。
示例 1:
输入:num = 16
输出:true
示例 2:
输入:num = 14
输出:false
提示:
1 <= num <= 2^31 - 1
通过次数69,716提交次数159,007
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/valid-perfect-square
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
/... | true |
ad28043f6989144f1631d962696bd176707460d2 | JavaScript | AlinaPisarenko/weather-app-project-react | /src/WeatherApp.js | UTF-8 | 2,830 | 2.703125 | 3 | [] | no_license | import React, { useState } from "react";
import WeatherInfo from "./WeatherInfo";
import "bootstrap/dist/css/bootstrap.min.css";
import "./WeatherApp.css";
import axios from "axios";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faMapMarkerAlt } from "@fortawesome/free-solid-svg-icons";
e... | true |
8886f82a12f3319ec761d937a8b4c054da8dca53 | JavaScript | dillonius01/tp-persistence | /public/js/ajax.js | UTF-8 | 2,688 | 3.3125 | 3 | [] | no_license | //setup option tags for hotels
$.get('/api/hotels')
.then(function(hotels) {
hotels.forEach(function(hotel) {
var hotelHtml = $('<option></option>').text(hotel.name)
$('#hotel-choices').append(hotelHtml);
})
})
.catch(console.error);
//setup option tags for restaurants
$.get('/api/restaurants')
.then(function(re... | true |
3c35be007f90ccd3ca131d2e7467d968e3ff9eb7 | JavaScript | Mieli/CRUD-Contacts | /src/infra/web/contact/Controller.js | UTF-8 | 1,956 | 2.9375 | 3 | [] | no_license | class ContactController {
constructor(service) {
this.service = service;
this.findAll = this.findAll.bind(this);
this.findById = this.findById.bind(this);
this.insert = this.insert.bind(this);
this.update = this.update.bind(this);
this.remove = this.remove.bind(this)... | true |
00e5b845f3adb76f9b052855bebc772429734bd7 | JavaScript | metrue/Algorithm-in-JS | /construct-binary-tree-from-preorder-and-inorder-traversal/dc.js | UTF-8 | 777 | 3.34375 | 3 | [] | no_license | const Node = require('../common/tree/binary_tree/node')
const buildTree = (preorder, inorder) => {
if (preorder.length === 0) {
return null
}
const val = preorder[0]
const root = new Node(val)
if (preorder.length === 1) {
return root
}
const index = inorder.indexOf(val)
const inorderLeft = i... | true |
fdc8750b1347d4d0d4c1eb5907f914627e3d548d | JavaScript | coppolaop/TaleManager | /src/Controller/FileController.js | UTF-8 | 1,785 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | const path = window.require('path');
const fs = window.require('fs');
class FileController {
constructor() {
this.folders = ['Campaign', 'Character', 'Place'];
this.Campaign = [];
this.Character = [];
this.Place = [];
this.darksunFolder = (window.require("electron").app || window.require("electr... | true |
f6e2bd755bd16695d30eb2a56ab204dc1535889d | JavaScript | sidhlee/traxmeta | /netlify/functions/get-lastfm-artist.js | UTF-8 | 888 | 2.515625 | 3 | [] | no_license | const axios = require('axios').default;
exports.handler = async function (event) {
if (event.httpMethod !== 'GET') return;
const { artistName } = event.queryStringParameters;
const config = {
timeout: 5000,
method: 'get',
};
const response = await axios({
url: `http://ws.audioscrobbler.com/2.0/... | true |
9ec0ef87fe55a4b6dcee1a9bfe3bd0c0440c12ec | JavaScript | luluMily/beaus-react | /src/components/beer-detail.js | UTF-8 | 2,363 | 2.546875 | 3 | [] | no_license | import React from 'react';
import Home from './home';
class BeerDetail extends React.Component {
constructor(props) {
super(props);
this.state = {
stores: []
}
}
componentDidMount() {
this.fetchStores(this.props.beer)
}
componentWillReceiveProps(nextProps) {
if(this.props.beer.id !== nextProps.beer... | true |
de369a51dd1a75c0e2459477c12eb30493037553 | JavaScript | SpikePy/WingChun | /script.js | UTF-8 | 2,394 | 3.171875 | 3 | [] | no_license | const database_side = [
['Links: ', 'links.mp3',],
['Rechts: ', 'rechts.mp3'],
];
const database_technique = [ // Schwierigkeitsgrade
['Tan Sao', 'tan.mp3', 'tan.jpg'], // │ │ │ │
['Gan Sao', 'gan.mp3', 'gan.jpg'], // │ │ │ └─ Anfänger
['Pak Sao', 'pak.mp3', 'pak.jpg'], // │ │ └─── Fortge... | true |
243874cc110f3ae89897cff3e8085eeb5c505e9e | JavaScript | gomez-fabio/trasteoAsyncReadingFiles | /modulo.js | UTF-8 | 666 | 2.59375 | 3 | [] | no_license | "use strict";
const fs = require('fs');
const path = require('path');
function Dato(modulo, callback) {
const fichero = path.join('./node_modules/',modulo,'package.json');
fs.readFile(fichero,(err,contenidofichero)=>{
if (err){
callback(err);
return;
}
const ... | true |
d661b1981d2f92bf7a7d00baa23375e9be8d0b6d | JavaScript | alfanhui/graph_visualiser_honours_project | /src/utilities/WrapText.js | UTF-8 | 1,918 | 3.203125 | 3 | [
"MIT"
] | permissive | const maxLength = 30;
let regEx = /^[\s]*$/;
//for fontsize 10px, max char is 30.
export function wrapContextTextToArray(text) {
let wrappedArray = [];
if (text.length > maxLength) {
while (text.length > 0) {
let indexStart = regEx.test(text[0]) ? 1 : 0;
let pushChecker = true;
... | true |
eeb3dd80e482aa5f3ab25a3f2d08015ae0baa681 | JavaScript | BallChart123/ticket-management | /routes/ticket.js | UTF-8 | 2,082 | 2.734375 | 3 | [] | no_license | const router = require('express').Router();
const TicketRepository = require('../repository/TicketRepository');
const ticketRepository = new TicketRepository();
// index (get all tickets)
router.route('/').get((req, res) => {
Ticket.find()
.then((tickets) => res.json(tickets))
.catch((err) => res.... | true |
f497ba7e0dab80d89bdb2339d7b7069909360f2b | JavaScript | RicarlOz/WaterVending | /php/script.js | UTF-8 | 657 | 2.6875 | 3 | [] | no_license | function getRequest() {
var Objeto = new XMLHttpRequest();
Objeto.open('GET', 'scripts/backend.php', true);
Objeto.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
Objeto.onreadystatechange = function() {
document.getElementById('title').innerHTML = Objeto.responseText;
}
Objeto.send();
}
... | true |
f5f2351bd401d9d6d081823b857c9585f5eca40b | JavaScript | denisvieira05/c-news | /src/services/news/NewsApiDataSource.js | UTF-8 | 672 | 2.515625 | 3 | [] | no_license | import ApiDataSource from "../ApiDataSource";
import NewsConverter from "./NewsConverter";
import firebase from "firebase/app";
import "firebase/database";
class NewsApiDataSource extends ApiDataSource {
getNews() {
return new Promise((resolve, reject) => {
firebase
.database()
.ref("/news"... | true |
f0d916c1e6bc5da5938ee26c07db82dfb4e39617 | JavaScript | Papooch/ABBCCC | /web/js/custom.js | UTF-8 | 5,488 | 2.59375 | 3 | [] | no_license |
//var robots = [["Karel", 0], ["Ondra", 1]];
var event_data = [];
var robot = "";
Date.prototype.toDateInputValue = (function() {
var local = new Date(this);
local.setMinutes(this.getMinutes() - this.getTimezoneOffset());
return local.toJSON().slice(0,10);
});
function main(){
d = new Date();
today = ... | true |
900b3617555c4f1bf2bd7a673ec40ae634dcb10b | JavaScript | theuema/WebTech_TUGraz | /js/infobox.js | UTF-8 | 2,752 | 3.59375 | 4 | [] | no_license | var initialText = `Open a saved Image or drag a new Image onto the screen to start.`;
var rgbText = `The RGB color model is an additive color model. That means, adding together the three colors red, green, blue allows to produce a broad spectrum of colors. For example, adding together the two colors green and red resul... | true |
b7bfbeeb6e43d980a9c6ee8d1ff2fb82bcb54534 | JavaScript | byungyurii/React-Native | /react-native-todo/src/App.js | UTF-8 | 4,431 | 2.78125 | 3 | [] | no_license | import React, { useState } from 'react';
import styled, { ThemeProvider } from 'styled-components/native';
import { theme } from './theme';
// 리액트 네이티브에서 상태바를 제어할 수 있는 컴포넌트이다. 상태바의 스타일을 변경할 수 있고, 안드로이드 기기에서 상태 바가 컴포넌트를 가리는 문제를 해결 할 수 있음.
import { StatusBar, Dimensions } from 'react-native';
import Input from './compone... | true |
17de8c9c4f1f78a8056b33dab58d5c45213ac1e0 | JavaScript | travis-deshotels/foodApp | /src/main/resources/static/js/MenuControl.js | UTF-8 | 552 | 2.59375 | 3 | [
"MIT"
] | permissive | var app = angular.module('foodApp', []);
app.controller("foodControl", function($scope, $http){
$scope.restaurants = [];
$scope.selectedRestaurant = {};
$scope.getRestaurants = function() {
$http.get("/api/food/restaurant").then(
//success
function(response) {
... | true |
5dc24a29f6bdf69208e75278705b772a9764c94e | JavaScript | ChenLin12138/Front-OE | /lib/API.js | UTF-8 | 7,826 | 2.609375 | 3 | [] | no_license | import REST from "./rest";
import User from "./user";
import Router from "next/router";
import Error from "../models/error";
/**
* * @param {object} object with key and value
*
* @return {string} query string
*/
const objectToQuery = (param) => {
if(!param) return '';
return '?' + Object.keys(pa... | true |
8925247ab2adb5a6c562269c42edcc7a84724b63 | JavaScript | hbcrhythm/Vue-cnodejs | /mock/libs/util.js | UTF-8 | 323 | 2.65625 | 3 | [] | no_license | 'use strict';
exports.getToken = (req) => {
var Auth = req.header('Authorization');
if(Auth) {
const parts = Auth.split(' ');
if(!Object.is(parts.length, 2) || !Object.is(parts[0], 'Bearer')){
return false;
}
return parts[1];
}else {
return false;
}
... | true |
fd1f91c19a011b29e4e25799599b7f5961ce6ea1 | JavaScript | adewale2018/currency_converter_task | /src/store/reducers/rates.js | UTF-8 | 623 | 2.53125 | 3 | [
"MIT"
] | permissive | import { RatesTypes } from "../actions/rates/types";
const initialState = {
loading: false,
loadingStatus: "",
rates: [],
};
const rateReducer = (state = initialState, action) => {
const { payload } = action;
switch (action.type) {
case RatesTypes.SET_LOADING:
return {
...state,
lo... | true |
4c8940de093b4776f587352a527994312e06b4b3 | JavaScript | bradynparmesan/lighthouse-js-fundamentals | /w1/reverse.js | UTF-8 | 258 | 3.59375 | 4 | [
"LicenseRef-scancode-public-domain"
] | permissive | for (let j = 2; j < process.argv.length; j++) {
let stringNow = "";
stringNow += process.argv[j];
let reverseString = "";
for (let i = stringNow.length - 1; i >= 0; i--) {
reverseString += stringNow.charAt(i);
}
console.log(reverseString);
}
| true |
038e6357ddca36d574f77317ba6dbf0c4e8110bd | JavaScript | ezeematias/CursoIngresoJS | /6-InstruccionFor/jsIteracionesFor-04.js | UTF-8 | 173 | 2.984375 | 3 | [] | no_license | //Ezequiel Unía - Div. H
//al presionar el botón repetir hasta que utilizamos 'BREAK'.
function mostrar()
{
for(var i = 0;;i++)
{
console.log(i);
if(i > 19)
{
break;
}
}
} | true |
761672f9fe0c40c7284227c9d64efe4ae2ce612f | JavaScript | TrivialConflict/sudoku-fall15 | /sudoku-outline.js | UTF-8 | 1,529 | 3.359375 | 3 | [] | no_license |
Grid constructor
----------------
// new Grid(initString) ==> grid instance
DigitSet constructor
----------------
new DigitSet(digit) ==> DigitSet instance where digit used to define the possibleValues
DigitSet objects
----------------
Properties:
possibleValues: [digits 1-9]
Methods:
removePossibleVal... | true |
07e537febca742bba7f46bc3661cad0ed9b0c087 | JavaScript | coding-in-the-wild/payment-method-factory | /index.js | UTF-8 | 373 | 2.640625 | 3 | [] | no_license |
module.exports = function Factory() {
var paymentMethods = {}
function add(newPaymentMethod) {
paymentMethods[newPaymentMethod.id] = newPaymentMethod
}
function get(id) {
if (typeof paymentMethods[id] === 'undefined') {
throw new Error("No payment method exists for id '" + id + "'")
}
return paymentM... | true |
c95eda3c33a233bbf62e570f5ad6a8f0ac0ce088 | JavaScript | wrharding/flexo-web | /src/components/pages/home-page/HomePage.js | UTF-8 | 2,683 | 2.625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import HomeTemplate from '../../templates/home-template/HomeTemplate';
import { fetchData, postData } from '../../../services/api';
const HomePage = ({ secret }) => {
const [teamOptions, setTeamOptions] = useState(null);
const ... | true |
d245e40851ae8ef7c3119a367f0b74b4667756ff | JavaScript | Gagandeep-Kaur-01/React_Basics | /Ecma_properties/every.js | UTF-8 | 244 | 3.921875 | 4 | [] | no_license | const arr = [1, 2, 3, 4, 5];
let ret = arr.every(val => {
return val > 3
})
console.log(ret); // returns false
/*
if every element satisfies then returns true,
if at least one element doesn’t satisfy the condition then returns false.
*/ | true |
634f627ab9f896233c513240f6e34f081eafb723 | JavaScript | bimei1010/classwork210 | /classwork210-gh-pages/midterm/sketch.js | UTF-8 | 1,218 | 3.140625 | 3 | [] | no_license | //midterm - generative design
function setup() {
createCanvas(640, 640);
background("white");
noStroke();
var columns = 20;
var rows = 20;
var w = width/columns;
var h = height/rows;
var randomSize = random(-20, 20);
for (var x = 0; x < width; x += w) {
for (var y = 0; y < height; y += h) {
var r ... | true |
6aed8b4b8902357b6ee7e9790c093265e631e080 | JavaScript | hp199541/web | /src/utils/config.js | UTF-8 | 2,057 | 3.171875 | 3 | [] | no_license | // 防抖函数,防止重复提交表单请求
// export function Debounce (fn,wait){
// let time
// return function () {
// let args = arguments
// let ctx = this
// clearTimeout(time)
// time = setTimeout(()=>{
// fn.apply(ctx,args)
// },wait)
// }
// }
// //节流函数,防止一段时间内重复提交
// export fu... | true |
7f21d810ea04ed8fb78523dcdfc2667922c5caff | JavaScript | caro-ben/caro-ben.github.io | /assets/javascripts/theme.js | UTF-8 | 609 | 2.53125 | 3 | [] | no_license | (function() {
jQuery(document).ready(function() {
var currentDate, date, day, month, year;
new WOW().init();
$(".rotate").textrotator({
animation: "fade-2",
separator: ",",
speed: 700
});
currentDate = new Date("May 29, 2016");
day = currentDate.getDate();
month = current... | true |
65096a5bf0429755797d9d00de1ed370acccc0ec | JavaScript | elsehow/simple-charm | /examples/logging/logging.js | UTF-8 | 1,069 | 2.84375 | 3 | [
"BSD-2-Clause"
] | permissive | var spawn = require('child_process').spawn
, path = require('path')
, charm = require('../..')
, fs = require('fs')
var process = spawn('node', [path.join(__dirname, 'random-stream.js')])
// loggers will save to a file
// named after the time of the file-version
function logStream (stream) {
// for appending ... | true |
caf26e69a8d4757901d06cae822d6c90bafd0f09 | JavaScript | JosephM2425/ECMAScript-review | /src/es7/index.js | UTF-8 | 259 | 4.375 | 4 | [] | no_license | // Includes > indexOf
let numbers = [1,2,3,5,8,7];
if (numbers.includes(7)) {
console.log('Si se encuentra el valor 7');
}else{
console.log('No esta el 7.');
}
// **
let base = 4;
let exponent = 4;
let result = base ** exponent
console.log(result); | true |
679d2b13c14585b792e2f0ca10c07d2e1f9fb2b3 | JavaScript | RandyDavis/Angular2TheoryToPractice | /02_ES6-And-TypeScript/promises.js | UTF-8 | 1,394 | 4.15625 | 4 | [] | no_license |
// function doAsyncTask(cb) {
// setTimeout(() => {
// console.log("Async Task Calling Callback");
// cb();
// }, 1000);
// }
// doAsyncTask(() => console.log("Callback Called"));
/******* ES6 Promise Example ***********/
// NORMAL PROMISE EXAMPLE
// const hasError = false;
// function doAsyncTask() {
... | true |
0af20a59cd6809230ca709ce1beacb374728d20c | JavaScript | strophy/dapi | /lib/transactionsFilter/testTransactionAgainstFilter.js | UTF-8 | 2,916 | 2.625 | 3 | [
"MIT"
] | permissive | const { BloomFilter } = require('@dashevo/dashcore-lib');
/**
* @param {string} transactionHash
* @param {Number} inputIndex
* @returns {Buffer}
*/
function inputIndexToBuffer(transactionHash, inputIndex) {
const binaryTransactionHash = Buffer.from(transactionHash, 'hex');
const indexBuffer = Buffer.alloc(4);
... | true |
cf4a99712a683f813dde96ea96056fde61724340 | JavaScript | krishanth30/letlive-dev | /popup.js | UTF-8 | 3,546 | 2.625 | 3 | [] | no_license | function getCurrentTabUrl(callback) {
var queryInfo = {
active: true,
currentWindow: true
};
chrome.tabs.query(queryInfo, function(tabs) {
var tab = tabs[0];
callback(tab.url);
});
}
var site;
jQuery(document).ready(function() {
var callback = function(url) {
site = url;
if(site != null && site !=... | true |
4500e44fc793dee4990f0b2010d2511d5da5379e | JavaScript | dan-lew/Projects | /JavaScript/9 - DOM /Access Key/accessKey.js | UTF-8 | 2,180 | 3.859375 | 4 | [] | no_license | ///////////////////////////////////////////////////////////////
//AccessKey - Creates shortcut
// IE, Chrome, Safari, Opera 15+: [ALT] + accesskey
// Opera prior version 15: [SHIFT] [ESC] + accesskey
// Firefox: [ALT] [SHIFT] + accesskey
///////////////////////////////////////////////////////////////
document.getEle... | true |
9ffe5977c203cca892bb4304c3dd81b354b90b3c | JavaScript | Nimisha1728/Shopping-List | /shopping.js | UTF-8 | 856 | 2.671875 | 3 | [] | no_license | function list()
{
var txt="";
var xhttp=new XMLHttpRequest();
xhttp.onreadystatechange=function(){
if(this.readyState==4&&this.status==200){
var response=JSON.parse(this.responseText);
var Jlist=response.list;
txt+="<table>";
... | true |
12abbb8fe2a903439062ce50c7a00f7e6fd2ba43 | JavaScript | ronnytomasetti/hw-rps | /assets/js/rpsls.js | UTF-8 | 5,321 | 3.125 | 3 | [
"MIT"
] | permissive | /**
* RPSLS Game Object
* Ronny Tomasetti
* 2016 UCF Coding Bootcamp
*/
function Game() {
this.player = {};
this.opponent = {};
this.weapons = [ 'rock', 'paper', 'scissors', 'lizard', 'spock' ];
this.config = {
apiKey: "AIzaSyDkXBvYGeQz45NI9wQmWy6C_cS7P4KR354",
... | true |
b4a3b81b57c6b02822348d7bf92676bb0f404707 | JavaScript | AlexMolodoy/905693-keksobooking-18 | /js/backend.js | UTF-8 | 1,544 | 2.515625 | 3 | [] | no_license | 'use strict';
(function () {
var RequestUrl = {
GET: 'https://js.dump.academy/keksobooking/data',
POST: 'https://js.dump.academy/keksobooking',
};
var Status = {
OK: 200
};
var REQUEST_TIMEOUT = 10000;
var createRequest = function (onSuccess, onError) {
var xhr = new XMLHttpRequest();
... | true |
53ddf5f9e92b60bda61b645cffcb18235aa64751 | JavaScript | rarlala/TIL | /JavaScript/preview/testcode18.js | UTF-8 | 316 | 3.65625 | 4 | [
"MIT"
] | permissive | function Circle(radius){
this.radius = radius;
}
Circle.prototype.getArea = function(){
return Math.PI * this.radius ** 2;
};
const circle1 = new Circle(1);
console.log(circle1)
console.log(circle1.__proto__ === Circle.prototype);
console.log(Object.getPrototypeOf(circle1));
console.log(circle1.getArea()); | true |
c134b1325bf0cf7726dc4f680c242bcfa42c6499 | JavaScript | hekto/bone-test | /lib/EventDispatcher.js | UTF-8 | 2,448 | 2.90625 | 3 | [] | no_license | /**
* modified from https://github.com/mrdoob/eventdispatcher.js by github/hekto
* es2015 + .on .off
*/
"use strict";
const EventDispatcher = class { // eslint-disable-line no-redeclare
apply( object ) {
object.addEventListener = EventDispatcher.prototype.addEventListener;
object.hasEventLi... | true |
1d8633570b29bd40d87ede95a9ea2ba14857b3ce | JavaScript | training-bot/labs11-trainingBot-BE | /routes/seedRouter.js | UTF-8 | 2,102 | 3.015625 | 3 | [
"MIT"
] | permissive | // Dependencies
const router = require("express").Router();
const {
createFakeTeamMembers,
createFakeUsers,
createFakeTrainingSeries,
createFakePosts
} = require("../database/seeds/fakeData");
// Models
const TeamMember = require("../database/Helpers/teamMember-model"),
Users = require("../database/Helpers/... | true |
7d48b2097bc2c7a85abefe2e74ed00770a6faf42 | JavaScript | harishganapathi/recursiveproject | /Paint_application/options.js | UTF-8 | 1,843 | 2.96875 | 3 | [] | no_license | var canvas = document.getElementById("drawArea");
var context = canvas.getContext("2d");
var nowx = 0 ,nowy= 0,thenx = 0 ,theny= 0;
var flag = false;
var color = "black";
var thick = 2;
var drawing = false;
dot_flag = false;
context.strokeStyle = 'red'
canvas.addEventListener("mous... | true |
1357526cf63392aaf66f5fbeb64a497c5cb4441e | JavaScript | patpalmerston/webdb-ii-guided | /roles/roles-router.js | UTF-8 | 2,986 | 2.828125 | 3 | [] | no_license | const router = require('express').Router();
const knex = require('knex');
// this configuration object teaches knex hot to find the database and what driver to use.
const knexConfig = {
client: 'sqlite3', // the npm/yarn module we installed
useNullAsDefault: true, // needed when working with SQLite3
connection: ... | true |
c8474c9fe4625cf5bec292ab15692514bf1eeff5 | JavaScript | shar09/JS-Practice | /algorithms/Backtracking/ipAddress.js | UTF-8 | 1,442 | 3 | 3 | [] | no_license | function restoreIpAddresses(s) {
// Write your code here
if(s.length > 12) {
return [];
}
function isValidIpNumber(t) {
if(t.length < 0 || t.length > 3)
return false;
if(t.length > 1 && t[0] == 0)
return false;
if(parseInt(t) > 255)
re... | true |
80b7c850685da6855059d7d340bbd07db4e551f9 | JavaScript | stellaurora/Evolve | /modules/view.js | UTF-8 | 11,250 | 2.921875 | 3 | [] | no_license |
// Tile / Chunk / Entity drawing
// Update window canvas to fit webpage
function updateWindow(ctx) {
// Change canvas height & width to match window height & width
ctx.canvas.width = window.innerWidth * 3/4;
ctx.canvas.height = window.innerHeight;
sctx.canvas.width = window.innerWidth * 1/4;
sctx.canvas.hei... | true |
b3b5ecec6b4261c0e8aa8fab1c41e597f0638c1d | JavaScript | SMOEDOTS/Hello-World-Clicker | /script.js | UTF-8 | 5,999 | 3.4375 | 3 | [] | no_license | var timesPressed = 0;
var text = "You've pressed this button " + timesPressed + " times.";
var clickLevel = 1;
var much = "Upgrade clicker for " + cost + "?";
var cost = clickLevel * clickLevel;
var cost2 = autoclickers * 50 + 500;
var cost3 = (ultraclickers * 100000000) + 1000000;
var autoclickers = 0;
var ultraclic... | true |
a5f6bb7433b7c31eae42b302100d0e6dbd25f9c1 | JavaScript | rasseljandavid/tmis | /js/script.js | UTF-8 | 1,965 | 2.796875 | 3 | [] | no_license | $(function() {
var users = {};
var userLabels = [];
var searchPeople = _.debounce(function( query, process ) {
//the "process" argument is a callback, expecting an array of values (strings) to display
//get the data to populate the typeahead (plus some)
//from your api, wherever that may be
$.ge... | true |
76f9bb347860dd450fd8029e849566785dd14b75 | JavaScript | jimmyjamesjj/wdft-react-day-1--class-code | /src/components/Header.js | UTF-8 | 520 | 2.875 | 3 | [] | no_license | // Please import this line at the top of fucntional components as well
import React from 'react'
function Header (){
// Conditionally render classes
// Note this is a hint for the lab if you're reading this.
// If you've understood how props work this would be easy peassy
let myClass = props.classNam... | true |
94a52cefa5d9017c569b149cc9c754756fe22780 | JavaScript | FMI-Projects/jitter | /server/utilities/validation/messages.js | UTF-8 | 461 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | const required = field => `${field} is required`;
const minLength = (field, length) =>
`${field} must be at least ${length} symbols long`;
const maxLength = (field, length) =>
`${field} can't be more than ${length} symbols long`;
const unique = field => `${field} already exists`;
const invalidValue = field =>... | true |
f537ee0f1e2ca9137c37a8c99dea50259c6d54b0 | JavaScript | ArthurW404/react-blog-starter | /src/components/TimeLine/HorizontalTimeline.js | UTF-8 | 722 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* Documentation:
* https://www.npmjs.com/package/react-horizontal-timeline
*/
import React, { useState } from "react";
import HorizontalTimeline from "react-horizontal-timeline";
const HT = () => {
const VALUES = [
"2000-12-12",
"2000-12-13",
"2000-12-14",
"2000-12-16",
"2001-12-14",
];
... | true |
4709bd8339f435962e25ef5ed13ff8c76e428b00 | JavaScript | bagelhobbit/lcs-playoff-contention | /public/scripts/matchups.js | UTF-8 | 1,515 | 3.09375 | 3 | [
"MIT"
] | permissive | async function createTable(leagueName) {
let response = await fetch('/api/matchups/' + leagueName);
let teams = await response.json();
let target = document.getElementById('target')
let header = '<th></th>'
let rows = ''
let teamIndex = 0
for (let matchup of teams) {
let teamMatchup... | true |
0e005270f8bcacc353ed2c1be58c1319f70223ee | JavaScript | ChaosQK/Tuya-Lights-Control | /html/public/js/scripts.js | UTF-8 | 8,975 | 2.5625 | 3 | [] | no_license | $(document).ready(function () {
var sock = io('http://192.168.5.**:8333');
var type = '';
var color = '';
sock.on('broadcast', function (data) {
console.log(data);
//console.log(data);
//type = data['21'];
color = data['24'];
changeFromData(data);
... | true |
51d7766e8ce92fc59811b481b4f5d63f2e0ae435 | JavaScript | anminam/ex-datastracture-algorithm | /DataStracture/Grape/index.js | UTF-8 | 3,104 | 3.625 | 4 | [] | no_license | import { Node } from "./Node.js";
import { Stack } from "./Stack.js";
import { Queue } from "./Queue.js";
class Grape {
constructor(initNumber) {
this.root = null;
this.nodes = [];
for (let i = 0; i < initNumber; i++) {
this.nodes.push(new Node(i));
}
}
indexOf(data) {
return this.node... | true |
5a717e2b5dce1494cdbaf4f1e790395196e478b7 | JavaScript | zapproject/multiparty-oracle | /test/helpers/utils.js | UTF-8 | 2,234 | 2.90625 | 3 | [] | no_license | exports.CurveTypes = {
"Absolute": 0,
"Logarithmic": 1
};
exports.DECIMALS = 1000000000000000000;
exports.ZeroAddress = "0x0000000000000000000000000000000000000000";
exports.fetchPureArray = function (res, parseFunc) {
let arr = [];
for (let key in res) {
if (parseFunc != null) {
... | true |
a718d17e7121154955e595d7f7936b51452927ca | JavaScript | eliudnyamai/restaurant-locato | /restaurant.js | UTF-8 | 3,867 | 2.96875 | 3 | [] | no_license | class Restaurant {
constructor(Geojson) {
this.Geojson = Geojson;
this.storedData = JSON.parse(localStorage.getItem("restaurants"));
}
addReview(reviewText, reviewStars, featureId) {
let review = {
stars: +reviewStars,
comment: reviewText,
};
if (!this.storedData) {
fetch(thi... | true |
0557b781d370846a4c736d5f5058bdff0d79afee | JavaScript | PrabeenSoreng/freeCodeCamp | /Intermediate Algorithm Scripting/16-steamroller.js | UTF-8 | 478 | 3.6875 | 4 | [] | no_license | // Solution 1
function steamrollArray(arr) {
let stack = [...arr];
let resArr = [];
while (stack.length) {
const next = stack.pop();
if (Array.isArray(next)) stack.push(...next);
else resArr.push(next);
}
return resArr.reverse();
}
// Solution 2
function steamrollArray(arr) {
return arr.reduce(... | true |
c2e579884b64dd65771cbc8c77a3ad63950afb81 | JavaScript | daffaputradamar/marketplace-express-webservice | /controller/provinsiController.js | UTF-8 | 1,192 | 2.515625 | 3 | [] | no_license | const rajaOngkir = require("rajaongkir-nodejs").Starter(
"edeaa0dfb104f493d229fbd68f3cc1e9"
);
const axios = require("axios");
module.exports = {
getProvinsi(req, res) {
rajaOngkir.getProvinces().then(function(data) {
let obj = data.rajaongkir.results;
let provinsi = obj.map(data => ({
id_p... | true |