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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5a13003e04fe9566a6b349f5d852d6e730048095 | JavaScript | sarfata/introduction-to-pebbledev | /simplyjs/clock.js | UTF-8 | 365 | 3.234375 | 3 | [] | no_license | function displayTime() {
var now = new Date();
simply.text({
title: " " + now.getHours() + ":"
+ now.getMinutes()
+ ":" + now.getSeconds()
}, true);
}
// FullScreen mode
simply.fullscreen(true);
// Display time now
displayTime();
// And update it ... | true |
1ccb0dab9631af584869778141baf79c9ffeb14e | JavaScript | golmansax/funnel | /server/categories.js | UTF-8 | 1,639 | 2.65625 | 3 | [
"MIT"
] | permissive | import Autocomplete from 'autocomplete';
import { categories as rawCategories } from '../static_data/categories.json';
import slugify from '../shared/utils/slugify';
const autocomplete = Autocomplete.connectAutocomplete();
const index = new Map();
const slugs = [];
function insertCategoryAndSlug(category, slug) {
i... | true |
1bd729c4885f4146aa26e18d701b29bdd6d74b80 | JavaScript | crashb/javascript-analyzer | /test/fixtures/two-fer/61/two-fer.js | UTF-8 | 107 | 2.640625 | 3 | [
"MIT"
] | permissive | var testName = (name = 'you') =>{
console.log('One for ' + name + ', one for me.')
}
testName('Alice') | true |
fec5b053e3ae37d99eabceb96ab0ddda794cb92d | JavaScript | IAMZAID22/Class24 | /sketch.js | UTF-8 | 885 | 2.5625 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var wall1,wall2,wall3,ground,ball;
function setup() {
createCanvas(1000, 700);
engine = Engine.create();
world = engine.world;
walll2 = createSprite(690,600,20,100);
walll2.shapeColor = co... | true |
04383fdf89fb5a9c7bda9ac33c3affdc4e8f558c | JavaScript | gxy6622/yougou | /public/js/address.js | UTF-8 | 4,139 | 2.609375 | 3 | [] | no_license | $('.menu').click(function() {
$('.nav').toggleClass('active');
});
// $('form button').click(function() {
// $('.update-address').removeClass('active');
// });
var addressForm = document.forms.address;
//地址展示
function getAddressList(data) {
data.forEach(function(item) {
$(`
<li data-id=${ item.id }>
<div c... | true |
7e16cdf049d634a55c06ea17ad467ddb5b00d7f5 | JavaScript | Hackerbone/TechParea | /index.js | UTF-8 | 807 | 2.671875 | 3 | [] | no_license | const express = require('express');
const app = express();
const PORT = 8080;
const fs = require('fs');
const animeList = './animes.json';
app.use(express.json());
// localhost:8080/animes
app.get('/animes', (req, res)=>{
fs.readFile(animeList, (err, animeData)=>{
if(err){
... | true |
0749ecb000d5c522789fe5a981b3ee4a27d1c744 | JavaScript | isaul92/vitacoras | /src/main/resources/static/js/ordenesServicio/searchProduc.js | UTF-8 | 1,877 | 2.65625 | 3 | [] | no_license | window.onload = function() {
$("#buscar")
.click(
function() {
/*
* var select =
* document.getElementById("cusategoriaActiv.id"), // El //
* <select> value = select.value, // El valor
* seleccionado text =
* select.options[select.selectedIndex].innerText; // E... | true |
7ccf83f0bc8cae1d2c9b25473c626fc91ec6886f | JavaScript | mpoliakov/shri-2020-advanced-js | /proxyIn.js | UTF-8 | 1,082 | 3.53125 | 4 | [] | no_license | /*
in, который игнорирует свойства прототипа
Написать прокси-объект, для которого оператор in вернет истину только в том случает, когда свойство находится в самом объекте, но не в его прототипе.
*/
const proto = { value: 42 };
const object = Object.create(proto);
Object.defineProperty(object, 'year', {
v... | true |
9887d90d94680d2055aedd4853225c3c2508fe36 | JavaScript | Kanma/Athena-Scripting | /unittests/scripts/simple.js | UTF-8 | 54 | 2.578125 | 3 | [
"MIT"
] | permissive | function sum(a, b)
{
return a + b;
}
sum(10, 5);
| true |
c903b82d31dc9af920ebf515d82e5a2d437c759a | JavaScript | ksss/bubblevote | /chrome-extention/lib/httpcache.js | UTF-8 | 1,573 | 2.78125 | 3 | [] | no_license | window.Cache = (function(){
var $K = function(i){
return function(){ return i };
};
function http (opts) {
var d = Deferred();
var req = new XMLHttpRequest();
req.open(opts.method, opts.url, true);
if (opts.headers) {
for (var k in opts.headers) if (opts.headers.hasOwnProperty(k)) {
req.setRequestHeader(k, ... | true |
bba8fd657abbe3869d94044c8f8691d0a457b6c6 | JavaScript | NiharikaSharma2017/sharma-niharika-webdev | /public/assignment/views/website/controllers/website-new.controller.client.js | UTF-8 | 1,130 | 2.578125 | 3 | [] | no_license | (function(){
angular
.module("WebAppMaker")
.controller("NewWebsiteController", NewWebsiteController);
function NewWebsiteController($routeParams, $location, WebsiteService) {
var vm = this;
vm.userId = $routeParams.uid;
vm.createWebsite = createWebsite;
function... | true |
6ce5fa8b6900dd4c1bfbcb8e5d7508d708d4bce7 | JavaScript | arumz/The-Firebase-Store | /src/Admin.js | UTF-8 | 2,928 | 2.75 | 3 | [] | no_license | import React, {Component} from "react";
import chocolate from "./img/chocolate.jpg";
import dalmation from "./img/dalmation.jpg";
import corgi from "./img/corgi.jpg";
import black from "./img/black.JPG";
import greyhound from "./img/greyhound.jpeg";
import mastiff from "./img/mastiff.jpeg";
import pit from "./img/pit-b... | true |
f15536735a6ac4f992e9ae9342a9d7b1d24ba34f | JavaScript | david9898/canvasExperiments | /mouseEvents.js | UTF-8 | 713 | 2.828125 | 3 | [] | no_license | window.onload = function () {
let canvas = document.getElementById('canvas')
let contex = canvas.getContext('2d')
// canvas.addEventListener('mousedown', function (event) {
// console.log('mouseDown')
// console.log(event)
// })
//
// canvas.addEventListener('mouseup', function ... | true |
4dcb4a2ad2d4bd276aa5d12a769660bee57d3f11 | JavaScript | regineshirley/CPSC473_Project1 | /scripts/loginFormHandler.js | UTF-8 | 2,416 | 2.640625 | 3 | [] | no_license | (function(window) {
'use strict';
var App = window.App || {};
var $ = window.jQuery;
function LoginFormHandler(selector, logindb) {
if (!selector) {
throw new Error('No selector provided');
}
this.logindb = logindb;
this.$formElement = $(selector);
... | true |
14c2c83dc82d2160c9c14f92da47df388c94dce7 | JavaScript | Indre101/code_code | /js/code_academy/round.js | UTF-8 | 204 | 3.9375 | 4 | [] | no_license | const numImaginaryFriends = friendNumber => Math.round(friendNumber * 0.33);
// Uncomment the line below when you're ready to try out your function
console.log(numImaginaryFriends(1)) // Should print 6 | true |
7b1e54c156c201b738e97454e2381ffd005b24a5 | JavaScript | zbretz/blog | /database/models/blog_commands.js | UTF-8 | 2,918 | 2.734375 | 3 | [] | no_license | let BlogModel = require('./blog')
// let post = new BlogModel({
// title: 'First Post'
// })
// let blogSchema = new mongoose.Schema({
// title: {type: String, required: true, unique: true},
// text: {type: String, required: true},
// //createdAt: Date;
// date: { type: Date, default: Date.now },
... | true |
f766eeb39dd30f0d26775b0fe85feb28ab9d0e2a | JavaScript | DFectuoso/MC2d | /controls.js | UTF-8 | 2,219 | 2.859375 | 3 | [] | no_license | var controlsUp = function(ev) {
arrows=((ev.which)||(ev.keyCode));
switch(arrows) {
case 13:
ENTER_KEY = false;
break;
case 40:
case 83:
DOWN_KEY = false;
break;
case 38:
case 87:
UP_KEY = false;
break;
case 39:
case 68:
RIGHT_KEY = false;
... | true |
b500fe326bf3e9aa6e60c54b8ce4acca8bd94175 | JavaScript | jim-y/strong-password-generator | /backend/routes/index.js | UTF-8 | 1,384 | 2.546875 | 3 | [
"MIT"
] | permissive | var express = require('express');
var router = express.Router();
var randomize = require('randomatic');
var jwtToken = require('jsonwebtoken');
/*
a: Lowercase alpha characters (abcdefghijklmnopqrstuvwxyz')
A: Uppercase alpha characters (ABCDEFGHIJKLMNOPQRSTUVWXYZ')
0: Numeric characters (0123456789')
!: Speci... | true |
4410f43fe942e418b4806c826245f701f10ea0c6 | JavaScript | Lewis-Lucas/CESI-Projet-Web | /Application/src/js/class.Ticket.js | UTF-8 | 819 | 2.8125 | 3 | [] | no_license | class Ticket {
constructor(id ,ticketNum ,nom, prenom, titre, description, date, status, technicien) {
this.id = id;
this.ticketNum = ticketNum;
this.nom = nom;
this.prenom = prenom;
this.titre = titre;
this.description = description;
this.date = date;
... | true |
947e4741794efd5ed2109bd19ec1ce88bb100229 | JavaScript | BorisPerkovic/BorisMassage | /jscript/config.js | UTF-8 | 1,753 | 2.78125 | 3 | [] | no_license | $(window).on("load", function(){
$(".preloader").fadeOut(1000); // set duration in brackets
});
$(document).ready(function(){
/* Contact form section
-----------------------------------------------*/
$("#submit").click(function(){
var name_lastname=$("#name").val();
var ema... | true |
4e18404ae379f0e6a2b051007a05f4b7671d2397 | JavaScript | radleymith/nodejs-wrapper | /test/test.natural_language_classifier.v1.js | UTF-8 | 4,435 | 2.53125 | 3 | [
"metamail",
"LicenseRef-scancode-other-permissive",
"Beerware",
"LicenseRef-scancode-zeusbench",
"Apache-1.1",
"LicenseRef-scancode-rsa-1990",
"LicenseRef-scancode-pcre",
"Spencer-94",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"NTP",
"LicenseRef-scancode-rsa-md4",
"MIT",
"HPND-sel... | permissive | 'use strict';
var assert = require('assert');
var watson = require('../lib/index');
var nock = require('nock');
var service = {
username: 'foo',
password: 'bar',
url: 'http://ibm.com:80',
version: 'v1'
};
before(function() {
nock.disableNetConnect();
});
after(function() {
nock.cleanAll();
});
var natu... | true |
dc4d2a0cfa6bacf13e0589f85cb9adee27cdba97 | JavaScript | Mocchy2019/mocchyPrototype | /テンプレート/master.js | UTF-8 | 502 | 2.75 | 3 | [] | no_license | const topBarBurger = document.querySelector(".header__burger");
const topBar = document.querySelector(".header");
const topBarOpen = "header--open";
const noScroll = "no-scroll";
let topBarVisible = false;
topBarBurger.onclick = () => {
if (topBarVisible) {
document.documentElement.classList.remove(noScroll);
... | true |
22d74837f626e57f0201f95b463be99089c62ac6 | JavaScript | jafaralkafar/full-app | /src/redux/reducers/post.js | UTF-8 | 1,161 | 2.640625 | 3 | [] | no_license | import axios from 'axios'
const GET_POSTS = 'GET_POSTS'
const GET_POSTS_PENDING = 'GET_POSTS_PENDING'
const GET_POSTS_FULFILLED = 'GET_POSTS_FULFILLED'
const GET_POST = 'GET_POST'
const GET_POST_PENDING = 'GET_POST_PENDING'
const GET_POST_FULFILLED = 'GET_POST_FULFILLED'
let initialState = {
data: [],
loadin... | true |
c83b85f1bfbcd636cad49bdb8f5212385931f987 | JavaScript | doujintao/letao | /public/front/js/search.js | UTF-8 | 2,887 | 3.015625 | 3 | [] | no_license | /**
* Created by Administrator on 2018/3/7.
*/
$(function(){
//约定存入本地缓存的数据的键为list
//功能1:从本地缓存中取出数据,渲染到页面上
//1.取数据
function getArr(){
//从本地缓存取到的数据为数组,数组中的内容为字符串形式
var history = localStorage.getItem('list') || '[]';
//将数组中的字符串形式转换为数组形式
var arr = JSON.parse(history);
return arr;
};
//渲染数... | true |
666e9cdf46ad915bba3877e58811e21b5a310e2b | JavaScript | ariffira/fbw12 | /adel_hanifa/in_class/node_express_middleware/myFirstApp/server.js | UTF-8 | 1,310 | 2.765625 | 3 | [] | no_license | // using express js
const express = require('express');
const app = express();
const port = 3000;
const path= require('path');
const localStorage = require('localStorage')
let user = 'admin';
app.use(express.static(path.join(__dirname, 'public')));
function getAdminPage (req, res, next){
let users = JSON.p... | true |
0757263db753d5b8153e4bc03b0fd603b0ff4436 | JavaScript | kes2401/freeCodeCamp-algorithms | /22-pig-latin.js | UTF-8 | 974 | 4.15625 | 4 | [] | no_license | // Translate the provided string to pig latin.
// Pig Latin takes the first consonant (or consonant cluster) of an English word, moves it to the end of the word and suffixes an "ay".
// If a word begins with a vowel you just add "way" to the end.
// Input strings are guaranteed to be English words in all lowercase.
fu... | true |
c7f34b8d9745fe6b04485c423098291518a1ed05 | JavaScript | doggogqgqgqgqgqgqgqgqgqg/ReGuilded-Setup | /src/app/index.js | UTF-8 | 4,431 | 2.6875 | 3 | [
"MIT"
] | permissive | // Node
const { ipcRenderer, shell } = require("electron");
const { install, inject, uninject } = require("./actions");
// Elements
const statusText = document.getElementById("statusText");
const installBtn = document.getElementById("installBtn");
const injectBtn = document.getElementById("injectBtn");
const uninjectB... | true |
b4380429762ded3ae1470e6f92b98674b4b48d8e | JavaScript | JasminiSantos/CappacitaDev | /desafio-3-pokemons/src/database/dataBaseMysql.js | UTF-8 | 1,045 | 2.84375 | 3 | [] | no_license | const { databaseConnection } = require('./connection');
async function salvarPokemons(pokemon){
const queryInsertPokemon = `INSERT INTO pokemons(nome_pokemon, tipo_pokemon) VALUES ('${pokemon.nome}','${pokemon.tipo}')`;
const result = await databaseConnection.raw(queryInsertPokemon);
if (result){... | true |
69f584c67eeee8dac0078a0f950e258a9d0eacf2 | JavaScript | drjs-framework/helpers | /src/__tests__/checker.test.js | UTF-8 | 2,026 | 2.734375 | 3 | [] | no_license | const {
isFunction, existObjectPath, buildIfExist,
stringIsNotEmpty,
} = require('../checker');
describe('Checker library', () => {
describe('isFunction', () => {
it('Check arrow function', () => {
const a = () => {};
expect(isFunction(a)).toBeTruthy();
});
it('Check named function', () =... | true |
15f2a7dcb282387a4cdbad1e5491a5a262b7332d | JavaScript | nss-day-cohort-14/gauntlet-now-we-re-a-third | /javascripts/domBuild.js | UTF-8 | 1,227 | 2.546875 | 3 | [] | no_license | "use strict";
var $ = require('jquery');
const Gauntlet = require('./player');
const Classes = require('./classes');
let domBuild = {};
domBuild.addClassCards = function(classArray) {
let classCardString = '';
let colCounter = 0;
for (let i = 0; i < classArray.length; i++) {
classCardString += `
<div c... | true |
98ac8bbeef5666a8ce3a9131160073bf0704a6d4 | JavaScript | alebotia/sharedBookFront | /src/components/UpdateUser.jsx | UTF-8 | 3,902 | 2.703125 | 3 | [] | no_license | import React, {Component} from 'react';
import PropTypes from 'prop-types'
import { getAllUsers } from '../libs/ApiConnections.js';
import AddUser from './AddUser.jsx'
import TableElement from './TableElement.jsx'
import AlertMessage from './AlertMessage.jsx'
class UpdateUser extends Component{
// currentPage cont... | true |
feb6de14635c808e66c476529231bd9f76ae998a | JavaScript | Croquignolex/smart-code-test-react-js | /src/services/ArticlesService.js | UTF-8 | 1,628 | 2.75 | 3 | [
"MIT"
] | permissive | import {useState, useEffect} from 'react';
import {API_URL} from "../constants/apiContants";
import {apiGetRequest} from "../functions/ajaxFunction";
const ArticlesService = () => {
const [loader, setLoader] = useState(false);
const [articles, setArticles] = useState([]);
const [activePage, setActivePage]... | true |
ac2a0ecebbc1051d05e0446f7c4632a2fe48b4bd | JavaScript | RBSystems/generator-integrator | /app/index.js | UTF-8 | 3,247 | 2.53125 | 3 | [] | no_license | 'use strict';
const Generator = require('yeoman-generator');
const path = require('path');
const fs = require('fs');
const mkdirp = require('mkdirp');
const pkg = require('../package.json');
module.exports = class extends Generator {
constructor(args, opts) {
super(args, opts);
this.argument('appname', { ty... | true |
5185a22660f49bf3f985ae9ff3aa6c7591b0bcae | JavaScript | LeoMoonStar/TexasPoker-react | /src/lib/Game.js | UTF-8 | 3,878 | 3.484375 | 3 | [] | no_license | class Game {
constructor(handA = null, handB = null) {
this.handA = handA;
this.handB = handB;
this.result = null;
this.order = [
"A",
"K",
"Q",
"J",
"T",
"9",
"8",
"7",
"6",
"5",
"4",
"3",
"2",
];
}
setA(hand) {
... | true |
578081636ebf74f1fb763fb5bc127e17831fb9f3 | JavaScript | Carnicero90/js-lista-cognomi | /js/script.js | UTF-8 | 1,634 | 3.609375 | 4 | [] | no_license | var nomeUtente;
var listaNomi = ["gIANNI", "franceSco", "aldo", "juanito", "carmen", "carmelo", "Alejandro", "ZORRO"];
// VALIDATE USERNAME
while (!nomeUtente) {
nomeUtente = prompt("Inserire proprio nome (non lasciare vuoto!");
}
nomeUtente = nomeUtente.toLowerCase();
// PUSH nomeUtente TO listaNomi
listaNomi.pus... | true |
ae3dd56ca7838a5887ee03724ff62c52a8c51579 | JavaScript | fs-c/v1 | /testing/osu-node/player2.js | UTF-8 | 1,963 | 2.625 | 3 | [] | no_license | const robot = require('robotjs');
const { join } = require('path');
const rls = require('readline-sync');
const { readdirSync, readFileSync } = require('fs');
const args = require('minimist')(process.argv.slice(2));
const keys = 4;
const width = 512 / keys;
const typeBMP = {
circle: 1,
combo: 4,
hold: 128... | true |
18786f0acd73a518baa533eee20560b0f8fa1cb6 | JavaScript | jaroslavpsenicka/gencase | /server/test/02-cases.js | UTF-8 | 9,196 | 2.65625 | 3 | [] | no_license | const expect = require('chai').expect;
const request = require('request');
describe('Case', () => {
var model;
var caseObject;
it('find test model', done => {
request.get('http://localhost:8080/api/models' , (error, response) => {
expect(response.statusCode).to.equal(200);
model = JSON.parse(r... | true |
d36864ff772d13f6204657b6043aba413984e5c2 | JavaScript | adclleva/sorting-algorithm-visualizer | /src/Visualizer/sketch.js | UTF-8 | 586 | 3.0625 | 3 | [
"MIT"
] | permissive | export default function sketch(lines) {
return function (p) {
p.setup = function () {
p.createCanvas(window.innerWidth, window.innerHeight);
drawLines();
};
p.windowResized = function () {
p.resizeCanvas(window.innerWidth, window.innerHeight);
drawLines();
}
const drawLin... | true |
b7f9beee2073affda83363f4c3ef6e6a38f93ded | JavaScript | ODwyerRichard/IS1113117323203 | /cost_calc.js | UTF-8 | 512 | 2.671875 | 3 | [] | no_license | /* global $ */
function calcSub(){
var argSubTotal;
if(document.getElementByID('salesforce').checked){
argSubTotal = 100;
}
else{
argSubTotal = 300;
}
display(argSubTotal);
}
function display(parm1){
document.getElementByID("subtotal").value = parm1;
document.getElementByID("Total").value = pa... | true |
b00a0385b7d4d302887a8d671c079f95ba7dca75 | JavaScript | lasyamundra/PRO-36 | /js/sketch.js | UTF-8 | 1,550 | 3.140625 | 3 | [] | no_license | var database;
var fedTime, lastFed, foodObj;
var dog,sadDog,happyDog;
var foodS,foodStock;
var feed,addFood;
function preload(){
sadDog = loadImage ("images/Dog.png");
happyDog = loadImage ("images/happyDog.png");
}
function setup(){
var canvas = createCanvas (1000,500);
database = firebase.dat... | true |
3405ebb05325c756959f4e6fe7d610004ae669bc | JavaScript | BabaDorin/Asistenta-pentru-programarea-site-urilor-WEB | /Teme pentru acasa/17.09.20/Sarcina5/main.js | UTF-8 | 937 | 3.578125 | 4 | [] | no_license | let n = parseInt(prompt("Introduceti un numar: "));
let x, k;
putere(n);
alert(n + " = " + x + "^" + k);
function cmmdc(a, b){
if(b==0) return a;
else return cmmdc(b, a%b);
}
function x_pow_n(x, n){
if(n == 0) return 1;
else return x * x_pow_n(x, n-1);
}
function putere(n){
k = 0;
d = 2;
... | true |
64503686483d3c52e398d32f059300340b100312 | JavaScript | kecorona/cv.kristincorona.com | /assets/js/codeivate.js | UTF-8 | 2,566 | 2.578125 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
$.getJSON('http://codeivate.com/users/kcorona.json?callback=?',
function data(data) {
var programming_now_message;
var i = 1;
var color = d3.scale.category20b();
var platformElements = Object.keys(data.platforms).length;
var countElements = Math.floor(12/p... | true |
5d9b74933011236429d96f026b5c822165720fe1 | JavaScript | guohao1119/myvue | /src/platforms/web/entry-runtime-with-compiler.js | UTF-8 | 1,305 | 2.859375 | 3 | [] | no_license | import Vue from "./runtime/index";
// 这里会先缓存Vue中原先定义的$mount
// Vue.prototype.$mount = function (el) {
// return mountComponent(el)
// }
const mount = Vue.prototype.$mount
Vue.prototype.$mount = function (el) {
const options = this.$options
// 如果没有配置render方法,就将template转成render
if (!options.render) {
// 就取te... | true |
c9c62a4b821be5d74bd70cab1c50af7b60f60a22 | JavaScript | lllllllllwith10ls/GAME | /bigboi.js | UTF-8 | 12,261 | 2.75 | 3 | [] | no_license | class BigBoi extends Entity {
constructor(x,y,vx,vy) {
super(x,y,vx,vy,250,2,0.1,75);
this.angle = 0;
this.attackReload = 500;
this.reload = 30;
this.reload2 = 30;
this.attackCooldown = Math.random()*200+300;
this.attackCooldown2 = 500;
this.cooldown = 30;
this.cooldown2 = 30;
th... | true |
e11a4e25728f0ac7d576acf738b16e6dcf9bb23b | JavaScript | lippyDesign/currency-exchange-react-redux | /src/containers/SearchBar.js | UTF-8 | 4,009 | 2.71875 | 3 | [] | no_license | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import {
fetchItems,
fetchCurrencyM0,
fetchCurrencyM1,
fetchCurrencyM2,
fetchCurrencyM3,
fetchCurrencyM4,
fetchCurrencyM5,
fetchCurrencyM6
} from '../actions';
c... | true |
4532419eac1c1debb80d54e9d017d4ae10b79161 | JavaScript | JimHotchkiss/lead-tracker-client | /src/redux/actions/showContactAsyncAction.js | UTF-8 | 536 | 2.515625 | 3 | [] | no_license | const API_URL = process.env.REACT_APP_API_URL
export const showContactSuccess = (contact) => {
return { type: "SHOW_CONTACT", contact }
}
export const showContactAction = (contactData, props) => {
return (dispatch) => {
dispatch({ type: "LOADING_CONTACT" })
fetch(`${API_URL}/contacts/${contactData}`)
... | true |
90b454ee91958182154c1fab278376a685619279 | JavaScript | seanho96/image-classifying-pokedex | /scripts/tensorflow.js | UTF-8 | 2,818 | 2.765625 | 3 | [] | no_license | async function run() {
const model = await tf.automl.loadImageClassification(
"./tensorflow/model.json"
);
//get image to test
const image = document.getElementById("result");
const predictions = await model.classify(image);
//sort prediction by highest prob, take the first one
predictions.sort(sortBy... | true |
9ae3674790c3a41c78575c1aee1df2e55f9289bd | JavaScript | atsikov/shrink-yarn-lock | /utils.js | UTF-8 | 2,469 | 2.75 | 3 | [] | no_license | function parseEntryHeader(header) {
const parsed = header
.split(", ")
.map(function(name) {
return name.replace(/"/g, "");
})
.map(function(name) {
return parsePackageName(name);
});
return {
package: parsed[0].package,
entries: p... | true |
23890bbe21228583baa07376fbe3fdf027874731 | JavaScript | stefanwerleman/portfolio-v1 | /src/components/skillList/skillList.js | UTF-8 | 4,106 | 2.59375 | 3 | [] | no_license | import { v1 as uuid } from 'uuid';
const skills = [
{
id: uuid(),
langs: ['c'],
header: 'C',
text:
'This was the first programming language I learned in my senior year of high school. This is how learned the concepts of dynamic memory management and low-level architecture. I have implemented some of my fir... | true |
0a5a934311a356c1e3825b502367bc97f775601c | JavaScript | Sailmeter/sailmeter | /NMEAHelper.js | UTF-8 | 1,977 | 3.109375 | 3 | [
"MIT"
] | permissive | // function from https://github.com/nherment/node-nmea
module.exports = {
// decode latitude
// input : latitude in nmea format
// first two digits are degress
// rest of digits are decimal minutes
// output : latitude in decimal degrees
parseLatitude: function(lat, hemi) {
var h... | true |
532a14a2f9dc3d98fb4630d37c920b4b6296b3f0 | JavaScript | Anselmoa/SM2-Project | /server/user/route.js | UTF-8 | 2,989 | 3.109375 | 3 | [] | no_license | var express = require('express');
var User = require('./user');
module.exports.init = function() {
var routerApi = express.Router();
// middleware to use for all requests
routerApi.use(function(req, res, next) {
console.log('Somebody uses our API');
next();
});
// POST NEW USER http://localhost:3001/api/us... | true |
ab6a7d4d4cb1fd7165497ed858fed755245cfd65 | JavaScript | zzx0624/zzx0624.github.io | /nodejs/client.js | UTF-8 | 557 | 2.75 | 3 | [] | no_license | var net=require('net');
var hostname=process.argv[2];
var port=process.argv[3];
var client=net.connect({host:hostname,port:port},function(){
console.log('connected to server!');
process.stdin.setEncoding('utf8');
for(var a=0;a<5;a++){
process.stdin.on('readable',function(){
var chunk=process.st... | true |
1448847d21b02f19adbe30028dae86bb84288480 | JavaScript | TomPope94/games-night | /src/components/games/articulate/ArticulateBoard.js | UTF-8 | 5,755 | 2.5625 | 3 | [] | no_license | import React, { useState, useEffect, Fragment } from 'react';
import { connect } from 'react-redux';
import BoardQuadrant from 'components/games/articulate/BoardQuadrant';
import GameButton from 'components/global/GameButton';
import { sendNextRound, addRota, sendEndGame } from 'actions/articulate';
const Articulate... | true |
c0f2b4c4bcd153645a69c3db54b8e32a2ae5bd00 | JavaScript | ilovelili/Samantha.js | /lib/SamanthaClosure/src/dataProxy/Abstract.js | UTF-8 | 851 | 2.609375 | 3 | [] | no_license | /**
* @fileoverview SamanthaClosure.dataProxy.Abstract base abstract class for local and xhr data proxies.
*/
goog.provide('SamanthaClosure.dataProxy.Abstract');
goog.require('goog.structs.Map');
/**
* Base model to handle xhr requests
*
* @constructor
*/
SamanthaClosure.dataProxy.Abstract = function() {
/... | true |
6176fe1c977d4a685a6182b63a49504bf81aa78a | JavaScript | kaviyabakiyavel/JavascriptBasicforBegineer | /Section5-object/Course7.js | UTF-8 | 708 | 4.5 | 4 | [] | no_license | // for in loop
const circle = {
radius : 1 ,
draw(){
console.log('draw')
}
}
for(let key in circle){
console.log(key , circle[key])
}
//throw an error for-of used for iterating array and maps not object
// for(let key of circle){
// }
for(let key of Object.keys(circle)){
console.log(ke... | true |
a667d8337a2d96cf4afc307e25b34b7199e52300 | JavaScript | antoniolopesjr/React-course | /script.js | UTF-8 | 2,034 | 3.84375 | 4 | [] | no_license | function myFunction() {
var x = document.getElementById("firstNumber").value;
var y = document.getElementById("secondNumber").value;
var plus = document.getElementById("plus").checked;
var minus = document.getElementById("minus").checked;
var times = document.getElementById("times").checked;
va... | true |
3558e0b0a112bffeab44b47215acbbdfbf8b9a48 | JavaScript | jamesrosas/webComponents | /component.js | UTF-8 | 7,551 | 2.71875 | 3 | [] | no_license | class nikeCard extends HTMLElement {
constructor(){
super()
this.attachShadow({ mode: 'open'})
// this.title = this.getAttribute('title')
// this.category = this.getAttribute('category')
// this.feature = this.getAttribute('feature')
// this.price = this.getAttribute... | true |
67de7f2d394151f62cfc0702d57f3300f93d8beb | JavaScript | xatgomezstudio/lirihw | /liri.js | UTF-8 | 3,472 | 2.921875 | 3 | [] | no_license | //GOOD CODE BABY
//Hiding keys n bag
require("dotenv").config();
//Global variables storing required files
var axios = require("axios");
var Spotify = require("node-spotify-api");
var fs = require("fs");
//I got the keys keys keys
var keys = require("./keys.js");
var omdbKey = "20523c31";
var spotify = new Spotify(k... | true |
ff4a9cdc2761b50389390a722bc26aac6c2f91f7 | JavaScript | baidu/BIPlatform | /designer/src/main/resources/public/report-ui/src/core/xutil/lang.js | UTF-8 | 7,648 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | /**
* xutil.lang
* Copyright 2012 Baidu Inc. All rights reserved.
*
* @file: 基本工具函数
* @author: sushuang(sushuang)
* @depend: xutil.lang, xutil.string
*/
(function () {
/* globals xutil */
var LANG = xutil.lang;
var utilTrim = xutil.commonUtil.trim;
var objProto = Object.prototype;
var o... | true |
2d6ce07ac10180564e3a75d5d5b7ed6021d34a5b | JavaScript | RanaWebD/DryCleanerBoysReactNative | /client/components/Slides.js | UTF-8 | 1,536 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import { View, Text, ScrollView, Dimensions, TouchableOpacity } from 'react-native';
//get the mobile window width with the react native helper call Dimensions
const SCREEN_WIDTH = Dimensions.get('window').width;
export default class App extends Component {
randerLastSli... | true |
5267377e16f17b2337fa81da4b735ccdeea35ba7 | JavaScript | armikhalev/ember-mela | /app/controllers/koyla.js | UTF-8 | 2,550 | 2.578125 | 3 | [] | no_license | import Ember from 'ember';
import { ensurePromise } from '../utils/ensurePromise';
export default Ember.Controller.extend({
langTranslateFrom: 'English',
english:true,
actions: {
filterByWord(param) {
// Check the first letter of the input param and get the data from serever. Don't reload data from s... | true |
39a2aedf1d658c44b38f67931a7c90e65a0a52fd | JavaScript | reykumcon/webFun_js_playing_with_objects | /playing_with_objects.js | UTF-8 | 325 | 3.34375 | 3 | [] | no_license | var users = [
{
name: "Michael",
age:37
},
{
name: "John",
age:30
},
{
name: "David",
age:27
}
];
console.log(users[0].name + " - " + users[0].age);
console.log(users[1].name + " - " + users[1].age);
console.log(users[2].name + " - " + users[2].... | true |
76a19d587986faf2f4f5602d7a5fd38c3e485387 | JavaScript | anish726/news-project | /src/redux/reducer/articleReducer.js | UTF-8 | 664 | 2.625 | 3 | [] | no_license |
const initailState = {
articles: [],
error: null
}
function articles(state = initailState, action) {
// console.log(action, 'reducer article')
// console.log("state=======", state)
switch (action.type) {
case 'ARTICLE_REQUEST':
return {
...state
}
... | true |
9336c6d4c277a318e16db2bc468e9cef45eef46e | JavaScript | frcepeda/artificial-intelligence | /2.n-puzzle/ui/js/puzzle.js | UTF-8 | 5,620 | 2.71875 | 3 | [] | no_license | function Puzzle(o){
var p = $("#puzzle-wrapper");
p.empty();
var n = this.n = o.n;
if (!o.start){
this.perm = [];
for (var i = 0; i < n*n; i++)
this.perm.push(i);
} else this.perm = o.start;
this.nextStep = 0;
this.start = this.perm.slice(0);
this.solvable = o.solvable != null ? o.solv... | true |
a821bfc04ae1404e5583672cbc7122c43ce43678 | JavaScript | mcatta/node-thumb-api | /lib/sourceValidation.js | UTF-8 | 2,060 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | var fs = require('fs'),
http = require('http'),
url = require('url');
module.exports = {
/**
* Verify if path is allowed and exists
* @param {[type]} url_req [description]
* @param {Function} callback [description]
* @return {[type]} [description]
*/
verifySource: function(u... | true |
b99d9ccbdb86ce7d1778e35b04e38a2ce396644d | JavaScript | Shahidakber/meanstack2021 | /arrays/arrowfuntions/evensarrow.js | UTF-8 | 139 | 3.484375 | 3 | [] | no_license | var arr=[1,2,3,4,5,6,7,8]
data=arr.filter(num=>num%2==0)
console.log(data);
arr.forEach(o=>console.log(o)) //used for internal iteration
| true |
f099c62fa98f054a2348d8de65d536a960b65099 | JavaScript | devinmcginty/devinmcginty.github.io | /party/main.js | UTF-8 | 6,616 | 2.625 | 3 | [] | no_license | // Lazy constants
var SECOND = 1000;
var MINUTE = SECOND * 60;
var HOUR = MINUTE * 60;
var DAY = HOUR * 24;
var LATLNG = new google.maps.LatLng(40.043736, -75.182705);
var COLOR_MAP = [
"#72FE95",
"#74FEF8",
"#B0A7F1",
"#FFA4FF",
"#FFA8A8"
]
// var END_DATE = "Sep 20, 2014 15:00:00";
... | true |
dbac6cfb00680ed10c7d5a8e5118cd15277373f6 | JavaScript | Maxoun456/FNFBot | /features/features/automod.js | UTF-8 | 1,455 | 2.546875 | 3 | [] | no_license | const mongo = require('@util/mongo')
const warnSchema = require('@schemas/warn-schema')
module.exports = client => {
var swears = []
client.on( 'message', async message => {
const { channel } = message
if(channel.type === 'dm') {
return
}
if(message.guild.id ===... | true |
b10a999ba9cb9eff13fe8887fc5a91c2f09fa0fe | JavaScript | walmor/algorithms-practice | /codility/10-prime-and-composite-numbers/min-perimeter-retangle.js | UTF-8 | 521 | 3.890625 | 4 | [] | no_license | // Pretty easy. 12 minutes.
function solution(N) {
if (N < 1) return 0;
let minPerimeter = Number.MAX_SAFE_INTEGER;
for (let i = 1; i * i <= N; i++) {
if (N % i === 0) {
const a = i;
const b = N / i;
const perimeter = 2 * (a + b);
minPerimeter = Math.min(minPerimeter, perimeter);
... | true |
5ce5ba602c65e4ce409f0a99ef74ce52638f8d3a | JavaScript | AsenTahchiyski/SoftUni | /2. JavaScript Basics/2016.01.31 - Exam/p4.js | UTF-8 | 2,336 | 3.046875 | 3 | [] | no_license | function solve(arr) {
var total = {};
arr.forEach(function(line) {
var data = line.split(' & ');
var name = data[0]; // Array Matcher
var type = data[1]; // strings
var number = Number(data[2]);
var score = Number(data[3]);
var lines = Number(data[4]);
va... | true |
2bcb1c413efb898a9f7a22e83366aab66b4a6878 | JavaScript | lucaminudel/TDDwithMockObjectsAndDesignPrinciples | /TDDMicroExercises.ProposedSolution/Javascript/unicode-file-to-htm-text-converter-tests/unicode-file-to-htm-text-converter-test.js | UTF-8 | 1,311 | 2.875 | 3 | [] | no_license | describe('Unicode To Htm Converter', function () {
describe('UnicodeFileToHtmTextConverter', function () {
it('should convert ampersand', function () {
var stubTextStream = a.stub(TextStream);
spyOn(stubTextStream, 'getText').andCallFake(function (callback) { return callback('Cut & Paste'); });
var targe... | true |
e234c32e77af9c22b59a8658ff5b423869bce92a | JavaScript | nirmalit/LAWPOINT_PROJECT | /Frontend-Lawpoint/src/core/helper/solutionHelper.js | UTF-8 | 892 | 2.546875 | 3 | [] | no_license | const api="http://localhost:8000/api";
export const addSolution = (userId,caseId,token,solution) => {
const body=JSON.stringify({details:solution});
return fetch(`${api}/solution/${userId}/${caseId}`,{
method:"POST",
headers:{
Authorization:`Bearer ${token}`,
Accep... | true |
0a72a42c66a71a16e7343fcaf94e07550c8b4c2f | JavaScript | Yangyouguo/xianmu | /src/js/car1.js | UTF-8 | 5,086 | 2.765625 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded',function(){
var tab = document.getElementsByClassName('tab')[0];
var tabItem = tab.children[0].children;
var tabContent = tab.children[1].children;
tabXh();
function tabXh(){
tabItem[0].... | true |
960a43609f9ea9ae1e58418820ca1737367a4be8 | JavaScript | YPZ-24/Curso_FundamentosJS | /Teoria/constantes.js | UTF-8 | 228 | 3.078125 | 3 | [] | no_license | //CONSTANTES const
//Se recomienda que se definan en mayusculas
const PI = 3.14;
//No se pueden definir sin valor (Saldrá un error)
const EULER;
//Una vez definido su valor no se puede cambiar (Saldrá un error)
PI = 3.1416; | true |
aa89935f8bead50ad104a7c03648f9badb2f3b41 | JavaScript | AlanLouette/ExJavascript | /contenu/02-la-colline/01-javascript/11-fetch/03-details/script.js | UTF-8 | 1,297 | 3.0625 | 3 | [] | no_license | /* becode/javascript
*
* /11-fetch/03-details/script.js - 11.3: details
*
* coded by leny@BeCode
* started at 12/05/2019
*/
// NOTE: don't focus on the existing code structure for now.
// You will have time to focus on it later.
(() => {
document.getElementById('run').addEventListener("click", () => {
... | true |
58ec64885130453fc32a89668aec77be43097ca0 | JavaScript | 15071343750/ali | /admin/common/check.js | UTF-8 | 434 | 2.640625 | 3 | [] | no_license | /**
* Created by 小新 on 2018/1/19.
*/
var thc = $("thead :checkbox");
var tbc = $("tbody :checkbox");
thc.click(function () {
tbc.prop('checked', $(this).prop('checked'));
});
tbc.click(function () {
var len = $("tbody :checkbox").length;
var checkedLen = $("tbody :checkbox:checked").length;
if (len ==... | true |
05817b69ff7c93c4ddcb8e29b7919006f2faf51f | JavaScript | AanandBhandari/Doctor_finder_V1 | /controllers/user/auth.js | UTF-8 | 2,207 | 2.640625 | 3 | [] | no_license | const User = require("../../models/User");
const jwt = require("jsonwebtoken");
exports.signup = async (req, res) => {
try {
let userExists = await User.findOne({ email: req.body.email });
console.log(userExists);
if (userExists)
return res.status(403).json({
error: "Email is taken!"
... | true |
f10bf3fbe5709fb3862f1c57a327bfedd39e9f66 | JavaScript | aajiwani/ReactNativeMemoryGame | /MemoryGameClient/js/actions/gameActions.js | UTF-8 | 3,278 | 2.671875 | 3 | [] | no_license | import * as gameActionTypes from '@memory_game_action_types/gameActionTypes';
import Horizon from '@memory_game_api/HorizonClient'
import * as libBoardTile from '@memory_game_lib/boardTile';
import { MemoryGameError } from '@memory_game_lib/memoryGameError';
import BoardLibrary from '@memory_game_lib/board';
const scor... | true |
5d456b11b48adafaadf960ecb9bd8c5317fb9453 | JavaScript | bilbo184/codewars | /6kyu_ASCIIFun#1_X-Shape.js | UTF-8 | 1,099 | 4.3125 | 4 | [] | no_license | // This will probably be a little serie :)
// X-Shape
// You will get an odd Integer n (>= 3) and your task is to draw a X. Each line is
// seperated with '\n'.
// Use the following characters:
// ■ □
// e.g.:
// ■□□□■
// ■□■ □■□■□
// x(3) ... | true |
3d0e7698832dc364dc542cb7999ee9a2ade386ae | JavaScript | bstizzle/js-events-dom-practice-project | /index.js | UTF-8 | 2,492 | 3.53125 | 4 | [] | no_license | //headers/other text
const header = document.createElement("h1");
header.setAttribute("id", "header");
header.innerText = "Draw a S N E K";
document.body.appendChild(header);
const instructions = document.createElement("h3");
instructions.setAttribute("id", "instructions");
instructions.innerText = "Press space ... | true |
b641c599a5b42db48110e43b45dd42d11cb7f97f | JavaScript | fly7632785/myadmin | /src/view/test/test.js | UTF-8 | 2,767 | 4.46875 | 4 | [] | no_license | var str = 'yiifaa',
str1 = new String('yiifaa'),
str2 = String('yiifaa')
console.log('str:', typeof str) //string
console.log('str1:', typeof str1)//object
console.log('str2:', typeof str2)//string
// new String是对象 不是String的基本类型
console.log('str1 === str', str1 === str)
console.log('str === str2', str === str2)
c... | true |
77947108eae136e741e5268e2b278f0fb44680e0 | JavaScript | toomeefed/maybe-gc | /index.js | UTF-8 | 1,173 | 2.71875 | 3 | [
"MIT"
] | permissive | const assert = require('assert');
const is = require('is');
const ms = require('ms');
const debug = require('debug')('maybe:gc');
const defaultRate = 10 * 60 * 1000; // 10 minutes
const queue = []; // gc objects queue
let intervalTimes = 0; // processing times
let realRate = 0; // the frequency of the first call
/**... | true |
99bfae1d31ebb863c159d73abb59c1fa17591e08 | JavaScript | Steve9hw2/cart253 | /projects/Project02-Anything/js/SceneOne.js | UTF-8 | 3,719 | 2.53125 | 3 | [] | no_license | class SceneOne {
constructor(variation) {
this.x = 0;
this.y = 0;
this.variant = variation;
this.section = 1;
}
update(variant,lemmings) {
switch(variant) {
case 1:
this.VariantOne();
break;
case 2:
this.VariantTwo();
break;
}
this.displayUI(this.s... | true |
633eb0c54b2845745bd733f71b9078ce4e7505e7 | JavaScript | Kamil2601/University | /Studia_inzynierskie/Semestr_3/WWW/Lista_4/Zad2/script.js | UTF-8 | 2,813 | 3.078125 | 3 | [] | no_license | function check_account() {
info = document.getElementById("account_info");
var pesel_reg = new RegExp("[0-9]{26}");
var pesel = document.getElementById("account").value;
var pesel_test = pesel_reg.test(pesel);
if (pesel_test == false) {
info.innerHTML = "Nieprawidłowy numer konta";
i... | true |
67cd320079f3f362140c76fff41e862c8e741d3a | JavaScript | monolinufps/multiplicar-node | /app.js | UTF-8 | 874 | 2.5625 | 3 | [] | no_license | //required, crea un objeto del modulo y usa sus funciones q hemos puesto , para exportar
const agv = require("./config/yargs").agv;
const funcion = require("./operacion/muti");
const colors = require('colors');
console.log('base ', agv.base, ' limite', agv.limite);
// acuerdo a la funcion que se elije de los agv
let... | true |
b2834b5fca5653c7bc437198fe2a7b94e624356d | JavaScript | vamsivarma/chatfuel-api-bot | /web_scrapper.js | UTF-8 | 6,053 | 2.859375 | 3 | [] | no_license | const rp = require('request-promise');
const cheerio = require('cheerio');
const fs = require('fs');
const request = require('request');
var Q = require('q');
const options = {
uri: `https://farm-r.com/s?category=all`,
transform: function (body) {
return cheerio.load(body);
}
};
var cat_list = [];
//@TODO... | true |
934ab4f3beecc074a495506775d4dfed1b391ad7 | JavaScript | ANewModern/Pomodoro-Clock | /js/index.js | UTF-8 | 2,854 | 3.109375 | 3 | [] | no_license | let timer, pauseTime, audioPlay;
let audio = document.getElementById("myAudio");
let pauseTrue = false;
let restTime = false;
let workOrRest = ".workTime";
function sec2Time(secs) {
let hours = Math.floor(secs / (60 * 60));
let divisor_for_minutes = secs % (60 * 60);
let minutes = Math.floor(divisor_for_minutes... | true |
506942e10c60633afb3e6101f3a7089365a7df13 | JavaScript | ayushgupta2013/CS-Commnication-Scheduling-Team-Red | /react-front/src/makeAppointment/controller_add.js | UTF-8 | 2,253 | 2.609375 | 3 | [] | no_license | import * as assert from 'assert';
export default class Controller {
constructor({repository, viewDataMapper, appointmentEventId, onFinishListener}) {
this.repository = repository;
this.viewDataMapper = viewDataMapper;
this.appointmentEventId = appointmentEventId;
this.onFinishListener = onFinishLis... | true |
f80f2a26aa0e1a8a9612dd50f10e6be800375707 | JavaScript | ozgurcoskuner/react-todolist | /src/Components/TodoMain.js | UTF-8 | 1,564 | 2.765625 | 3 | [] | no_license | import React, { useState } from "react";
import TodoItem from "./TodoItem";
import TodoForm from "./TodoForm";
import { v4 as uuidv4 } from "uuid";
function TodoMain() {
const [items, setItems] = useState([
{
id: uuidv4(),
activity: "Meeting",
time: "13:30",
date: "2021-03-11",
remi... | true |
c0a53523ecfd0693120617d47c7c70c72155a4c0 | JavaScript | cristopher-peraza/Curso-JS | /Practicas/FuncionesyContexto.js | UTF-8 | 704 | 4.625 | 5 | [] | no_license | //Funcion que crea funciones e imprimen el numero que estan en su contexto.
function crearFunciones(){
var arr = [];
var numero = 1;
//Push, permite meter una funcion dentro de un arreglo.
arr.push(
(function(numero){
return function(){
console.log(numero);
}
})(numero)
);
n... | true |
6d0406765cd9a417f737a030da9d21c78850fcbd | JavaScript | DoubleYing/website-hexo-next | /themes/next/scripts/tags/example-quote.js | UTF-8 | 517 | 2.5625 | 3 | [
"MIT"
] | permissive | /* global hexo */
// Usage: {% examplequote %} Something {% endexamplequote %}
// Alias: {% eq %} Something {% endeq %}
function exampleQuote (args, content) {
var withpstring = hexo.render.renderSync({text: content, engine: 'markdown'});
var withoutpstring = withpstring.slice(3, -5);
return '<div class="quote-e... | true |
657430aeada34914bff38bb4b577b3d877e45c8f | JavaScript | glprt/jest-extended | /src/matchers/toHaveBeenCalledOnceWith/predicate.test.js | UTF-8 | 3,689 | 2.8125 | 3 | [
"MIT"
] | permissive | import predicate from './predicate';
import { callsPredicate, equalityPredicate } from './predicate';
describe('.toHaveBeenCalledOnceWith', () => {
describe('callsPredicate', () => {
test('should return false when passed an empty array', () => {
expect(callsPredicate([])).toBe(false);
});
test('sh... | true |
cd5d50604064fbe9c1acad600d072403e2292821 | JavaScript | YooHannah/Gophers | /js/music.js | UTF-8 | 601 | 2.734375 | 3 | [] | no_license | // 音乐
class Music {
constructor(name) {
this.audio = new Audio();
this.load(name);
}
load(name) {
this.audio.src = `../music/${name}.mp3`;
}
play() {
// readyState == 0 无音频就绪信息
// readyState == 1 无元数据
// readyState == 2 无数据播放下一秒/帧
// readyState == 3 当前及下一秒是可以用
// ... | true |
1c8e89737929ba811edba2d5eb12ca07f10e343a | JavaScript | jinhaochan/pyflow | /src/static/js/model/flow.js | UTF-8 | 9,045 | 2.84375 | 3 | [
"MIT"
] | permissive | define([], function() {
var Flow = function(id, name) {
this._flow = {};
this._flow.id = id;
this._flow.name = name;
this._flow.nodes = [];
this._flow.links = [];
this._result = undefined; // store flow running results
};
Flow.prototype.flow = function() {
... | true |
7b24ab650f9b96bf2bcf44db0e89543f94dcf510 | JavaScript | moshhasa/react_forms | /src/components/BasicForm.js | UTF-8 | 2,707 | 2.921875 | 3 | [] | no_license | import useInput from "../hooks/use-input";
const BasicForm = (props) => {
const {
value: firstName,
hasError: firstNameHasError,
isValid: firstNameIsValid,
valueChangeHandler: firstNameValueChangeHandler,
valueBlurHander: firstNameBlurHandler,
reset: resetFirstName,
} = useInput((value) => ... | true |
5640cfe0b9fe9368e237b4df33c368a93cdd4fd7 | JavaScript | LuuuFan/demo | /frontend/reducers/canvas.js | UTF-8 | 473 | 2.5625 | 3 | [] | no_license | import {RECEIVE_CANVAS, REMOVE_CANVAS} from '../actions/canvas';
const canvasReducer = (state={}, action) => {
Object.freeze(state);
let newState;
switch(action.type){
case RECEIVE_CANVAS:
newState = Object.assign({}, state);
newState[action.id] = action.canvas;
return newState;
case REMOVE_CANVAS:
... | true |
142eb92e6d8c9952aabaaf316e9ba381834204e6 | JavaScript | Akrabut/Pet-Hospital | /server/src/utilities/error_helper.js | UTF-8 | 344 | 2.671875 | 3 | [] | no_license | function errorFactory(type, message, context) {
const error = new Error();
error.message = message;
error.name = type;
error.context = context;
return error;
}
function generateError(res, code, type, message, context) {
return res.code(code).send({ error: errorFactory(type, message, context) });
}
module.... | true |
39c4ad89a36bab428f775814e36e4ce0594ea73c | JavaScript | gigix/shivaganda | /village-ziggy/village-ziggy-app/assets/www/enketo/js/webform-drishti-all.js | UTF-8 | 176,884 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | /**
* Pads a string with prefixed zeros until the requested string length is achieved.
* @param {number} digits [description]
* @return {String|string} [description]
*/
String.prototype.pad = function(digits){
var x = this;
while (x.length < digits){
x = '0'+x;
}
return x;
};
var profilerRecords = []... | true |
882f5b1e24cdf922f8873986a54920cde12cabdf | JavaScript | MahmoudSayed96/hackerrank | /10-Days-Of-JavaScript/Day 2/loops.js | UTF-8 | 456 | 4.21875 | 4 | [] | no_license | /*
* Complete the vowelsAndConsonants function.
* Print your output using 'console.log()'.
*/
function vowelsAndConsonants(s) {
let temp = "";
for (let i = 0; i < s.length; i++) {
if (s[i] === 'a' || s[i] === 'e' || s[i] === 'i' || s[i] === 'o' || s[i] === 'u') {
console.log(s[i]);
... | true |
711c1f0e2176579484fa2d001a6f6669c28d8a94 | JavaScript | tjcchen/use-state-effect | /src/OtherComponent.js | UTF-8 | 576 | 2.59375 | 3 | [] | no_license | import React, { useEffect } from 'react';
const OtherComponent = () => {
// ComponentDidMount, ComponentDidUpdate, ComponentWillUnmount
// are all combined into useEffect hook
useEffect(() => {
// empty dependencies will help trigger componentDidMount hook
console.log('ComponentDidMount triggered');
... | true |