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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
748edcc08ea82c14d34a54d3b0803d8fd42729bb | JavaScript | dillonchanis/pokedex | /profile.js | UTF-8 | 1,563 | 3.21875 | 3 | [] | no_license | var http = require("http");
var EventEmitter = require("events").EventEmitter;
var util = require("util");
//Function to get Pokemon Info
function Profile(pokemon) {
EventEmitter.call(this);
profileEmitter = this;
//Connect to the API
var request = http.get("http://pokeapi.co/api/v1/pokemon/" + pokemon.toLow... | true |
4307c5728aa70f29806c2840cf85245e3ab369cd | JavaScript | yuansheng1989/streampoint-assignment1 | /src/redux/cards/reducer.js | UTF-8 | 1,431 | 2.59375 | 3 | [] | no_license | import { DUPLICATE_CARD, DELETE_CARD, EDIT_CARD } from "./constants";
import { v4 as uuidv4 } from "uuid";
const initState = {
cards: [
{
id: uuidv4(),
title: "Custom Title",
body: "Custom Body Text",
titleSize: 36,
bodySize: 16,
cornerRadius: 16,
titleColor: "#000000",
... | true |
82b97f02aa4f19f4bbfa28abd37d19ffb87a0b5b | JavaScript | Balasundararao/ReactJS | /src/components/practicecomponents/react_hooks/HooksCounterTwo.js | UTF-8 | 917 | 3.109375 | 3 | [] | no_license | import React, { useState } from 'react'
function HooksCounterTwo() {
const initialCount = 0;
const [count, setCount] = useState(initialCount);
const incrementFive = () => {
for( let i=0; i<5; i++) {
setCount( prevCount => prevCount + 1)
}
}
return(
<div>
... | true |
ca672bca0f4ba69ca1c32b0ae1b2a902870ef576 | JavaScript | codeuniversity/ppp-profiler | /example_scripts/running_average.js | UTF-8 | 432 | 3.15625 | 3 | [] | no_license | var average = get("average", 0)
var count = get("count", 0)
average = ((average * count) + message.value) / (count+1)
count++
set("average", average)
set("current", message.value)
set("count", count)
var t = "The lifetime average of the CPU temperature is "+ average.toFixed(2) +"C"
title(t)
description("Its current te... | true |
1be4a977c7e98cf758892b4948fbb1a5327bd0b8 | JavaScript | braydenwerner/Werntype | /src/Components/AnimatedHeader/AnimatedHeader.js | UTF-8 | 1,793 | 2.78125 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import './AnimatedHeader.scss'
export default function AnimatedHeader({ text }) {
// this is overall pretty bad, did this a while ago, but its functional
const [currentString, updateCurrentString] = useState('')
const [curre... | true |
46ed4ba2568b1edf20d98b9cb4bb66d3b1d314a6 | JavaScript | patrickhthomas/real-portfolio | /main.js | UTF-8 | 3,649 | 3.25 | 3 | [] | no_license | window.onscroll = function () {
moveRotate();
moveRotate2();
moveRotate3();
moveRotate4();
moveRotate5();
moveRotate6();
moveRotate7();
};
window.smoothScroll = function(target) {
var scrollContainer = target;
do { //find scroll container
scrollContainer = scrollContainer.pa... | true |
dc2021cb9f43134373ee34122c85623136ffafa1 | JavaScript | flow-ai/flowai-js-templates | /src/messenger/templates/products.js | UTF-8 | 1,201 | 2.59375 | 3 | [] | no_license | import Template from '../../base/templates/template'
/**
* Products Template
*
* @description
* The product template can be used to render products that have been uploaded to Facebook catalog. Product details (image, title, price) will automatically be pulled from the product catalog.
*
* @memberof Messenger
... | true |
09c0f31172258bb7ed027b7d29076ea81cf61ec0 | JavaScript | Rax4/Warsztaty-Dodatkowe | /templateA/js/addressView.js | UTF-8 | 1,711 | 2.78125 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded",function()
{
function loadUserView()
{
$.ajax(
{
type: 'GET',
url: '../../router.php/address/',
contentType: 'application/json',
dataType: 'json',
success: function (r... | true |
383ade779d0b4789dc57e74ba9807a475c2523ba | JavaScript | zolotyh/27042017 | /examples/1.js | UTF-8 | 3,963 | 2.78125 | 3 | [
"MIT"
] | permissive | const image = document.createElement('img');
document.body.appendChild(image);
image.style.position = 'absolute';
image.style.zIndex = 1000;
image.style.left = 0;
image.style.top = 0;
image.setAttribute('src', 'http://localhost:8001/assets/images/layout.png');
image.onmousedown = function (e) {
const coords = ge... | true |
2e5471fb1bf8b69e69d5ed05d9993081a842f155 | JavaScript | RostislavZalevsky/HTML-CSS-JS-Padding-Margin | /script.js | UTF-8 | 1,460 | 2.96875 | 3 | [] | no_license | var Text = document.getElementById("Text");
Text.onkeydown = ClearText;
var margintop = document.getElementById("margin-top");
var marginbottom = document.getElementById("margin-bottom");
var marginleft = document.getElementById("margin-left");
var marginright = document.getElementById("margin-right");
var bordertop ... | true |
19ed565342c471b2fd8c16dcaec70ce3dbafe16a | JavaScript | happysuslik/training | /angular/table/assets/javascripts/work2.js | UTF-8 | 858 | 2.71875 | 3 | [] | no_license | /**
* Created by Gix on 20.11.2015.
*/
var model = {
user: "Root",
recipes: [{ name: "Яишница", passed: true},
{ name: "Индейка", passed: true},
{ name: "Курица в духовке", passed: true},
{ name: "Яблочный пирог", passed: false}]
};
var recipeListApp = angular.module("recipeListApp", ... | true |
b3cfe4e60cd0abde74ba97cc974c26aa6f2fa705 | JavaScript | svetoslavmishev/js-web | /ExpressJS/02.NodeJSIntroduction/IntroductionToNodeHomework/storageModule.js | UTF-8 | 2,196 | 3.078125 | 3 | [] | no_license | let storage = (() => {
let storage = new Map();
let fs = require('fs');
function put(key, value) {
if (!checkIfString(key)) {
throw new Error('The key must be a String!');
}
if (isInStorage(key)) {
throw new Error('The key is already in the Storage');
... | true |
909bb35e1246adced855c0bf8e7f6e434e6ba27a | JavaScript | augustinevt/logistic-pizza-app | /js/ui.js | UTF-8 | 1,689 | 2.734375 | 3 | [] | no_license | var pizzaInfo = {toppings: []};
function domify() {
$('.order').remove();
currentCustomer.orders.forEach(function(order) {
$('body').append('<div class="order" id="order'+ order.id + '"></div>');
$('#order' + order.id).append('<h3>'+order.id+'</h3>');
$('#order' + order.id).append('<h2 class="size">hel... | true |
410b168b40e8a7a847b5e34dbe5eda8877ec6fcd | JavaScript | Nadjakoroleva/dima-hero | /js/script.js | UTF-8 | 2,366 | 3.046875 | 3 | [] | no_license | let hero;
let healthpack;
let enemy;
let x = 2;
let dx = 5;
let y = 2;
let dy = 5;
let hx = 400;
let hy = 100;
let ex = -10;
let ey = -10;
let dex = 1;
let dey = 1;
let c = 0;
let raz = 100;
let lose = 0;
let health = 0;
let dhealth = 0;
let dmg = 0;
let boost = 0;
function setup() {
createCanvas(800, 800);
}
funct... | true |
ae1dda7ed28e1160d69a17a860a6cd9e15804440 | JavaScript | EirikBirkeland/search-replace-chrome-extension | /index.js | UTF-8 | 435 | 3.03125 | 3 | [] | no_license |
document.addEventListener("DOMContentLoaded", function (event) {
function textNodesUnder (el) {
let n;
const a = [];
const walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false);
while (n = walk.nextNode()) {
a.push(n);
}
return a;
}
textNodesUnder(document).map(... | true |
7d8d2d47ad057f05cf044f47363475855e2c97ac | JavaScript | Reaper622/DataStructure-Algorithm-TS | /Algorithm/Search/FindClosestElements.js | UTF-8 | 2,109 | 3.59375 | 4 | [] | no_license | "use strict";
exports.__esModule = true;
/**
* 给定一个排序好的数组,两个整数 k 和 x,
* 从数组中找到最靠近 x(两数之差最小)的 k 个数。
* 返回的结果必须要是按升序排好的。
* 如果有两个数与 x 的差值一样,优先选择数值较小的那个数。
*
* @param {number[]} arr
* @param {number} k
* @param {number} x
*/
function FindClosestElements(arr, k, x) {
var left = 0;
var right = arr.length - 1;
... | true |
7372933e9068bce9a5ff36d00a7df3f2d5fcb57d | JavaScript | Emmett09/Pizza_Shop_App | /src/App.js | UTF-8 | 20,400 | 3.0625 | 3 | [] | no_license | import React, { Component } from "react";
import Basket from "./Basket";
class App extends Component {
constructor(props) {
super(props);
// each array starting with apiData is an
// array to hold our JSON data
// isFetched indicates if the API call has finished
// errorMsg is either null (none)... | true |
f7e28d623132db2fbdf7920d24f06c14024fe864 | JavaScript | rapm94/todo-client | /src/helpers/api.js | UTF-8 | 1,183 | 2.65625 | 3 | [] | no_license | import axios from "axios";
const URL = 'http://127.0.0.1:6080/api';
export const getTodos = async () => {
try {
const todos = await axios.get(URL + "/todos")
return todos
} catch (error) {
console.log(error)
}
}
export const addTodo = async (formData) => {
try {
const ... | true |
81422e9f1c6332939025c3f8102d2c27a7ce44b0 | JavaScript | Ottervanger/lumo | /src/renderer/tile/WebGLTileRenderer.js | UTF-8 | 7,157 | 2.953125 | 3 | [
"MIT"
] | permissive | 'use strict';
const defaultTo = require('lodash/defaultTo');
const EventType = require('../../event/EventType');
const Shader = require('../../webgl/shader/Shader');
const TextureArray = require('../../webgl/texture/TextureArray');
const VertexAtlas = require('../../webgl/vertex/VertexAtlas');
const TileRenderer = req... | true |
500c6802fd7434dca89f0340671f93757d670581 | JavaScript | qwop/userscript | /monolith/88/110898.user.js | UTF-8 | 867 | 2.609375 | 3 | [] | no_license | // ==UserScript==
// @name WebCT Automatic Login
// @namespace http://userscripts.org/users/dstjacques
// @description Automatic login for the WebCT portal
// @include *
// ==/UserScript==
var username = "";
var password = "";
var userField = document.getElementById("webctid");
use... | true |
6a9ed7577f1182e5f14e33fdd57db26c10441a02 | JavaScript | hangem422/vanilla-mvvm-architecture | /sample/src/moudles/component.js | UTF-8 | 3,685 | 2.890625 | 3 | [] | no_license | const _pendding = new WeakMap();
const _penddingPreProp = new WeakMap();
class Component {
#init = false;
state = {};
prop = {};
constructor() {
Promise.resolve().then(() => {
if (this.#init) return;
this.preRender();
});
}
/**
* @description Change the state value.
* @param {{... | true |
e643d591b9f80bdfe31f730311b49b83423a353c | JavaScript | bogdanorzea/leetcode | /src/insertIntoBST.js | UTF-8 | 2,679 | 3.875 | 4 | [] | no_license | // https://leetcode.com/problems/rotate-list/
const assert = require('assert').strict;
/**
* Definition for a binary tree node.
* function TreeNode(val, left, right) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null : ri... | true |
aa5dedcc2e5055637ed44f9ef229996e66c6df49 | JavaScript | akashgujjar273/DS-Algo-In-JavaScript | /data structures/6 hash tables/2 interviewq.js | UTF-8 | 678 | 3.765625 | 4 | [] | no_license | //on2 not effiecient
function itemInCommon(arr1, arr2) {
for(let i = 0; i < arr1.length; i++) {
for(let j = 0; j < arr2.length; j++) {
if (arr1[i] === arr2[j]) return true
}
}
return false
}
let array1 = [1, 3, 5]
let array2 = [2, 4, 5]
itemInCommon(array1, array2)
//effieci... | true |
984dc85bb6f9b69160bd919bbeea3acfef0cf9aa | JavaScript | HelloMissGu/hxqymanage | /src/utils/validators.js | UTF-8 | 992 | 2.953125 | 3 | [] | no_license | const validateNumber = ({ min = -Infinity, max = Infinity, integer = false } = {}) => (value) => {
const number = Number(value);
if (Number.isNaN(number)) return '请输入数字';
if (integer && number % 1 !== 0) return '请输入整数';
if (number < min) return `数字不能小于${min}`;
if (number > max) return `数字不能大于${max}`;
return... | true |
2a4411fa380650401d4efb8a7bfe27317f416c1d | JavaScript | hitore/leetcode-practise | /middle/328-OddEvenLinkedList.js | UTF-8 | 867 | 3.65625 | 4 | [] | no_license | /*
给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。
请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1),时间复杂度应为 O(nodes),nodes 为节点总数。
2020-03-03
71 / 71 个通过测试用例
执行用时 : 136 ms, 在JavaScript提交中击败了59.00% 的用户
内存消耗 : 36.6 MB, 在JavaScript提交中击败了69.00% 的用户
*/
var oddEvenList = function(head) {
if (head === null) return he... | true |
af6e5ab29eef3e516ecf97a58d98d36efd77cd09 | JavaScript | roark/burly-bouncer | /src/bouncer.js | UTF-8 | 1,778 | 2.765625 | 3 | [
"MIT"
] | permissive | const Decision = require('./decision')
class Bouncer {
constructor () {
this._rules = {}
this._timeout = 5000
this._errorCallback = null
}
setRule (ruleName, ruleFunc) {
// validate args
if (typeof ruleName !== 'string') {
throw new Error('rule name must be a String')
}
if (ty... | true |
ee84b00ec6f7ce13ae8b43ce7349d2cd8641a572 | JavaScript | MatthewRonaldJohnson/Tech-Blog | /public/js/updatePost.js | UTF-8 | 1,003 | 3 | 3 | [] | no_license | const postForm = document.getElementById('PostForm');
const postTitle = document.getElementById('title');
const postBody = document.getElementById('body');
postForm.addEventListener('submit', async function (e) {
e.preventDefault();
if(!postTitle.value || !postBody.value){
alert("Your post must have a ... | true |
d118880e4839b240aa48e2c177efc0396b0fc31b | JavaScript | mkgamer14/Xzero-bot-map-nieuw | /commands/review.js | UTF-8 | 1,679 | 3.328125 | 3 | [] | no_license | const discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
// Aantal sterren opvragen.
const aantalSterren = args[0];
// Nakijken als men een getal meegeeft, of als men een getal tussen 1 en 5 opgeeft.
if (!aantalSterren || aantalSterren < 1 || aantalSterren > 5) r... | true |
9d90cbf68d9b6abcd3d2bac67812dd1dec01d44e | JavaScript | CodeHiti/user-list-and-task-tracker | /exercise-1/js/app.js | UTF-8 | 1,267 | 2.734375 | 3 | [] | no_license | var userDataApiUrl = 'https://5dc588200bbd050014fb8ae1.mockapi.io/assessment';
fetch(userDataApiUrl).then((response) => {
return response.json();
}).then((userData) => {
getUsers(userData);
});
var source = $("#template").html();
var template = Handlebars.compile(source);
function getUsers(users) {
for (... | true |
42e075a4699fa45ce2bdf4cff0efe80ffd85306f | JavaScript | Creatorpravin/JavaScriptGrammar | /Chapter2/console_dir.js | UTF-8 | 71 | 2.515625 | 3 | [] | no_license | let x = { property: 1, prop1: 2, method: function(){}};
console.dir(x); | true |
b793ecd718823fd87c2f5f6c4b0f2813b5dc18c3 | JavaScript | bjorger/webwiz | /src/donutChart.js | UTF-8 | 5,982 | 2.90625 | 3 | [] | no_license | import * as d3 from 'd3';
import { generation_colors } from './types';
/**
* @typedef {Object} Pokemon
* @property {String} name
* @property {Number} type_1
* @property {Number} type_2
* @property {Number} total
* @property {Number} generation
* @property {Number} legendary
*/
var old_data = [];
/**
* @param... | true |
745814f174044ec0cffba2c7c658810745624b85 | JavaScript | ourarash/isometric_cubes | /sketch.js | UTF-8 | 3,535 | 2.875 | 3 | [] | no_license | // By Arash Saifhashemi
/// <reference path="../node_modules/@types/p5/global.d.ts" />
let leftTopX = 0;
let leftTopY = 0;
let w = 1;
let precision = 10;
let maxPrecision = 20;
let minPrecision = 3;
let step = 1;
let time = 0;
let smallAxisSize = 80;
let bigAxisSize = 250;
function setup() {
leftTopX = 0;
leftT... | true |
b93678136674dbbe43d3d700d31a4c1565b5d987 | JavaScript | lvletan/lab2_files | /files/js/functions.js | UTF-8 | 2,105 | 3.171875 | 3 | [] | no_license | let value="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore ... | true |
95cbaae3d6fcfd3a9a048f7933ad61c10308fffd | JavaScript | jzepedaa/friendFinder | /app/routing/apiRoutes.js | UTF-8 | 1,113 | 2.828125 | 3 | [] | no_license |
var friends = require('../data/friends.js');
module.exports = function (app) {
app.get('/api/friends', function (req, res) {
res.json(friends);
});
app.post('/api/friends', function (req, res) {
var match = {
name: "",
photo: "",
friendDifference: 10... | true |
09b8c5b4a35e99bb4c139cb92d42ba1932dc61bf | JavaScript | swimhiking/GeoExtApp | /packages/remote/GeoExt/src/mixin/SymbolCheck.js | UTF-8 | 8,134 | 2.96875 | 3 | [] | no_license | /* Copyright (c) 2015-2016 The Open Source Geospatial Foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
... | true |
bd02aa69eaaf83f96a1ffeb1a5640eed206af75f | JavaScript | CamdenKo/functionalJSSorting | /test.js | UTF-8 | 902 | 2.96875 | 3 | [] | no_license | const sortingMethods = require('./sorting')
const generateTest = (method) => {
describe(method.name, () => {
it('works for empty set', () => {
expect(method([])).toEqual([])
})
it('works for a single element', () => {
const toTest = [1]
expect(method(toTest)).toEqual(toTest)
})
... | true |
a5735a5f498e410a9f8f77804b788a9bcd172de0 | JavaScript | laxmikantm/LaxmiProtractorExcercise | /crud_spec.js | UTF-8 | 2,792 | 2.703125 | 3 | [] | no_license | describe('CRUD Operations-Laxmi', function() {
var homepageUrl= 'http://computer-database.herokuapp.com/computers';
var addNewCompBtn = element(by.id('add'));
var d = new Date();
var testRecordName = '1234Laxmi';
var newRecordName= testRecordName+d.getMinutes()+d.getSeconds();
var computerName = element(by.id('na... | true |
037a260b69ad0b7bf267cd1b2b1c47b8670825fd | JavaScript | sschand/basic_mean_demo | /server/config/routes.js | UTF-8 | 934 | 2.96875 | 3 | [] | no_license | // This is our routes.js file located in server/config/routes.js
// This is where we will define all of our routing rules!
// We will have to require this in the server.js file (and pass it app!)
// First, at the top of your routes.js file you'll have to require the controllers
var friends = require('./../controllers/... | true |
824a9a7b44aba53827c44d08b3137a28a4c7d36e | JavaScript | flokiowl/test-tiny | /src/js/main.js | UTF-8 | 7,111 | 2.75 | 3 | [] | no_license | 'use strict';
// language and currency lists
var item1 = [
document.querySelector('.header-top__item.en'),
document.querySelector('.header-top__link.en')
];
var item2 = [
document.querySelector('.header-top__item.fr'),
document.querySelector('.header-top__link.fr')
];
var item3 = [
document.querySelector('.heade... | true |
ea46cfa8521eb5677c0e9c48d24759a841a08f28 | JavaScript | Nanogami/Hockey | /js/script.js | UTF-8 | 2,017 | 3.515625 | 4 | [] | no_license | let ball
let p1
let p2
function setup()
{
createCanvas(windowWidth, windowHeight);
p1 = new Paddle(1,color('gray'))
p2 = new Paddle(2,color('gray'))
ball = new Ball()
}
function draw(){
background('white')
drawLine()
ball.draw()
ball.move()
p1.draw()
p2.draw()
let checkScore = ball.checkScore()
if(... | true |
7a7c21869cf5d523fd82e059a5c49cb53bdd9639 | JavaScript | anqing-xian/bird | /script/Sky.js | UTF-8 | 435 | 2.78125 | 3 | [
"MIT"
] | permissive | const skyDom = document.getElementsByClassName('sky')[0];
const skyStyles = getComputedStyle(skyDom);//获取到天空的样式
const skyWidth = parseFloat(skyStyles.width);
const skyHeight = parseFloat(skyStyles.height)
class Sky extends Rectangle {
constructor () {
super(skyWidth, skyHeight, 0, 0, -50, 0, skyDom);
}
... | true |
2f5375deb2da601d60455ba52d2e8e078494b0b2 | JavaScript | romacardozx/DogsWorld | /api/src/controllers/Dogs.js | UTF-8 | 4,625 | 2.625 | 3 | [] | no_license | const {Breed, Temperament} = require ("../db")
const axios = require('axios');
const { Op } = require("sequelize");
const { API_KEY } = process.env;
require('dotenv').config();
//const {v4: uuidv4 } = require('uuid')
/*async function llamadoApiRazas(){
try {
let response = await axios.get(`https://api.thedogapi.com... | true |
c67b7f137c49b812088dec5eb21aa9d98d392798 | JavaScript | MelissaGarrett/javascript-arrays-bootcamp-prep-000 | /arrays.js | UTF-8 | 959 | 3.703125 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | var chocolateBars = ["snickers", "hundred grand", "kitkat", "skittles"];
function addElementToBeginningOfArray (arr, element) {
var newArr = arr;
newArr.unshift(element);
return newArr;
}
function destructivelyAddElementToBeginningOfArray (arr, element) {
arr.unshift(element);
return arr;
}
function ... | true |
d5f99bbeea35b87fef198c88c36b04accb1a933f | JavaScript | kt390256/Spotiqualize | /routes/home.js | UTF-8 | 2,470 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
const HomeController = require('../controller/HomeController');
const ArtistController = require('../controller/ArtistController');
const AlbumController = require('../controller/AlbumController');
const FeatureArtistController = require('../controller/FA... | true |
62680fa438d7383e24b8d96cfa1308ec77e658a0 | JavaScript | drawwithcode/2019-08--naflav | /sketch.js | UTF-8 | 825 | 2.8125 | 3 | [] | no_license | function preload() {
// put preload code here
}
function setup() {
// put setup code here
createCanvas(windowWidth, windowHeight);
background('#9F7CE4');
//question definition
var myText = "Did I forget my drawing tablet back in Brazil?";
textFont("Fondamento");
textSize(60);
fill('#333');
textAli... | true |
160d5913149730d598bb79c2aea5efd24525b106 | JavaScript | michael-horn/Build-a-Tree | /levels.js | UTF-8 | 10,913 | 2.546875 | 3 | [] | no_license | /*
* Build-a-Tree
* Life on Earth Project (http://sdr.seas.harvard.edu/content/life-earth)
*
* Michael S. Horn
* Northwestern University
* michael-horn@northwestern.edu
* Copyright 2011, Michael S. Horn
*
* This project was funded by the National Science Foundation (grant 1010889).
* Any opinions, findings an... | true |
5d29e184b7f6b5ecbda374fc853adc1f00d07879 | JavaScript | jfarenq/summit-health-patient-records | /site/public/src/informationController.js | UTF-8 | 2,297 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | function retrievePatientInformation(){
if (!sessionStorage.getItem("patientid")) {
console.log("Redirecting to login");
window.location = '/login.html';
return;
}
var url = "./info";
var params = "id="+sessionStorage.getItem("patientid");
var http = new XMLHttpRequest();
ht... | true |
64e4e1988cb99cde00035fb524782472b59f3558 | JavaScript | itzsarim/coding-practice | /frontend-practise/bigfrontend-dev/DS&A/sum-chain.js | UTF-8 | 264 | 3.796875 | 4 | [] | no_license | // sum(1)(2)(3)() = 6
const sum = x => y => y ? sum(x+y) : x;
console.log(sum(1)(2)(3)(4)());
let sum2 = function (a) {
let closureFunc = b => b ? sum(a + b) : a;
closureFunc.toString = () => a;
return closureFunc;
}
alert(sum2(10)(2)(3)(4)); | true |
f245da8b0f0da41aa7a344ec4ec0a681385e557d | JavaScript | craigdallimore/booking | /static/js/View/View.js | UTF-8 | 570 | 2.625 | 3 | [] | no_license | (function(App) {
function View(config) {
for(var attr in config) {
this[attr] = config[attr];
}
}
View.prototype.render = function() {
if (!this.el) {
this.el = document.createElement(this.tagName || 'div');
this.el.className = this.className || ... | true |
5dbdcf6f3eeda21ec56e23b2b13b42e6edf5cb94 | JavaScript | FuriticuS/Lessonreact | /src/redux/reducer/auth-reducer.js | UTF-8 | 8,434 | 2.75 | 3 | [] | no_license | // ------ action type сделаем переменные для всех type в наших функциях
import {authUser, loginUser, logoutUser, securityAPI} from "../../api/api";
import {stopSubmit} from "redux-form";
const SET_USER_DATA = 'auth/SET_USER_DATA';
const GET_CAPTCHA_URL_SUCCESS = 'auth/GET_CAPTCHA_URL_SUCCESS';
//для нашего запроса по... | true |
d2742d5cc6420b769467393be8f3c3ad96575887 | JavaScript | ajaytalemuger/node-assignment-user-api | /src/routers/user.js | UTF-8 | 3,263 | 2.65625 | 3 | [] | no_license | const express = require("express");
const router = new express.Router();
const User = require('../models/user');
const auth = require('../middlewares/auth');
const { checkIfUserExist, validateUserId, checkIfEmailAlreadyExists, checkPostbody } = require("../middlewares/validate");
// Array of fields allowed in search q... | true |
2edc83fa87a920982d24ecdba23d0d9b03ca7f0f | JavaScript | julshotal/igme230 | /Portfolio/JS/JSprojects1/p5CodeFolderSetup/Demo3-3AvatarStack/Demo3-3AvatarStack/MainAvStack.js | UTF-8 | 956 | 3.359375 | 3 | [] | no_license | /**
* Demo3-3 Avatar Stack - by Al Biles
* Main driver to test Avatar and AvAtack classes.
* This will be the jumping off point for your first
* major "project". For now, the Avatars are all white
* dots on a black background that move around using
* Perlin noise.
*
* ICE 3-3 is to pop the top element of the A... | true |
00ba3985f55503f8798e472c316d1b4eb2c85096 | JavaScript | coolpo/webpackconfig | /src/index.js | UTF-8 | 463 | 2.515625 | 3 | [] | no_license | import './assets/css/index.styl'
import Img1 from './assets/img/1.jpg'
import Img2 from './assets/img/2.jpg'
import mod1 from './assets/js/mod1'
function start() {
const app = document.querySelector('#app')
const img1 = new Image()
const img2 = new Image()
img1.src = Img1
img2.src = Img2
const p = document.cr... | true |
34a3603bf95bc8f228b87d8e31b251204856f6b9 | JavaScript | pburkett/gregslist-vue | /src/services/CarsService.js | UTF-8 | 649 | 2.609375 | 3 | [] | no_license | import { AppState } from '../AppState'
import { api } from './AxiosService'
class CarsService {
async getCars() {
// fetch data
const res = await api.get('cars')
// add to AppState
AppState.cars = res.data
}
async getOne(id) {
const res = await api.get(`cars/${id}`)
AppState.activeCar = ... | true |
5164562faa0939155f5321574fc88d769b17da40 | JavaScript | jonasfrey/jsanimation | /animation.js | UTF-8 | 1,455 | 3.609375 | 4 | [] | no_license | /**
This is a very simple, yet powerful animation object
Usage:
//initialization
animation.fps = 60; //set fps optional
animation.renderFunction = myRepeatingFunction; // set the function which is called every fps
//controls
animation.start(); //start the animation
animation.stop(); //stop the animation
*/
window.an... | true |
3b4fe4a4f91324acc0f07697e317254ad19ddd59 | JavaScript | CedricTheofanous/sports | /team-landing-page/src/containers/EventsContainer.js | UTF-8 | 2,659 | 2.6875 | 3 | [
"MIT"
] | permissive | import React, {useState, useEffect} from 'react'
import styled from 'styled-components'
import FutureEvent from '../components/FutureEvent'
import PastEvent from '../components/PastEvent'
import LoadingSpinner from '../components/LoadingSpinner'
const StyledDiv = styled('div')`
display: grid;
grid-template-columns... | true |
815b5980bfe9100550ab98db08b01516956a41ef | JavaScript | MainShayne233/js_monkey_patches | /test/array_patches_test.js | UTF-8 | 3,621 | 3.109375 | 3 | [] | no_license | require('../lib/array_patches.js')
var assert = require('assert')
// monkey patching for the monkey patching tests
assert.arraysEqual = function(array1, array2) {
return assert.equal(true, array1.equals(array2))
}
describe('Array', function() {
describe('#equals(otherArray)', function() {
it('should return ... | true |
881430a186a539a9ba9dc877b639f7c69366c994 | JavaScript | Pilewski/react-scrabble | /lib/app.js | UTF-8 | 1,252 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
import tribonacci from './vanilla';
import letterScores from './letterScores'
import Helper from './helper';
class App extends Component {
constructor() {
super();
this.state = {
userInput: '',
signature: [],
arrayLength: 1,
tribList: []
}... | true |
2848d12f869b4be313062222f88cdeb574fd145d | JavaScript | brandonin/algorithms | /reverse.js | UTF-8 | 454 | 3.6875 | 4 | [] | no_license | function reverse(input){
var input = input.split('');
for(var i = 0; i < input.length/2; i++){
var temp = input[i];
input[i] = input[input.length-i-1];
input[input.length-i-1] = temp;
}
console.log(input.join(''));
}
reverse('hello');
function reverse1(input){
var input = input.split('');
for(var i = inpu... | true |
de343bb8957eb2281a5153d7c625049a5c656383 | JavaScript | nocenter/hypercloud | /lib/templates/js/register.js | UTF-8 | 276 | 2.65625 | 3 | [
"MIT"
] | permissive | /* global $ */
// register page js
$(function () {
var usernameInput = $('#input-username')
var usernameOutput = $('#output-username')
output()
usernameInput.on('keyup', output)
function output () {
usernameOutput.text(usernameInput.val() || 'username')
}
})
| true |
7d6b37c56520befa97e977be463789f606b8f86c | JavaScript | yatharthkatyayan/drawAndTalk | /src/component/container/container.jsx | UTF-8 | 1,549 | 2.625 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import Board from "../board/board";
import "./style.css";
const Container = () => {
const [size, setsize] = useState(8);
const [color, setcolor] = useState("rgb(101, 226, 101)");
useEffect(() => {
let color_container = document.getElementById("color-contai... | true |
6090d83f1a5cc4f5b0901c64d9ca8b235dbf0ba8 | JavaScript | taksenov/taksenov.github.io | /VanillaJS/11_DZ-8-master/hm2/script.js | UTF-8 | 6,373 | 2.859375 | 3 | [] | no_license | // ДЗ 2: Создать приложение для ВКонтакте, которое загружает список ваших
// друзей и выводит их на страницу в следующем формате:
// Фото, ФИО, Возраст, Дата рождения.
// Друзья должны быть отсортированы по дате рождения в порядке убывания.
// То есть на самом верху списка расположен друг с ближайший датой рождения.
//... | true |
386b14198c17d18c01c1ef3a7da2a17798350fab | JavaScript | Radhika1220/ProgrammingConstructsJS | /Repetition_WhileLoop/FlipCoin.js | UTF-8 | 463 | 3.765625 | 4 | [] | no_license | var headCount=0;
var tailCount=0;
while(headCount<=10 || tailCount<=10)
{
let coinVal=Math.floor(Math.random()*10)%2;
console.log(coinVal);
if(coinVal==0)
{
console.log("Head")
headCount++;
}
else
{
console.log("Tail")
tailCount++;
}
}
if(headCount==11)
{
... | true |
13eacecfa77d717385615ba3f99d94682bcfc9e7 | JavaScript | jonmetz/pianogoggles | /js/checkBackground.js | UTF-8 | 2,396 | 2.765625 | 3 | [] | no_license | var checkBackground = (
function () {
var THRESHOLD = 150750;
// var INTERVAL = 100;
var STABILITY_THRESHOLD = 50;
var ready = false;
var thresholdingFrames = [];
var backgroundThreshold = [];
var counter = 0;
var getBackgroundThreshold = function() {
return backgroundThreshold;... | true |
f2d7551a66dfa257854233b1d59db60da04b1a9c | JavaScript | heber013/computersapp | /steps/when.js | UTF-8 | 1,041 | 2.625 | 3 | [] | no_license | import ComputerPage from '../pageObjects/computer.page';
import ComputerListPage from '../pageObjects/computerlist.page';
const { When } = require('cucumber');
When('I enter the computer data:', (computertable) => {
computertable.hashes().forEach(function (computer) {
if (computer['name']) {
ComputerPage.ent... | true |
3e6e16f20ce046413dcbc4ebbe6bf73178a27254 | JavaScript | ybhsos/react200 | /src/R015_Map.js | UTF-8 | 816 | 2.734375 | 3 | [] | no_license | import React,{Component} from "react";
class R015_Map extends Component{
componentDidMount() {
var Map_Arr = [3,2,8,8];
let Map_newArr = Map_Arr.map(x => x);
console.log("1 . :" + Map_newArr);
let Map_Mul = Map_Arr.map(x=>x*2);
console.log("2 . :"+ Map_Mul);
var... | true |
8f952b9cb24d178414a513a7725f6fa489d92c57 | JavaScript | zesii/PigFarming | /pig/static/js/app/jsonParse.js | UTF-8 | 465 | 2.734375 | 3 | [] | no_license | /**
* Created by Administrator on 2016/11/5.
*/
var jsonParse = (function(){
var arrToJsons = function(arr){
var objArr = [];
for(var i=0;i<arr.length;i++){
var str = arr[i][0];
str = "{"+str+"}";
console.log(str);
var obj = JSON.parse(str);
... | true |
4570c80ad7ff86de7caf257add2ea10e18edf13f | JavaScript | mcschatz/breakout | /lib/brick.js | UTF-8 | 443 | 3.171875 | 3 | [
"MIT"
] | permissive | var Brick = function(game, position) {
this.game = game;
this.position = position;
this.size = {x: 87, y: 18};
this.status = 1;
};
Brick.prototype = {
draw: function(canvas, color) {
if(this.status === 1) {
canvas.beginPath();
canvas.rect(this.position.x, this.position.y, this.size.x, this.si... | true |
173cf2f809df3b93280bd9e3e794fa12d95bd301 | JavaScript | Saliba-san/startpage | /Bento/js/greeting.js | UTF-8 | 710 | 3.578125 | 4 | [] | no_license | // Get the hour
const today = new Date();
const hour = today.getHours();
// Here you can change your name
const name = ' Saliba-san';
// Here you can change your greetings
const gree1 = 'Hora de capotar,';
const gree2 = 'Bom dia! ';
const gree3 = 'Boa tarde, ';
const gree4 = 'Boa noite, ';
// Define the hours of ... | true |
7b65a0837352803366cd5b9cc0bf3ed1a7337a4e | JavaScript | holterdipolter/teleframe | /lib/functions/if-ping-true-false.js | UTF-8 | 818 | 2.765625 | 3 | [] | no_license | // name: if ping true/false
// outputs: 4
if (msg.payload){
flow.set('pingCounter', 12);
flow.set('onlineFlag', true);
if (!(flow.get('onlineFlag'))){
msg.payload = "firstOnline";
return [null, msg, null, msg];
} else {
msg.payload = "online";
... | true |
eaf501d2f0b6699c0e4860f7d4a24ae56470decc | JavaScript | eclectic-matt/Node.JS | /GameTester/gametester/shithead/functions/setup.js | UTF-8 | 2,371 | 3.78125 | 4 | [] | no_license | //CREATE A DRAW PILE - called 'drawPile', hidden, and owned by no-one
let drawPile = new Deck('drawPile', true, null);
//GENERATE THE CARDS BASED ON THE SHITHEAD RULES
let cardArray = new DeckType('SHITHEAD_CARDS');
//ADD CARDS IN BULK
drawPile.addCards(cardArray,false);
//SHUFFLE THE CARDS
drawPile.shuffle();
//ADD TH... | true |
198f9553ea70872df4368e42212203c54d261711 | JavaScript | joorjoor/AtomicExamples | /WebView3D/JavaScript/Resources/Components/Scene.js | UTF-8 | 533 | 2.765625 | 3 | [
"MIT"
] | permissive | "atomic component";
//Define a Scene component
exports.component = function(self) {
//we are attaching that component to the Scene, so we are sure that ours node is a scene
var scene = self.node;
var time = 12;
self.start = function() {
// create the procedural sky
var pnode = scene.createChild()... | true |
12d6c80a2a4c7c69020e2c527426e3f7cdf5bb49 | JavaScript | ritvij14/noterr.io | /app.js | UTF-8 | 3,772 | 3.5625 | 4 | [] | no_license | var homeButton = document.getElementById("home-button");
var aboutUsButton = document.getElementById("about-us-button");
var addNoteButton = document.getElementById("add-note-button");
var savedNotesList = document.getElementById("saved-notes");
var deleteButton = document.getElementsByClassName("delete-btn");
var edit... | true |
4f1fbc8f79271f93c5b3349cf5429f89d923d294 | JavaScript | shaneavila/the-odin-project | /web-development-101/rock-paper-scissors/main.js | UTF-8 | 2,363 | 3.953125 | 4 | [] | no_license | const numOfRounds = 5;
let computer = 0;
let player = 0;
function computerPlay() {
const choices = ['rock', 'paper', 'scissors'];
const rand = choices[Math.floor(Math.random() * choices.length)];
return rand;
}
function finalScore() {
const winner =
player > computer
? `You won! Score: Player - ${pl... | true |
197ce5c29d869acb89effa194210dd1333775cd0 | JavaScript | TerryHintz/tutoring | /src/Events.js | UTF-8 | 405 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
class Events extends Component {
state = {
word: 'default'
}
handleKeyPress = (event) => {
console.log(event.key);
}
render() {
return (
<div>
<input type={'text'} onKeyPress={(event) => this.handleKeyPress(event)}/>
... | true |
aac8f14e4d77489a7c017a99a217b82496d12e31 | JavaScript | parnasos/Ejercicios-Adalab | /Mod 2/2.5/2.5_9/main.js | UTF-8 | 741 | 2.84375 | 3 | [] | no_license | 'use strict';
const teacherTuerto = document.querySelector(".teacher--tuerto");
const teacherIsra = document.querySelector(".teacher--isra");
const teacherNasi = document.querySelector(".teacher--nasi");
teacherNasi.addEventListener ("click", addclass);
teacherIsra.addEventListener ("click", addclass);
te... | true |
f6c73b6ef13688dd13e8e826345299a94924653f | JavaScript | Nicole0724/appCache | /assets/js/wsw_funs.js | UTF-8 | 4,163 | 2.53125 | 3 | [] | no_license | // 全局函数定义-通用方法
Wsw.funs = function (name) {
}
// 取得当前Userinfo状态及信息 参数:cookieNameAll 表示像userinfo这样的大key值
/*使用方法
* var userInfo = Wsw.funs.getCookieAll('userinfo');
console.log(decodeURIComponent(userInfo.think.nickname));
//Jquery字符UrlEncode 编码、解码
Jquery解码:decodeURIComponent(url);
Jquery编码:encodeURIComponent(ur... | true |
926760ba96b81c5c918ea92fd81359545f5a6dea | JavaScript | KirilSZyapkov/Syntax-Functions-and-Statements | /Syntax, Functions and Statements/aggregateElements.js | UTF-8 | 300 | 3.453125 | 3 | [] | no_license | function aggregateElements(input) {
let sum = input.reduce((a, b) => a + b, 0);
let inverseSum = input.reduce((a, b) => a + (1 / b), 0);
let concInput = input.join('');
console.log(sum);
console.log(inverseSum);
console.log(concInput);
}
aggregateElements([1, 2, 3]) | true |
9d5c6538403b0398fcc2b407b4f0f65e02779e8d | JavaScript | scared1995/avito | /src/card.js | UTF-8 | 5,366 | 2.96875 | 3 | [] | no_license |
getPagination('#myTable');
function getPagination(table) {
var lastPage = 1;
$('#maxRows').on('change', function (evt) {//функция для переключения кол-во отображаемых строк
lastPage = 1;
$('.pagination')
.find('li')//находим все элементы списка на странице
.slice(1, -... | true |
56e14d6fb5a9b65fcf0846bf114d592162e4ff60 | JavaScript | EmirVelazquez/gifTastic | /assets/javascript/app.js | UTF-8 | 7,064 | 3.515625 | 4 | [] | no_license | /*Master function that will execute only after the DOM has loaded */
$(document).ready(function () {
//Global Variables
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//This array holds the original buttons displayed when DOM loads
var butt... | true |
ac038cc43dcef949fcf1667a86062f2204e94fa8 | JavaScript | fiskr/scripps | /HSP/1157/mobile-optimize.js | UTF-8 | 2,440 | 3.078125 | 3 | [] | no_license | /*
* put the following in the doc.ready
* for the hello world init.js file
*/
//put this at the bottom of the "mobile banner" for the uber article
(function(){
if(document.URL.match(/http.*?\.com.*\.html\?layout=mobile/) ){ //only execute if on a mobile page (checking the current URL)
$('#sh-head').css('di... | true |
1e1b89475c8b7f42bb8663c0a6209e04afdac953 | JavaScript | enso-ui/strings | /src/strings.js | UTF-8 | 1,181 | 3 | 3 | [
"MIT",
"ISC"
] | permissive | const diff = (first, second) => (first ?? '').split('')
.filter((char, index) => char !== (second ?? '').charAt(index))
.join('');
const regEx = new RegExp(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);
const valid = string => string !== null
&& typeof string !== 'undefined'
&&... | true |
40d6907f7201d24d36a8ee25e7825b85f986e29a | JavaScript | hendriksandy/javascript_01 | /index.js | UTF-8 | 165 | 2.640625 | 3 | [] | no_license | console.log("Hello Winc Academy")
console.log("Hello Winc Academy")
let name = 'andy'
console.log(name)
let age = "48"
console.log(age)
console.log(typeof age) | true |
a93c25e7336b9e52ae45b0d911073b5483d52410 | JavaScript | Nikhil9hac/js-tutorial | /creating.js | UTF-8 | 1,252 | 3.328125 | 3 | [] | no_license | newli=document.createElement('li')
<li></li>
tnode=documenr
VM2892:1 Uncaught ReferenceError: documenr is not defined
at <anonymous>:1:1
(anonymous) @ VM2892:1
tnode=document.createTextNode('Nikhil')
"Nikhil"
nweli.classname='created1';
VM3141:1 Uncaught ReferenceError: nweli is not defined
at <anonymous>:1:1... | true |
d074030c54c835f51f639338b237b32cf5305019 | JavaScript | unuseless/xo | /src/exo/controls/base/ExoDropdownExtension.js | UTF-8 | 4,040 | 2.546875 | 3 | [] | no_license | import DOM from "../../../pwa/DOM";
import Core from "../../../pwa/Core";
class ExoDropdownExtension {
constructor(control) {
this.control = control;
this.events = new Core.Events(this);
}
async init(){
const ctl = this.control;
const btnClone = ctl.htmlElement... | true |
e6be6eada57b4ca00edab32543a209a3d2435421 | JavaScript | tjwudi/xmirror | /js/xmirror.js | UTF-8 | 660 | 2.59375 | 3 | [] | no_license | (function(window) {
var constraints = {
'video': {
mandatory: {
maxWidth: 300,
maxHeight: 300,
minWidth: 300,
minHeight: 300
}
}
};
function success(stream) {
var videos = document.querySelectorAll('video'),
attachedStream = stream;
if (window.URL... | true |
401e1cd0c2bd2c71f3bb18024060ae8e3b28510f | JavaScript | aventex94/api-users | /actions/actionUser.js | UTF-8 | 2,238 | 2.59375 | 3 | [] | no_license | const Joi = require('joi');
var empty = require('is-empty');
module.exports = {
v1: {
validateBodyPost: validateBodyPost,
validateBodyPut: validateBodyPut,
validateId: validateId,
}
}
function validateBodyPost(req, res, next) {
const schema = Joi.object().keys({
name: ... | true |
90059d415e97b6b1bb9411c60cf28486358359a5 | JavaScript | fablee1/m4-d4 | /src/App.js | UTF-8 | 1,465 | 2.515625 | 3 | [] | no_license | import WarningSign from './components/WarningSign';
import {Row, Col, Button} from 'react-bootstrap'
import Fantasy from './data/fantasy.json'
import History from './data/history.json'
import Horror from './data/horror.json'
import Romance from './data/romance.json'
import Scifi from './data/scifi.json'
import BookL... | true |
a6d8ea19a7a22a121b4ffeeeb04b7ff596930de5 | JavaScript | roymcfarland/refactoru-handlebars-store | /main.js | UTF-8 | 2,144 | 2.953125 | 3 | [] | no_license | //////////////////////////////////
//////// PRODUCTS DATA.JS ////////
//////////////////////////////////
var productsData = {
productsList: [
{
title: "Super Mario World",
cost: 11.25,
image: "http://ecx.images-amazon.com/images/I/31QRKPQ24FL._AA160_.jpg",
details: {
players: "1-2... | true |
9252ea677ce863d2c9583bab376b04ac8c70a63e | JavaScript | cmccarthy15/GraceShopper | /server/api/products.js | UTF-8 | 3,507 | 2.6875 | 3 | [] | no_license | const router = require('express').Router()
const { Product, Review } = require('../db/models')
module.exports = router
router.get('/', (req, res, next) => {
Product.findAll({ include: [{ all: true }] })
.then(products => res.json(products))
.catch(next)
})
router.post(`/`, (req, res, next) => {
Product.cr... | true |
c94fb4a84f4139b134c1330b064295e769dd32b4 | JavaScript | monmaheen/SampleTestCode | /Todo-List-Project/Colors.js | UTF-8 | 2,591 | 3.4375 | 3 | [] | no_license | var numSquares = 6;
var squares = document.querySelectorAll(".square");
var color = generateRandom(numSquares);
var pickColor = randomColor();
var colorDisplay = document.getElementById("colorDisplay");
var answerSpan = document.querySelector("#answer")
var helement = document.querySelector("h1");
var reset = do... | true |
08ab9ef0cecf701972c5b69f972bc4471b651e1f | JavaScript | grmrh/Word-Guess | /index.js | UTF-8 | 3,476 | 3.453125 | 3 | [] | no_license | var inquirer = require('inquirer');
var Word = require('./word');
var colors = require('colors');
// random words generator https://www.randomlists.com/random-words
const randomWords = [
'tranquil', 'middle', 'wretched', 'unwieldy', 'detail', 'fluffy', 'delicate',
'shallow', 'jittery', 'eminent', 'pencil', 'toothpa... | true |
5906ba429560862518729b52d3dcdd6563072f72 | JavaScript | dadaa1/reactall | /src/shijian/throttle.js | UTF-8 | 565 | 3.203125 | 3 | [] | no_license | // 定时器实现,缺点:当停止后最后还会调用一次,不好
function throttle(method, wait) {
let timeout = null;
return function() {
if (!timeout) {
timeout = setTimeout(() => {
method.apply(this, arguments);
timeout = null;
}, wait);
}
};
}
// 时间戳实现
function throttle1(method, wait) {
let prev = new Date()... | true |
6b300389cc05d22723db2b07a8dd7cd71c282371 | JavaScript | burakyetistiren/to-do-list-js-es6 | /src/ListItem.js | UTF-8 | 406 | 2.578125 | 3 | [] | no_license | import {Engine} from './Engine.js';
export class ListItem{
constructor(description = "", id){ // changed
this.description = description; // changed
this.id = id;
const en = new Engine(); // changed
en.setSearchBar();
}
setDescription(desc){
this.description = desc;
}
setId(id){
this.id = id;
... | true |
74e3295643a13f1fc162d020dd31c2f25d1961ba | JavaScript | llxxll12345/projects | /greedy.js | UTF-8 | 8,998 | 2.703125 | 3 | [] | no_license | function $(str) {
return document.getElementById(str);
} //get from document
function $tag(str,target) {
target = target || document;
return target.getElementsByTagName(str);
} //get from tag
//generate a 2D array
function multiArray(m, n) {
... | true |
b38bfec721b72cc4789284af6f03e9011a9f7292 | JavaScript | EduardoDuQuesne/exercise-sandwich-maker | /javascripts/cheese.js | UTF-8 | 266 | 2.765625 | 3 | [] | no_license | /*jshint esversion: 6 */
let cheesePrices = {
swiss: 1,
american: 1,
muenster: 1.25,
gouda: 1.25,
havarti: 1.25
};
const addCheese = function(cheeseSelection) {
return cheesePrices[cheeseSelection];
};
module.exports = { addCheese }; | true |
c6d32d36450f76bf2b566038ec64513518d64112 | JavaScript | Automedon/CodeWars-7-kyu-Soluitions | /Thinkful - Number Drills: Rømer temperature.js | UTF-8 | 754 | 3.984375 | 4 | [
"MIT"
] | permissive | /*
Description:
You're writing an excruciatingly detailed alternate history novel set in a world where Daniel Gabriel Fahrenheit was never born.
Since Fahrenheit never lived the world kept on using the Rømer scale, invented by fellow Dane Ole Rømer to this very day, skipping over the Fahrenheit and Celsius scales enti... | true |
2a00dbd799fa2c012646636d0e13e927de4a0f3f | JavaScript | tolustar/user-story | /src/pages/viewStory/ViewStory.js | UTF-8 | 3,307 | 2.546875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useHistory, useParams } from "react-router-dom";
import "./ViewStory.css";
import LogoutButton from "./../../components/LogoutButton";
import allActions from "./../../store/actions";
export const acce... | true |
eb63ed5fa2f206988a4d358b326e2f94ac54161f | JavaScript | 2pavel/calc | /calc.js | UTF-8 | 2,337 | 3.625 | 4 | [] | no_license | // Basic operation functions
function add(a, b) {
return Number(a) + Number(b);
}
function subtract(a, b) {
return Number(a) - Number(b);
}
function multiply(a, b) {
return Number(a) * Number(b);
}
function divide(a, b) {
return Number(a) / Number(b);
}
function sqroot (a) {
return Math.sqrt(Number(... | true |
8b39221671415d3d701ed5ef0c5c1720c8db44cd | JavaScript | doctape/doctape-client-js | /src/wrapper-browser.js | UTF-8 | 2,422 | 2.53125 | 3 | [
"MIT"
] | permissive | window.Doctape = function (config) {
var self = new DoctapeSimple(config);
self.prototype = DoctapeSimple;
/*
** EVENT ARCHITECTURE
*/
(function () {
var evcb = {};
this.emit = function (event, data) {
setTimeout(function () {
var i, l;
if (evcb[event] !== undefined && (l ... | true |