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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
acf21b82cd10cbc5627b29a91b4350c165340720 | JavaScript | liuyanxing/leetcode | /sort/quick-sort.js | UTF-8 | 618 | 3.75 | 4 | [
"MIT"
] | permissive | function quickSort(nums, left, right) {
if (left < right) {
let partitionIndex = partition(nums, left, right)
quickSort(nums, left, partitionIndex - 1)
quickSort(nums, partitionIndex + 1, right)
}
}
function partition(nums, left, right) {
let pivot = left
let index = pivot + 1
for (let i = index;... | true |
3b43dd78d824c1743a8e24bd8d63add6a4329dd4 | JavaScript | jyschwrtz/leetCode-practice | /binary_search/search_in_rotated_sorted_array.js | UTF-8 | 1,169 | 3.6875 | 4 | [] | no_license | /**
* @param {number[]} nums
* @param {number} target
* @return {number}
*/
var search = function(nums, target) {
if (nums.length === 0) {
return -1;
} else if (nums.length === 1) {
if (nums[0] === target) {
return 0;
} else {
return -1;
}
}
le... | true |
d0f790ceedb3ef60e6d381e7fbcc350f4a5e77a0 | JavaScript | Raellopes368/portal_do_sertao | /src/model/Autor.js | UTF-8 | 1,571 | 2.71875 | 3 | [] | no_license | const Database = require('../db/config')
module.exports = {
async get(){
const db = await Database()
const data = await db.all(`SELECT * FROM autor `)
await db.close()
return data.map( autor =>({
id: autor.id,
nome: autor.nome,
profissao: autor... | true |
79dcd5df0d59de3603084bafe5dccb00329df803 | JavaScript | MuhammeedAlaa/Chemistry-app | /routes/admin.js | UTF-8 | 10,383 | 2.515625 | 3 | [
"MIT"
] | permissive | // jshint esversion:8
const express = require('express');
const _ = require('lodash');
const {getAssistInfo, getCourseInfo, getCenterInfo, getlectureInfo} = require('../databaseUtils/info');
const {insertAssistant, insertCenter, insertCourse, isCodeUsed, insertNewLecture, insertNewExam} = require('../databaseUtils/... | true |
cb2f97b8ae2479f1af1f03610296092b4505156e | JavaScript | Lan714/Password-Generator | /script.js | UTF-8 | 1,168 | 3.6875 | 4 | [] | no_license | document.getElementById('generate').addEventListener('click', () => {
event.preventDefault()
let length = prompt('Enter between 8 and 128 characters')
while (length < 8 || length > 128) {
alert('Please enter requested character amount.')
length = prompt('Enter between 8 and 128 characters')
}
let l... | true |
af03bb3edd9c11831dbee42fa3386974a5425b05 | JavaScript | EconClass/Smart_Art_API | /controllers/cards.js | UTF-8 | 1,306 | 2.5625 | 3 | [] | no_license | const express = require('express'),
app = express(),
Card = require('../models/card.js');
Deck = require('../models/deck.js');
module.exports = (app) => {
// CREATE
app.post('/api/deck/:id/card ', async (req, res) => {
let card = new Card(req.body)
Deck.findOne({ _id: req.params.id }).then( dec... | true |
1a2505133a0640d9b463345fca415142269d451e | JavaScript | TylorKelley/Final-Project | /DieRoller/script.js | UTF-8 | 5,147 | 2.9375 | 3 | [] | no_license | var $die = $(".die"),
sides = 20,
initialSide = 1,
lastFace,
timeoutId,
transitionDuration = 500,
animationDuration = 3000;
$("ul > li > a").click(function () {
reset();
rollTo($(this).attr("href"));
return false;
});
function randomFace() {
var face = Math.floor(Math.random() * sides) + initialS... | true |
47e6a9e5d694d7e0496abeb83615bbf848709b35 | JavaScript | sergii-yastremskyi/goit-js-hw-10-food-service | /src/index.js | UTF-8 | 982 | 2.671875 | 3 | [] | no_license | import './sass/main.scss';
import cards from '../menu.json';
import templateCard from './templates/templateCard.hbs'
function markupCards (obj) {
return obj.map(templateCard).join('')
}
const linkForRender = document.querySelector('.js-menu')
linkForRender.insertAdjacentHTML('afterbegin', markupCards(cards))
const... | true |
894f4d0a01efe067e510b30afb5ce619ed57815b | JavaScript | jaymovaliya/FCC-Algorithms | /Advance Algorithm Scripting/MapDebris.js | UTF-8 | 594 | 3.140625 | 3 | [] | no_license | function orbitalPeriod(arr) {
var newarr = [];
var GM = 398600.4418;
var earthRadius = 6367.4447;
for (var obj in arr) {
var t1 = 2 * Math.PI;
var t2 = Math.pow(earthRadius + arr[obj].avgAlt, 3);
var t3 = Math.sqrt(t2 / GM);
var orbPeriod = Math.round(t1 * t3);
de... | true |
5ba6d4fc52fb9045aec9109310fc46e34982e539 | JavaScript | joanterm/Mini-Holiday-Project | /index.js | UTF-8 | 1,541 | 3.578125 | 4 | [] | no_license | const revealBtn = document.getElementById("reveal-btn")
const resetBtn = document.getElementById("reset")
const displayArea = document.getElementById("display-area")
const revealedArea = document.getElementById("revealed-area")
const imageArea = document.getElementById("image-area")
const revealedMsg = document.getElem... | true |
bced3401b8df2636126b2ccf093866920c09f436 | JavaScript | fitzgen/geotoy | /wasm/index.js | UTF-8 | 9,843 | 2.625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import { memory } from "./geotoy_wasm_bg";
import {
create_mesh,
points_len,
point_dim,
points,
lines_len,
line_dim,
lines,
triangles_len,
triangle_dim,
triangles,
attractors_len,
attractor_dim,
attractors,
kinds_len,
kind_dim,
kinds,
vertex_shader,
fragment_shader
} from "./geotoy_w... | true |
2fd3dec7dcab5325f5712de2acb0e233a8878650 | JavaScript | abhinav-193/Small_Projects | /text-utils-master/src/App.js | UTF-8 | 1,812 | 2.640625 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | permissive |
import { useState } from 'react';
import './App.css';
import Alert from './components/Alert';
import About from './components/About';
import Navbar from './components/Navbar';
import TextForm from './components/TextForm'
// import {
// BrowserRouter as Router,
// Switch,
// Route,
// Link
// } from "react-rou... | true |
725834f5e98f7a0b7a994d1a9ebc005fbf030e79 | JavaScript | FazleRabbiRana/fund-for-environment-react-spa | /src/components/Selection/Selection.js | UTF-8 | 1,136 | 2.765625 | 3 | [] | no_license | import React from 'react';
import './Selection.css';
const Selection = (props) => {
const selections = props.selectedDonors;
// calculate total amount
const totalReducer = (previous, current) => previous + current.grantedAmount;
const totalAmount = selections.reduce(totalReducer, 0);
// insert class based on to... | true |
25e847402204800a2c3644821e897db386157155 | JavaScript | sky3d/resolve | /packages/core/create-resolve-app/src/test-example-exists.js | UTF-8 | 604 | 2.53125 | 3 | [
"MIT"
] | permissive | const testExampleExists = (pool) => async () => {
const {
fs,
path,
EOL,
resolveCloneExamplesPath,
resolveCloneExamplePath,
exampleName,
} = pool
if (fs.existsSync(resolveCloneExamplePath)) {
return
}
const examplesDirs = fs
.readdirSync(resolveCloneExamplesPath)
.filter((... | true |
2e09ba36a162f933233d0cad391f2bbc28052bd2 | JavaScript | 1VinceP/kanzashi | /src/ducks/starwars.js | UTF-8 | 745 | 2.515625 | 3 | [] | no_license | import * as starwars from './swapi_service'
const initialState = {
person: '',
loading: false
}
const GET_PERSON = 'GET_PERSON'
const GET_PERSON_PENDING = 'GET_PERSON_PENDING'
const GET_PERSON_FULFILLED = 'GET_PERSON_FULFILLED'
function starwarsReducer( state = initialState, action ) {
switch( action.typ... | true |
52383a748ecd05925a26338fa793f11db3c81643 | JavaScript | bfritscher/cours-html-classroom-monitor | /public/main.js | UTF-8 | 6,737 | 2.625 | 3 | [] | no_license | const JWT_KEY = "jwt";
const ASSIGNMENT_KEY = "classroom_html_assignment";
const jwt = localStorage.getItem(JWT_KEY);
let toastError;
let toastSuccess;
function init() {
if (!jwt) {
login();
} else {
const assignment = localStorage.getItem(ASSIGNMENT_KEY);
localStorage.removeItem(ASSIGNMENT_KEY);
i... | true |
c289bed9241753c41b649d85b2794550ec87c20b | JavaScript | manovik/basic-js | /src/vigenere-cipher.js | UTF-8 | 2,341 | 3.09375 | 3 | [
"MIT"
] | permissive | class VigenereCipheringMachine {
constructor(bool = true) {
this.bool = bool;
this.asciiModule = 65;
this.mod = 26;
this.generateDecodeArray
}
encrypt(message, key) {
const upMessage = message.toUpperCase().split('');
const arr = [];
let upKey = key.toUpperCase();
while(upKey.len... | true |
adeec94f0815827f440795acd8f0b2fdf86b7083 | JavaScript | ShaunZh/jirengu--works | /react-todolist/todolist/src/TodoInput.js | UTF-8 | 593 | 2.5625 | 3 | [] | no_license | /*
* @Author: Marte
* @Date: 2017-07-31 10:09:16
* @Last Modified by: Marte
* @Last Modified time: 2017-07-31 15:23:38
*/
import React, {Component} from 'react';
export default class TodoInput extends Component {
render() {
// onChange 和 onKeyPress 是添加事件
return <input type="text" value = {this.props.con... | true |
f7a16f8b075e84fc7914396aaa18c7e0e74ee0ac | JavaScript | detolly/Phantombot-scripts | /speedruncom/speedruncom.js | UTF-8 | 8,660 | 2.703125 | 3 | [] | no_license | //Code courtesy of tSparkles (https://twitch.tv/tSparkles)
//I do commissions for free because learning is fun
(function () {
var client_id = "m4rybj39stievswbum8069zxhxl5y4";
var channel = "thmcs";
// todo list:
// 1. get game and use that string for the gameName.
// 2. get title and ch... | true |
edbd656c2f95ef3d577ac4755a1e9361fe8b455c | JavaScript | tianyingchun/webapp-architecture | /source/app/helpers/utilityApps.js | UTF-8 | 1,868 | 2.515625 | 3 | [] | no_license |
/**
* Util for all normal application helper methods.
* It extends utilitiy.js
*/
(function() {
//*@protected
var normalize = function (url) {
return url.replace(/([^:]\/)(\/+)/g, "$1");
};
var http = /^http/;
var getLocation = function () {
var u = location.protocol,
... | true |
cc6267bec3d84073102840f4c0f807638438bb38 | JavaScript | roybarak80/redux-voting-app | /src/App.js | UTF-8 | 1,291 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import { voteReact, voteAngular, voteVuejs } from './actions';
import './app.css';
class App extends Component {
constructor(props) {
super(props);
this.store = this.props.store;
}
handleVoteAngular = () => {
this.store.dispatch(voteAngular());
}
... | true |
8f9f453bcdfd261faa2c0663a5b2a1063f50a3d3 | JavaScript | JPorts/React-Burger-Order-Builder | /src/components/Burger/Burger.js | UTF-8 | 1,337 | 3.03125 | 3 | [] | no_license | import React from 'react';
import classes from './Burger.css';
import BurgerIngredient from './BurgerIngredient/BurgerIngredient';
const burger = (props) => {
// js Object to extract keys of the object passed in. This will give us the array of ingredients.
let transformedIngredients = Object.keys(props... | true |
19cafbdbce7bfc60801abad594245be7cdf96e3f | JavaScript | source-code-quality-analysis/new-javascript-in-2019 | /0511摇号小工具/app.js | UTF-8 | 2,290 | 2.890625 | 3 | [] | no_license | var vm = new Vue({
el: "#app",
data() {
return {
num: "",
numResult: "",
nameArr:[],
nameInput:"",
nameResult:"",
show:true,
timer:null,
start:true,
stop:false,
}
},
met... | true |
4c84f13493f8dd069705166797c5e932a3577cca | JavaScript | syahn/Problem-solving | /FCC/[29] Map the Debris.js | UTF-8 | 1,004 | 3.828125 | 4 | [] | no_license | // 1. Reflection
// - I solved it with a hint.
// - It's first time using Math.round()
// - Problem might be intended for alternating original obj, but I just made new one.
// 2. Problem
// Return a new array that transforms the element's average altitude into their orbital periods.
//
// The array will contain obj... | true |
84b62c41ba2e1b8c3397a9d46b88ddf47a3cdd4c | JavaScript | Hitsuoyue/daily-practice | /js/001_debounce && throttle/index.js | UTF-8 | 838 | 3.390625 | 3 | [] | no_license | let debouceInputEle = document.getElementById("debouceInput");
let throttleInputEle = document.getElementById("throttleInput");
debouceInputEle.addEventListener("input", debounce(onChange, 1000))
throttleInputEle.addEventListener("input", throttle(onChange, 500))
function onChange(e) {
console.log('e.target.value... | true |
e0fa84ff700bd11f9e16b8b772252ec90aadaac5 | JavaScript | adijes/bringgiton | /common-utils.js | UTF-8 | 1,392 | 2.53125 | 3 | [] | no_license | const commonUtils = {
encodeParamsAsQuery: function(params) {
let query_params = "";
for (let key in params) {
const value = params[key];
if (value !== undefined) {
if (query_params.length > 0) {
query_params += '&';
}
... | true |
ae34e26ca43d9c88e72e8554554fc9a0ea7e4da5 | JavaScript | huanwangUvic/OPMS | /WebRoot/js/typem.js | GB18030 | 2,904 | 2.546875 | 3 | [] | no_license | var xmlHttp = false;
function createXMLHttpRequest(){
if(window.ActiveXObject){
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(ee){
xmlHttp = false;
}
}
}else if(window.XMLHttpRequest){
try{
xmlH... | true |
2a5d258ee55461000d06abb8129b1bbc997ca076 | JavaScript | Toyfon/FreeCodeCamps | /my-app/src/FreeCodeCampsTusks/Basic JS/81.js | UTF-8 | 448 | 3.796875 | 4 | [] | no_license |
//Make an object that represents a dog called myDog which contains the properties name (a string), legs, tails and friends.
//You can set these object properties to whatever values you want, as long as name is a string, legs and tails are
//numbers, and friends is an array.
var myDog = {
// Only change code below t... | true |
d7cd448bba131d61bdefed0926568a9242dd6c47 | JavaScript | lynpotskie/BROWSER-PRACTICE | /ex_15/script.js | UTF-8 | 199 | 2.859375 | 3 | [] | no_license |
const important = document.getElementById('important');
console.log(important);
const li = document.querySelector('li');
const ul = document.querySelector('ul');
console.log(li);
console.log(ul);
| true |
ee20b3cb33d1b6bbc6870da324aae180a03a87ae | JavaScript | ValentineStone/nodejs-game-prototype-1 | /public/js/bin2hex.js | UTF-8 | 632 | 3.3125 | 3 | [] | no_license | function bin2hex(_buffer)
{
var hexCodes = [];
var view = new DataView(_buffer);
for (var i = 0; i < view.byteLength; i++)
{
// Using getUint32 reduces the number of iterations needed (we might process 4 bytes each time)
var value = view.getUint8(i)
// toString(16) will give the hex representation of ... | true |
61690155f5c8ff17e9b2bfb72c998229a5871a48 | JavaScript | Marcoslipic/reverse-integer | /index.js | UTF-8 | 412 | 3.578125 | 4 | [] | no_license | var reverse = function(x) {
const reverseDigits = parseInt(x.toString().split("").reverse().join(""))
if (x >= 0 && reverseDigits < 2147483648) {
return reverseDigits
} else if (x < 0 && (reverseDigits * -1) > -2147483648){
return reverseDigits * -1
} else {
return 0
}
}
c... | true |
a8a339d0071009fa3100bcc8fee94575bad99357 | JavaScript | hankeliu2015/algorithmPractice2.github.io | /javascript/subArraySum.js | UTF-8 | 543 | 3.765625 | 4 | [] | no_license |
// ////solution | Kadane’s Algorithm
//
// function largestSubarraySum(array){
// let currentSum = 0;
// let maxSum = 0
//
// for( i = 0; i < array.length; i++) {
// let currentNum = array[i];
//
// currentSum = Math.max((currentSum + currentNum), 0)
// // console.log(currentSum);
// maxSum = Mat... | true |
d0a900c8a309f4bd53c2d201a5d1eac98aff196c | JavaScript | EvanBC1/leetCode | /bubble sorter/app.js | UTF-8 | 2,629 | 3.703125 | 4 | [] | no_license | // button handlers
document.getElementById("nextStep").addEventListener("click", nextStep);
document.getElementById("previousStep").addEventListener("click", previousStep);
document.getElementById("autoSort").addEventListener("click", autoSort);
document.getElementById("stopAutoSort").addEventListener("click", stopAuto... | true |
3ecf7f34003360b3a0063a02d9a9192f5b2e4152 | JavaScript | shlokpat/shlokpat.github.io | /typingAnimation.js | UTF-8 | 1,077 | 3.859375 | 4 | [] | no_license | const typedText = document.querySelector(".typed-text");
const textArray = ["Student", "Engineer", "Athlete", "Tech enthusiast", "Learner" ];
const typingSpeed = 175;
const erasingSpeed = 75;
const newTextWait = 1500;
let textArrayIndex = 0;
let charIndex = 0;
function type() {
if (charIndex < textArray[textArray... | true |
704fc6bf40267bdb3a73abb69c4bd0962caea11c | JavaScript | beta-sheet/SBB_Polyhack | /client/src/components/Map/stylize_elements.js | UTF-8 | 567 | 2.796875 | 3 | [] | no_license |
/* TEST FUNCTIONS TO ADJUST LINE OUTPUT */
export function colorById(id) {
var res = parseInt(id) === 1 ? "red" : "blue";
return res;
}
export function weightById (id) {
var res = parseInt(id) === 1 ? 2 : 10;
return res;
}
export function opacityById(id){
var res = parseInt(id) ===... | true |
c9e11bbe3c395ccb3a161e8ee9482cf8d2fa3e3b | JavaScript | 8BitRobot/DnD-Discord-Bot | /commands/create.js | UTF-8 | 2,102 | 2.75 | 3 | [] | no_license | const MongoClient = require("mongodb").MongoClient;
const request = require("request");
module.exports = {
name: "create",
description: `Create a new character and register it as your own. You can only use this command after sending your character sheet PDF, or it might register someone else's character as you... | true |
81a2e61304ef40e1b6fcaee7b895fe707089f431 | JavaScript | Juby210/bot.js | /bot/commands/games/minesweeper.js | UTF-8 | 3,635 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | const cmd = require("../../command.js");
module.exports = class command extends cmd {
constructor() {
super({
name: "minesweeper",
aliases: ["ms", "mines"]
});
this.run = this.r;
}
async r(a = {}) {
let i;
let rows = 5;
let columns = 5;... | true |
663964e17b1671ba0cf8ea87a7dcdc7c3b060a8c | JavaScript | olejbl/Webtek-Prosjekt | /prototyp/scripts/bildegalleriscript.js | UTF-8 | 3,216 | 2.59375 | 3 | [] | no_license | const img_f = ["pic1.jpg", "pic2.jpg", "pic3.jpg", "pic4.jpg"];
let slideshowElement = document.getElementById("slideshow");
var modalElement = document.getElementById("myModal");
var divModalElement = document.getElementById("divModal");
var closeElement = document.getElementById("close");
closeElement.onclick = funct... | true |
c88d32e24c16a50e5ebcc0fb55d17b69d17a0e3c | JavaScript | jenjenayjen/JavaScript-Projects | /Basic-JavaScript-Projects/Project2_functions/JS/main.js | UTF-8 | 804 | 4.65625 | 5 | [] | no_license | //step 68 returns a string
function returnSth() {
var str = "Hi Im a string.";
var result = str.fontcolor("green");
document.getElementById("say-sth").innerHTML = result;
}
//step 70 returns a concatenated string
function concat() {
var sentence = "I am learning";
sentence += " a lot from this cours... | true |
d5b3f5940857f9bb045a68180f54cf71d7e57fa1 | JavaScript | ArtPop6/-js_fullStack | /VUE/vue-music/src/api/index.js | UTF-8 | 2,071 | 2.625 | 3 | [] | no_license | import Vue from 'vue'
import axios from 'axios'
// 不import就用vue.$toast
const vue = new Vue() // vue的实例,具有vue本身所有属性
// axios配置 请求时间,axios请求数据超过十秒就报错
axios.defaults.timeout = 10000
// 后端代码放服务器,'/' 前面域名一样,写入所有项目域名,可以直接写baseURL + ''
// 提供测试环境ip去访问后端,线上服务器
axios.defaults.baseURL = 'http://localhost:3000'
// 返回状态判断 axio... | true |
d21d83bdd41ee57e0847882b07b454958586ba74 | JavaScript | jhaynes32/In-The-Kitchen | /scripts1/login.js | UTF-8 | 1,115 | 3.140625 | 3 | [] | no_license | // console.log('Hello Jeremiah')
const form = document.querySelector('form');
const userId = window.location.pathname.split('/')[2];
const handleSuccess = (res) => {
document.getElementById('welcomeUser').insertAdjacentHTML('afterbegin', `${res.data.name}`);
}
// Listen for login click event
form.addEventLi... | true |
c0b35630a153fab7b74c17313583c0c441c2a5a6 | JavaScript | Sammons/nitpicker | /test/Runner.js | UTF-8 | 4,026 | 2.734375 | 3 | [] | no_license | const assert = require("assert"),
path = require("path"),
_ = require('underscore'),
fs = require("fs"),
async = require('async');
function assertAllElementsAre(array, type, msg) {
var allElementsMatch = true;
_.each(array, function(el) {
allElementsMatch |= el instanceof type;
})
assert.ok(allElem... | true |
4d8d9ffaadb33b48370e40fe6d1bcd49991c36ec | JavaScript | tylerrasor/party-party-partyinator | /src/stolen-party-stuff/party.js | UTF-8 | 2,993 | 2.90625 | 3 | [] | no_license | import getPixels from 'get-pixels'
import gifEncoder from 'gif-encoder'
import { toGreyscale } from './greyscale'
/**
* Writes a party version of the given input image to the specified output stream.
* @param {string} inputFile the thing to be partyified
* @param {stream.Writable} outputStream The stream where the ... | true |
309dd2b0886db2e4b44208abd4bbb25be25d813b | JavaScript | Codaisseur/react-recipes-teacher | /src/reducers/recipes.test.js | UTF-8 | 1,004 | 2.53125 | 3 | [
"CC0-1.0"
] | permissive | import chai, { expect } from 'chai'
import { TOGGLE_LIKE } from '../actions/recipes/toggle-like'
import recipes, { dummyData } from './recipes'
describe('recipes reducer', () => {
const initialState = recipes()
const expectedState = []
it('return an empty array for the initial state', () => {
expect(initial... | true |
be301f64028b6d047b10a7792a4d494da578d450 | JavaScript | glisteningly/vue-scada-test | /src/mixin/ActionAnimated.js | UTF-8 | 1,055 | 2.515625 | 3 | [] | no_license | const SCADA_ANIME_CSS =
`svg#svg_scada_view .scada-anime {
animation-name: none!important;
}`
// const getStyleEl = () => {
// let styleEl = document.getElementById('scada-style')
// if (!styleEl) {
// styleEl = document.createElement('style')
// styleEl.setAttribute('id', 'scada-style')
// documen... | true |
a48a9ad60b8744cd88be5704d23524a4be138fda | JavaScript | Louise-MP/orinoco | /public/js/panier.js | UTF-8 | 6,284 | 3.25 | 3 | [] | no_license | //////////////// PARTIE PRODUIT ////////////////
//Affichage du produit
const affichagePanier = () => {
//je récupére mon produit dans session storage "panier"
let panier = JSON.parse(sessionStorage.getItem("panier"))
let prixTotal = JSON.parse(sessionStorage.getItem("prixTotal"))
let prixPanier = docu... | true |
3fcbb1cd7c3caa2fff6c4ff24cee6da57526a896 | JavaScript | li704644993/thoughtworks-uidev | /test/framework/core.test.js | UTF-8 | 2,320 | 2.9375 | 3 | [
"MIT"
] | permissive | import core from '../../src/framework/core';
describe('core', () => {
it('trigger error correctly', () => {
expect(() => {
core.onError('throw exception')
}).toThrow('throw exception');
})
it('whether it is a string', () => {
expect(core.isString('hello')).toBe(true);
... | true |
9a2bdf9c5a14d6404171bd2fe0d05cffdb9e5bae | JavaScript | yodacom/dfutube | /app.js | UTF-8 | 7,577 | 2.84375 | 3 | [] | no_license | /* eslint-env jquery */
// Searchbar handler
$(function() {
var videoList = [];
const searchField = $('#query');
$('#search-form').submit(function(e) {
e.preventDefault();
search();
});
$('#results').on('click', '.videoLink', function(e){
e.preventDefault();
var vide... | true |
327907fb05d05a7b6fd26da611c6a432530b4d72 | JavaScript | itbootcampphp/js-gen4 | /28_KLASE/Autobus/script.js | UTF-8 | 830 | 3.515625 | 4 | [] | no_license | console.log("Klase - Autobus");
import {Autobus} from "./autobus.js";
let autobus1 = new Autobus('123-43-FS', 72);
let autobus2 = new Autobus('653-37-CH', 40);
let autobus3 = new Autobus('143-62-HT', 54);
let autobusi = [autobus1, autobus2, autobus3];
let ukupnoSedista = niz => {
let ukupno = 0;
niz.forEach... | true |
48397653b008686d3323fbbcf0b5f2c2be37e8a7 | JavaScript | JDarkGreen/inovalec | /admin/js/validar.js | UTF-8 | 822 | 2.53125 | 3 | [] | no_license | function validar(){
if(document.getElementById("usuario").value==0){
$("#error1").fadeIn(1200);
$("#error1").fadeOut(1500);
document.getElementById("usuario").focus();
$("#usuario").animate({ backgroundColor: "#1B9451" }, "fast")
.animate({ opacity: "fader" }, "fast")
.animate({ opacity: "show" }, "fast"... | true |
97b7093aa3f051fb2dc9854cd68819071a8f75d8 | JavaScript | Attila24/drawbook | /client/app/user/controller/FollowModalController.js | UTF-8 | 1,419 | 2.875 | 3 | [] | no_license | 'use strict';
FollowModalController.$inject = ['type', 'UserService', 'user'];
/**
* The controller responsible for handling actions in the followings/followers modal window.
*/
export default function FollowModalController(type, UserService, user) {
const vm = this;
// bindable member variables
vm.typ... | true |
76bab1c70622ca5378708875a2dc158a868c3477 | JavaScript | neyudo/wallet | /billetera_3.js | UTF-8 | 3,141 | 3.34375 | 3 | [] | no_license | const search = document.getElementById('search')
const matchList = document.getElementById('match-list')
const api_url = 'https://api1.binance.com/api/v3/ticker/price'
const buscadatos = async precios => {
const response = await fetch('https://api1.binance.com/api/v3/ticker/price');
const datos = await respo... | true |
f715adc077642d6e821f79d9aa4fc253033697ee | JavaScript | Slemishka/LAMP | /js/secondPart.js | UTF-8 | 5,963 | 2.671875 | 3 | [] | no_license | $(document).ready(function () {
//hide all edit tables
$("#editForm,#editFormEnd,#editFormMid").hide();
//first
$("#editPath").click(function () {
const id = $("#path").children(":selected").attr("id");
//clear tables
$("#editFormTable").children().not(':first-child').remove();
... | true |
a60f35fee15d93445427734e24f3f5547bb367ba | JavaScript | jonasvilniuje/simple_javascript_tasks | /six.js | UTF-8 | 676 | 3.734375 | 4 | [] | no_license | class Story {
constructor() {
this.value = "";
}
name(str) {
this.value = str;
return this;
}
go(str) {
var action;
var adj = ["i", "you", "we", "they"];
if (adj.includes(this.value.toLowerCase()))
action = " go to";
else action = "... | true |
b4512054590e504f9555e071cfdbb26bb016ba9f | JavaScript | amitkumarnagar/calorie-tracker | /src/App.js | UTF-8 | 3,543 | 2.90625 | 3 | [] | no_license | import React, { useState, useEffect, useMemo } from 'react';
import './App.css';
const generateTestId = (mealType, item, cal) => `meal_${mealType}_${item.replace(' ', '').toLowerCase()}_${cal}`;
const MealList = ({ type, meals, title, calConsumed, limit, onClick }) => {
return (
<div className="meal-type">
... | true |
bc714a2da0140590f107281319df6320a044ba0e | JavaScript | Psyniac/StoryCharacterGenerator | /CharStoryGenerator Prototyp/scripts/char_qa.js | UTF-8 | 6,040 | 2.59375 | 3 | [] | no_license | //DATA BASE
var placeholders_categories = [
"object",
"weapon",
"mood",
"place"
];
var init_texts = [
"Your story begins quite troublesome. There were numerous complications during your birth. It almost cost your mother’s life. She was only able to survive due to the midwives’ experience.",
"<br><... | true |
972eebb80a9b3c290e160308fa2475b5ca5a5c77 | JavaScript | Costle784/take-home-fullstack-public | /front-end/src/routes/Discover/components/Discover.js | UTF-8 | 2,160 | 2.546875 | 3 | [] | no_license | import React, { Component } from "react";
import DiscoverBlock from "./DiscoverBlock/components/DiscoverBlock";
import makeRequest from "../api/makeRequest";
import Loading from "../../../common/components/Loading/Loading";
import "../styles/_discover.scss";
export default class Discover extends Component {
constr... | true |
48a8cac763313322c2f28c34520d62ebde3f1f4c | JavaScript | kanwarkakkar/ekoDelivery | /server/delivery/createGraph.js | UTF-8 | 711 | 2.765625 | 3 | [] | no_license | // Eko Delivery project
import _ from 'lodash'
// Creating graph of input routes
function createGraph(inputRoutesStr){
let routesGraph = {}
const inputRoutes = _.map(inputRoutesStr.split(','),_.trim);
_.forEach(inputRoutes,(route)=>{
let fromTown = route.charAt(0).toUpperCase();
let toTow... | true |
bb349b90e562bd7d36b153db2341b15ca73f9106 | JavaScript | prakal/subclass-dance-party | /src/init.js | UTF-8 | 3,995 | 2.984375 | 3 | [] | no_license | $(document).ready(function(){
window.dancers = [];
// console.log('dfsfsd',makeBlinkyDancer);
// window.makeBlinkyDancer = makeBlinkyDancer;
// console.log(window.makeBlinkyDancer);
$(".addDancerButton").on("click", function(event){
/* This function sets up the click handlers for the create-dancer
* ... | true |
8a03174d3ce2bed4cfcd54db7749300f8db229f9 | JavaScript | flow-ai/flowai-js-templates | /lib/whatsapp/templates/contacts.js | UTF-8 | 5,394 | 2.515625 | 3 | [] | no_license | "use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj ... | true |
a70d6e63348100d6eab6629257093cc0f4e81a67 | JavaScript | gravityrail/drivetime | /src/scripts/mainVR.js | UTF-8 | 4,090 | 2.640625 | 3 | [] | no_license | import THREE from 'three'
import TWEEN from 'tween.js'
import AbstractVRApplication from 'scripts/views/AbstractVRApplication'
import Road from '../features/road';
import Stats from 'stats.js'
const glslify = require('glslify')
const shaderVert = glslify('./../shaders/custom.vert')
const shaderFrag = glslify('./../sh... | true |
23dfef255fa348a61511d13e5c668934e1d76478 | JavaScript | TommyCargo/udemy-js | /40/js/script.js | UTF-8 | 895 | 4.25 | 4 | [] | no_license | let number = 1;
// 1) анонимная самовызывающаюся функция
// function expression , а без скобок будет function declaration
(function() {
let number = 2;
console.log(number);
return console.log(number + 3);
}())
console.log(number);
// 2) использование объектного интерфейса
let user = (function() {
... | true |
5016ca5d973b545c642c2113c55504cb11e15705 | JavaScript | NaveenVNaik/Shopping-Cart | /eventlisteners.js | UTF-8 | 2,995 | 3.296875 | 3 | [] | no_license | var _ = require('lodash');
console.log(_);
var testArray = [1,2,3,4,4,5];
console.log(_.without(testArray,4));
var userinput = document.getElementById("userinput");
var addbutton = document.getElementById("addtocart");
var cart = document.getElementById("cart");
var removefromcart = document.getElementById("removefromc... | true |
c15da911cac11fbc6ef51f16dff5190be8bd3700 | JavaScript | ceruberu/practice | /day07/javascript.js | UTF-8 | 1,472 | 3.859375 | 4 | [] | no_license | var name, age, gender, is_member, thirsty, drink_of_choice;
// 만약 웹사이트 멤버가 아니거나 21살 이하면 사모님 혹은 사장님 (성별) 클럽에 가입할수 없습니다.
// 아니라면 미스터/미스 아무개에게 웹사이트에 오신걸 환영하라, 목이 마르다면 무슨음료를 원하는지 물어봐라
// 유저가 가장 좋아하는 음료가 우유가 아니라면 네 지금 [] 드리겠습니다 , 우유라면 웹사이트에서 강퇴
is_member = prompt("웹사이트 멤버이신가요?");
age = +prompt("나이가?");
gender = prompt("성... | true |
ab36baa7169fa9bd95ec51bf6dc5a5bda37c683f | JavaScript | zzeni/sa-homeworks-08 | /GeorgiKeranov/coffee-machine/beverage.js | UTF-8 | 1,136 | 3.234375 | 3 | [] | no_license | /* jshint esnext: true */
const PRICES = {
coffee:{
type: "Coffee",
price: 0.5,
cafe: 20,
water: 60,
},
coffee_with_milk:{
type: "Coffee with milk",
price: 0.6,
cafe: 20,
water: 50,
milk: 20,
},
cappuccino:{
type: "Cappuccino",
price: 0.8,
cafe: 20,
water... | true |
680c9c743d8b5475f628481be11ca10390ca250f | JavaScript | qualvalordex/eguamat | /js/Matematica/GeometriaPlana.js | UTF-8 | 918 | 3.59375 | 4 | [
"MIT"
] | permissive | //Função cálculo da área do círculo
function acirculo(r){
return ((Math.PI*r*r*100)/100);
}
//Função cálculo da área do quadrado
function aquad(l){
return l*l;
}
//Função cálculo da área do retângulo
function aretan(la,lb){
return la*lb;
}
//Função cálculo da área do losango
function alosan(D,d){
ret... | true |
003263970b998683f7f6c0e459aa1f85b2e55dee | JavaScript | joelbrewster/family-tree | /models/user.js | UTF-8 | 801 | 2.828125 | 3 | [] | no_license | var mongoose = require('mongoose');
//Defining the structure of our user collection
var userSchema = new mongoose.Schema({
first_name: String,
last_name: String,
email: {type: String, required: true, unique: true },
meta: {
age: Number,
website: String,
address: String,
country: String
},
c... | true |
3cd325ad1a99f753969a24f822752bdf6bf2b656 | JavaScript | Stobart13/PeepShowBot | /app.js | UTF-8 | 774 | 2.578125 | 3 | [] | no_license | require('dotenv').config()
const Twit = require('twit');
var fs = require('fs');
var T = new Twit({
consumer_key: process.env.TWIT_CONSUMER_KEY,
consumer_secret: process.env.TWIT_CONSUMER_SECRET,
access_token: process.env.TWIT_ACCESS_TOKEN,
access_token_secret: process.env.TWIT_ACCESS_TOKEN_SECRET
});
tweetFrom... | true |
7f83ef7e6e663cfadb04d548df7c36b1dd409597 | JavaScript | TK-Tang/LeaderboardLMS | /Leaderboard LMS/LeaderboardLMSAPI/scripts/invitation-startscript.js | UTF-8 | 578 | 2.5625 | 3 | [] | no_license | module.exports.startScript = function(){
var invitationList = {};
invitationList.invitation001 = {
link: "aaaaaaaaa",
course_id: 1
}
invitationList.invitation002 = {
link: generateInviteLink(),
course_id: 1
}
invitationList.invitation003 = {
link: gener... | true |
11ffcd9b3ab9a0b2f10dfa6941c88098f9dda6f3 | JavaScript | zoeyyandi/Chatty | /src/ChatBar.jsx | UTF-8 | 1,404 | 2.71875 | 3 | [
"MIT"
] | permissive | import React, {Component} from 'react'
class ChatBar extends Component {
constructor(props) {
super(props);
}
handleKeyDown = (event) => {
if(event.keyCode === 13) {
let username = this.user.value
let content = event.target.value
this.props.sendMessage(u... | true |
1b708a1c26e2f8024154de963e2c9d7658dcf9bb | JavaScript | mushahiroyuki/ndp2 | /example/ch06/06_revealing_constructor/example.js | UTF-8 | 318 | 2.765625 | 3 | [] | no_license | "use strict";
// #@@range_begin(list1)
const ticker = require('./ticker');
ticker.on('tick', (tickCount) => console.log(tickCount, 'TICK'));
// ticker.emit('something', {}); <-- これは失敗する
// require('events').prototype.emit.call(ticker, 'someEvent', {}); <-- これが成功する
// #@@range_end(list1)
| true |
3cd1392b5b82faa703e43e0ee66cc92b041f888d | JavaScript | chat-du-cheshire/CodeDojoES6-test | /src/forOf.js | UTF-8 | 244 | 3.875 | 4 | [] | no_license | const arr = ['a', 'b', 'c', 'd', 'e'];
// Обход массива по индексам
for (let index in arr) {
console.log(index);
}
// Обход массива по элементам
for (let item of arr) {
console.log(item);
} | true |
ab9bc9e356c5d08aa005e1b4310119cc62bc41de | JavaScript | thucnh96-dev/js | /Promise.js | UTF-8 | 892 | 3.46875 | 3 | [] | no_license | const axios = require('axios');
let promise = new Promise(function (resolve, reject) {
setTimeout(() => resolve('oke'), 1000);
//setTimeout(() => reject(new Error('no Hope!')), 1000);
});
promise.then(
result => console.log(result),
error => console.log(error),
);
function getJSON() {
// To make th... | true |
86282e63647806f99993b951b6e53def8833c4cc | JavaScript | tympollack/ez-bid-backend | /functions/resize-images.js | UTF-8 | 1,706 | 2.546875 | 3 | [] | no_license | const shareable = module.parent.shareable
const productPicturesBucketConfig = shareable.config.datastore.buckets.productPictures
const bucketRef = shareable.functions.storage.bucket(productPicturesBucketConfig.name)
const thumbPrefix = '' + productPicturesBucketConfig.thumbPrefix
const { tmpdir } = require('os')
const... | true |
0c1d74648e78c9c7de941a717149b739bc555afd | JavaScript | lordHodges/nx_proyectAPI | /api/controllers/Hostal/ingresoHostal.controller.js | UTF-8 | 1,084 | 2.53125 | 3 | [] | no_license | const mapper = require("automapper-js");
class IngresoHostalController {
constructor({ IngresoHostalService }) {
this._service = IngresoHostalService;
}
async upload(req, res) {
if (!req.file) {
console.log("No file received");
return res.send({
success: false,
});
} else {
console.log("file ... | true |
a831b9fa75542ed3bd58a0d3d5eef57fe7e89418 | JavaScript | cbello92/schema-validator | /src/modelSchema.js | UTF-8 | 12,594 | 3.28125 | 3 | [] | no_license | /**
* Clase base (heredable) para crear instancias de esquemas que representan "tablas de base de datos".
* Nos da la flexibilidad de crear reglas de negocio tanto para insertar o modificar informacion en las tablas que deseamos representar.
*
* @class
* @author Camilo Bello [<camilo.bello@crecic.cl>]
*/
expo... | true |
8abff265bfdf3f598ea2b9bb73e4268e4eebfa7d | JavaScript | luCAOrx/tarefa-algoritimo-repeticao | /respostas-js/resposta1.js | UTF-8 | 189 | 3.4375 | 3 | [] | no_license | let nota = 0;
for (let i = 0; i < 10000; i++) {
nota = parseFloat(prompt('Digite sua nota'));
if (nota >= 0 && nota <= 10) {
break;
}
}
alert('Nota digitada: ' +nota); | true |
738144892ad12d6e108f54fce4a87ff3e275869c | JavaScript | gustavoalisson/exercicios-javascript | /ex002.js | UTF-8 | 434 | 4.28125 | 4 | [] | no_license | /*
Equilátero: Os três lados são iguais.
Isósceles: Dois lados iguais.
Escaleno: Todos os lados são diferentes.
*/
function triangulo(a,b,c){
if(a === b && a === c){
console.log('Triângulo Equilátero')
}else if((a === b || a === c || b === c) ) {
console.log('Triângulo isósceles')
}else{... | true |
71cd90d007ee3d40689673a2fa35e9633ccc1540 | JavaScript | ansh9436/NodeExpressProject | /util/random_helper.js | UHC | 1,066 | 2.953125 | 3 | [] | no_license | var typeHelper = require(__base + 'util/type_helper.js');
var randomstring = require('randomstring');
//־ [min, max) .
function GetRandom(min, max) {
if (!max) {
return Math.floor(Math.random() * min);
}
else {
return Math.floor(Math.random() * (max - min) + min);
}
}
//ִ max rate Ȯ 츦... | true |
28ee4d9b9ec4ca2c38065da7f0e0b87d49ee3c1a | JavaScript | tanoshiibot/memory-becode | /script.js | UTF-8 | 3,018 | 3.21875 | 3 | [] | no_license | const RAINBOW = "🌈";
const SAKURA = "🌸";
const MUSHROOM = "🍄";
const FOURLEAFCLOVER = "🍀";
const CAKE = "🍰";
const COOKIE = "🍪";
const CACTUS = "🌵";
const GRAPES = "🍇";
let deck = [RAINBOW, RAINBOW, SAKURA, SAKURA, MUSH... | true |
c820b926f6290ac9ef3bd1d37dc10a2cebe4e311 | JavaScript | jdpaterson/tinyApp | /help.js | UTF-8 | 2,203 | 2.640625 | 3 | [] | no_license | const randomString = require('randomstring');
const bcrypt = require('bcryptjs');
const {User, Url, Visit} = require("./db/schema");
function generateRandomString() {
return randomString.generate(6);
}
function isEmptyString(str){
return str === '' ? true : false;
}
function getUserByEmail(userEmail){
return U... | true |
760cc252a98948d2d492168fcb23e616c8c475f5 | JavaScript | yashpandit/javascript-exercises | /dec_15_2019/singleNumber/singleNumber.js | UTF-8 | 335 | 3.296875 | 3 | [] | no_license | const singleNumber = (numbers) => {
const frequency = {};
for (let number of numbers) {
if (!frequency[number]) {
frequency[number] = 0;
}
frequency[number]++;
}
for (let key of Object.keys(frequency)) {
if (frequency[key] === 1) {
return Number(key);
}
}
};
module.exports =... | true |
0c93c3f4862c107595cc25d754a4ade22b06ae06 | JavaScript | tomasperezv/node-sensor-hue | /src/api/client.js | UTF-8 | 1,081 | 2.53125 | 3 | [
"MIT"
] | permissive | const requestInterface = require('http');
const labelValues = (labels) => {
let result = '';
if (!labels) {
return result;
}
labels.forEach((label, index) => {
if (index > 0) {
result += ',';
}
result += `${label[0]}="${label[1]}"`;
});
return result;
};
module.exports = {
send:... | true |
799cb38286b9dde2a4f52ca3d361d91e9fb50acc | JavaScript | leviwp48/PlanetRocket-V1 | /adam-hayes/public/js/ajax/servers/LaravelServer.js | UTF-8 | 2,964 | 2.546875 | 3 | [] | no_license |
/////////////////////////////////////////////////////////////
// //
// //
/////////////////////////////////////////////////////////////
BlueBox.compose(
"ajax.servers.BaseServerInterface",
"ajax.servers... | true |
c0a7f4ac919887b5440d7c5e5562106728373449 | JavaScript | yung6699/vue-testing | /src/utils/index.js | UTF-8 | 613 | 2.84375 | 3 | [] | no_license | export function getUser(id) {
if (id <= 0) throw new Error("Invalid ID")
return {
id,
email: `user${id}@test.com`,
}
}
export function fetchUser(id, cb) {
setTimeout(() => {
console.log("wait 0.1 sec.")
const user = {
id: id,
name: "User" + id,
email: id + "@test.com",
}
... | true |
4844866261b49ce7036bde2a410beba1492587d5 | JavaScript | lagmoellertim/jsCYK | /cyk.js | UTF-8 | 2,900 | 2.984375 | 3 | [
"MIT"
] | permissive | class CYK{
constructor(grammar, startstate) {
var self = this
self.grammar = grammar
self.startstate = startstate
}
__getValidCombinations(left_collection_set, right_collection_set){
var self = this
var valid_combinations = []
for(var num_collection in left_collection_set){
var left... | true |
90e91260c1a54023838745bd29df78731e67d07f | JavaScript | thomas771020/ColorWheelPicker | /js/ColorWheelPicker.js | UTF-8 | 1,395 | 2.6875 | 3 | [] | no_license | (function($) {
$.fn.colorWheelPicker = function(colors) {
return this.each(function() {
var jTarget = $(this),
level = colors.length,
colorWheel = $('<div class="color-wheel"></div>'),
fanDegree = 360 / level,
rotateWheel = function rotateWheel(idx) {
var start = 36... | true |
86596261ffd4f0dea03f076c065ae9042924d920 | JavaScript | advisorycloud/aws-ses | /index.js | UTF-8 | 1,441 | 2.609375 | 3 | [
"ISC"
] | permissive | /**
* Send email via AWS SES Service
*
* @see {@link https://aws.amazon.com/ses/}
* @see {@link https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SES.html}
*/
"use strict"
/**
* Wrapper around AWS.SES
*
* @type {class}
*/
class SES {
/**
* Constructor
*
* @param {object} [options={}] AWS SES... | true |
865802699981c3876c0be68d66d96ae8f475b8d3 | JavaScript | brevityhq/duxhund | /src/utils/assertions.js | UTF-8 | 1,227 | 3.328125 | 3 | [
"MIT"
] | permissive | import isPlainObject from './isPlainObject'
export function assertType(object, type, { funcName, argName, optional }) {
if (!hasType(object, type, optional)) {
throw new Error(
`${funcName} expects the '${argName}' argument to be ${outputType(
type
)}, but instead received '${typeof object}'.... | true |
1403c827f302fe5a97faca9b2834246420f8b1c1 | JavaScript | chekuda/trekbase | /shared/game/managers/GameLoopManager/GameLoopManager.js | UTF-8 | 548 | 2.578125 | 3 | [] | no_license | import { FRAME_DIVIDER, STEP } from '../../consts'
export default class TimeManager {
constructor() {
this.now = 0
this.delta = 0
this.last = 0
}
reset() {
this.now = 0
this.last = 0
this.delta = 0
}
run(gameUpdate, gameRender) {
this.now = window.performance.now()
this.delt... | true |
5cbfa47b560f0e6573f26f0414af637bd8fabe0d | JavaScript | Pantascope/Website | /main.js | UTF-8 | 355 | 2.578125 | 3 | [] | no_license | var banner = document.querySelector('.heroRow');
var bannerVideo = document.querySelector('.bannerVideo');
if (/iPad|iPhone|iPod/.test(navigator.platform)) {
banner.style.backgroundImage = 'url("' + bannerVideo.poster + '")';
banner.style.backgroundSize = 'cover';
banner.style.backgroundPosition = 'center';
ba... | true |
876d3f303be94226dca50a31d8cc1f0312a3d21b | JavaScript | CharlyWelch/budget-tracker | /src/components/expenses/reducers.test.js | UTF-8 | 1,359 | 2.640625 | 3 | [] | no_license | import { expensesByCat } from './reducers';
import { CATEGORY_ADD, CATEGORY_DELETE } from '../categories/reducers';
import { EXPENSE_ADD, EXPENSE_DELETE } from './reducers';
it('has default empty object as state', () => {
const state = expensesByCat(undefined, {});
expect(state).toEqual({});
});
const addCat = ()... | true |
a69fe0802c63a998fb5e234a48d03d257bbbc553 | JavaScript | vvTrailer/ganIntegrityChallengeAPI | /src/cities.js | UTF-8 | 2,976 | 3.28125 | 3 | [] | no_license | import { getCityData } from './helpers.js'
import geolib from 'geolib';
import geodist from 'geodist'
export const getCitiesByTag = async (tag, isActive) => {
const cityData = await getCityData()
let cities = cityData.filter(city => city.isActive === !!isActive && city.tags.includes(tag))
return cities
}
... | true |
ce773138f6c49a73c05dbd48c3d5938529eb69e4 | JavaScript | husseinbelaifa/Desiedog-Website | /public/js/about.js | UTF-8 | 1,267 | 2.578125 | 3 | [] | no_license | if (window.attachEvent) {window.attachEvent('onload', load);}
else if (window.addEventListener) {window.addEventListener('load', load, false);}
else {document.addEventListener('load', load, false);}
function load() {
function scrollTo(obj) {
$('html, body').animate(obj, 600);
}
var missionScroll = ... | true |
fc66e6f51efba39ca2782cf27054275e03ae0af4 | JavaScript | rasmuserik/devintro | /lib/inbook.js | UTF-8 | 900 | 3.515625 | 4 | [] | no_license | // # Functions defined in the book and used other places in the book
//
// Needed here as the scripts are executed individually
// when making the illustrations.
function koch1() {
turtle.forward();
turtle.left(60);
turtle.forward();
turtle.right(120);
turtle.forward();
turtle.left(60);
tu... | true |
5f046bfbd8a876fb549831988e99d23a9c021a1a | JavaScript | SolvingMan/Dev.Chipi-Laravel-development- | /public/assets/next/js/next_product.js | UTF-8 | 6,077 | 2.609375 | 3 | [
"MIT"
] | permissive | jQuery(document).ready(function () {
var fit = null;
var color = null;
var size = null;
var productData = {};
productData.productURL = location.href;
productData.availableQuantity = 1000;
productData.selectedSku = "";
productData.quantity = 1;
$('.add-to-cart-button').on('click', fun... | true |
c9717a09483347d637cf6125271ed809bf648380 | JavaScript | Demonzp/fat-trainer-Redux- | /server/controllers/exerciseController.js | UTF-8 | 2,499 | 2.71875 | 3 | [] | no_license | const { Exercise } = require('../models/Exercise');
const { User } = require('../models/User');
// // ONLY FOR TESTING!
// // GET exercises list of specific user (by user ID).
// const exerciseGet = async (req, res) => {
// try {
// const exercises = await Exercise.find({ owner: req.user._id });
// ... | true |
f4f6ca83fb77d0dea0a102c60192665db290fc28 | JavaScript | doumKim/fake-momentum | /modules/background.js | UTF-8 | 623 | 3.265625 | 3 | [] | no_license | const changeBackground = () => {
const backgroundElement = document.getElementById('background');
const IMG_AMOUNT = 4;
const paintImage = (imageNumber) => {
backgroundElement.style.backgroundImage = `url(./img/bg${imageNumber}.jpg)`;
};
const getRandomNumber = (amount) => {
const randomNumber = Math.floor(... | true |
443cca38f2ea4acf74b77735af4f8a3713cf3026 | JavaScript | ashnur/bigint-benchmark | /food_arb.js | UTF-8 | 943 | 2.734375 | 3 | [] | no_license | var arb = require('../arb/integer.js')
var inteq = require('../arb/integer_equality.js')
var ri = require('../arb/test/helpers/rand_int.js')
var large = ri(null, null, 0)
var small = ri('small', null, 0)
var tiny = ri('tiny', null, 0)
var one = require('../arb/one.js')
var zero = require('../arb/zero.js')
var negone = ... | true |
55c97d3665428d0558997cd83dd2265e7f99b985 | JavaScript | mkiki/wg-database | /lib/database.js | UTF-8 | 8,640 | 2.59375 | 3 | [
"MIT"
] | permissive | /**
* wg-database - Database access functions
*/
// (C) Alexandre Morin 2015 - 2016
const pg = require('pg');
const utils = require('wg-utils');
const extend = require('extend');
const Log = require('wg-log').Log;
const Exception = require('wg-log').Exception;
const moment = require('moment');
const log = Log.getLo... | true |