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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2fd22ae6f0d4c7baa111af58f103f713f611ce77 | JavaScript | Shivani8984/nucampsiteServer | /models/campsite.js | UTF-8 | 1,847 | 2.765625 | 3 | [] | no_license | const mongoose = require('mongoose'); //importing mongoose
const Schema = mongoose.Schema; //making a shorthand to the mongoose.schema function for us so that we can just refer to it as schema
require('mongoose-currency').loadType(mongoose); //this will load the new currency type in the mongoose so that it's available... | true |
c00766dae1ae892be7369eb298a90744ff3b6087 | JavaScript | shnere/GAGraphColoring | /static/js/GA_GraphColoring.js | UTF-8 | 6,656 | 3.15625 | 3 | [] | no_license | //$(document).ready(function(){
/* Declarar Variables y Objetos
-------------------------------------------------- */
var nodes;
var population;
var time;
var replacement;
var connections;
var solution;
var fitness;
// Correccion de datos de entrenamiento
$("#calcular").live('click',function (event){
e... | true |
d35db76a05b9e863c93c26041bc15713230b2ea8 | JavaScript | maplexu/fullstack- | /node后台/node爬虫/jsdom.js | UTF-8 | 413 | 2.8125 | 3 | [] | no_license | //jsdom的基本用法
const JSDOM = require('jsdom').JSDOM;
const fs = require('fs');
fs.readFile('test.html', (err, buffer) => {
if(err){
console.log(err);
}else{
let html = buffer.toString();
let jsdom = new JSDOM(html);
let document = jsdom.window.document;
let $ = document.querySelectorAll.bind(d... | true |
b6aa61c0bbdc3d6408882d8ce0f31262d8d17d5d | JavaScript | EthanEFung/checker-tron-3000 | /client/js/models.js | UTF-8 | 3,671 | 3.5625 | 4 | [
"MIT"
] | permissive | //Checkers is played by two players.
// The board consists of 64 squares, alternating between 32 dark and 32 light squares.
// The board is positioned so that each player has a
//light square on the right side corner closest to him or her.
// Each player begins the game with 12 colored discs.
//(Typically, one set o... | true |
5d5bf9193dce7b4e8039c52258c9a35f71dafd32 | JavaScript | justinmattos/jpfp | /client/store/student/studentList.js | UTF-8 | 723 | 2.515625 | 3 | [] | no_license | import axios from 'axios';
import { setStudentDetail } from './studentDetail';
const SET_STUDENT_LIST = 'SET_STUDENT_LIST';
export const setStudentList = (students) => {
return {
type: SET_STUDENT_LIST,
students,
};
};
export const fetchStudentList = ({ sort, page, size }) => {
return (dispatch) => {
... | true |
bf5d04741e528e5bf7b2cc51459d88093b8625b0 | JavaScript | NikolasMelui/nodejs-noframeworks | /src/lib/logs.js | UTF-8 | 4,366 | 2.921875 | 3 | [
"MIT"
] | permissive | /**
* Library for storing and rotating logs
*/
import fs from 'fs';
import path from 'path';
import zlib from 'zlib';
const logs = {
baseDir: path.join(__dirname, '../data/logs'),
// Append a string to the file. Create the file if it does not exist.
append: (file, string, callback) => {
// Open the file f... | true |
3f839c42d72d3ed46319d655de445826294be135 | JavaScript | wharley/myBarbecue | /api/company/companyService.js | UTF-8 | 2,099 | 2.65625 | 3 | [] | no_license | 'use strict'
const Company = require('./company')
const errorHandler = require('../common/errorHandler')
Company.methods(['get', 'post', 'put', 'delete'])
Company.updateOptions({new: true, runValidators: true})
Company.after('post', errorHandler).after('put', errorHandler)
Company.before('post', validateCnpj).before(... | true |
f8f179786845bc4cf964cf862d44101e9f455c0e | JavaScript | krishnajc/nodetours | /data/customers.js | UTF-8 | 2,626 | 2.609375 | 3 | [
"MIT"
] | permissive | const logger = require('../utilities/loggers')
var Customers = function() {
// GET all
this.getCustomers = function(dbo, callback) {
dbo.collection('customers').find({}, {projection:{_id: 0}}).toArray(function(err, data) {
if (err) {
logger.error(`getCustomers : Error reading customers db`);
... | true |
07cafd9f31836063fa03ae151d6537b153116954 | JavaScript | Pabloandumundu/Tagstoo | /js/utils.js | UTF-8 | 6,085 | 2.546875 | 3 | [
"MIT"
] | permissive | /*
* Copyright 2017-2018, Pablo Andueza pabloandumundu@gmail.com
* This file is part of Tagstoo.
* Tagstoo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your opti... | true |
c19b7c308dd8bfb86f5fe1b5a19fd1706003f04f | JavaScript | hinterlist/booklytrip-graphql | /src/lib/dataLoaders/mongoDataLoader.js | UTF-8 | 1,400 | 2.921875 | 3 | [] | no_license | /**
* A thin layer around DataLoader that query data from mongodb
* and normalize results.
*
* USAGE:
* const loader = mongoDataLoader('_id', Cities);
*
* // Load city with ID "1"
* loader.load(1);
*
* @flow
*/
import DataLoader from 'dataloader';
import { toString } from 'lodash';
type Options = {
cac... | true |
4db970606064661eb467d300e9053ac97ee9d114 | JavaScript | pshihn/stone-work | /src/tiler.js | UTF-8 | 2,632 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | const _registry = {};
export class TilerRegistry {
static add(name, classType) {
_registry[name] = classType;
}
static type(name) {
return _registry[name];
}
}
export class Tiler {
constructor(element, options) {
this._root = element;
this._options = options;
this.clear();
}
create... | true |
4c815db9f73f1921352bed08e5b8ade8ae55255d | JavaScript | shyoucc/brace | /src/proxy.js | UTF-8 | 588 | 2.59375 | 3 | [] | no_license | /*
@代理模式
*/
const proxy = {}
var mult = function() {
var result = 1;
for(var i = 0, l = arguments.length; i < l; i++) {
result = result * arguments[i]
}
return result
}
let multProxyFn = function (fn){
// 缓存加入
let cache = {}
return function(){
let args = Array.prototype... | true |
89d8926ff190bfbd301a9194edf48f7ba952aca1 | JavaScript | Sonobe-br/fundamentos-javaScript_tipos-variaveis-fun-es | /console.js | UTF-8 | 1,405 | 4 | 4 | [] | no_license | //log -> registro
/* const minhaVar = true;
console.log(245);
console.log('sou um texto');
console.log(minhaVar);
*/
//tratamento de erro!
console.error('erro na linha 10')
/* Embora seja o mais utilizado, .log() é um dos vários métodos que podemos utilizar para exibir
informações na chamada “saída padrão” - o ter... | true |
89c08eeb4b577898fb70626380cb016762326a57 | JavaScript | ayiyiyiyi/react-sutdy | /my-react/src/components/TodoInput/index.js | UTF-8 | 1,283 | 2.90625 | 3 | [] | no_license | import React, { Component, createRef} from 'react'
//通过 ref 来获取react组件或 dom 元素,要使用 ref 之前必须先调用 React.createRef 方法 来创造一个 ref
import propTypes from 'prop-types'
export default class TodoInput extends Component {
static propTypes = {
btnText: propTypes.string
}
static defaultProps = {
btnText: "ADD"
}
co... | true |
e6bc43408fddfca39afadad6f21744646dc40195 | JavaScript | wild-programmer/core | /mycore.js | UTF-8 | 31,599 | 3.46875 | 3 | [] | no_license | /**
* Created by wlt05 on 2016/12/18.
*/
(function (window) {
//在这里借用数组的方法用call,apply改变push的指向给jQuery添加值 所以这个伪数组的length就会随着改变了
var arr = [];
var push = arr.push;
var toSting = ({}).toString;
var slice = arr.slice;
//判断参数是不是一个html字符串
function isHTML(html) {
if (!!html && html[0] === '... | true |
e9e708f70de89dedbec5efdc3bdbcec60d34afb2 | JavaScript | mjb527/MM_Hayes | /index.js | UTF-8 | 3,438 | 3.21875 | 3 | [] | no_license |
$(document).ready( () => {
// Telephone number must conform to this pattern
$('#tel').mask('(000) 000-0000');
// add all states programmaticaly to the select tag
const states = ['Alabama','Alaska','American Samoa','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','F... | true |
e23b329f994e2bc4077ba00f8523806ce04443b3 | JavaScript | Ankitadoshi/JS_Projects | /Animated_model/index.js | UTF-8 | 496 | 2.734375 | 3 | [] | no_license | window.onload = function(){
var modal = document.getElementsByClassName('modal')[0];
var button=document.getElementById('myBtn');
var closeLink = document.getElementsByClassName('close')[0];
button.onclick = function(){
modal.style.display="block";
}
closeLink.onclick= function(){
... | true |
dd3a4a9f54b4fa3fdc20a362dd3429cf4364c762 | JavaScript | caneta/notes | /js-stuff/es6_test/src/modules.js | UTF-8 | 319 | 2.53125 | 3 | [] | no_license | // Modules: default exports, one per module
export default class Modules {
static get title() {
return 'Modules'
}
static examples() {
console.log('Test!')
}
}
export const sqrt = Math.sqrt
export function square(x) { return x*x }
export function diag(x, y) {
return sqrt(square(x) + square(y))
}
| true |
2badb18af92ab739e866704085c1ac0b92ecddf8 | JavaScript | StPaulStylee/prime_solo_project | /public/scripts/controllers/game.controller.js | UTF-8 | 9,110 | 2.78125 | 3 | [] | no_license | angular.module('pokerApp')
.controller('GameController', GameController);
function GameController(poker, pokerSocket) {
console.log('GameController Loaded');
var ctrl = this;
ctrl.messages = [];
ctrl.table;
ctrl.card1 = {};
ctrl.card2 = {};
ctrl.chipStack;
ctrl.smallBlind;
ctrl.bigBlind;
ctr... | true |
8fc006abf63e3048b1900a4b777d80197a123687 | JavaScript | LalalaAda/Lottery | /lotterysite_v3/Agency/static/Agency/js/memberAndagent.js | UTF-8 | 8,270 | 2.53125 | 3 | [
"MIT"
] | permissive | $(".addmember-btn").click(function(){
username = $("#aum-username").val()
password = $("#aum-password").val()
console.log('click submit button');
if (username.length <6) {
$(".addmember-tips").removeClass('alert-success');
$(".addmember-tips").addClass('alert-danger');
$(".a... | true |
5034d881c8593df9c5d54d30ccc29d0e7bdfbb4e | JavaScript | bhamon/node-odin-http | /lib/SessionStore.js | UTF-8 | 3,836 | 2.640625 | 3 | [
"BSD-2-Clause-Views"
] | permissive | 'use strict';
var lib = {
node:{
crypto:require('crypto')
},
deps:{
q:require('q'),
joi:require('joi')
},
odin:{
util:require('odin').util,
http:{
Session:require('./Session')
}
}
};
/**
@class
@classdesc Session store.
@alias module:odin/http.SessionStore
@desc Con... | true |
cc836b99a4c2a546e0147cacd405f95e4a0b691b | JavaScript | manishkhanchandani/classesrfeb | /manish/reactprjs/healthprint-reactjs/src/components/Questions/InputTextField.js | UTF-8 | 1,750 | 2.5625 | 3 | [] | no_license | import React, {Component} from 'react';
import {FormGroup,FormControl,Image} from 'react-bootstrap';
class InputTextField extends Component {
constructor(props) {
super(props);
var selectedValue = this.props.answered[this.props.data.questionName];
this.state = {value:selectedValue};
... | true |
3b01a7187e8a54e93cd3d86c4937d76cdb3a99f8 | JavaScript | gajus/flow-runtime | /packages/flow-runtime/src/__tests__/__fixtures__/ParameterizedTypeAlias/typeAliasWithDefaultParams.js | UTF-8 | 482 | 2.59375 | 3 | [
"MIT"
] | permissive | /* @flow */
import type TypeContext from '../../../TypeContext';
function makeType (t: TypeContext) {
return t.type("Demo", Demo => {
const T = Demo.typeParameter("T", undefined, t.number());
return t.object(
t.property("x", T)
);
});
}
export function pass (t: TypeContext) {
const type = mak... | true |
06b004b921fcc96d77f165d8fa13c63013d5ea4b | JavaScript | yulianzhilan/BLOG | /blog/src/main/webapp/static/js/simple-validate.js | UTF-8 | 10,448 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | /**
* 非空
* <input type="text" class="required"/>
* 字母
* <input type="text" class="alpha"/>
* 数字
* <input type="text" class="num"/>
* 字母数字
* <input type="text" class="alphanum"/>
* 运单号
* <input type="text" class="awb"/>
* 长度
* $("#inputID").bindValidator({len: 3}); // 3位
* $("#inputID"... | true |
dcd522090b8633c092f4f37b268326503a09048f | JavaScript | edgonza12/Prueba-Agile | /chart.js | UTF-8 | 1,841 | 3.203125 | 3 | [] | no_license |
google.charts.load('current', {'packages':['bar']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() { //Esta funcion crea el chart
var data = google.visualization.arrayToDataTable([ //Se define el array con los valores de los charts
['Mes', 'Enero'],
['Enero', 1000],
['Febrero', 250]... | true |
2a5f2144b6a0629b353c728d0e586abe78a9941f | JavaScript | randyarbolaez/simple-capitalization | /app.js | UTF-8 | 604 | 3.78125 | 4 | [] | no_license | let blah = document.getElementById('blah');
function firstLetterOfEachWordCapitalized(e) {
e.preventDefault();
let sentence = document.getElementById('sentence').value;
sentence = sentence.trim();
let arrayOfWords = sentence.toLowerCase().split(' ');
for (let i = 0; i < arrayOfWords.length; i++) {
let ... | true |
9d305a4747f28532e9d034f29b3f189788aa27cc | JavaScript | mastermatt/advent_of_code | /helpers/math.js | UTF-8 | 2,227 | 3.40625 | 3 | [] | no_license | // Greatest Common Divisor
const baseGcd = (a, b) => (b ? baseGcd(b, a % b) : a);
exports.gcd = (...args) => args.reduce(baseGcd);
// Lowest Common Multiple
const baseLcm = (a, b) => a * (b / baseGcd(a, b));
exports.lcm = (...args) => args.reduce(baseLcm);
// Extended Euclidean algorithm
// https://en.wikipedia.org/w... | true |
cff4d660e66081939475765b2d15f00eefe75a8c | JavaScript | conwasa/GithubAPI | /script.js | UTF-8 | 1,365 | 3.046875 | 3 | [] | no_license | // github user finder example
$(document).ready(function() {
$(document).on('keypress', '#username', function(event) {
if (event.which === 13) { // check the key was <enter>
var input = $(this);
var username = input.val();
console.log('username was: ' + username);
getGithubInfo(usern... | true |
1c9d9644129588b54d9d80eb871ce03fce943667 | JavaScript | AphexHenry/aphexhenry.github.io | /pages/animationCarla/js/StepManager.js | UTF-8 | 3,503 | 3.34375 | 3 | [
"Artistic-2.0"
] | permissive | "use strict";
function StepManager()
{
this.steps = [];
this.time = 0;
this.stepCountTotal = 0;
this.textInBetweenScreen = new TextInBetween();
this.instructionManager = new InstructionManager();
this.timeLast = new Date();
this.States = {STATE_INIT_ANIMATION:0, STATE_RUN_ANIMATION:1, STATE_... | true |
7548e9fc70ceb6a7c60263a24b391171835941ab | JavaScript | Diegoapaps/E-Train | /Frontend/components/createWorkout.js | UTF-8 | 2,035 | 2.65625 | 3 | [] | no_license | import { createWorkoutServer } from '../server connections/workouts.js';
import { closeModal, hideTrainingComponent } from './routineCreator.js';
// server URL
const url = `http://localhost:3000/tracker/workouts`;
const endTrainingBtn = document.querySelector('#end-routine-training');
const trainingContainer = docume... | true |
37a8f97143c4ecbc376f43414d5d87fc6d544dbd | JavaScript | des-yogi/mishka-ad | /docs/js/scripts.js | UTF-8 | 1,222 | 2.546875 | 3 | [] | no_license | "use strict";
var menuBtnToggle = document.querySelector('.main-nav__btn-toggle');
var menuPopup = document.querySelector('.main-nav__list');
//var menuCloseBtn = document.querySelector('.close-btn');
window.addEventListener('DOMContentLoaded', function(event) {
if(menuBtnToggle.classList.contains('main-... | true |
aac5703963eb00f0ed7d19cdc07e081a7183f737 | JavaScript | donilan/dbase | /dbase-web/src/main/resources/statics/js/jquery.utils-0.0.1.js | UTF-8 | 817 | 2.8125 | 3 | [] | no_license | (function($){
$.extend({
insertParam: function(paramStr, key, value) {
key = escape(key);
value = escape(value);
if(paramStr.indexOf('?') == 0) {
paramStr = paramStr.substr(1);
}
var kvp = paramStr.split('&');
var i=kvp.length; var x; while(i--){
x = kvp[i... | true |
c7e818bdf8c71bae424f6499558ae9440333cc4a | JavaScript | gurwinder-sing/vidly | /routes/rentals.js | UTF-8 | 2,704 | 2.765625 | 3 | [] | no_license | const auth = require('../middleware/auth');
const { Rental, validateRentalSchema} = require('../models/rental');
const { Movie } = require('../models/movie');
const { Customer } = require('../models/customer');
const express = require('express');
const mongoose = require('mongoose');
const Fawn = require('fawn');
cons... | true |
dc795f6c896adb8820def6eb890cc6a15422412c | JavaScript | danielboufford/senior-enrichment | /app/reducers/campuses.js | UTF-8 | 2,461 | 2.96875 | 3 | [] | no_license | import axios from 'axios';
const initialState = {
campuses: [],
selectedCampus: {}
}
/* ------------ Actions --------------- */
const GET_ALL_CAMPUSES = 'GET_ALL_CAMPUSES';
const GET_ONE_CAMPUS = 'GET_ONE_CAMPUS';
const CREATE_CAMPUS = 'CREATE_CAMPUS';
const EDIT_CAMPUS = 'EDIT_CAMPUS';
const DELETE_CAMPUS = 'DE... | true |
12fe502a0c7fe341c47e220aa6f21d8355a7adde | JavaScript | Pa7ry/html5-ejercicios | /ejerciciosJS/ejercicio4.js | UTF-8 | 3,713 | 3.21875 | 3 | [] | no_license | var cliente1={
nombreCliente:"Pepito",
direccion_fisica:"CalleAlcala",
email:"pepito@email.es",
tlf:"632154789",
persona_contacto :"Pepita",
facturacion: [2, 25],
setnombreCliente: function (Patri) {
this.nombreCliente=Patri;
},
setDireccion_fisica: function (... | true |
33e72ab08f33f224f10faa10234fb559eaafcb40 | JavaScript | SugarCottonIce/gallery-by-react | /src/components/Main.js | UTF-8 | 10,960 | 2.625 | 3 | [
"MIT"
] | permissive | require('normalize.css/normalize.css');
require('styles/App.scss');
import React from 'react';
import ReactDOM from 'react-dom';
//获取图片相关数据
var imageDatas = require('../data/ImageDatas.json');
/*let yeomanImage = require('../images/yeoman.png');*/
//利用自执行函数,将图片名信息转成图片URL路径信息
imageDatas = ( function genImageURL(imageD... | true |
559e6b30dac07e81caf6dbe18d34b6bcbb0fbb19 | JavaScript | JordanBinder/LSCode | /JS101/problem_set/string_and_text_processing/exer_1.js | UTF-8 | 2,134 | 4.46875 | 4 | [] | no_license | /*
P -Understand the Problem
E -Examples / Test cases
D -Data Structure
A -Algorithm
C -Code
*/
/*
P -
Input: string
Output: boolean value
Explicit requirements:
Implicit Requirements:
Questions:
What kind of loop/iteration might be good for this question (if any)?
Can this be made easier/more readable by breaki... | true |
9c6c075e5d9a12208e49873d2bcccd164c0cb959 | JavaScript | sayudhroy/URGame | /resources/templates/login/login.js | UTF-8 | 3,363 | 3.140625 | 3 | [] | no_license |
function signin() {
username = document.getElementById("username").value;
password = document.getElementById("password").value;
//XHR FOR GETTING THE SALT FROM THE SERVER
var xhr = new XMLHttpRequest();
var url = "getSalt";
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-type",... | true |
27dff160f4fb00ea6ceda9d41484b7bbed267dff | JavaScript | arbyte-br/Arbyte-Atividades | /turma-2/joaopedrobarros777/Lista_8/atividade5.js | UTF-8 | 320 | 3.4375 | 3 | [] | no_license | let rs = require ("readline-sync")
let nome = rs.question("Qual eh o seu nome?\n")
let numeros = []
for (let i = 0; i < 3; i++){
let numerosUsuario = rs.questionInt("digite o numero da posicao: " + (i+1) + "\n")
numeros.push(numerosUsuario)
}
let objeto = {nome: nome, numeros: numeros}
console.log(objeto) | true |
59bca251d1e47363788d45e0e92915375b43bd0e | JavaScript | jeonghwan-kim/functionalstudy | /quiz/high-order-function/index.js | UTF-8 | 1,325 | 4.21875 | 4 | [] | no_license | /*
@everyone 지난 시간 복습퀴즈 나갑니다
아래에 나오는 함수를 함수형으로 구현해 보는게 문제입니다 :)
스텝바이 스텝으로 책에 나온 과정처럼 기본 기능 구현 -> 추상화 -> 함수의 조합으로 문제 해결 이렇게 해보시면 좋습니다
sum(1, 2, 3, 4, 5);
sumArr([1,2,3,4,5]);
safeSum(1, null, 3, 4, 5);
safeMultiply(1, null, 3, 4, 5);
checkObj(객체형인지 확인, 특정프로퍼티가 있는지 확인, 특정 프로퍼티의 값이 숫자인지 확인);
*/
const sum = (...args) =>... | true |
380f48f7ea1c23332bb7f780374b44c55614c9ca | JavaScript | jayz28/Slashbot | /tests/_mixins/enemy/actions/do_nothing.test.js | UTF-8 | 969 | 2.59375 | 3 | [
"MIT"
] | permissive | /*eslint-env mocha */
"use strict";
const Enemy = require('@app/content/enemies').Enemy;
const Character = require('@app/character').Character;
const DoNothingAction = require('@mixins/enemy/actions/do_nothing').DoNothingAction;
describe('DoNothingAction', () => {
describe('getFightActions()', () =>... | true |
6ec013058abbdd9f0a9bd200fb2aa71d50c2837d | JavaScript | rehankhan21/SE-Homework | /JS/numberloop.js | UTF-8 | 183 | 3.125 | 3 | [] | no_license | for (let row = 5; row >= 1; row-- ) {
for (let col = 1; col <= row; col++){
//console.log(row);
process.stdout.write(col.toString());
}
console.log();
}
| true |
f373a8bdd161614b9c55d51b373e9276c980737f | JavaScript | tulusibrahim/quizApp | /public/index.js | UTF-8 | 3,081 | 3.171875 | 3 | [] | no_license | let ask = document.getElementById('ask')
let option = document.getElementById('option')
let jawaban = document.getElementById('jawaban')
let timer = document.getElementById('timer')
let next = document.getElementById('next')
let current = document.getElementById('currentscore')
let judge = document.getElementById('judg... | true |
51059f35cb90403f5d81115d3b01d8a1764a482a | JavaScript | PokhodniaA/Learning-JS-Hillel | /Лекция 2/Homework 2/EX.3/main.js | UTF-8 | 687 | 3.0625 | 3 | [] | no_license | let whoIsThis = prompt('Кто пришел?', '');
switch (whoIsThis) {
case null:
console.log('Вход отменен.');
break;
case 'Админ':
let password = prompt('Пароль?', '');
switch (password) {
case null:
console.log('Вход отменен.');
break
... | true |
6122d9402d18d9f6e0bf21888e0359a192b40c20 | JavaScript | cappelleMedia/farao | /pages/admin/js/formValidators.js | UTF-8 | 824 | 2.65625 | 3 | [] | no_license | // should dubbles be alowed?
function validatePromoForm() {
$result = {
titel: {'fieldId': '#promoTitle', 'fieldname': 'Titel', 'message': ''},
desc: {'fieldId': '#promoText', 'fieldname': 'Omschrijving', 'message': ''},
start: {'fieldId': '#promoStart', 'fieldname': 'Start datum', 'message'... | true |
f8b917ede1c88d03fd853a64e76e04d2d118a31c | JavaScript | diegohideky/YouChat | /resources/helpers/encrypt.js | UTF-8 | 585 | 2.84375 | 3 | [
"MIT"
] | permissive | var bcrypt = require("bcrypt-nodejs");
module.exports.hash = function (password, callback) {
bcrypt.hash(password, null, null, function(err, hash) {
if (err) callback({success: false, message: "Não foi possível criptografar senha."});
callback({success: true, message: "Senha criptografada", hash: hash});
... | true |
602a74364bd9fa2cbc1f3735f0229b0e112072fd | JavaScript | fidelthomet/r_x0 | /r_x0_node/control.js | UTF-8 | 553 | 2.953125 | 3 | [] | no_license | const radius = 76 / 2
const spread = 240
const steps = 1600
const steps_per_mm = steps / (radius * 2 * Math.PI)
const steps_per_deg = (spread * Math.PI) / 360 / (1 / steps_per_mm)
function rotate (deg = 0, left = true) {
if (left === false) deg = -deg
const steps = Math.round(deg * steps_per_deg)
return [1, ste... | true |
d243d1526d975d45bffeedb8f0be2265cd7ff17a | JavaScript | DawnaS/FCC-Seuss-Quotes | /js/main.js | UTF-8 | 4,927 | 3.046875 | 3 | [] | no_license | // all Dr. Seuss quotes sourced from https://www.goodreads.com/author/quotes/61105.Dr_Seuss
$(document).ready(function() {
var quotes = [ //21
{
quote:"You have brains in your head. You have feet in your shoes. You can steer yourself any direction you choose. You're on your own. And you know what you know.... | true |
c564c76609ad68f0e315bfcffef530681b21cb3c | JavaScript | Shtekata/14.Softuni-ReactJS | /04.Components-Basic-Idea/react-components/src/components/BookList.js | UTF-8 | 2,145 | 2.875 | 3 | [
"MIT"
] | permissive | import { Component } from 'react';
import Book from './Book';
class BookList extends Component {
constructor(props) {
super()
this.state = { compId: {}, isSelected: false }
}
bookClicked = (x) => console.log(`The book ${x} has been added to basket!`)
changeIsSelected = (id) => {
... | true |
81608b3ea36fc23ca2da30ab2de547554ead5865 | JavaScript | G23D/Unity-Scripts | /ReadURL.js | UTF-8 | 1,812 | 2.90625 | 3 | [
"MIT"
] | permissive | #pragma strict
//released under the MIT license by G23D Studios-Kyle "G" www.g23d.com;
//edit between "" below to change to your own URL;
var url = "http://photong23d.azurewebsites.net/read/readusers.aspx";
var textof : String;
textof = "";
//create a global variable to store the web page text
static var dataGlobal =... | true |
dbb149d6c5b09acae83d3f2b990758051be8ccde | JavaScript | Dev-Force/RPCMS | /app/utils/controller/crud-controller-generator.js | UTF-8 | 3,066 | 2.78125 | 3 | [] | no_license | import mongoose from 'mongoose';
/**
* A function that takes 3 arguments and returns a Class to be used as a base for a dao Class
* Available opts are <getAll, getById, save, updateById, deleteById, deleteMultiple>
*
* @param {String} mdl
* @param {String} mdl_plural
* @param {String[]} [opts=[]]
* @param {stri... | true |
85cc76722b90909f0abe6351366ba97fad1d4d67 | JavaScript | Kikamilka/REST_AJAX | /js/loaderData.js | UTF-8 | 1,121 | 2.578125 | 3 | [] | no_license | (function () {
var root = 'http://jsonplaceholder.typicode.com';
$(document).ready(function () {
$.ajax({
url: root + '/albums',
method: 'GET'
}).then(function (albums) {
for (var ind_album = 0; ind_album < albums.length; ind_album++) {
$("<div... | true |
122e974e8faae451b4f4cff9abce9bf656f4cc07 | JavaScript | davidokonji/Chat-App | /public/js/chat.js | UTF-8 | 2,988 | 2.640625 | 3 | [] | no_license | const socket = io();
const message = document.querySelector('#message');
const sendBtn = document.querySelector('#submit');
const locationBtn = document.querySelector('#location');
const messages = document.querySelector('#messages');
const form = document.querySelector('#message-form');
const sideBar = document.query... | true |
91f7a4556ddac3171187bd8bf6c14ab8926dac3d | JavaScript | 974973202/js | /vue/element-ui/utils/create.js | UTF-8 | 757 | 3.109375 | 3 | [] | no_license | // 创建指定组件实例并挂载于body上
import Vue from 'vue';
export default function create(Component, props) {
// 0. 先创建vue实例
const vm = new Vue({
render(h) {
// render方法提供给我们一个h函数,它可以渲染VNode
return h(Component, {props})
}
}).$mount(); // 更新操作
// 1. 上面vm帮我们创建组件实例
// 2. ... | true |
4963dd4ddeb1b1780dbc6c64a9da1d960812568a | JavaScript | Lorexe/YACE | /Yace-war/web/theme/default/script/mycaptcha.js | UTF-8 | 526 | 2.6875 | 3 | [] | no_license | var a = Math.ceil(Math.random() * 10);
var b = Math.ceil(Math.random() * 10);
var c = a + b;
function showCaptcha() {
document.write("<span id='calcul'>" + a + " + " + b +" = </span>");
document.write("<input id='captcha' role='captcha' type='text' maxlength='2' placeholder='?'/>");
}
function validateCaptcha() {... | true |
487ff3e38b1cf560d866e2eab7e86540db927894 | JavaScript | percona/support-snippets | /mongodb/scripts/print_storage_details.js | UTF-8 | 3,375 | 2.65625 | 3 | [] | no_license | //
// Print storage details for all collections and indexes.
// Supports sharded clusters
//
// @author alex.bevilacqua@mongodb.com
// @version 1.2
// @updated 2022-04-19
//
// History:
// 1.2 - Properly filter out views
// 1.1 - Include Document Count / Average Object Size
// 1.0 - Initial Release
// You can remove t... | true |
51462c39071f196d5ccdea793ed5faba01bdbf49 | JavaScript | akurdyukov/backbone.hateoas | /test/spec/embedded/embedded.js | UTF-8 | 3,376 | 2.546875 | 3 | [
"MIT"
] | permissive | /*jshint -W030 */
describe(
'Hal.Embedded',
function() {
describe('initialize', function() {
it('With no models do nothing', function() {
var embedded = new Hal.Embedded();
expect(embedded.attributes).to.be.defined;
expect(embedded.attribut... | true |
9b6b108a89e6e0e06daad239e28c5a30a837a1f8 | JavaScript | siwufeiwu/IFE-2017 | /echarts-7/node/convertData.js | UTF-8 | 4,613 | 2.796875 | 3 | [] | no_license | // 将原始数据转换为满足可视化要求的json格式数据
var fs = require('fs');
var fileIn = './echarts-7/data/rawdata.txt';
var fileOut = './echarts-7/data/converted.json';
fs.readFile(fileIn, function(err, data) {
if (err) {
console.log(err);
} else {
var converted = convert(data);
fs.writeFile(fileOut, JSON.st... | true |
0eb0823634c29ddb28a14bc29a9d783197c1680c | JavaScript | adamstrain2010/pms-api | /server.js | UTF-8 | 2,423 | 2.90625 | 3 | [] | no_license | const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const url = require('url');
var Response = require('./models/response');
var Availability = require('./models/availability');
var RoomAvailability = require('./models/roomAvailability');
var ToDo = require('./m... | true |
b808fc5f1134fea675d44e22b1b0e7ef9c7f5f88 | JavaScript | gs-maker/Solid-Principles | /depInversion_edit.js | UTF-8 | 876 | 3.265625 | 3 | [] | no_license | // refactored for Dependency Inversion
class Store {
constructor(paymentProcessor) {
this.paymentProcessor = paymentProcessor;
}
purchaseBike(quantity) {
this.paymentProcessor.pay(200 * quantity);
}
purchaseHelmet(quantity) {
this.paymentProcessor(15 * quantity);
}
}
// stripe payment in Cents
class Stri... | true |
3d75cb6ce423731520062ce9c56988a7c4d490b8 | JavaScript | locky5/Maximum-Depth-Of-Binary-Tree | /maxdepthofbinarytree.js | UTF-8 | 224 | 2.78125 | 3 | [] | no_license | var maxDepth = function(root) {
function max(root, sum) {
if (root === null) {
return sum
}
return Math.max(max(root.left, sum + 1), max(root.right, sum + 1))
}
return max(root, 0)
};
| true |
89c9bbfa6948a4db5720c30d9acc1d9ab25c7288 | JavaScript | amendias/proyecto02 | /js/main.js | UTF-8 | 1,772 | 2.765625 | 3 | [] | no_license | const scene = new THREE.Scene()
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 )
const renderer = new THREE.WebGLRenderer({ antialias: true})
renderer.setSize( window.innerWidth, window.innerHeight )
document.body.appendChild( renderer.domElement )
var geometry = new T... | true |
b2ae6247fddcedfcf0eae41383bff69183ff83c3 | JavaScript | medcharfi96/holbertonschool-higher_level_programming | /0x12-javascript-warm_up/8-square.js | UTF-8 | 401 | 2.8125 | 3 | [] | no_license | #!/usr/bin/node
let count = 0;
if (process.argv.length < 3) {
console.log('Missing size');
} else if (isNaN(parseInt(process.argv[2]))) {
console.log('Missing size');
} else {
let j;
let sortie = '';
for (count = 0; count < parseInt(process.argv[2]); count++) {
for (j = 0; j < parseInt(process.argv[2]); j... | true |
251fcccd0996264e69023a29a5c102568293cd74 | JavaScript | xiaoiver/vue-ssr-pwa-demo | /server.dev.js | UTF-8 | 1,180 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
* @file server.js
* @author lavas
*/
const LavasCore = require('lavas');
const express = require('express');
const stoppable = require('stoppable');
let port = process.env.PORT || 3000;
let core = new LavasCore(__dirname);
let app;
let server;
function startDevServer() {
app = express();
core.build()
... | true |
086c608770c9ba2c5a7b3d4f10ad41f10262c14e | JavaScript | Sifum/Javascript-pattern | /基本语法规范.js | UTF-8 | 4,796 | 3.84375 | 4 | [] | no_license | //js没有用var声明的变量将作为全局变量
function sum(x,y)
{
result = x +y;
return result; //此处的result即成为了全局变量
}
//使用链式赋值导致成为全局变量的问题
function foo()
{
var a=b=0; //此处变量a为局部变量,但b成为了全局变量。须使用var a,b; a=b=0;的方式
//...
}
/*
由此需要注意:
使用var声明的全局变量是不可以用delete删除的;
没有使用var声明的全局变量是可以用delete删除的。
*/
var global_var = 6;
glob... | true |
643e99031b543f7da637f417bf9608bf77ee5e95 | JavaScript | sis3py/react-large-datasets | /src/PaginationApp.js | UTF-8 | 1,920 | 2.515625 | 3 | [] | no_license | import './App.css';
import Pagination from './Pagination';
import ProductList from './ProductList';
import { createProducts, filterProducts } from "./helper";
import { usePagination } from './hooks/usePagination';
import { useState, useEffect, useMemo } from 'react';
const PaginationApp = () =>{
const [searchText, s... | true |
b4b9c34c6a053fab39ff5e213ce4f0bc08f93e1f | JavaScript | lauraAyala/GrupoB-Desarrollo-Frontend | /frontend/src/componentes/Paginacion.js | UTF-8 | 687 | 2.515625 | 3 | [] | no_license | import React from 'react';
const Paginacion = ({donorsPerPage, totalDonors}) => {
const pageNumbers = [];
for (let i = 1; i <= Math.ceil(totalDonors / donorsPerPage); i++ ){
pageNumbers.push(i);
}
return(
<nav>
<ul className = "paginacion">
{pageNumbers... | true |
9924f43b608df47496a604929e4bcaf9378e0794 | JavaScript | Bilal-Hanif01/JavaScriptAssignment | /chap6.js | UTF-8 | 4,935 | 3.8125 | 4 | [] | no_license | //...................
// 1. Write a program to take a number in a variable, do the
// required arithmetic to display the following result in your
// // browser:
// document.write("<h1> RESULT : </h1>"+" "+ "<p> </ p>");
// var a =10;
// document.write(" The value of a is: "+""+a+ "<p> </ p>");
// document.write(" ........ | true |
51937b11297ed580dad580817632a31913e4a1cf | JavaScript | rhildred/PROG1795Javascript | /public/js/getTax.js | UTF-8 | 400 | 2.671875 | 3 | [
"MIT"
] | permissive | var getTax = function(nIn, sProv){
if(typeof sProv == "undefined") sProv = 'ON';
if(sProv == 'PEI'){
return (nIn * 1.14).toFixed(2);
}else if(sProv == 'NB' || sProv == 'NL' || sProv == 'ON'){
return (nIn * 1.13).toFixed(2);
}else if(sProv == 'NS'){
return (nIn * 1.15).toFixed(2);
}
return (nIn * 1.... | true |
1ab881f70a51f0e0188f913780c389a61f6e9f4f | JavaScript | CodingGabe/cf-todo | /src/components/todo.js | UTF-8 | 3,028 | 3.203125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import './todo.css';
// function set the state for tasks
// provides line through class if 'complete' is clicked
function Task({ task, index, completeTask, removeTask }) {
return (
<div
className="list-item"
style={{ textDecoration... | true |
4f7e6309df15bd05b4b506e182b8d05c82e48ed1 | JavaScript | migunovaia71/1366763-kekstagram-21 | /js/utils.js | UTF-8 | 557 | 2.828125 | 3 | [] | no_license | 'use strict';
(function () {
const DEBOUNCE_INTERVAL = 500; // ms
const getRandomInt = (minValue, maxValue) => {
return Math.floor(Math.random() * (maxValue - minValue + 1)) + minValue;
};
window.utils = {
getRandomInt
};
window.utils.debounce = function (cb) {
let lastTimeout = null;
... | true |
982d9b9139b87b95e440eb553b7e4597d8082166 | JavaScript | AIUshedo/core-engineering | /engineering-22/week-3/jquery-intro/dom-lab-starter-code/js/index.js | UTF-8 | 343 | 3.453125 | 3 | [] | no_license | $(function() {
Math.floor(Math.random() * 6) + 1;
var $dotInInner = $(".innerSquare");
$($dotInInner).addClass("dot");
var array = [1, 2, 3];
$(array).each(function(index, number){
console.log(number);
});
});
//Manipulate those elements so that they will or won't
//show a black dot depending on... | true |
e3e8d174375b9c7cb6bbce00c645df0784fde2a7 | JavaScript | cvazac/detect-native-overrides | /src/detect.js | UTF-8 | 4,038 | 2.625 | 3 | [
"MIT"
] | permissive | var getPrototypeOf = require('./getPrototypeOf').getPrototypeOf
function detectNativeOverrides() {
var overridden = []
if (Object.getOwnPropertyNames) {
var iframe, freshWindow, objects, serializer;
function setup() {
var d = window.document
iframe = d.createElement('iframe')
iframe.styl... | true |
cce368bfa7201eb7c80af16ac6fb102f586eb156 | JavaScript | whymog/advent-of-code-2018 | /2/2.js | UTF-8 | 1,033 | 3.390625 | 3 | [] | no_license | const fs = require('fs');
const readline = require('readline');
const file = fs.createReadStream('data.txt');
const lineReader = readline.createInterface({
input: file,
});
const sourceArray = [];
const repeats = {
two: 0,
three: 0,
};
lineReader
.on('line', function(input) {
sourceArray.push(input);
... | true |
0e79cc0b8bc98f609ac484bf5217ef41c149ab9a | JavaScript | JMarSar/IMDB | /clases.js | UTF-8 | 3,960 | 2.90625 | 3 | [] | no_license | "use strict";
exports.__esModule = true;
exports.nuevaPelicula = exports.jsonToImdb = exports.imdbToJson = exports.Imdb = exports.Movie = exports.Professional = void 0;
var fs = require("file-system");
var rls = require("readline-sync");
var Professional = /** @class */ (function () {
function Professional(name, ag... | true |
757e4c6e1c78f63e37500862d99fac357deb3c06 | JavaScript | SandeshCharka/Bamazon | /Customer.js | UTF-8 | 4,148 | 2.90625 | 3 | [] | no_license | require("dotenv").config();
var mysql = require("mysql");
var inquirer = require("inquirer");
var Table = require('cli-table');
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: process.env.MYSQL_SERVER_PASSWORD,
database: "bamazonDB"
});
connection... | true |
8d9d3d1ba74aa75a4138abbd5f5b68aa76b5c9d1 | JavaScript | dardosordi/lux | /src/packages/database/__tests__/validation.test.js | UTF-8 | 740 | 2.609375 | 3 | [
"MIT"
] | permissive | /* @flow */
import Validation from '../validation'
describe('module "database/validation"', () => {
describe('class Validation', () => {
describe('#isValid()', () => {
const validator = (value = '') => value.length >= 8
test('returns true when constraints are met', () => {
const subject = n... | true |
cbe613569bef5e01f4ccff60c588b44e228d8d35 | JavaScript | BraidenWinegar/shelfie | /src/Components/Form/Form.js | UTF-8 | 2,627 | 2.734375 | 3 | [] | no_license | import React from 'react'
import axios from "axios"
class Form extends React.Component {
constructor(){
super();
this.state={
name: '',
price: 0,
imgUrl: ''
}
}
handelChange = (e) =>{
let {name} = e.target;
this.setState({
... | true |
5dc76ba79b5f06dcb92ca698a77ac283814f420e | JavaScript | sergey-podunov/amperka | /projects/LCD.js | UTF-8 | 2,509 | 2.953125 | 3 | [] | no_license | const NUM_ITEMS = 2;
const COLOR = { BLACK:0, YELLOW:1, GREEN:2, RED:3, WHITE:3 };
const FONT_SIZE = 25;
const LINE_MARGIN = 5;
var backLightPin = P6;
backLightPin.set();
var isLightOn = true;
var buttonPin = P12;
var cursorPin = P13;
pinMode(buttonPin, 'input_pullup');
pinMode(cursorPin, 'input_pullup');
var butt... | true |
12cca0f2ca6e759b0a5e519f0f420f2c39e6dfc6 | JavaScript | juliao/DilbertComicStrips | /background.js | UTF-8 | 4,639 | 3.1875 | 3 | [
"BSD-2-Clause"
] | permissive | /**
*
* This script is part of "Dilbert Comic Strips" Web Browser Extension, available at:
* Chrome: https://chrome.google.com/webstore/detail/dilbert-comic-strips/gpjlhjgiccobkcodaeimjbcjckpcnbjp
* Firefox: https://addons.mozilla.org/en-US/firefox/addon/dilbert-comic-strips/
*
* "Dilbert Comic Strips" fetc... | true |
d72da808463a6eeb676d3b2c3807929692be9d76 | JavaScript | NTACT/transition-gradebook-client | /src/utils/getReportFileName.js | UTF-8 | 916 | 2.640625 | 3 | [] | no_license |
export default function getReportFileName(reportName, {startYear, startTerm, endYear, endTerm, student, filtered}) {
try {
const startTermLabel = (!startTerm || startYear.termType === 'annual')
? ''
: `-${startYear.termType[0].toUpperCase()}${startTerm.index + 1}`;
const endTermLabel = (!endYea... | true |
f103a2acfc6e3a953c9f326e477ab70ec5cca403 | JavaScript | lamovo/seaside-slider | /js/is-descendant.js | UTF-8 | 415 | 2.921875 | 3 | [] | no_license | define(function() {
return function(ancestor, descendant) {
var hasId = descendant.hasAttribute('id');
// add temporary id
if(!hasId) descendant.setAttribute('id', 'temp' + +new Date());
// query the id against the ancestor
var result = ancestor.querySelector('#' + descendant.getAttribute('id'));
// remo... | true |
5851e26e53827322bda9cef8d0a4fb89bb73f278 | JavaScript | hateinternet/brain-games | /src/games/prime.js | UTF-8 | 696 | 3.15625 | 3 | [] | no_license | import makeGame from '..';
import getRandomNumber from '../utils';
const isPrime = (num) => {
if (num < 2) {
return false;
}
if (num === 2) {
return true;
}
const iter = (divider) => {
if (divider >= num / 2) {
return true;
}
if (num % divider === 0) {
return false;
}
... | true |
04085c73c9e788830e29f1248985a2337f77f83f | JavaScript | azhu7/DonutTycoon | /js/tabDonutShop.js | UTF-8 | 14,132 | 3.09375 | 3 | [] | no_license | /**
* Author: Alexander Zhu
* Date Created: May 8, 2018
* Description: Donut Shop tab logic for Donut Tycoon.
*/
/** Format night player info. */
function setNightPlayerInfo() {
logger.info("setNightPlayerInfo(): Setting night player info.");
$("#dayInfo").html(`Night ${player.day}`);
$("#player... | true |
66a22805ce14f55f36f814d0fe326ed2e89be7aa | JavaScript | RogueArt/freecodecamp-projects | /apis-and-microservices/boilerplate-project-exercisetracker/server.js | UTF-8 | 4,374 | 2.9375 | 3 | [] | no_license | const express = require('express')
const app = express()
const cors = require('cors')
require('dotenv').config()
// Models for manipulating data
// const { Exercise } = require('./models/exercise.js')
const { User } = require('./models/user.js')
// Connect to database
const mongoose = require('mongoose')
mongoose.con... | true |
c9b06e10e40917a403fe4f643f43e7673099a842 | JavaScript | ItsMattG/vision-work | /resources/js/scripts.js | UTF-8 | 2,990 | 2.703125 | 3 | [] | no_license | $(document).ready(function() { /* document.ready means the code can only run after the document has been loaded */
/* For the sticky navigation */
$('.js--section-features').waypoint(function(direction) { /* the direction allows us to choose wherever or not the function will run depending on the direction */
... | true |
1994921ab57de8b978007d352f2825c5b6fe71fd | JavaScript | danfitz/juno | /jsFundamentals/Exercises/2019-07-11-counterFinalFiles/script.js | UTF-8 | 1,656 | 3.40625 | 3 | [] | no_license | $(document).ready(function() {
let counter = 0;
let goal;
const $counter = $(".counter");
const $goal = $("#goal");
const $submit = $("input[type='submit']");
const checkGoal = () => {
// if goal reached, give alert and reset everything
if (counter === goal) {
... | true |
b249a4d791e79e0b0c272ed8d5335a73bdb234b6 | JavaScript | yildirim038/hicoders-modul3 | /week12/okul kayit sistemi/routes/teachers.js | UTF-8 | 1,199 | 2.578125 | 3 | [
"MIT"
] | permissive | import express from 'express';
var router = express.Router();
import * as service from '../service/teachers-sevice.js'
/* GET teachers listing. */
router.get('/', async function(req, res, next) {
const allTeachers = await service.getAllTeachers();
res.send(allTeachers);
});
/** Add a new teachers */
router.post('... | true |
7414da9ea126806d53258edaec5f1a47be742746 | JavaScript | zhuxiaoyu1019/note-taker | /server.js | UTF-8 | 1,741 | 2.546875 | 3 | [
"MIT"
] | permissive | const express = require('express');
const fs = require('fs');
const path = require('path');
const { v4: uuidv4 } = require("uuid")
const app = express();
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(express.static('public'));
app.get("/notes", (req, res) => {
res.sendFile(path... | true |
4b20a4b11fec78a1542a5e158c2e5ea7f29da94c | JavaScript | itzzmeakhi/kart | /src/redux/cart/cart.reducer.js | UTF-8 | 1,886 | 2.640625 | 3 | [] | no_license | import { CartActionTypes } from './cart.types';
import { addQuantityToProd, removeQuantityToProd } from './cart.utils';
const initialState = {
cartItems: [],
noOfItemsInCart: 0,
error: null
}
const cartReducer = (state = initialState, action) => {
switch(action.type) {
case CartActionTypes.AD... | true |
c089d27a60eca6decc4dd99311b0930de083a33d | JavaScript | anyuxuan/destructure-array | /index.js | UTF-8 | 1,048 | 3.515625 | 4 | [] | no_license | const isType = (type) => (obj) => Object.prototype.toString.call(obj) === `[object ${type}]`;
const isString = isType('String');
const isArray = Array.isArray || isType('Array');
function destructuringArray(targetArray, formatter) {
try {
const REG = /\w+/g;
if (isString(formatter)) {
formatter = JSON... | true |
ccd64f2ad701186c7e3c71808b7477bf594f0e84 | JavaScript | Habibka/MentorMate | /PrintLogo.js | UTF-8 | 2,972 | 3.65625 | 4 | [] | no_license | function printLogo(characterWidth) {
if (characterWidth < 2 || characterWidth > 10000 || characterWidth % 2 == 0) {
console.log('The given number is invalid, please enter odd number between 2 and 10000');
return;
}
let maximumRows = characterWidth + 1;
let rowCharacterLength = c... | true |
aa4894d887e486bc78dab1947910c6feb71a42d6 | JavaScript | xiaoRoy/java-script-play-ground | /src/chap6/deleting-properties.js | UTF-8 | 851 | 4 | 4 | [] | no_license | /**
* 6.3 Deleting propterties
*/
var dog = {
name: "Dog",
age: "2",
price: 44.0
}
delete dog.price; // Delete x, and return true.
delete dog.price; // Do nothing(price doesn't exist), and return true.
delete dog.toString(); // Do noting(toString is inherited property), and return true.
delete 44; // No... | true |
b9a603a0dc46fef486478ff19b58810c8185c643 | JavaScript | PENG-GDPR-Data-Tracking/reusable-component | /demo/src/client-1/web/app.js | UTF-8 | 478 | 3.390625 | 3 | [] | no_license | let counter = 0;
const call = url => {
const callCounter = counter++;
document.querySelector('#log').innerHTML += `Call id:${callCounter}, ${url}<br>`;
// Using fetch: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
fetch(url)
// fetch(url, { mode: 'no-cors' })
.then(res => res.... | true |
8e6ef4b05170c972165d297b0d847bb6545b2619 | JavaScript | kathakkar/spinner | /spinner2.js | UTF-8 | 246 | 2.78125 | 3 | [] | no_license |
spinner = ['\r|','\r/','\r-','\r\\','\r|','\r/','\r-','\r\\'];
spinnerTimeout = 100;
for (let i = 0; i < spinner.length; i++) {
setTimeout(() => {
process.stdout.write(spinner[i] + ' ');
}, spinnerTimeout);
spinnerTimeout += 200;
}
| true |
de8d1f2ff54f3f1c391da9b82dd524c540c69ef9 | JavaScript | tomalexander/kbot | /plugins/holiday.js | UTF-8 | 1,768 | 2.5625 | 3 | [] | no_license |
var http = require('http')
, util = require('util')
, format = util.format
, plugin = module.exports = {}
;
plugin.rb = function rb(channel) {
var client = this.bot.client;
http.get({
host: this.config.host
, port: this.config.port
, path: this.config.path
}, function(res) {
var buf = [];
... | true |
9d3d8c6b8e48ca393bba223b04c67dd2e4051298 | JavaScript | alemas/pokemon-api-populator | /bin/index.js | UTF-8 | 4,904 | 2.984375 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env node
var request = require('request');
var fs = require('fs');
const cliProgress = require('cli-progress');
const colors = require('colors');
var arguments = process.argv.splice(2, process.argv.length -1).join(' ')
console.log(arguments);
// fs.readFile("./data/first_generation.json", function(err, da... | true |
4cd1a09398a707d4f9c69b79b292658f0ac653ba | JavaScript | JacobWazydrag/jsdom-fetch-dog-ceo-challenge-chi01-seng-ft-062220 | /src/index.js | UTF-8 | 1,905 | 3.546875 | 4 | [] | no_license |
document.addEventListener('DOMContentLoaded', function(){
fetchImages();
fetchBreeds();
});
function fetchImages (){
const imgUrl = "https://dog.ceo/api/breeds/image/random/4"
fetch (imgUrl)
.then(res => res.json())
.then(results => {
results.message.forEach(imageurl => ... | true |
a8d97354871edb46bd8d066a3af9f94bcd84f5f6 | JavaScript | DanielAbedoy/methmat | /src/views/dos/Biseccion/Form.jsx | UTF-8 | 5,969 | 2.890625 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from 'react';
import { Row, Col, Input, Button } from 'reactstrap';
import Evaluador from '../../../utils/Evaluador';
const Form = ({ state }) => {
const [funcion, setFuncion] = useState('pot(x,3)+3*pot(x,2)+12*x+8');
const [x0, setX0] = useState(0);
const [x1, setX1] = use... | true |
4b6097058524da1f6968ba458b921db17a23c440 | JavaScript | sampreethamithkumar/Node.js | /vidly/index.js | UTF-8 | 1,921 | 3.15625 | 3 | [] | no_license | const Joi = require('joi');
const express = require('express');
const app = express();
app.use(express.json());
const genres = [
{ id: 1, type: "Action"},
{ id: 2, type: "Thriller"},
{ id: 3, type: "Crime"}
];
// GET request for all the genres
app.get(`/api/genres`, (req,res) => {
res.send(genres);
... | true |