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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
104d8832ce212e05892af2b31aef84a03dc7d9de | JavaScript | Ayushparikh-code/projectsshow | /Projects/Overcoding/js/script.js | UTF-8 | 1,360 | 2.71875 | 3 | [] | no_license | window.onscroll = function() {
if(window.innerWidth > 600) {
stickyNav();
}
}
var content = document.querySelector(".content");
var contentSize = content.offsetHeight;
var navbar = document.getElementById("nav");
var aside = document.getElementById("aside");
var stickyNavbar = navbar.offsetTop;
va... | true |
a7d99bd7e99e342830f5f62fe9d200f4c5550e40 | JavaScript | TeamDos/JS | /src/js/leaderboard.js | UTF-8 | 1,606 | 2.515625 | 3 | [] | no_license | import React, { Component, PropTypes } from 'react';
import Cookies from 'js-cookie';
export default class Leaderboard extends Component {
static propTypes = {
leaderboardData: PropTypes.array.isRequired,
playAgain: PropTypes.func.isRequired,
addImg: PropTypes.func.isRequired,
toLogout: PropTypes.func.isReq... | true |
96f2249c001697bc7946faf7a4fcd472c2fcccdd | JavaScript | Robertp205/battleship | /src/components/BattleGrid.jsx | UTF-8 | 2,789 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import { hoverUpdate, placeMove } from "../utils/battleGridHelpers";
import BattleGridSquare from "./BattleGridSquare";
import "../styles/Grid.css";
const dictionary = {
0: null,
1: "A",
2: "B",
3: "C",
4: "D",
5: "E",
6: "F",
7: "G",
8: "H",
9: "I",
10:... | true |
62544a668ce63c1c4b594f198792334084e9a5fe | JavaScript | TANGQingMiss/leetcode | /easy/sortArrayByParity.js | UTF-8 | 426 | 3.1875 | 3 | [] | no_license | /**
* @param {number[]} A
* @return {number[]}
*/
var sortArrayByParityII = function(A) {
let len = A.length;
let j = len - 2;//index of pair
for(let i = len - 1; i >= 0; i -= 2){//index of odd
if(A[i] % 2 != i % 2){
while(A[j] % 2 == j % 2){
j -= 2;
}
... | true |
7628201266e568208575347ebf159806c027858e | JavaScript | Rajashrichaudhari123/test12 | /scripts/Pagination.js | UTF-8 | 2,888 | 2.6875 | 3 | [
"MIT"
] | permissive | (function(){
$m.juci.dataset("currentPage", 0);
$m.juci.dataset("navigatePage", null);
$m.juci.dataset("pageSize", PAGESIZE);
$m.juci.dataset("totalPages", 0);
$m.juci.dataset("totalCount", 0);
var bSetup = false;
function doNext(){
var page = $m.juci.dataset("currentPage");
var pageSize = $m.juci.dataset(... | true |
33468ba8733ed77108909a8a27d79cfa892155ad | JavaScript | jshahid21/personifyIaaS | /csvConverter/MBGoogle.js | UTF-8 | 4,622 | 2.515625 | 3 | [] | no_license | // obtain a JWT-enabled version of request
var request = require('google-oauth-jwt').requestWithJWT();
// my version of request
var requestDownload = require('request');
requestDownload = require('google-oauth-jwt').requestWithJWT(requestDownload);
// var requestDownload = require('google-oauth-jwt').requestWi... | true |
32849f854b779d76140f4a1a7ef8ed56c7a07778 | JavaScript | lawvs/Algorithm-Training | /leetcode/1014.capacity-to-ship-packages-within-d-days.js | UTF-8 | 652 | 3.328125 | 3 | [] | no_license | const canShip = (w, weights, D) => {
let d = 0
weights.reduce((sum, cur) => {
if (sum + cur <= w) {
return sum + cur
}
d++
if (cur > w) {
d = Number.MAX_SAFE_INTEGER
}
return cur
}, 0)
console.log(d, D)
return d < D
}
/**
* @param {number[]} weights
* @param {number} D
... | true |
bb7455746e52e8832d86d96eb4e0e3aa1fcc6ac1 | JavaScript | highercomve/unilateral-data-flow | /test/stores/todos.spec.js | UTF-8 | 501 | 2.53125 | 3 | [] | no_license | import expect from 'expect'
import Todos from '../../src/task_reducer'
function initialState () {
console.log('Initial state must be []')
expect(
Todos(undefined, [])
).toEqual([])
}
function ifAddTodo() {
console.log('With one todo must be [TODO{}]')
const text = "nueva todo"
const state = Todos({ ty... | true |
74320b4d96f65d1b2cd15ce90ceff71913ef2a84 | JavaScript | fe-olaf/210801 | /study/event/index.js | UTF-8 | 335 | 2.9375 | 3 | [] | no_license | const list = document.querySelector('#list')
list.addEventListener('click', (e) => {
console.log(e.target.innerText)
})
const btn = document.querySelector('#btn_add')
btn.addEventListener('click', () => {
const li = document.createElement('li')
li.appendChild(document.createTextNode('append item'))
list.appe... | true |
6201c7e8306440b9178efee85425e31155bfab78 | JavaScript | makovskaia/makovskaia.github.io | /text.js | UTF-8 | 1,538 | 2.546875 | 3 | [
"MIT"
] | permissive | let example =
`solid Octahedron_Created_by_Prototyre3D
outer loop
facet normal 0 0 0
vertex 0 0 -1
vertex 1 1 0
vertex 1 -1 0
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 0 0 -1
vertex 1 -1 0
vertex -1 -1 0
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 0 0 -1
... | true |
264319a0d2f98e4530cdb42117543624fd409557 | JavaScript | adityanegara/dicoding_frontend_pemula | /1. Dasar Javascript/quis_object.js | UTF-8 | 291 | 2.734375 | 3 | [] | no_license | const restaurant = {
"name" : "Rumah Makan Sari Mulya",
"city" : "Poltangan",
"favorite drink" : "Es Teh",
"favorite food" : "Rendang",
"isVegan" : false
};
const name = restaurant.name;
const favoriteDrink = restaurant["favorite drink"];
console.log(name);
console.log(favoriteDrink);
| true |
d8db2b80012a62e97d61799b0cc682e5a0de85ae | JavaScript | satyasandeep007/basicprograms | /swap.js | UTF-8 | 52 | 2.578125 | 3 | [] | no_license | let a = 5; b = 6;
[a,b] = [b,a];
console.log(a,b);
| true |
9d630bd1fb0dcd7a5fb07df3c8af0244ec8d1e47 | JavaScript | PackRat1997/ryanswebsite.us | /game/script.js | UTF-8 | 1,055 | 3.0625 | 3 | [] | no_license | var money = 0;
var moneyPC = 1;
var upgrdCost = 100;
var upgradeAmt = 5;
function update() {
document.getElementById("moneyCount").innerHTML = 'Money: ' + Math.round(money);
document.getElementById("moneyButton").innerHTML = 'Money +' + moneyPC;
if(upgrdCost < 1000000) {document.getElementById("upgrade-money-butt... | true |
9f5bb6b3b6f298504245d6837f9bd6bfb25c59b8 | JavaScript | RomanFPL/custom-react-cms | /app/src/components/editor-meta/editor-meta.js | UTF-8 | 4,754 | 2.5625 | 3 | [] | no_license | import React, {Component} from "react";
export default class EditorMeta extends Component {
constructor(props){
super(props);
this.state = {
meta: {
title: "",
keywords: "",
description: ""
}
}
}
componentDidMo... | true |
53888fcffe3ccd128773dfb2dab2a22123817ce2 | JavaScript | PavelLevskiyGit/Reusable | /Exercises/7-objects.js | UTF-8 | 243 | 2.5625 | 3 | [
"MIT"
] | permissive | 'use strict';
const fn = () => {
const obj1 = { name: 'Pavel' };
let obj2 = { name: 'Pavel' };
obj1.name = 'SecondName';
obj2.name = 'SecondName';
// obj1 = { test: 'test' }
obj2 = { test: 'test' };
};
module.exports = { fn };
| true |
2612a0131797fde8700e9b98ed1f258aaad24cbe | JavaScript | PavloCode/goit-fe-course | /javascript/module-14/src/test/test.test.js | UTF-8 | 666 | 2.578125 | 3 | [
"MIT"
] | permissive | import Model from '../js/model.js';
describe('Model class', () => {
const model = new Model();
const testUrl = 'http://test-website.com';
const array = model.arrayItems;
it('Should create Model istance', () => {
expect(model instanceof Model).toBe(true);
});
it('Should pass validation ... | true |
f867152dc9981e31aa3e06e1b6fac3fb29d289cc | JavaScript | andreasbrett/CodeWars | /js/7kyu_onesAndZeros.js | UTF-8 | 225 | 3.125 | 3 | [] | no_license | // https://www.codewars.com/kata/578553c3a1b8d5c40300037c
const binaryArrayToNumber = (arr) => {
return arr.reduce(
(acc, cur, idx, src) =>
acc + (cur == 0 ? 0 : Math.pow(2, src.length - idx - 1)),
0
);
};
| true |
d8971744334a7cc6b49c63b9e56ccab03dab895e | JavaScript | raveve/chickenfoot | /main.js | UTF-8 | 5,992 | 2.734375 | 3 | [] | no_license | jQuery(document).ready(function ($) {
//localStorage is adding in the player's total score with the ID from the total column. Need to also store each input so they are returned on page load also.
//Will need to add a clear all button for clearing scores before a new game.
//If input is blank, make the valu... | true |
a75db3403247cc53b4cb74f08d5722c5c7ac27c1 | JavaScript | HealthDrones/SistemaGerenciamentoDrones | /js/automato.js | UTF-8 | 10,990 | 3.046875 | 3 | [
"MIT"
] | permissive | //Variável global destinada a
var Grade = {};
var config = null;
//var teste = null;
/*
*/
var Config = function(width, height){
this.width = width;
this.height = height;
}
var Automato = function(idCel, line, coll, state, disLin, disCol){
this.idCel = idCel;
this.line = line;
this.coll = coll;
this.... | true |
814b04011a41a77d7674244a571af571e3cbee23 | JavaScript | RuchirSaxena/WebApI-Using-Node-Express-Js-etc | /app.js | UTF-8 | 1,177 | 2.78125 | 3 | [] | no_license | var express=require('express');
var app=express();
var bodyParser=require('body-parser');
try{
var mongoose=require('mongoose');
}catch(err){
console.log(err);
}
Genre=require('./model/geres');
Books=require('./model/books');
//Initializing Body Parser
app.use(bodyParser.json());
//Connect to Mongooes
mongoose.c... | true |
d0c2a9da66a547c15f6b906e0c1a0255cc289eff | JavaScript | leqiangzhu/Super-Galactic-Age-Calculator | /spec/AgeCalculator-spec.js | UTF-8 | 1,406 | 3.03125 | 3 | [
"MIT"
] | permissive | import { AgeCalculator } from '../src/AgeCalculator';
describe("AgeCalculator", function(){
let test_day = new AgeCalculator(2010,1,1);
it('should identify a AgeCalculator class',function(){
expect(test_day.GetMaxDay()).toEqual(31);
});
it('should check if the GetAgeOnEarth() works',function(){
/... | true |
684e2350974d8815c5138f572733263457f9d837 | JavaScript | vothanhdat/flickr | /src/utils/Decorator.js | UTF-8 | 1,759 | 2.890625 | 3 | [] | no_license |
import { isEqual } from 'lodash'
/**
* Prevent multiple same promise task call in the same time,
* This funtion wrap all of method call into only one until this task is done
*/
export function wrapPromise(target, propertyKey, descriptor) {
if (target[propertyKey] instanceof Function) {
var _promiseSy... | true |
29af90c6bf997c93458260086de0b021cb48252e | JavaScript | bcrusu/RENDLER | /nodejs/src/dotUtil.js | UTF-8 | 1,591 | 2.65625 | 3 | [] | no_license | const fs = require('fs');
const endOfLine = require('os').EOL;
function write(outputPath, nodeToChildNodes, nodeImageFileName) {
var url, nodeName;
var nodeNames = {};
var nodeIdCounter = 0;
var stream = fs.createWriteStream(outputPath, {
flags: 'w',
defaultEncoding: 'utf8'
});
... | true |
cb7646130ecfe3cbaa9defc1e6068fef10bbfa19 | JavaScript | rupali-04/css_Projects | /parallax effect/app.js | UTF-8 | 1,839 | 2.859375 | 3 | [] | no_license | // bring the elements
const header = document.querySelector('header');
const bigCircle = document.querySelector('.bigC');
const smallCircle = document.querySelector('.smallC');
const p_image = document.querySelector('.prop1');
const gallery = document.querySelector('.gallery');
const g_text = document.querySelector('.g... | true |
5326e23ca19ce7e5896a7811096843d49be6d7db | JavaScript | wakr/MyWatchedMovies | /lib/external_api/HttpRequester.js | UTF-8 | 451 | 2.640625 | 3 | [] | no_license | var request = require('request');
function HttpRequester() {
}
/**
* @param address target webpage.
* @param callback function to call with the response.
*/
HttpRequester.GET = function (address, callback) {
request.get(address, function (error, result, jsonResponse) {
if (error) {
callback(... | true |
e4eb0c179b6d6699fb3a03f9d9ea99a0ebb569c1 | JavaScript | sitewards/sucodo | /src/js/colorwarner.js | UTF-8 | 697 | 2.84375 | 3 | [] | no_license |
Sucodo.ColorWarner = {
getColor: function (number) {
if (number <= 0) {
return '#000000';
}
if (number > 256) {
return '#ff0000'; // a lot of results, total red!
} else {
var red, green, hexRed, hexGreen;
red = Math.round(number/2);
... | true |
ccd175425f3ecbd92bdae9c22749119d1a69a955 | JavaScript | IceMetalPunk/ES6-Platformer | /js/loaders.js | UTF-8 | 6,080 | 2.78125 | 3 | [] | no_license | import { eventPromise } from "./helpers.js";
class LoadManager {
constructor() {
this.pending = 0;
this.total = 0;
this.loadingBar = document.getElementById('loadProgressBar');
this.batches = {};
}
updateBar() {
this.loadingBar.max = this.total;
this.loadingBar.value = this.total - this.p... | true |
4e0cc4d08038c066536f44041a01d16f2846d4f0 | JavaScript | aloncon/React | /elcogem/src/Hooks/windowSize.js | UTF-8 | 578 | 2.734375 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
export const useWindowWidth = () => {
const [winWidth, setWinWidth] = useState(window.innerWidth);
const handelWinResize = () => {
//console.log('handelWinResize', window.innerHeight, window.innerWidth);
setWinWidth(window.innerWidth);
}
... | true |
e52dde76fdb0d975b7fd8ce5bd60f323b16f3e50 | JavaScript | TenshiMunasinghe/React-projects | /react-camp/src/index.jsx | UTF-8 | 645 | 2.59375 | 3 | [] | no_license | import React from "react";
import ReactDOM from "react-dom";
import App from "./components/App";
// import "./stylesTodo.css";
import "./styles.css";
// function App() {
// let styles = {
// fontSize: "2vw"
// };
// const d = new Date();
// const hours = d.getHours();
// let time;
// if (hours < 12) {
// ti... | true |
dcad3221fddde38330b0850400cf1f042f3055ba | JavaScript | omaracrystal/ant_hill_game | /client/public/js/gun.js | UTF-8 | 792 | 3.21875 | 3 | [] | no_license |
//circle properties
var bulletX = 200;
var bulletY = 200;
var bulletR = 50;
var canvas;
var ctx;
//array of bullets
var bullets = [];
//bullet constructor
function Bullet (x, y, dx, dy) {
this.x = x;
this.y = y;
this.dx = dx;
this.dy = dy;
}
//shoot method
function shoot() {
bullets.push(new Bullet(x+xx,... | true |
0f2bf542e15e5265c4006b1b0503f72fd6a18227 | JavaScript | bote795/Cheetcode-Study-Prep-March-2021 | /Groana/masteringCode/01_twoNumSum.js | UTF-8 | 369 | 3.28125 | 3 | [] | no_license | const twoSum = (nums, target) => {
let hash = {};
for (let i = 0; i < nums.length; i++) {
if (hash[nums[i]] >= 0) {
return [hash[nums[i]], i];
} else {
const diff = target - nums[i];
hash[diff] = i;
}
}
};
console.log(twoSum([2, 7, 11, 15], 9));
console.log(twoSum... | true |
f3cbe5c054817a7ab4af288acd40f354e04b8271 | JavaScript | sidlim/js-utils | /src/data-containers/trie.js | UTF-8 | 1,094 | 3.484375 | 3 | [
"MIT"
] | permissive | class Node {
constructor(terminal = false) {
this.terminal = terminal;
this.children = new Map();
}
}
class Trie {
constructor() {
this.root = new Node(false);
}
add(word) {
let curr_node = this.root;
if (word == "") {
curr_node.terminal = true;... | true |
cea02be2bef10b6a8575365b58f1a3b87f65921b | JavaScript | ecraft2learn/ai | /misc/water balloon game claude/script.js | UTF-8 | 1,719 | 3.171875 | 3 | [
"BSD-3-Clause"
] | permissive | let flower1 = document.querySelector('.flower-1');
let flower2 = document.querySelector('.flower-2');
let flower3 = document.querySelector('.flower-3');
let flowers = document.querySelectorAll('.flower');
let balloons = [];
function dropBalloon() {
let balloon = document.createElement('div');
balloon.classList.ad... | true |
db7d020619146e71004aa134016b94238d597ecc | JavaScript | kongnyc/codewars_two | /coding-challenges/7-27-21/main.js | UTF-8 | 1,148 | 4.40625 | 4 | [] | no_license | // You will be given an array of numbers. You have to sort the odd numbers in ascending order while leaving the even numbers at their original positions.
// Examples
// [7, 1] => [1, 7]
// [5, 8, 6, 3, 4] => [3, 8, 6, 5, 4]
// [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] => [1, 8, 3, 6, 5, 4, 7, 2, 9, 0]
// assert.deepEqual(... | true |
6e535e697e92e00348e973d576f77b1b177976a9 | JavaScript | friktiny/Beta | /comandos/img.js | UTF-8 | 701 | 2.53125 | 3 | [
"MIT"
] | permissive | const Discord = require('discord.js')
var pixabay = require("pixabay-api")
var key ="21834636-80997c500eebd26540de1ccd1"
module.exports.run = async (client, message, args) => {
const value = ['anvil', 'car', 'market', 'rap', 'computer', 'penis', 'dog', 'arabe', 'brasil', 'mexicano']
pixabay.searchImages(key, M... | true |
9c4e332051dfe3999250a56df449196206366a64 | JavaScript | Changzhouli3309/jws_task2_frontend | /src/ProductList.js | UTF-8 | 1,735 | 2.53125 | 3 | [] | no_license | import { useEffect, useState } from "react"
import UserService from "./UserService"
import ProductService from "./ProductService"
import { NewProduct } from "./NewProduct"
export const ProductList = ({ user, setisLogin }) => {
const [productList, setProductList] = useState([])
const [isUpdate, setIsUpdate] = ... | true |
4a4891ad129c38acdee2086b4991b2b2c97e01ef | JavaScript | pez036/organelle | /client/src/components/pages/Calendar.js | UTF-8 | 3,449 | 2.515625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import MonthandYear from '../calendar/monthandyear';
import NavBar from '../layout/NaviBar';
import "../layout/calendar.css";
import moment from 'moment';
import Button from 'react-bootstrap/Button';
import days from '../calendar/days';
import dayStyles from '../calen... | true |
38875990a865e24928f842d7a4d3cc92262be6aa | JavaScript | calebgregory/weather-app | /main.js | UTF-8 | 3,406 | 3.078125 | 3 | [
"MIT"
] | permissive | // To see an example of the type of JSON file I am pulling from, see:
// http://api.wunderground.com/api/12b199f575226d1c/geolookup/conditions/forecast/q/37201.json
var API_URL = 'http://api.wunderground.com/api/12b199f575226d1c/geolookup/conditions/forecast10day/q/';
var lookup = document.querySelector('input[name = ... | true |
e8377ac892fa697f1bbdeac4c8f70ac6a903fdd8 | JavaScript | alexbosworth/lightning | /lnd_responses/rpc_peer_message_as_message.js | UTF-8 | 939 | 2.703125 | 3 | [
"MIT"
] | permissive | const bufferAsHex = buffer => buffer.toString('hex');
const {isBuffer} = Buffer;
/** Map an RPC peer message to message details
{
data: <Message Data Buffer Object>
peer: <Peer Public Key Buffer Object>
type: <Message Type Number>
}
@throws
<Error>
@returns
{
message: <Message Data Hex S... | true |
7f7e254e66390a2076ad4710b0977475e32f1136 | JavaScript | TitusBuchanan/Algorithims- | /end.js | UTF-8 | 218 | 3.0625 | 3 | [] | no_license | function confirmEnding(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
let reg = new RegExp(target + "$", "i");
return reg.test(str);
}
console.log(confirmEnding("Bastian", "n")); | true |
df02a98ea392b26b2e306f517ff6e299b31cb8d9 | JavaScript | davidjinuk/tweetr | /public/scripts/composer-char-counter.js | UTF-8 | 361 | 2.984375 | 3 | [] | no_license | $(document).ready(function() {
let max = 140;
$("textarea").keyup(function() {
var textLength = $(this).val().length;
var textRemaining = max - textLength;
$("span.counter").text(textRemaining);
if (textRemaining < 0) {
$("span.counter").css("color", "red");
} else {
$("span.counter... | true |
aab61cfdc4f575851f51676ced62137769a06b14 | JavaScript | jarrodek/arc-prototype | /arc-prototype/app/elements/payload-parser-behavior/payload-parser-behavior.js | UTF-8 | 7,628 | 2.65625 | 3 | [] | no_license | (function() {
'use strict';
/**
@license
Copyright 2016 Pawel Psztyc, The ARC team
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless... | true |
e7c5025bcf5e3643c516c4f238263ef203dfce64 | JavaScript | RizaHariati/javascript | /12-Scroll/app.js | UTF-8 | 1,967 | 2.734375 | 3 | [] | no_license | // --date--
const date = document.querySelector(".date");
const newDate = new Date().getFullYear();
date.textContent = newDate;
// --toggle--
const container = document.querySelector(".links-container");
const toggleBtn = document.querySelector(".nav-toggle");
const links = document.querySelector(".links");
const ... | true |
c9cff08e3b96d514aa6b0915ce9cb0ff900678af | JavaScript | Egremy-quark/Practicas_JS | /js/12-ejercicioCinco.js | UTF-8 | 750 | 4.15625 | 4 | [] | no_license | // alert('Huevos');
/*
Programa que muestre todos los números divisores de un número introducido en un prompt
*/
var numero = parseInt(prompt('Mete un número', 1));
/*
Creamos un ciclo For ya que este por su estructura que se utiliza para ejecutar un bloque de código un número determinado de veces.
Un ciclo Fo... | true |
f19914ffcd627aa72e024fa29995ce6d674ce9ef | JavaScript | ludiazv/node-nrf24 | /examples/GettingStarted.js | UTF-8 | 3,092 | 2.59375 | 3 | [
"MIT"
] | permissive | 'use strict';
const rf=require("../build/Release/nRF24");
const readline = require('readline');
const CE=24,CS=0;
//const CE=25,CS1=1;
const IRQ=-1;
//const IRQ=27;
console.log("Cofiguration pins CE->",CE," CS->",CS," IRQ->",IRQ);
var radio=new rf.nRF24(CE,CS);
radio.begin(false);
var ready=radio.present();
if(!rea... | true |
25f1fd0fc62af46af93a44906bf3f733d013fffe | JavaScript | JosueAnd/js-basics-online-shopping-lab-bootcamp-prep-000 | /index.js | UTF-8 | 1,815 | 3.46875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | var cart = [];
function getCart() {
return cart;
}
function setCart(c) {
cart = c;
return cart;
}
function addToCart(item) {
cart.push({
itemName: item,
itemPrice: Math.floor(Math.random() * 100 + 1)
});
return `${item} has been added to your cart.`;
}
function viewCart() {
var returnable = `I... | true |
6da70314c06a0f8f7eaa50f9864fba66262af265 | JavaScript | TomasSand/TomNeuralNetwork | /ReteRNN.js | UTF-8 | 1,675 | 2.6875 | 3 | [] | no_license |
var music_rnn, rnnPlayer;
var melody1;
Players();
inizializzamodello();
function Players() {
MagentaPlayer = new mm.Player();
MagentaPlayer = new mm.SoundFontPlayer('https://storage.googleapis.com/magentadata/js/soundfonts/sgm_plus');
}
function melodysequence() {
melody1 = {
notes: [
{pitch: not... | true |
6852352bdf0f7b11d16727546b2675c829f0649e | JavaScript | MathisPr/Javascript | /BreakOutGame.js | UTF-8 | 10,226 | 3.4375 | 3 | [] | no_license |
// Variables
var containerUI = document.querySelector('.container');
let ballUI = document.querySelector('#ball');
let paddleUI = document.querySelector('.paddle');
const startBtnUI = document.querySelector('.startBtn');
const gameoverUI = document.querySelector('.gameover')
let gameover = true;
... | true |
6283bb4856d18e8070fb6a95aa767f3584376629 | JavaScript | TDolphy/week-4-game | /assets/javascript/game.js | UTF-8 | 1,882 | 3.84375 | 4 | [] | no_license |
$(document).ready(function(){
//Start with declaring global variables to be used such as wins,
//losses, current score
// Generate the numbers
var goalScore = Math.floor((Math.random() * 102) + 19);
var crystal1 = Math.floor((Math.random() * 12) + 1);
var crystal2 = Math.floor((Math.random() * 12) + 1);
var cr... | true |
7ca7d8b9235ac5b437015ddc9998de344ce7e785 | JavaScript | DirkSonguer/Vitou | /structures/user.js | UTF-8 | 769 | 2.53125 | 3 | [] | no_license | // *************************************************** //
// User structure
//
// This structure reflects a user within the system.
//
// Author: Dirk Songuer
// License: CC BY-NC 3.0
// License: https://creativecommons.org/licenses/by-nc/3.0
// *************************************************** //
// reference objec... | true |
8d346a5538fd0edf0bf6d89b5d670826b3a93397 | JavaScript | ruwanganath/Software-Engineering-Pracs | /Biosensor.js | UTF-8 | 521 | 3.40625 | 3 | [] | no_license | let getRandomArbitrary =function(min,max){
return parseInt(Math.random() * (max-min) + min);
}
class Biosensor{
constructor(name){
this.name = name;
this.live();
}
heartBeat(){
let heartRate = getRandomArbitrary(60,80);
console.log(this.name +' heartbeat = '+he... | true |
2569ad08930e81e8b02504ab038b3daa2ab57b90 | JavaScript | samazing94/MovieQuery | /movieQuery.js | UTF-8 | 1,518 | 3.328125 | 3 | [] | no_license | var movieList = [
{ title: "Star Wars: Return of the Jedi", year: "1977", length: 125, rating: "8.4", genre: "sci-fi" },
{ title: "The Matrix Revolutions", year: "2003", length: 129, rating: "6.7", genre: "sci-fi" },
{ title: "Omen : The Final Conflict", year: "1981", length: 108, rating: "6.7", genre: "horror" }... | true |
de3a076b813132cf38580d839968c8322e3652bd | JavaScript | SKN11/DataStructures | /Recursion/P_capitalizefirst_recursion.js | UTF-8 | 292 | 3.828125 | 4 | [] | no_license | function capitalizeFirst (arr) {
let res =[];
for(let i=0;i<arr.length;i++)
{
res.push(arr[i].charAt(0).toUpperCase()+arr[i].slice(1));
}
return res;
}
let s = capitalizeFirst(['car','taco','banana']); // ['Car','Taco','Banana']
console.log(s); | true |
c2bfdf0d328c2271c9dc0c58e69d09f866bea971 | JavaScript | ethan-mace/Coding-Dojo | /MERN/Full Stack MERN/Full Stack Mern/Product Manager/app/client/src/components/Edit.jsx | UTF-8 | 2,274 | 2.71875 | 3 | [] | no_license | import { useState, useEffect } from 'react';
import axios from 'axios';
export default props => {
const { id, deleteHandler } = props;
const [item, setItem] = useState([])
const [title, setTitle] = useState('')
const [price, setPrice] = useState(0)
const [desc, setDesc] = useState('')
const [ou... | true |
355798c0b076d3c8f8178e62bcf7b46aa49ebead | JavaScript | lukaszplac/udAssignment2 | /src/App.js | UTF-8 | 1,230 | 2.9375 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Validator from './Validator/Validator';
import CharElement from './CharElement/CharElement';
import uniqid from 'uniqid';
class App extends Component {
state = {
enteredText: ""
}
onChangeHandler = (event) => {
this.setState({
e... | true |
1721cc5d8b913a111da0a970e257c2f82f5678bc | JavaScript | emisha12/To-do-list | /To do list/listJS.js | UTF-8 | 4,129 | 3.0625 | 3 | [] | no_license | var TODOList = {};
TODOList.init = function(){
var eventText, tb1, selectedPara, i,eventTextArray= [];
var divArray = [], checkedArray = [],sameEvent=0;
tb1=document.getElementById("textBox1");
document.getElementById("addBtn").addEventListener('click', addTODOEvent);
function addTODOEvent... | true |
4968e3e109f64488356bbbbadd6eab2b997ea5a4 | JavaScript | zenazn/pheme | /zhang_p_jackson_c_p3/Project/lib/lines.js | UTF-8 | 653 | 2.671875 | 3 | [] | no_license | "use strict";
var stream = require('stream');
var util = require('util');
// Note: this discards lines
function Lines() {
Lines.super_.call(this);
this.buf = "";
this.first = true;
}
util.inherits(Lines, stream.Transform);
Lines.prototype._transform = function(chunk, encoding, cb) {
this.buf += chunk;
... | true |
f63549a6e9b070fbb089b194e4d658d3f438e08f | JavaScript | Nefritor/GameEngine | /Engine/CellConfig.js | UTF-8 | 2,526 | 3.59375 | 4 | [] | no_license | export default class CellConfig {
constructor(config) {
for (const prop in config) {
if (config.hasOwnProperty(prop)) {
switch(prop) {
case 'x':
case 'y':
case 'type':
this[prop] = config[prop];
... | true |
0d461fe53d728e0e3a94111463989ab7fd27ec68 | JavaScript | bmarchete/node-course | /aula-17-18/passport.js | UTF-8 | 1,186 | 2.78125 | 3 | [
"MIT"
] | permissive | const passport = require('passport');
const LocalStrategy = require('passport-local').Strategy;
const db = require('./db');
//inicializa a estrategia de autenticação para o passport
//a função dentro de LocalStrategy configura os parametros de autenticação
passport.use(new LocalStrategy(auth));
//configuração de aute... | true |
cc2ecd88628471be35a1c415146e3c94fb9f7796 | JavaScript | BlueStoneQ/acg-box | /src/js/utils/onSwipe.js | UTF-8 | 4,934 | 3.46875 | 3 | [
"MIT"
] | permissive | /**
* 实现简易的移动端滑动事件
* 1- 目前需求只需要实现左右滑动即可
* 2- 左滑动: swipe2L() 右滑动:swipe2R(refs,func ) // 这里目前直接传refs 不理想的话 传this+refs的字符串形式--func是回调
* 3- 左右滑动的核心实现抽象出来 减少重复逻辑 -- 既swipe就是对外暴露一层二次封装
* 4- 在这个事件的基础上 -- 想实现一些左右滑动的组件 例如首页的左右滑动图
* 5- 最基础的是 利用传进来的refs给虚拟dom绑定onTouchStart onTouchMove onTouchEnd三个基础事件
* React中的事件: https:... | true |
0c9b879b00c980c29b3b3c7f2e85e20351c6cace | JavaScript | ubuntu030/u2-downloader | /server/VideoInfoCtrl.js | UTF-8 | 3,239 | 3.0625 | 3 | [] | no_license | // https://stackoverflow.com/questions/34628305/using-promises-with-fs-readfile-in-a-loop
const util = require('util');
const fs = require('fs');
const path = require('path');
const FILE_INFO_PATH = path.join(__dirname, '../video/video_info.json');
const AUDIO_PATH = path.join(__dirname, '../audio');
const VIDEO_PATH ... | true |
f44103ff14393c2d4a19c55841904ceb89b4e130 | JavaScript | Dreamkiller1911/stroymaster-pro | /themes/new/js/mylibrary/Comments.js | UTF-8 | 4,064 | 2.609375 | 3 | [] | no_license | /**
* Created by tazeb on 02.05.2016.
*/
function Comments (pl)
{
var _this = this;
this.place = $(pl);
this.params = undefined;
Messager.call(this);
/** Функция инициализации объекта с комментариями, отправка и показ добавленного комментария*/
this.init = function (pl){
/*if(_this.p... | true |
03708df56ea3015914a0e225589bc48f2548778a | JavaScript | IngelaL/project-pizza-bot | /code/pizzabot.js | UTF-8 | 1,703 | 4 | 4 | [] | no_license |
// Pizza sorts:
const vegetarian = "Vegetarian Pizza"
const hawaiian = "Hawaiian Pizza"
const pepperoni = "Pepperoni Pizza"
const pizzaPrice = 80
console.log("Vegetarian Pizza", "Hawaiian Pizza","Pepperoni Pizza");
// prevent the alert to pop up. Must click "order pizza"
const orderPizza = (event) => {
event... | true |
0636cb129107c1da72818c81b0a8ca41779f7f6a | JavaScript | shvartzdev/Charp-project | /ClientApp/src/components/Courses/Task.js | UTF-8 | 7,728 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import './styles.css';
import {
Button, Modal, ButtonToolbar,
Form, ControlLabel,
FormGroup,
FormControl
} from "react-bootstrap";
import './styles.css';
export default class Task extends Component {
constructor(props, context) {
super(props, conte... | true |
fdd2b8d8b762b3cb15fa0ae8f6d142d1abcb1b2b | JavaScript | flamingotiger/canvas-test | /src/utils/MultiSelect.js | UTF-8 | 1,200 | 2.5625 | 3 | [] | no_license | import Rect from "../shapes/Rect";
import Entity from "../base/Entity";
import Point from "../base/Point";
import Vector from "../base/Vector";
import Dimension from "../base/Dimension";
import Canvas from "../base/Canvas";
export default class MultiSelect extends Entity {
constructor(position) {
super(position)... | true |
5538a2f2b30021b32ee6f39fc32cfb12cea8c5a1 | JavaScript | mathewdaubney/Minesweeper-AI | /assets/js/sketch.js | UTF-8 | 15,712 | 3.25 | 3 | [] | no_license | var HEIGHT = 8
var WIDTH = 8
var MINES = 8
var board
var minesweeper
var minesweeper_ai
var gameOver = false
function runGame(){
document.querySelector('.withoutGame').style.display = "none";
document.querySelector('.withGame').style.display = "flex";
resetGame()
}
function resetGame(){
board = new Bo... | true |
ad6bd2303b1ddf92be9be4c194af5981d7dc2de2 | JavaScript | chrisvander/trader | /server/functions.js | UTF-8 | 710 | 3.234375 | 3 | [] | no_license | function round(num) {
return (Math.round(100*num)/100).toFixed(2);
}
module.exports = {
// PARAMETERS
// input: an array of data points to calculate upon
// size: the number of data points to create each moving average
//
// RETURNS
// an array of moving averages of the size of the input minus the
// ... | true |
4a64ad563737e8c5b24a0e5c41a6dceb4cd0700e | JavaScript | Ageel/train-activity | /assets/javascript/logic.js | UTF-8 | 2,751 | 2.90625 | 3 | [] | no_license | $(document).ready(function(){
var config = {
apiKey: "AIzaSyC9yhLViSJSFvmjPQyaLNbvJce7MoYn6Js",
authDomain: "train-7fe6c.firebaseapp.com",
databaseURL: "https://train-7fe6c.firebaseio.com",
projectId: "train-7fe6c",
storageBucket: "train-7fe6c.appspot.com",
messagingSenderId: "231507051133"
... | true |
1f28423263008a57947f7de1346a841183d9d333 | JavaScript | MidhunSureshR/hydrogen-web | /src/utils/LockMap.js | UTF-8 | 3,069 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | /*
Copyright 2020 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | true |
89e49dfee3af47438f02156b47ba42c53f146149 | JavaScript | CyrineBzn/top-chef | /Server/LaFourchette.js | UTF-8 | 4,220 | 2.53125 | 3 | [] | no_license | const request = require('request');
const fs = require('fs');
const similarity = require('similarity');
const apiSearch = 'https://m.lafourchette.com/api/restaurant/search?&offer=0&origin_code_list[]=THEFORKMANAGER&limit=400';
const apiRestaurant = 'https://m.lafourchette.com/api/restaurant/';
function get_sales(rest... | true |
517d8e056daab221ff22c780dc09371b06aea368 | JavaScript | candidocon/codeWars | /stringTransformer.js | UTF-8 | 674 | 4.25 | 4 | [] | no_license | //https://www.codewars.com/kata/string-transformer/train/javascript
function stringTransformer(str) {
let transformedStr = "";
for (let i = 0; i < str.length; i++) {
if (str[i] === str[i].toLowerCase()) {
transformedStr += str[i].toUpperCase();
} else {
transformedStr += str[i].toLowerCase();
... | true |
6466704089024a45fa9b1b572fe237582dd2db8d | JavaScript | aereeeee/TIL | /fun/arc/arc.js | UTF-8 | 1,133 | 3.015625 | 3 | [
"MIT"
] | permissive | const scale = 40;
const gap = 3;
const fontSize = 350;
const pos = [];
let font;
let t = 0;
function preload() {
font = loadFont("./JosefinSans-Bold.ttf");
}
function setup() {
createCanvas(600, 800);
background(0);
textSize(fontSize);
pos.push(font.textToPoints("C", width - 120, height - 50));
pos.push(f... | true |
055f67fbf77f9e6b0caa70529af86c14a43ad8be | JavaScript | ivanberry/chatroom | /doc/__node-in-action/add-todo-server.js | UTF-8 | 284 | 2.546875 | 3 | [
"MIT"
] | permissive | const http = require('http');
let items = [];
const server = http.createServer((req, res) => {
switch(req.method) {
case('GET'):
show(res);
break;
case('POST'):
add(req, res);
break;
default:
badRequest(res);
}
});
server.listen(3003);
| true |
ae22fdd388f1152e2ea7f151b266bfb40c5ec0b4 | JavaScript | gnaeus/JavaScript.Common | /react/react-lazy-i18n/react-lazy-i18n.js | UTF-8 | 5,137 | 2.734375 | 3 | [
"MIT"
] | permissive | // @ts-check
import {
createElement,
createContext,
useContext,
useRef,
useReducer
} from "react";
/** @type { import("react").Context<string | null >} */
export const LocaleContext = createContext(null);
/**
* Get translation function for component.
* @param {function(string): any} loadResources Translat... | true |
575dd5656da905e450f6b906d80b432707e2acf8 | JavaScript | GhettoGeek/elected-officials-lookup | /video-clips-feature.js | UTF-8 | 1,791 | 2.796875 | 3 | [] | no_license | function formatQueryParams(params) {
const queryItems = Object.keys(params)
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
return queryItems.join('&');
}
let generateYoutubeSearchUrl=(query, maxResults=3)=>{
const params = {
key: KEY,
q: query+" news",
part: 'snippet... | true |
529acbbdca0c31156c3a4808970f8accec0fa0a3 | JavaScript | adrianoapi/loteria-browser | /js/main.js | UTF-8 | 2,579 | 2.828125 | 3 | [] | no_license |
app.url = "https://www.maniadeganhar.com.br/api/ultimo-resultado";
document.getElementById("select-jogo").addEventListener("click", submitArticle);
document.getElementById("search" ).addEventListener("click", btnSearch );
document.getElementById("next" ).addEventListener("click", btnNext );
docu... | true |
dae40890e212b547345bd6124abfa549f6ab5c2a | JavaScript | ZarahZmith/github-orgs | /src/main.js | UTF-8 | 1,369 | 3.03125 | 3 | [] | no_license | let promise = fetch(
'https://api.github.com/users/addyosmani/orgs',
{
method: 'GET',
headers: {
Authorization: 'token '
}
}
);
promise.then(function responseHandler(response) {
if (response.status > 199 && response.status < 300) {
// console.log("yay, we got here!!");
// console.log(... | true |
c9caf66ea27d52f853fcc385761fc270332a9eb7 | JavaScript | BekoBou/83596-pixel-hunter | /js/views/header.js | UTF-8 | 1,410 | 2.671875 | 3 | [] | no_license | import AbstractView from './abstract';
import bindRestartHandler from './../restart';
const getHeart = (lifes) => {
let result = '';
for (let i = 0; i < 3 - lifes; i++) {
result += '<img src="img/heart__empty.svg" class="game__heart" alt="Life" width="32" height="32">';
}
for (let i = 0; i < lifes; i++) {
... | true |
29a7841ec19a93951e78ece8e614b288b1bd1203 | JavaScript | elliotaplant/puzzlemaster-presents | /may2/baseballConcert.js | UTF-8 | 2,659 | 3.984375 | 4 | [] | no_license | const fs = require('fs');
// Load all the concert words from the concert words file into a Set
//
// Create an empty list of possible solutions
//
// Load all the baseball names into a List
// For each full name in the baseball list
// Get the first name from the full name
// Get the last name from the full name
/... | true |
ace4fbef09bafba8503766d78ac5fbe70930949b | JavaScript | mikesnacki/library | /app/index.js | UTF-8 | 1,758 | 2.734375 | 3 | [] | no_license |
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import Addbook from "./components/Addbook"
import Books from "./components/Books"
import base from "./data/firebase"
class App extends React.Component {
constructor(props) {
super(props)
this.addBook = this.addBook.b... | true |
cdb1e334811a5b91acc75b00a358153b6357a4bd | JavaScript | squarefeet/AudioIO | /src/math/trigonometry/Tan.es6 | UTF-8 | 1,122 | 3.046875 | 3 | [] | no_license | import "../../core/AudioIO.es6";
import Node from "../../core/Node.es6";
// Tangent approximation!
//
// Only works in range of -Math.PI to Math.PI.
//
// sin( input ) / cos( input )
class Tan extends Node {
/**
* @param {Object} io Instance of AudioIO.
*/
constructor( io, value ) {
super( i... | true |
a248f386d5bb353c33b4f917a488e2cd55b07874 | JavaScript | agucarpar/FeedSana | /server/bin/Seeds.js | UTF-8 | 1,466 | 2.859375 | 3 | [] | no_license | // Seeds file that remove all users and create 2 new users
// To execute this seed, run from the root of the project
// $ node bin/seeds.js
require("dotenv").config();
const mongoose = require("mongoose");
const bcrypt = require("bcrypt");
const User = require("../models/User");
const Recipe = require("../mo... | true |
d6d0f84660b934a22240efadb098b512cd31598d | JavaScript | joetime/ToDoHashtags | /ToDoHashtags/js/app.js | UTF-8 | 4,398 | 2.53125 | 3 | [] | no_license |
(function () {
angular.module('todos', ['ngSanitize'])
.controller('TodosController', ['$scope', function ($scope) {
// load todos from localStorage or empty list
function init() {
console.log('init()');
$scope.myTodos = JSON.parse(localStorage.getItem('todos')) || [... | true |
39d6bd5bdc18b0a46dcdeac550d7b49327e00954 | JavaScript | sampbay/skin | /app/assets/javascripts/landing_page.js | UTF-8 | 458 | 2.875 | 3 | [] | no_license | /* Set the width of the side navigation to 250px */
function openNav() {
if (window.matchMedia('screen and (max-width:970px) , (max-height:465px').matches) {
// do smth
document.getElementById("mySidenav").style.width = "100%";
} else {
// do smth.else
document.getElementById("mySidenav").style.width = "25%";
}
... | true |
f3461a3dc4cdc05cf8d7016f077b59910ad853f3 | JavaScript | RamanMyreign/FullStack | /prcatical19/practical19.js | UTF-8 | 952 | 2.71875 | 3 | [] | no_license | var btn1 = document.getElementById('btn-1');
var nextbtn2 = document.getElementById('next-btn-2');
var backbtn2 = document.getElementById('back-btn-2');
var nextbtn3 = document.getElementById('next-btn-3');
var backbtn3 = document.getElementById('back-btn-3');
var form1 = document.getElementById('form-1');
var form2 = ... | true |
2a676a8f5e344c23656198820cac10e1713bbb3d | JavaScript | varesc90/varesc90.github.io | /JS/whatyouneed.js | UTF-8 | 1,227 | 2.9375 | 3 | [] | no_license |
var x;
$(document).ready(function() {
$('html').show();
$("#header li").mouseenter(function(){
$("#header").css("background-color","white")
});
$("#header li").mouseleave(function(){
$("#header").css("background-color","")
});
$("#choices li").each(function(i){
$(this).mouseenter(function(){
... | true |
510e150c25d7a8af2727f2ca07c1899c6b4654d7 | JavaScript | PepeValderramaRegueira/custom-pokeapi | /src/controllers/index.controller.js | UTF-8 | 1,202 | 2.625 | 3 | [] | no_license | const controller = {};
const connection = require('../dbConnection/connection');
const PokeModel = require('../models/pokemon.model');
controller.index = async (req, res) => {
try {
await connection();
const allPokemons = await PokeModel.find();
console.log(allPokemons);
res.render('index', { allPoke... | true |
62d7112d4021bf13092c0aafb10b9359e984a964 | JavaScript | mikkpr/geotic | /src/Registries/ComponentRegistry.js | UTF-8 | 1,736 | 2.859375 | 3 | [] | no_license | import Component from '../Component';
import camelcase from 'camelcase';
export default class ComponentRegistry {
#nameCache = new Map();
#definitions = new Map();
#ecs = null;
constructor(ecs) {
this.#ecs = ecs;
}
register(component) {
this.#definitions.set(component.name, co... | true |
8e093488585f919722551c26ad7122ae853c4360 | JavaScript | gpratte/texastoc-v3-client | /src/league/components/Points.jsx | UTF-8 | 1,537 | 2.546875 | 3 | [] | no_license | import React from 'react'
import {getPoints} from '../leagueClient'
import Table from "react-bootstrap/Table";
class Points extends React.Component {
constructor(props) {
super(props);
this.state = {
points: null
};
}
componentDidMount() {
getPoints(this.updatePoints);
}
updatePoints... | true |
77e4f282c4d69391d3913d6fd5a07e864b8ebd9a | JavaScript | arapin/hs_fw | /js/common.js | UTF-8 | 4,177 | 2.828125 | 3 | [
"MIT"
] | permissive | function explode(delimiter, string, limit) {
// discuss at: http://phpjs.org/functions/explode/
// original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// example 1: explode(' ', 'Kevin van Zonneveld');
// returns 1: {0: 'Kevin', 1: 'van', 2: 'Zonneveld'}
if (arguments.length < 2 || typeof d... | true |
e694e4d86081c01f33c22cd2916c0ef4c48913b8 | JavaScript | AtlasOfLivingAustralia/ecodata | /scripts/data_migration/grails3/updateUndefinedValues.js | UTF-8 | 2,578 | 2.671875 | 3 | [] | no_license |
var recursiveSearch = function(collection) {
var updateUndefinedToNull = function (collection, id, fieldToUpdate, origValue) {
print ("the undefined field is " + fieldToUpdate + " : " + origValue);
print ('updating ' + fieldToUpdate + ' to null');
var update = {};
//update[parentfi... | true |
4143271b4f05f624123b0eadefacafb00d683866 | JavaScript | pavelhristov/notifications-vue | /client/data/notifications.js | UTF-8 | 2,182 | 2.53125 | 3 | [
"MIT"
] | permissive | export default (function () {
let notifications = [
{
id: 1321,
type: 'text',
title: 'Test notification',
text: 'Test text notification',
expires: 3600
},
{
id: 4322,
type: 'bonus',
title: 'You wi... | true |
52b706451219482913bc06e9c32d5f82380195d0 | JavaScript | LucasDevv/ProjetoTCC | /src/home/home.js | UTF-8 | 2,097 | 2.53125 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import {Link, useHistory} from 'react-router-dom';
import './home.css';
import Api from '../api';
import MenuLateral from './menuLateral';
import Globais from '../global';
export default function Home(){
const [userState, setUserState] = useState(true);
const his... | true |
2a103fa37fbe9a541319ec7c0b474ea87265916e | JavaScript | aldiinugroho/simple-task | /backend/views/src/resultpage/Resultpage.js | UTF-8 | 1,331 | 2.65625 | 3 | [] | no_license | import React, { useEffect, useState } from "react"
const Resultpage = () => {
// production server
const URL = process.env.REACT_APP_GETRESULT
// local server
// const URL = 'http://www.json-generator.com/api/json/get/ceZlscbNxK?indent=2'
const GetResult = () => {
const [result, setResul... | true |
09236fa34792f93c1e26de0f69eced4c5821f8c1 | JavaScript | juliankohlman/Redux-II | /amigos/src/actions/index.js | UTF-8 | 1,598 | 2.6875 | 3 | [] | no_license | import axios from 'axios';
/*
{
fetchingFriends: false,
friendsFetched: false,
friendsSaved: false,
savingFriends: false, // show loading
updatingFriend: false,
friendUpdated: false,
deletingFriend: false,
friendDeleted: false,
friends: [],
error: null
}
*/
// action types
export const ERROR = 'ERR... | true |
1a7ffb72005effc3772a6cba7ba70e4e22f0f09b | JavaScript | gooduling/foodpoints-demo | /develop/constants/httpErrors.constant.js | UTF-8 | 1,029 | 2.515625 | 3 | [] | no_license | const statuses = {
400: {
message: 'bad request',
handler: () => {},
},
401: {
message: 'unauthorized',
handler: () => {},
},
402: {
message: 'payment required',
handler: () => {},
},
403: {
message: 'forbidden',
handler: () =>... | true |
bb08b9e638772cb1999ba6df93fb2906e1a858a2 | JavaScript | chantal-o/FoodHero-3 | /client/src/actions/authActions.js | UTF-8 | 2,432 | 2.59375 | 3 | [] | no_license | import axios from "axios";
import setAuthToken from "../utils/setAuthToken";
import jwt_decode from "jwt-decode";
import {
GET_ERRORS,
SET_CURRENT_USER,
USER_LOADING
} from "./types";
// import { decode } from "punycode";
// Register User
export const registerUser = (userData, history) => dispatch => {
axios
... | true |
27cbf71d4961f6bb4e57a23abb72b5de4442159e | JavaScript | tannerla/retail-store | /src/customer.js | UTF-8 | 699 | 2.625 | 3 | [
"ISC"
] | permissive | import moment from "moment";
import Basket from "./basket";
class Customer {
constructor(isEmployee = false, isAffiliate = false, dateJoined = moment()) {
this._isEmployee = isEmployee;
this._isAffiliate = isAffiliate;
this._dateJoined = dateJoined;
this._basket = new Basket();
}
get isEmployee(... | true |
e9868a40aab6dda9f63ef502a81078067e3a1a8e | JavaScript | SpaceNSorcery/Web-Diary | /diary.js | UTF-8 | 2,114 | 3.5625 | 4 | [] | no_license | const recordList = document.querySelector('#recordList');
//Get diary from local storage
function getDiaryFromLocalStorage() {
if(localStorage.getItem('diary') == null) {
return [];
} else {
return JSON.parse(localStorage.getItem('diary'));
}
}
// Handle window load event
funct... | true |
3b9d9414a8cacf10762be0a9cc313f02598b659f | JavaScript | jonallenaz/first-repository | /timer/js/analog.js | UTF-8 | 3,043 | 2.65625 | 3 | [] | no_license | var tzo = new Date().getTimezoneOffset() * 60 * 1000;
function start_clock(time, box_num, running){
var date = new Date(time + tzo);
var milliseconds = date.getMilliseconds();
var seconds = date.getSeconds();
var minutes = date.getMinutes();
var hours = date.getHours() > 12 ? date.getHours() - 12 : date.getHours(... | true |