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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
af533f9ef673a7fafeecbf9bf1956be28862c4a1 | JavaScript | CoinRoster/slotmachine | /html/common/js/currencyformat.js | UTF-8 | 2,683 | 3.71875 | 4 | [] | no_license | /**
* Converts an amount from a source currency to a target currency.
*
* @param amount The amount to format. May be a BigNumber object, number, or a string.
* @param fromCurrency The currency that the 'amount' parameter is currently in (to be converted from). Valid values include: "btc", "satoshis", and "tokens".
* @p... | true |
489bfc176f948e24db93dcbc0864e145fd4978ad | JavaScript | judamalua/DT-D12-Hackathon | /Acme-Survival/src/main/webapp/scripts/map/mapFunctions.js | UTF-8 | 2,608 | 2.90625 | 3 | [] | no_license | function randomPointInZone(r) {
var p = {};
var r1 = Math.random();
var r2 = Math.random();
if (Math.random(0, 1) > 0.5) {
p.x = (1 - Math.sqrt(r1)) * r.A.x + (Math.sqrt(r1) * (1 - r2)) * r.B.x + (Math.sqrt(r1) * r2) * r.C.x;
p.y = (1 - Math.sqrt(r1)) * r.A.y + (Math.sqrt(r1) * (1 - r2)) * r.B.y + (Math.sqrt(r1... | true |
f4ba4f937625213fd51dbf2472bca2612aaeb7df | JavaScript | nithyeswari/test_utility | /index.js | UTF-8 | 2,055 | 3.046875 | 3 | [] | no_license | const es = require('event-stream');
const fs = require('fs');
const Rx = require('rxjs');
const isAnagram = require('./anagram')
const processingStatus$ = new Rx.Subject();
processingStatus$.subscribe((message)=>console.log('['+ new Date().toString()+']'+message));
var groupedList = null;
const chunk = (arr, size) => a... | true |
5a460ea20f4afb97192469b8b54ba8745effeeb2 | JavaScript | BrownxGirl/password-checker | /src/password-checker.js | UTF-8 | 1,632 | 3.375 | 3 | [] | no_license | function passwordIsValid(password) {
let lowerCaseLetters = /[a-z]/g;
let upperCaseLetters = /[A-Z]/g;
let digit = /[0-9]/g;
let specialchar = /[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]/g; /// /\W_/g
if (password == "") {
throw "password should exist";
}
if (password.length <= 8) {
throw "password shoul... | true |
2fa74c8d22ff64a5420b4096cdca2d6138f0b951 | JavaScript | Lyrics1/arithmetic-visualization | /open/assets/js/mergeSort.js | UTF-8 | 31,801 | 2.53125 | 3 | [
"MIT"
] | permissive | window.onload = function() {
var numMin = 4;
var numMax = 7;
var dataMin = 1;
var dataMax = 50;
var array; //存储产生的随机数组 或者 记录输入的数据
var rHeight = 1;
var flag = 1; //默认升序
// var flagAnimation = 1; //默认有动画效果
var trans;
var count = 1; //记录动画的执行次数
var downCount = 1;
... | true |
a35e618609682845d5a986b3013efb1b40b58ce2 | JavaScript | TBBle/monte-carlo-stefano | /src/distributions/PERT.js | UTF-8 | 944 | 2.953125 | 3 | [] | no_license | import PD from 'probability-distributions';
class PERT {
constructor({ minimum, maximum, mode, height = 4 }) {
// Calculate parameters for the beta-curve
// Reference https://www.riskamp.com/beta-pert#the-beta-pert-distribution-in-r
// Handy, since the probability-distributions code provides the same API... | true |
468b94c0c95615ceda96269f5f77422122c2f064 | JavaScript | GearJunkie/can-of-books-backend | /modules/book.js | UTF-8 | 1,560 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
const getKey = require('../lib/getKey.js');
const jwt = require('jsonwebtoken');
const User = require('../models/User.js');
const Book = {};
//===================================================//
Book.profile = (req, res) => {
const token = req.headers.authorization.split(' ')[1];
jwt.verify(toke... | true |
c2b2dddba2796f3567cafbb67683667e2b86d497 | JavaScript | inspire12/homepage-spring-server | /src/main/resources/static/js/custom/tagging/tag.js | UTF-8 | 1,249 | 3.578125 | 4 | [] | no_license | var txt = document.getElementById('txt');
var list = document.getElementById('list');
var items = [];
txt.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
let val = txt.value;
checkTagTxt(val);
}
});
function checkTagTxt (val) {
if (val !== '') {
if ... | true |
243de42fc7a025c4239b2c849718a1475de9e39b | JavaScript | steverandy/json-datastore | /src/index.js | UTF-8 | 4,449 | 2.546875 | 3 | [
"MIT"
] | permissive | let fs = require("fs");
let path = require("path");
let mkdirp = require("mkdirp");
let promisify = require("util.promisify");
let writeFileAtomic = require("write-file-atomic");
mkdirp = promisify(mkdirp);
writeFileAtomic = promisify(writeFileAtomic);
let readFile = promisify(fs.readFile);
let readdir = promisify(fs.... | true |
52f111c28beecccac9ba493260b54515059fd17b | JavaScript | Makae/OOGeom | /js/networking/contentloader.js | UTF-8 | 577 | 2.609375 | 3 | [
"MIT"
] | permissive | var ContentLoader = (function() {
var instance;
var ContentLoader = function() {
if(instance)
return instance;
this.base = '';
this.service = new Service(5);
}
ContentLoader.prototype.setBase = function(base) {
this.base = base;
return this;
}
ContentLoader.prototype.load = fun... | true |
6e81299235615d4a12cbc27d1d0c657ccc1a5839 | JavaScript | simrit1/inscribed-square | /computation.js | UTF-8 | 2,645 | 3.640625 | 4 | [] | no_license | // @ts-check
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
getDistance(p) {
return Math.sqrt(
(this.x - p.x) * (this.x - p.x) + (this.y - p.y) * (this.y - p.y)
);
}
}
var minDistance = 5; // The min distance between 2 points (we get from mouse drag)
var path;
// approx. equ... | true |
41b7987d5df4c4f30d99e8a5ececaf5080b8c104 | JavaScript | defoebrand/shooter-test | /src/Characters/characters.js | UTF-8 | 1,532 | 2.828125 | 3 | [
"MIT"
] | permissive | import 'phaser'
export class PlayableCharacter extends Phaser.GameObjects.Sprite {
constructor(scene, x, y, key, type){
super(scene, x, y, key);
this.scene = scene;
this.x = x;
this.y = y;
this.scene.add.existing(this);
this.scene.physics.world.enableBody(this, 0);
this.bo... | true |
bf15dcda3902c12b1606c1164f678e7a046f6a49 | JavaScript | tuandangn/eshop | /src/core/data/data-seeders/product.seeder.js | UTF-8 | 1,317 | 2.796875 | 3 | [] | no_license | const products = [
{ name: 'God Father', displayOrder: 1, show: true, price: 99.99, shortDesc: 'God father book' },
{ name: 'Perfect Chess', displayOrder: 2, show: true, price: 88.99, shortDesc: 'Perfect Chess' },
{ name: 'Blue Sea', displayOrder: 3, show: true, price: 77.99, shortDesc: 'Blue Sea book' },
... | true |
c98d16541cb49fc054976cad541c0ab594e0f94a | JavaScript | jonjitsu/learnyoumeanstack | /ziplines/8-js-calculator/js/main.js | UTF-8 | 9,900 | 2.96875 | 3 | [] | no_license |
var what = function() { console.log.apply(console, arguments); },
extend = _.extend,
ObserverMixin = function(obj) {
var observers = [],
notify = function(data) {
observers
.forEach(function(observer) {
observer(data);
... | true |
2f8b9ebed33ecf69a0d79e8bbfbd568b7fba0934 | JavaScript | jakesboy2/ScreepSquad | /auxilliary_functions.js | UTF-8 | 817 | 3.359375 | 3 | [
"MIT"
] | permissive | /**
* @namespace Aux_functions
* @hideconstructor
* @inheritdoc
*/
/**
* Capitalizes the first letter of a string
* @memberof Aux_functions
* @return {string}
*/
String.prototype.capitalizeFirst = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
/**
* Gets the object from an ID as... | true |
6ddc7de1e4cee0e0a751b587278ed719363da726 | JavaScript | sf-wdi-26/homework | /mcarter78/w02d03-hw/app.js | UTF-8 | 1,900 | 3.25 | 3 | [] | no_license |
var posts = []; // emtpy array to hold posts
var $form = $("#postingForm"); // selecting the form element
var $post = $("#post"); // selecting the form input
var $postList = $("#post-list"); // selecting the ul... | true |
4d652c5be4482f04e8625f6b8362f80fd88dc47f | JavaScript | square1997/momentum | /src/backGround.js | UTF-8 | 383 | 3.234375 | 3 | [] | no_license | const backGround = ["1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg"];
const body = document.querySelector("body");
function loadImage() {
const randomImage = backGround[Math.floor(Math.random() * backGround.length)];
const image = new Image();
image.src = `bg/${randomImage}`;
image.classList.add("bgImage");
body... | true |
dd8d0ed76d8ed35cd06da64a1b91e89d7be48322 | JavaScript | Softcadbury/football-peek | /server/data/competitions.js | UTF-8 | 536 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
const competitions = {
championsLeague: {
code: 'champions-league',
name: 'Champions League',
smallName: 'C1'
},
europaLeague: {
code: 'europa-league',
name: 'Europa League',
smallName: 'C3'
}
};
// Add property isCompetition... | true |
8c3c7f0a4b0bba349d548fb14537536cbd8befcf | JavaScript | Olivaresosvaldo/Ga-fewd | /d10/materials/rgb-color-choice/js/project.js | UTF-8 | 346 | 3.203125 | 3 | [] | no_license | $("a").on("click", function() {
console.log("this button was clicked");
var stuffTheUserTyped = $("input").val();
var r = $("#red").val();
var g = $("#green").val();
var b = $("#blue").val();
var rgb = "rgb(" + r + "," + g + "," + b + ")"
console.log(rgb)
$('#wrapper').css('background-color', rgb);
$('#col... | true |
c148d0a27728650c5d39fa266ef679a0446c3add | JavaScript | JeDaIZIM/Labs_Javascript | /js/object.js | UTF-8 | 409 | 3.28125 | 3 | [] | no_license | function isEmpty(object){
if(Object.keys(object).length==1){
alert('There is ' + Object.keys(object).length + ' preference! ' + "False")
}
else if (Object.keys(object).length>1) {
alert('There are ' + Object.keys(object).length + ' preferences! ' + "False")
}
else{
alert('Object is empty! True')... | true |
71e64cf7c8ea00894aa471c3acfbf44d8aeb0eeb | JavaScript | sahojasv/net-worth-calculator | /src/utility/Util.js | UTF-8 | 259 | 2.65625 | 3 | [] | no_license | export const prepareAssetData = (assets, assetType) => {
const data = [];
assets.forEach(asset => {
if (asset.TypeId === assetType.Id) {
data.push({
Type: asset.Name,
amount: asset.Amount
});
}
});
return data;
}; | true |
0bf9bec15adb6464f888df1d7b7609bb4b53e0a2 | JavaScript | bjmashele/mem-muscle | /api/services/decks.service.js | UTF-8 | 918 | 2.828125 | 3 | [] | no_license | const mongoose = require("mongoose");
const Deck = require("../models/deck.model");
exports.createDeck = async function(deck) {
let newDeck = new Deck({
title: deck.title,
description: deck.description,
id: mongoose.Types.ObjectId(),
cards: deck.cards,
createdAt: new Date()
});
try {
let... | true |
59f49306a98e846383ec2505cfedc7dc0d709303 | JavaScript | hschaefer123/ui5-control-svgimage | /control/3rd/jquery-svg-inject.js | UTF-8 | 7,038 | 2.90625 | 3 | [
"MIT"
] | permissive | /*
svgInject - v1.0.0
jQuery plugin for replacing img-tags with SVG content
by Robert Bue (@robert_bue)
Dual licensed under MIT and GPL.
*/
;(function($, window, document, undefined) {
var pluginName = 'svgInject';
/**
* Cache that helps to reduce requests
*/
function Cache(){
... | true |
7a4cf65d7fa6b973a789070002945d74b09ea5a3 | JavaScript | sudo-ninguem/Contador-Automatico | /STATES.js | UTF-8 | 1,467 | 4.0625 | 4 | [
"MIT"
] | permissive | class App extends React.Component {
constructor(props){
super(props);
this.state = {
valor:0
}
}
render(){
setTimeout(() =>{ // Perceba que funções nativas de java funcionam perfeitamente em react
/* So lembrando que a função (setTimeout) é uma função nativa de JS que... | true |
6656112eb281922c352879ad0137f5a2bfa82890 | JavaScript | LenoviMAD/Landing | /italcambio/js/main.js | UTF-8 | 13,927 | 2.859375 | 3 | [] | no_license | //MODAL
if (document.getElementsByClassName("openModal")) {
//console.log("entre")
var modal = document.getElementById("tvesModal");
//Seleccionas todos los elementos con clase btnModal
var btn = document.getElementsByClassName("openModal");
//Recorres la lista de elementos seleccionados
for ... | true |
0182201f58f7e101524b4e80863385d3ade30eca | JavaScript | 3011stan/trybe-exercises | /bloco_4/dia_1/ex10.js | UTF-8 | 1,044 | 3.828125 | 4 | [] | no_license | /**Escreva um programa que se inicie com dois valores em duas variáveis diferentes: o custo de um produto e seu valor de venda. A partir dos valores, calcule quanto de lucro (valor de venda descontado o custo do produto) a empresa terá ao vender mil desses produtos.
Atente que, sobre o custo do produto, incide um impos... | true |
1ed7184493b325e6a5982c248af8a9242f101980 | JavaScript | Hong-Ki/sls-music-chart-crawler | /module/Response.js | UTF-8 | 585 | 2.796875 | 3 | [] | no_license | const defaultInfo = {
status: 200,
data: {},
headers: {}
};
class Response {
constructor(status, data, headers) {
this.status = status || defaultInfo.status;
this.data = data || defaultInfo.data;
this.headers = headers || defaultInfo.headers;
}
setStatus(status) {
this.status = status;
}... | true |
79ec429a1f37ce0bfd4a228e3a56ff2d533e114e | JavaScript | andreamaille/star-wars-app | /src/reducers/paginationReducer.js | UTF-8 | 1,500 | 2.78125 | 3 | [] | no_license | export default (state = {}, action) => {
const pages = {...state}
switch (action.type) {
case 'NEXT_PAGE':
if (pages.totalPages === pages.currentPage) {
return {
...state,
currentPage: pages.currentPage
}
} ... | true |
7543fe3e6df8640dea139d6db46285b2a5ab1f3f | JavaScript | foransingh2902/Angular-Projects | /typescript code/interfaces.js | UTF-8 | 387 | 3.0625 | 3 | [] | no_license | var drawpoint = function (point) {
// some code here
};
drawpoint({ x: 1, y: 3 });
// problem with this approach is that we can even pass the 'name:'foran''
// and it will work
// solution 1: inline annotation
var drawpointN = function (point) {
// some code
};
var drawpointI = function (point) {
console.lo... | true |
82054498c4686b4a1e9a3620226824510b97d1a2 | JavaScript | mariaYunB/brackets-school-1 | /js/projects.js | UTF-8 | 716 | 2.890625 | 3 | [
"MIT"
] | permissive | const toggleBlock = document.querySelector('.toggle');
const projectsToggles = document.querySelectorAll('.toggle__item');
//слайдер для учебных проектов
function showSlides(number) {
const slides = document.querySelectorAll('.card');
for (let i = 0; i < slides.length; i++) {
slides[i].classList.remov... | true |
1e3c02db253f6d977da3db342e20e9983568a6be | JavaScript | slutske22/Practice_files | /Editable Popup/index.js | UTF-8 | 3,728 | 2.8125 | 3 | [] | no_license | // Useful round number function
function roundNumber(number, tensplace = 10){
return Math.round( number * tensplace) / tensplace;
}
// Define some maps options
var mapOptions = {
center: [33.270, -116.650],
zoom: 8
}
//Create a map and assign it to the map div
var leafletMap = L.map('leafletMapid', map... | true |
1d50c0d0a5b4fdf20904cb4caf519a2478760ef9 | JavaScript | QzhouZ/React-components | /components/scrolltop/index.js | UTF-8 | 473 | 2.78125 | 3 | [] | no_license | /**
* Author: Zane 448482356@qq.com
* Date: 2016-01-25
*/
import React from 'react';
let Test = React.createClass({
getInitialState() {
return {
name: 'tom'
};
},
handle() {
this.setState({
name: 'zane'
});
},
componentDidMount() {
},
render() {
var txt;
if (this.props.type ... | true |
46e8e5be3a2f14ccf3251448362b2b15d42e5766 | JavaScript | Cleanly1/Cleanly1.github.io | /src/components/Clock/index.jsx | UTF-8 | 877 | 2.53125 | 3 | [
"MIT"
] | permissive | import React from 'react';
import styled from 'styled-components';
const StyledDiv = styled.div`
position: fixed;
bottom: -10px;
right: 10px;
transform: rotate(-90deg) translate(35px, 30px);
@media (min-width: 1024px) {
transform: rotate(0deg);
}
`;
const Text = styled.p`
font-size: 1.2rem;
font-weight: bo... | true |
ee33eb2dd1d432da850fb45ade6cb495d5465b6a | JavaScript | tannerlinsley/promisedland | /src/components/Timer.js | UTF-8 | 1,144 | 2.53125 | 3 | [] | no_license | import React from 'react'
import styled from 'styled-components'
import { format } from 'date-fns'
import RAF from 'raf'
const Styles = styled.div`
font-family: monospace, sans-serif;
font-size: 1.7rem;
color: rgb(235, 90, 90);
`
const getDuration = amount => new Date(2018, 0, 1).getTime() + amount
export defa... | true |
19722667ee715333e575519a8c1d0d2fefb8c5e8 | JavaScript | mahajan1217/personal-meeting | /public/js/ui.js | UTF-8 | 4,234 | 2.78125 | 3 | [] | no_license | import * as constants from './constants.js';
import * as elements from './elements.js';
export const updatePersonalCode = (personalCode) => {
const personalCodeParagraph = document.getElementById('personal_code_paragraph');
personalCodeParagraph.innerHTML = personalCode;
}
export const showIncoming... | true |
442fc0c194e58fa540c11ffd1a2aa5ec05725a50 | JavaScript | BryanRogel/football_betting | /src/components/resultTable/ResultTable.js | UTF-8 | 3,392 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react';
import styled from 'styled-components';
import $ from 'jquery';
class ResultTable extends Component {
componentDidMount() {
$("input:checkbox").on('click', function () {
// Cambia cada vez que se haga clic en el checkbox
var $box = $(this)... | true |
c2c00609360527a7d1e60b0d61f3eea804ad638f | JavaScript | vsparrow/flex_frontend | /src/js/category.js | UTF-8 | 210 | 2.640625 | 3 | [] | no_license | const CategoryAll = [];
class Category{
constructor(id,name){
this.id=id;
this.name=name;
this.items = [];
CategoryAll.push(this)
}//constructor
static all(){ return CategoryAll}
}//Category
| true |
821def0fb40e8cbc856420223901785e0b7d89f7 | JavaScript | StevenSopilidis/realestate | /Admin/adminMain/editUsers.js | UTF-8 | 1,374 | 2.625 | 3 | [] | no_license | new Vue({
el : "#vue-app",
data(){
return {
userAmount: 7,
//used in the editUserDetails.php
}
},
methods: {
seeMoreUsers(){
$('#tablebody').load('displayMoreUsersForEdit.php',{
... | true |
5b33e9ef6e7767221a14b832511ed1b4023e65d2 | JavaScript | itspriyambhattacharya/Ventrux-Technology.github.io | /js/app.js | UTF-8 | 2,285 | 2.53125 | 3 | [] | no_license | console.log("Test")
let navbar = document.querySelector('header')
console.log(navbar)
window.addEventListener('scroll', function () {
navbar.classList.toggle('sticky', this.window.scrollY > 0);
})
// Swiper Js Starts
var swiper = new Swiper(".mySwiper", {
slidesPerView: 3,
spaceBetween: 30,
slidesPerGroup: 3... | true |
17bc5027be77437c7495c478b9d6cbbcbaf37f55 | JavaScript | vrnery/desafio | /agendavirtual/public/assets/js/subscribe.js | UTF-8 | 1,922 | 2.6875 | 3 | [] | no_license | let btn_subscribe_newuser = document.querySelector('#btn_subscribe_newuser');
let btn_subscribe_cep = document.querySelector('#btn_subscribe_cep');
$(document).ready(function(){
$(".close").click(function(){
$("#myCloseAlert").alert("close");
});
});
btn_subscribe_cep.onclick = function(){
var getcep = docu... | true |
31995b6be5a6675fb4604f4060dcb322a79e7774 | JavaScript | JoniWaibs/lasttransfer-backend | /controllers/auth/index.js | UTF-8 | 1,926 | 2.609375 | 3 | [] | no_license | const userModel = require("../../models/users/Users");
const bcrypt = require("bcryptjs");
const { validationResult } = require("express-validator");
const jwt = require("jsonwebtoken");
require("dotenv").config({ path: ".env" });
module.exports = {
logIn: async (req, res, next) => {
const { email, password } = ... | true |
389e63ceb7651b5064d53ef83e804e149db1a5da | JavaScript | davidcyp/sculejs | /test_web/com.scule.tests.js | UTF-8 | 109,680 | 2.671875 | 3 | [] | no_license | /**
* Copyright (c) 2013, Dan Eyles (dan@irlgaming.com)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notic... | true |
f3c23fe439e56bde4bdf65e800d70658edf74846 | JavaScript | evanjt/elodie | /app/modules/broadcast.js | UTF-8 | 4,445 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | var exports = module.exports = {};
var path = require('path');
var exec = require('child_process').exec,
config = require('./config.js');
// The main process listens for events from the web renderer.
// When photos are dragged onto the toolbar and photos are requested to be updated it will fire an 'update-photos' ... | true |
7a2ad349c601c67a4a44ed008236d2593d4bfbbb | JavaScript | teemak/javascript-projects | /node-rest-api/routes/api/products.js | UTF-8 | 3,518 | 2.640625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const app = express(express);
const Product = require('../../models/product');
router.get('/', (req, res) => {
Product
.find()
//SELECT will only return those fields
.select('_id name price')
.then(products => {
... | true |
0c9e00a8d4c5fd50428bafe5b91cc4c3ca7e4bf0 | JavaScript | laurawyse/advent-of-code | /2018/day2/part2.js | UTF-8 | 912 | 3.328125 | 3 | [] | no_license | const fs = require('fs');
const boxIds = fs.readFileSync('input.txt', 'utf8').split('\n');
// for testing
// const boxIds = ['abcde', 'fghij', 'klmno', 'pqrst', 'fguij','axcye', 'wvxyz'];
let matchymatch;
boxIds.forEach(id1 => {
boxIds.forEach(id2 => {
if (id1 === id2) {
// nope, its the same... | true |
b8b0b20ebfcacb06fd74f13cd9a776d705621e90 | JavaScript | apastushenko/apastushenko.github.io | /GoIT/javascript/home/lesson9/task1.js | WINDOWS-1251 | 695 | 3.4375 | 3 | [] | no_license | /**
* Created by pastushenko-av on 03.11.2015.
*/
function sumArgs() {
var args = [].slice.call(arguments);
return args.reduce(function(a, b) {
return a + b;
});
}
alert( sumArgs(1, 2, 3) ); // 6, ,
//function sumArgs() {
// // reduce
// arguments.reduce = [].reduce;
// return ... | true |
e1cbae7f9b6cc6849e9f6837f76e61710b71a959 | JavaScript | stev-chen/FitnessApp | /public/controllers/challengeController.js | UTF-8 | 3,875 | 2.609375 | 3 | [] | no_license | app.controller('challengeController', function ($scope, challengesService, usersService, $routeParams, $location) {
function init() {
$scope.myChallenges = [];
$scope.progressBarStyle = {};
}
$scope.getChallenges = function() {
return challengesService.getChallenges(); ... | true |
f39103d644c46612181e0b5fd39d3cd790f4f76e | JavaScript | jprester/kamikaze-writer | /src/js/scripts.js | UTF-8 | 496 | 3.421875 | 3 | [] | no_license | var textSection = document.getElementById('textContent');
var myVar;
var time = 5;
textSection.addEventListener('keydown', runTimer);
function runTimer () {
clearTimeout(myVar);
myVar = setTimeout(timerAction, timerSetup(time));
}
function timerSetup(seconds) {
return seconds * 1000;
}
function timerAct... | true |
c770dabde3b1d60afe4015868e10ff286924f68e | JavaScript | brettz9/nyc | /test/helpers/spawn.js | UTF-8 | 563 | 2.515625 | 3 | [
"ISC"
] | permissive | 'use strict'
const cp = require('child_process')
function spawn (exe, args, opts) {
return new Promise((resolve, reject) => {
const proc = cp.spawn(exe, args, opts)
const stdout = []
const stderr = []
proc.stdout.on('data', buf => stdout.push(buf))
proc.stderr.on('data', buf => stderr.push(buf)... | true |
a1203b65f31b77fed6169f91a3ca4d7ea5ccb617 | JavaScript | soanni/stocks_oop | /js/chart.js | UTF-8 | 2,332 | 2.71875 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | function round(d) {
return Math.round(100 * d) / 100;
}
console.log('Start logging chart.js..');
$(document).ready(function () {
$('input[type="submit"]').click(function(e){
$('div.ui-jqchart').remove();
$('input[type="checkbox"]:checked').each(function(){
//var companyName = $(this).prev().text... | true |
03380123ed4923430a11741e957ef7b860dfc6b9 | JavaScript | Rebecca-P/web | /src/services/getAllUsers.js | UTF-8 | 853 | 2.6875 | 3 | [] | no_license | const User = require("../models/user");
function getAllUsers() {
return new Promise(resolve => {
User.find(function(err, users) {
if (err) {
resolve({
statusCode: 500,
msg: "An internal error occurred while processing the request"
});
} else {
resolve({
... | true |
2765bc801668cf50a06f8829e62b752c6ec853d9 | JavaScript | osor1o/finite-automaton | /src/redux/reducers/table.js | UTF-8 | 691 | 2.59375 | 3 | [] | no_license | const INITIAL_STATE = {
items: [],
};
export default (state = INITIAL_STATE, action) => {
switch(action.type) {
case 'ADD_TABLE':
const invalidTableItem = state.items.find((item) => {
const existStateAndInput = item.s1 === action.payload.s1 && item.i === action.payload.i;
if (existStateAn... | true |
25ac1470ad9634aee5783b6c4061ccc577ca8f5b | JavaScript | favoritemedium/gtasks-pomo | /app/scripts/background/audio-effect.js | UTF-8 | 1,105 | 2.875 | 3 | [] | no_license |
(function(){
var on = AppConfig.audioOn;
try { on = JSON.parse(localStorage.getItem('tomato-task-audio-on')) || on; }
catch (e) { /* do nothing */ }
var sounds = {
success: new Audio()
, 'break': new Audio()
};
sounds.success.volume = 0.5;
sounds['break'].volume = 0.5;
sounds.success.src = Ap... | true |
62ea6f3d909f03bb8012771c87bdb3e7233ec90f | JavaScript | ajoseerazo/learnpack-cli | /plugin/command/test.js | UTF-8 | 619 | 2.515625 | 3 | [] | no_license | const fs = require('fs')
const TestingError = (messages) => {
const _err = new Error(messages)
_err.status = 400
_err.stdout = messages
_err.type = 'testing-error'
return _err
}
module.exports = {
TestingError,
default: async function(args){
const { action, configuration, socket, exercise ... | true |
93d82032cf6c52f5a40a411863e8d890f95406e2 | JavaScript | GeovanniAlexander/mutantApi | /helpers/validations.js | UTF-8 | 1,443 | 3.34375 | 3 | [] | no_license | const valChain = (arr, point) => {
let val = {
x: 3,
y: 3,
xy: 3,
yx: 3
};
const { x, y } = point;
const length = arr.length;
let tmp = arr[x][y];
for( let i = 1; i < 4 ; i++ ){
if( y < length - 3 && (val.x != 3 || i === 1) ){
(arr[x][y+i] !... | true |
8201150b32388c5f8df2943699e5fc33fbd98ff0 | JavaScript | xfz1987/ES6 | /code_es6/10.Symbol.js | UTF-8 | 1,381 | 4.28125 | 4 | [] | no_license | /**
* 背景:
* ES5 的对象属性名都是字符串,这容易造成属性名的冲突。
* 比如,你使用了一个他人提供的对象,但又想为这个对象添加新的方法(mixin 模式),新方法的名字就有可能与现有方法产生冲突。
* 如果有一种机制,保证每个属性的名字都是独一无二的就好了,
* 这样就从根本上防止属性名的冲突。这就是 ES6 引入Symbol的原因
*/
var obj = {
'name': '123'
}
/**
* 新的原始数据类型Symbol,表示独一无二的值,它是一种类似于字符串的数据类型
* ES5六种基本数据类型: undefined、null、布尔值、字符串、数值、对象
* ... | true |
28f9b948439e023a8c175d85945131ca5c6f7528 | JavaScript | robertdigital/Openlaw-Api-Tutorial-public | /client/src/App.js | UTF-8 | 11,147 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | import React, { Component } from "react";
import BillOfSaleContract from "./contracts/BillOfSale.json";
import getWeb3 from "./utils/getWeb3";
import { Container,Grid, Button, Form} from 'semantic-ui-react';
import { APIClient, Openlaw } from 'openlaw';
import "./App.css";
//PLEASE SUPPLY YOUR OWN LOGIN CREDE... | true |
9cd17ca5111b6c28ca7d4787b60cea0780029630 | JavaScript | nurimba/q-postgres | /src/gen/updateTable.js | UTF-8 | 1,630 | 2.53125 | 3 | [
"Unlicense"
] | permissive | import { isArray } from './types'
import { prepareReturning } from './utils'
import comWhere from 'gen/comparatorWhere'
const breakline = `
`
const toSQL = (orm) => {
const { schema, paramters, conditions } = orm
const { table, fields } = schema
const returning = prepareReturning(fields)
const sqlWhere = condi... | true |
1306446fbb516fcf9ddf1b8bdfbee153e4960b57 | JavaScript | pankaj-creativitis/Nodetil | /WebServerBegin/WebServer.js | UTF-8 | 1,403 | 2.84375 | 3 | [] | no_license | 'use strict';
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
let mimes = {
'.htm' : 'text/html',
'.css' : 'text/css',
'.js' : 'text/javascript',
'.gif' : 'text/gif',
'.jpg' : 'text/jpg',
'.png' : 'text/png'
}
// serve files with... | true |
394182f3a8d52f07d26b0db3b8bbada8db8c3ecf | JavaScript | babel/minify | /packages/babel-helper-to-multiple-sequence-expressions/src/index.js | UTF-8 | 3,122 | 2.796875 | 3 | [
"MIT"
] | permissive | "use strict";
module.exports = function(t) {
return function toMultipleSequenceExpressions(statements) {
const retStatements = [];
let bailed;
do {
const res = convert(statements);
bailed = res.bailed;
const { seq, bailedAtIndex } = res;
if (seq) {
retStatements.push(t.exp... | true |
84579f384e0b1947fc2116ed40225522e62a59ca | JavaScript | bradcerasani/winnipegjs | /routes/index.js | UTF-8 | 2,676 | 2.6875 | 3 | [] | no_license | // file wide constants
var EVENT_PAGE_NAME = 'event-page';
var EVENT_PRE_TITLE = "Event ";
var fs = require('fs'),
path = require('path');
/*
* GET home page.
*/
exports.index = function(req, res) {
res.render('index', { title: 'Winnipeg.js', page: 'index', toDesktop: toDesktop(req) });
};
exports.events = fu... | true |
7c8efab61d3c85b2ac5a6b27c350430a0a5aca36 | JavaScript | luyzgarcia/acom | /js/orcamentos.js | UTF-8 | 4,062 | 2.703125 | 3 | [] | no_license | $(document).ready(function () {
$('#OrcamentoCreateForm').submit(function(e) {
if (!$("#OrcamentoCreateForm input:checkbox:checked").length > 0) {
alert('Selecione pelo menos um projeto para enviar o orçamento');
return false;
}
});
$('.check_projetos').click(fu... | true |
1df5fdcab274c21bfcaf8fa1c1959ace60b04bcb | JavaScript | ginnnnnn/modern-javascript-learning-notes | /more ES6 /sets/sanbox.js | UTF-8 | 1,161 | 4.15625 | 4 | [] | no_license | //sets ,sets is a new data structure it doesnt allow a dupicate value
const names = ['mario', 'zelda', 'mario', 'link'];
console.log(names);//["mario", "zelda", "mario", "link"]
const nameSet = new Set(names);//only way of creating Set
console.log(nameSet);//{"mario", "zelda", "link"} it's not an obj, and only one ... | true |
11d94585a15d5bf349b5128844711d35d7d34c42 | JavaScript | izadimran-mon/Instagram-Comic-Game | /test_query.js | UTF-8 | 1,353 | 2.796875 | 3 | [] | no_license |
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
// exports.helloWorld = functions.https.onRequest((request, response) => {
// response.send("Hello from Firebase!");
// });
express = require('express');
AWS = require('aws-sdk');
app = exp... | true |
31d01ee1d4d196b86a934f37689507dc097287c7 | JavaScript | ror-y/shortenthisurl | /build/server/controllers/link.js | UTF-8 | 4,765 | 2.515625 | 3 | [] | no_license | 'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.definePrope... | true |
5dbcbfbf7f530843802d18b2c51f029edb12805f | JavaScript | yousefsaqoul/steuer-rechner | /assets/js/main.js | UTF-8 | 1,845 | 2.953125 | 3 | [] | no_license | function berchnenNetto() {
let aufschlagen = document.getElementById('aufschlagenSteuer')
let abziehen = document.getElementById('abziehenSteuer')
let neunzehn = document.getElementById('neunzehn')
let sieben = document.getElementById('sieben')
let inputNummer = document.getElementById('inputNummer'... | true |
3d7b76db3704695f568a19ba10bc518b032d52ab | JavaScript | EspylArva/CookEat | /front/src/contexts/Recipes/Recipes.js | UTF-8 | 2,075 | 2.515625 | 3 | [] | no_license | import React, { createContext, useReducer, useEffect } from 'react';
import
searchReducer,
{
like as searchLike,
dislike as searchDislike,
FETCHING,
success,
failed
} from './searchReducer';
import cookeatDb from '../../indexedDb/cookeatDb';
import { configs } from '../../configs/configs'
export co... | true |
bac3f9d9bc260d0cc50b1efbef2b7404de19b088 | JavaScript | xorrou1/JS-basics | /урок 5/задание 2/Новая папка/app_2.js | UTF-8 | 398 | 2.609375 | 3 | [] | no_license | 'use strict';
const buttons = document.querySelectorAll('button');
const pB = document.querySelectorAll('.product-box');
const product = document.querySelectorAll('.product-i');
buttons.forEach(function(button){
button.addEventListener("click", function (event){
cardReplacement(event);
})
});
cardReplacement(... | true |
8e6ba4b378c118fce466d6d57eeddd109596ba43 | JavaScript | CSCI3383/Final-Project | /max-heap/js/maxHeapApp.js | UTF-8 | 757 | 3.015625 | 3 | [
"MIT"
] | permissive | var maxHeap = new maxHeap();
var maxHeapVisualizer = new maxHeapVisualizer('svg');
var handlePush = function() {
var input = document.getElementById('controls-input');
maxHeap.push(Number(input.value));
input.value = '';
input.focus();
visualize();
};
var handlePop = function() {
var popped = maxHeap.pop(... | true |
0d7e9db49239e0b6848a7cc5c844f4d687694c26 | JavaScript | Working-Title-MSFS-Mods/fspackages | /src/workingtitle-vcockpits-instruments-navsystems-g3000/html_ui/WTg3000/SDK/FlightElements/AirspaceSearcher.js | UTF-8 | 962 | 2.640625 | 3 | [
"MIT"
] | permissive | class WT_AirspaceSearcher {
constructor() {
this._queue = [];
this._isBusy = false;
}
get isBusy() {
return this._isBusy;
}
_finishSearch() {
this._isBusy = false;
let next = this._queue.shift();
if (next) {
next();
}
}
_... | true |
321e969f489735aafa7ff670da6c30e72f35ddeb | JavaScript | tanksalemalhar123/Chatting | /server.js | UTF-8 | 960 | 2.8125 | 3 | [] | no_license | var express = require("express"); //Express
var app = express(); //Initializing to APp
var server = require("http").createServer(app); //creating server
var io = require('socket.io').listen(server); //listening to server
users=[];
connections=[];
server.listen(process.env.PORT || 3000);
console.log('Server Runnin... | true |
7897a6fd0b20606fb9dc33ced28ea468b2582333 | JavaScript | h2190697689/second-shop | /src/pages/login-register/store/reducer.js | UTF-8 | 721 | 2.609375 | 3 | [] | no_license | import * as types from './action-type'
const defaultState = {
isAuth: false,
msg: '',
name: '',
pwd: '',
identity: '',
ownerId:''
}
export default (state = defaultState, action)=> {
switch (action.type) {
case types.LOGIN_SUCCESS:
return {...state, isAuth: true, ...actio... | true |
1a6a555d0de23d46dfb7fa438602e9cbf23a5aa7 | JavaScript | adrianmojica/RMH | /frontend/src/components/Nav.js | UTF-8 | 1,866 | 2.578125 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import { Link } from "react-router-dom";
import './Nav.scss'
function Nav() {
const existingToken = localStorage.getItem('token')
const [authToken, setAuthToken] = useState(existingToken);
let nav = <>
<div className="nav-left">
<li ... | true |
398bf96881d594d7091856e1d6288661316220c4 | JavaScript | eternalsakura/DIE-corpus | /jsc/JSTests/stress/concat-with-holesMustForwardToPrototype.js | UTF-8 | 505 | 3.375 | 3 | [] | no_license | Array.prototype[1] = 5;
function arrayEq(a, b) {
if (a.length !== b.length) {
throw new Error([a, "\n\n", b]);
}
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i]) {
throw new Error([a, "\n\n", b]);
}
}
}
let obj = {};
arrayEq([1, 2, 3].concat(4), [1, 2, 3, 4]);
arrayEq([1, 2, 3].conca... | true |
1deee6f105164382d3091ef4a839bb09b9b04cb3 | JavaScript | TheScienceMuseum/collectionsonline | /client/lib/get-data.js | UTF-8 | 677 | 2.640625 | 3 | [
"MIT"
] | permissive | var fetch = require('fetch-ponyfill')().fetch;
module.exports = function (url, opts, cb) {
fetch(url, opts)
.then(function (res) {
if (res.ok) {
return res.json();
} else {
return Promise.reject(new Error(res.status + ' Failed to fetch results'));
}
})
.then(function (js... | true |
7aa14552d062f42a38292e6eb607c8f73e505930 | JavaScript | trentschnee/MyReads | /src/SelectBook.js | UTF-8 | 1,779 | 3.046875 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import PropTypes from "prop-types";
class SelectBook extends Component {
// This state holds the value of the shelf the book is associated with.
state = {
changeValue: ""
};
/**
This method will change the shelf value to "none" if the value is undefined.
If a va... | true |
3f048971026b568bf8e2c1687e7338d49b5371b2 | JavaScript | danyguag/RoboticsWebsite | /web-content/js/global.js | UTF-8 | 3,663 | 2.640625 | 3 | [] | no_license | window.callScriptInitCalls = [];
window.tabsHtml = [];
Element.prototype.appendBefore = function (element) {
element.parentNode.insertBefore(this, element);
},false;
Element.prototype.appendAfter = function (element) {
element.parentNode.insertBefore(this, element.nextSibling);
},false;
var endsWith = function(src... | true |
dc8d27ee026e2321996ff4d0c53b5b97f2e61f2a | JavaScript | Serezon/rxjs-ramda-babel | /src/index.js | UTF-8 | 1,051 | 2.65625 | 3 | [] | no_license | import { ajax } from 'rxjs/ajax';
import { concat, interval } from 'rxjs';
import { map, tap, filter, bufferTime } from 'rxjs/operators';
import * as R from 'ramda';
import { XMLHttpRequest } from 'xmlhttprequest';
function createXHR() {
return new XMLHttpRequest();
}
console.clear();
const ajax$ = ajax({
cr... | true |
dae83359568e27bc83377eda2e3d4021fdf317f8 | JavaScript | bridgecrew-perf6/nextjs-react-tailwind-testing-library-sortable-list-with-time-travel | /components/globalState.js | UTF-8 | 2,500 | 2.796875 | 3 | [
"MIT"
] | permissive | import React, { useReducer, createContext } from "react";
import produce from "immer";
export const PostsContext = createContext();
export function PostsContextProvider({ children }) {
// base state
const initialState = {
Present: [],
Past: [],
};
// swap two indices in an array without mutating the ... | true |
e4386b03484ea650d6ed0cc2dee902bd2e9fc3e5 | JavaScript | MRAproject/Front | /src/components/dashboard/dashboard.js | UTF-8 | 6,221 | 2.546875 | 3 | [] | no_license | import React, { Component } from "react";
import ReactTable from "react-table";
import { connect } from "react-redux";
import { Doughnut, Bar } from "react-chartjs-2";
import {
getAllCars,
get_times,
carsLoading,
addCar,
removeCar
} from "../../actions/carsActions";
import "react-table/react-table.css";
impor... | true |
cfdcdb9e107780064cbe9ec2ff66e1334fa992dc | JavaScript | Yodigity/Eden-To-Eternity | /src/redux/reducers/dataReducer.js | UTF-8 | 1,323 | 2.515625 | 3 | [] | no_license | import {
SET_TALKS,
SET_TALK,
LOADING_TALKS,
LIKE_TALK,
UNLIKE_TALK,
DELETE_TALK,
POST_TALK,
SUBMIT_COMMENT,
} from "../types";
const initialState = {
talks: [],
talk: {},
loading: false,
};
export default function (state = initialState, action) {
switch (action.type) {
case LOADING_TALKS:... | true |
fdbabfe8e331986016a62354af5acfa396d85f39 | JavaScript | jdiffor/BitcoinBot | /main.js | UTF-8 | 4,148 | 2.78125 | 3 | [] | no_license | $(document).ready(() => {
readLocalXMLFile("../coins.xml");
});
var what = true;
function readLocalXMLFile(file) {
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, true);
rawFile.onreadystatechange = function () {
if(rawFile.readyState === 4)
{
if(rawFile.statu... | true |
028f5f8402f99ecf0934b0c70d7e19f9a8a1da44 | JavaScript | chantiggi/HCMS-App-CS467 | /server/models/locationsModel.js | UTF-8 | 754 | 2.625 | 3 | [] | no_license | 'use strict';
var sql = require('./db.js');
//Locations object constructor
var Locations = function(locations) {
this.locations = locations.locations;
this.locationID = locations.locationID;
this.locationName = locations.locationName;
}
//Need to update with org info
Locations.getAllPossibleLocations = fu... | true |
3e8dd44bf89c400b477cb75dd04926947b2766ab | JavaScript | newjersey/career-network | /__tests__/time-distance-parser.test.js | UTF-8 | 1,858 | 2.875 | 3 | [
"MIT"
] | permissive | import { advanceTo, clear } from 'jest-date-mock';
import TimeDistanceParser from '../src/time-distance-parser';
describe('TimeDistanceParser', () => {
describe('parse', () => {
beforeEach(() => {
advanceTo(Date.UTC(2019, 6, 4, 13, 25, 0));
});
afterEach(() => {
clear();
});
it('re... | true |
6cdb997099c19c65aaf3517e214499c63439dbe3 | JavaScript | Oleg24/Coderbytes | /03LongestWord.js | UTF-8 | 567 | 4.15625 | 4 | [] | no_license | /*Have the function LongestWord(sen) take the sen parameter being passed and return the largest word in the string. If there are two or more words that are the same length, return the first word from the string with that length. Ignore punctuation and assume sen will not be empty.
*/
function LongestWord(sen){
var m... | true |
51967a93b51767c4169dff70c20749261d82da9d | JavaScript | kendradalley/sailing-app | /controllers/trips.js | UTF-8 | 1,210 | 2.515625 | 3 | [] | no_license | var express = require('express');
var Trip = require('../models/trip');
var router = express.Router();
router.route('/')
.get(function(req, res){
Trip.find(function(err, trips){
if(err) return res.status(500).send(err);
return res.send(trips);
});
})
.post(function(req, res){
console.l... | true |
056c2a4b515ac771dc3185ff6f1726121c891078 | JavaScript | abhishek71994/KL-react-promises-october-talk | /callback.js | UTF-8 | 537 | 3.625 | 4 | [] | no_license | const peopleAPI = (username, password, callback) => {
// things are done
setTimeout(() => {
return callback({ success: true, data: username })
}, 2000)
}
const dogAPI = (username, dogName, callback) => {
setTimeout(() => {
return callback({ success: true, data: `${username} says that ${dogName} is the ... | true |
d5e4ca26e3e96b627890b7bd86acb0c65dce46be | JavaScript | GemsGame/ws-game | /src/js/services/ws-client.js | UTF-8 | 2,195 | 2.75 | 3 | [] | no_license | export default class WebSocketClient {
constructor() {
this.clientId = null;
this.game = {
players: []
};
this.messages = [];
}
createConnection () {
this.socket = new WebSocket('ws://localhost:3011');
}
getMessage() {
this.socket.onmessage = (message) => {
const response ... | true |
36489e5b52820e7be8820d426ffd8d183d42c992 | JavaScript | xinhehui/tracker | /packages/error-tracker/src/send.js | UTF-8 | 5,445 | 2.546875 | 3 | [] | no_license | import detector from 'detector'
var win = window
var doc = win.document
var loc = win.location
var M = win.Sai
// 避免未引用先行脚本抛出异常。
if (!M) { M = {} }
if (!M._DATAS) { M._DATAS = [] }
// 数据通信规范的版本。
var version = '1.0'
var URLLength = detector.engine.trident ? 2083 : 8190
var url = path(loc.href)
// UTILS -------------... | true |
f36a236496ca16931c6cdd8e3b27b1ed579aa5a1 | JavaScript | vitorbarros/win8-html-sdk | /Slider/ChooseColorWithRGBSliders/js/default.js | UTF-8 | 2,267 | 2.609375 | 3 | [] | no_license | // For an introduction to the Blank template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232509
(function () {
"use strict";
WinJS.Binding.optimizeBindingReferences = true;
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
... | true |
456085731d78ea4e78d0e31b64896509c54acba2 | JavaScript | pojlemz/Alchemie-Website | /routes/kyc-remove-upload.js | UTF-8 | 1,127 | 2.53125 | 3 | [] | no_license | const express = require('express');
const fileUpload = require('express-fileupload');
var router = express.Router();
// @NOTE: For encoding and decoding filenames we use
// https://www.hacksparrow.com/base64-encoding-decoding-in-node-js.html
// default options
router.use(fileUpload());
router.post('/kyc-upload', fun... | true |
804d414d176047cf3edfe3eb9891599553170f09 | JavaScript | alienmelon/computerangels.js | /computerangels.js | UTF-8 | 2,016 | 2.8125 | 3 | [] | no_license | function release_the_angels(num_amnt, showtag){
//
//add the following between your page's <head></head> tag:
//<script type="text/javascript" src="jquery-3.0.0.min.js"></script>
//<script type="text/javascript" src="computerangels.js"></script>
//
//call the following on page load:
//<body onLoad="release_the_a... | true |
fc2ead950a86965e603acfaad8b57953f353ac5d | JavaScript | obande-code/myTest | /src/component/search/Search.js | UTF-8 | 1,222 | 2.65625 | 3 | [] | no_license | import React, { useState} from 'react'
import './Search.css'
import { Form} from 'react-bootstrap'
const Search = () => {
const [query, setQuery] = useState('');
const [photos, setPhotos] = useState([]);
const searchPhotos = async (e) => {
e.preventDefault();
setQuery('');
... | true |
5fc7d997e2992f8fc548a23bfc8bcbd7921cf06f | JavaScript | rahulunited09/bakeryshop | /backend/__tests__/quote-routes.test.js | UTF-8 | 2,355 | 2.8125 | 3 | [] | no_license | //dependencies for test
const request = require("supertest");
const app = require("../api");
const mongoose = require("mongoose");
const User = require("../models/User");
const Quote = require("../models/Quote");
require("dotenv").config();
const { getAllQuotes } = require("../controllers/quotesController");
//functio... | true |
0db9ae7070f0f48775733e898713a6379fa5efc4 | JavaScript | prabhu-raja/async-demo | /index.js | UTF-8 | 1,020 | 3.484375 | 3 | [] | no_license | console.log('Before');
/*
* Promise approach
getUser(11)
.then(usr => getRepositories(usr.gitHubUserName))
.then(repos => console.log(`Repos - ${repos}`))
.catch(err => console.log('Error', err.message));
*/
// * Async & Await approach
async function displayRepos() {
try {
const usr = await getUser(11);... | true |
68a92f4524668caeb39be8e650fd0b4ec6a9862f | JavaScript | maoyeyang/study | /react/do_redux/src/index.js | UTF-8 | 995 | 2.625 | 3 | [] | no_license | import {
state
} from './redux/state'
import {
storeChange
} from './redux/storeChange'
import {
createStore
} from './redux/createStore'
const {
store,
dispatch,
subscribe
} = createStore(state, storeChange)
function renderHead(state) {
console.log('render head')
const head = document.getElementById(... | true |
40de86e569e1887b079abf4418bbefb342723c0c | JavaScript | HarveyDent2Face/capeshitbot-v4 | /comandos/botinfo.js | UTF-8 | 1,133 | 2.53125 | 3 | [] | no_license | const Discord = require("discord.js");
module.exports.run = async(bot, message, args) => {
const ownerID = '439635638640443400';
const owner = bot.users.get(ownerID);
//let botcreation = bot.createdAt();
let infoEmbed = new Discord.RichEmbed()
.setThumbnail("https://king-mag.com/files/2009/03/rorshachcartoon.j... | true |
ac17e84db70b2f6d38ccc40f11aeb4588253d3eb | JavaScript | Brewynn/Gold-Funding | /app/components/SlideShow/index.jsx | UTF-8 | 3,038 | 2.671875 | 3 | [] | no_license | import React, {useState, useEffect, useRef} from 'react';
import PropTypes from 'prop-types';
import Container from './Styles';
import Pagination from './Pagination';
import Buttons from './Buttons';
import Title from './Title';
const SlideShow = ({items, timer}) => {
const [interval, addInterval] = useState(null);
... | true |
5a8afe0c6a99a09e4e8b05658a452fe57922a134 | JavaScript | artjitt9611/2020M4-JSWEB | /javascript.js | UTF-8 | 2,059 | 3.03125 | 3 | [] | no_license |
/*document.getElementById('ok').addEventListener('click', function (e) {
let noElement = document.getElementById('no')
if (noElement.classList.contains('toggleOn')) {
noElement.classList.replace('toggleOn', 'toggleOff')
} else if (noElement.classList.contains('toggleOff')) {
noElement.clas... | true |
5fe68dd6c47d0ca0228f8142fa87add43e0b8e01 | JavaScript | pavankumarkulkarni/shoppingcart_client | /src/Components/CustomerCard/CustomerCard.js | UTF-8 | 2,748 | 2.59375 | 3 | [] | no_license | import React, { useState } from "react";
import style from "./CustomerCard.module.css";
export default function CustomerCard({
addCard,
card,
editCard,
cancelCardChange,
}) {
const [cardName, setCardName] = useState(card ? card.cardName : null);
const [cardNum, setCardNum] = useState(card ? card.number : n... | true |