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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4f8cd88a707beab82be893407edee206385d3c95 | JavaScript | Flywheel-Co/flywheel-adapt-docs | /assets/src/js/models/Page.js | UTF-8 | 1,001 | 2.84375 | 3 | [
"MIT"
] | permissive | /**
* Page model
*/
import slugify from 'underscore.string/slugify'
import titleize from 'underscore.string/titleize'
import humanize from 'underscore.string/humanize'
import Item from './Item';
export default class Page {
/**
* Constructor
* @param {Object} item
*/
constructor(item) {
this... | true |
ffaa9fa0f2bcff9e742d78da9c45004e2954a635 | JavaScript | lzyforever/nodejs_test | /exp/01_helloExpress.js | UTF-8 | 536 | 2.75 | 3 | [] | no_license | var express = require('express');
var app = express();
app.get("/", function(req, res){
res.send("你好");
});
app.get("/test", function(req, res){
res.send("这个是测试页面");
});
//正则匹配
app.get(/^\/student\/([\d]{10})$/, function(req,res){
res.send("学生信息,学号"+ req.params[0]);
});
//参数形式
app.get("/teacher/:gonghao", funct... | true |
4d889078c27addd185bc264a26cae31d0dbeb601 | JavaScript | YoussefWilliam/dynamic-programming-101 | /fib.js | UTF-8 | 677 | 4.3125 | 4 | [] | no_license | // NORMAL FUNCTION
const fib = (n) => {
if (n <= 2) return 1;
else return fib(n - 1) + fib(n - 2);
};
// HANDLING MORE COMPLEX NUMBERS
/*---------- Memoization----------*/
// A javascript object, which will be a hashmap
// Hashmap object consisting of the following: {Keys: values}
// Keys are the args of the fun... | true |
c742f4d114361f79886b395c43f7920d85cf3788 | JavaScript | StrykerViper/n320fall2020 | /labs/Project1/app/app.js | UTF-8 | 7,027 | 3.78125 | 4 | [] | no_license | //click listenrs for the turn count
document.getElementById("boxOne").addEventListener("click", clickTurn);
document.getElementById("topMiddle").addEventListener("click", clickTurn);
document.getElementById("topRight").addEventListener("click", clickTurn);
document.getElementById("middleLeft").addEventListener("click",... | true |
5508e2c956d6f7ad99eeb752f00b390aef8f4bc5 | JavaScript | libin1991/antd-admin | /src/components/SideMenu/index.js | UTF-8 | 2,598 | 2.65625 | 3 | [] | no_license | /* 侧边菜单 */
import React from 'react'
import { Menu, Layout, Icon } from 'antd'
import styles from './index.less'
const SubMenu = Menu.SubMenu;
const { Sider } = Layout
class SideMenu extends React.Component {
menuItemClick =(path)=> {
path = '/' + path
if (path === this.props.location.pathname) return
... | true |
2c8545f78068aacd5c19bf75939954c8e84a29e5 | JavaScript | chirag-parmar/chirag-parmar.github.io | /assets/js/particle_reset.js | UTF-8 | 762 | 3.265625 | 3 | [] | no_license | function dynamicallyLoadScript(url) {
var script = document.createElement("script"); //Make a script DOM node
script.src = url; //Set it's src to the provided URL
document.head.appendChild(script); //Add it to the end of the head section of the page (could change 'head' to 'body' to add it to the end of the... | true |
e3c03c457098a5c27ac1332e6d83929db859da19 | JavaScript | shihaotan91/iterators | /script.js | UTF-8 | 1,434 | 4.375 | 4 | [] | no_license | //LONG QUESTION 1
var words = ["hello", "what", "is", "up", "dude"]
var count = words.map(function (x) {
return x.length
})
console.log(count)
//SHORT QUESTION 4A
sumArr = [1,2,3,4]
var totalSum = sumArr.reduce(function(x,y){
return x + y
})
console.log(totalSum)
//SHORT QUESTION 4B
multiArr = [1,2,3,4]
... | true |
858910d25ffd0afe8daa81f1e84301f3410c9399 | JavaScript | thinkmariale/WebAdvJSSpring2015 | /Week02_Node_Express/students/Nour/basic-html-jquery/js/main.js | UTF-8 | 725 | 3.234375 | 3 | [
"MIT"
] | permissive | var app = {};
app.init = function(){
console.log("APP INIT!");
//function
//synchronous function
var syncFunc = function(number){
var sum = 0;
for(var i=0; i<number; i++){
sum += i;
}
console.log(sum);
//for sync function, you can return result
//via "return"
return sum;
};
var result = syncFunc(2468);
co... | true |
47a990bd2cf6838a1a48a1116436fad4c65da9f2 | JavaScript | WillieMensa/SUMADO-01 | /presenta-d.js | UTF-8 | 11,035 | 2.53125 | 3 | [] | no_license | /*
presenta-b.js
presentacion utilizando libreria tink (por los botones
preparacion de botones interactivos : ver interactivity.js
Desarrollo de presentación en pantalla de una aplicacion
Incorporacion de fonts, ejemplos de codigo en
https://developers.google.com/fonts/docs/getting_started
Imperdible!
... | true |
3094a84bdc179d0447c35229b91e4fbfecc34773 | JavaScript | satvik1257/ADV-C108-RECOGNIZING-ANIMALS-BY-VOICE---3 | /main.js | UTF-8 | 1,915 | 2.71875 | 3 | [] | no_license | function start_classification()
{
navigator.mediaDevices.getUserMedia({audio:true});
classifier=ml5.soundClassifier('https://teachablemachine.withgoogle.com/models/P8s56B34_/',modelready);
}
function modelready()
{
classifier.classify(gotresults);
}
function gotresults(error,results)
{
if(err... | true |
f301bd2f114710515c2086df5e45654818c8dfb0 | JavaScript | soulSingerK/shisan.underscore | /src/index.js | UTF-8 | 1,467 | 3.140625 | 3 | [] | no_license | import underscore from './underscore'
import { Event } from './event'
import { observer } from './subscriber/observer'
// const _ = new underscore()
const obj = {
name: 123,
age: 22
}
observer(obj)
obj.name = 'shisan'
console.log(obj)
// let count = 1
// const container = document.getElementById('container')
// ... | true |
64c3b7de445ea8214a4de458ac6212c032c027f3 | JavaScript | raxjs/rax-vscode-extensions | /extensions/vscode-rax-props-helper/src/getPropKeysFromCode.js | UTF-8 | 2,093 | 2.6875 | 3 | [] | no_license | const fs = require('fs');
const babelParser = require('@babel/parser');
const traverse = require('@babel/traverse').default;
const getBabelParserPlugins = require('./getBabelParserPlugins');
const getCompletionItem = require('./getCompletionItem');
// Get props keys from component code,
// * propTypes
// * assignment:... | true |
35344ef8e9c29f13c7a7007b88b7d5fd3a7323ae | JavaScript | mischkew/flatfinder | /src/index.js | UTF-8 | 2,563 | 2.59375 | 3 | [
"MIT"
] | permissive | require("./patches")();
const http = require("http");
const { config } = require("./config");
const { crawlFlatsAndNotifyAll } = require("./flatfinder");
const makeProtocol = require("./protocol");
function writeResponse(response, statusCode, contentType = null, body = null) {
const headers = contentType ? { "Conte... | true |
e30cf28c1aea667a136fc6ecfc0c65ce3f71ee7e | JavaScript | sgdreamer7/weather-app-react-demo | /src/api.js | UTF-8 | 1,607 | 2.65625 | 3 | [] | no_license | import axios from 'axios'
const WEATHER_API_KEY = '6572b42df938f020e05135df9086ac95'
const WEATHER_API_ROOT = 'https://api.openweathermap.org/data/2.5'
export const CITIES_FILE = 'city.list.min.json'
export const CITIES_URL = `${window.PUBLIC_URL}/${CITIES_FILE}`
let api = null
let apiLocal = null
function getInitia... | true |
904fa47548a547aca9eb725b07fd4065fb448721 | JavaScript | HugoBuffard/huloge | /GAME/js/component/bonusList.js | UTF-8 | 618 | 3.109375 | 3 | [] | no_license | var showBonusList = function(){
//définition de la div
var div = document.getElementById('bonus-list')
//set du ul
var ul = document.createElement("ul")
// ul.setAttribute('class', "list-group list-group-flush")
//set des li
for(let j = 0; j < Object.keys(BONUS).length; j++){
var... | true |
9250c947dc45be4c13f37c049d9c9e52585ad542 | JavaScript | dhilgarth/GlobalPinnedTabs | /stringExtensions.js | UTF-8 | 347 | 2.640625 | 3 | [
"MIT"
] | permissive | var StringExtensions = {
init: function () {
if (!String.prototype.repeat) {
String.prototype.repeat = function (count) {
var result = '';
for (var i = 0; i < count; i++) {
result += this;
}
return result;
... | true |
9c18d4be79db1be65f977b72e47e548ced43c55c | JavaScript | mrp1992/wordsfetcher | /test/index.test.js | UTF-8 | 928 | 2.703125 | 3 | [] | no_license | const request = require('supertest');
const app = require('../index.js');
describe('Test index', () => {
test('should return bad request response', () => {
return request(app).get("/words.json").then(response => {
expect(response.status).toBe(400);
expect(response.body.Message).... | true |
3acd64b3f8c83d990529dbe0009597f98f14f224 | JavaScript | kiki-kiko/iOS | /OS || System Restore Image/private/var/staged_system_apps/Music.app/Network.js | UTF-8 | 1,660 | 2.515625 | 3 | [
"MIT"
] | permissive | //
// Network.js
// Music
//
// Copyright © 2016 Apple Inc. All rights reserved.
//
class BridgedNetwork extends BridgedObject {
// MARK: - Object lifecycle
constructor(attributes) {
super();
this.TYPES = {
NONE: "none",
CELLULAR: "cellular... | true |
61405b555cd0632965468b75a351ce2335e5a7ab | JavaScript | KarolDawidziuk/MGame | /js/app.js | UTF-8 | 5,037 | 3.203125 | 3 | [
"MIT"
] | permissive | //consts
const cardList = document.querySelector('.deck');
//variables
let $deck = $('.deck');
let $restart = $('.restart');
let oneVisible = false;
let turnCounter = -1;
let visible_nr;
let cardOne = null;
let pairLeft = 8;
let timer;
let stars = 3;
let count = 0;
let checkOpened = [];
//card List array
let cardAr... | true |
0e74d707425b81ea6a1a4ac26357ab213b08cb67 | JavaScript | agbares/CMPE131-F18-prj | /models/contact.js | UTF-8 | 1,351 | 3.046875 | 3 | [] | no_license | /**
* contact model module.
* @module contact
*/
/* Dependencies */
const mongoose = require('mongoose');
/* Schema */
var contactSchema = mongoose.Schema({
});
/* Methods */
/* Statics */
/**
* Creates a new contact in the DB.
* @function createContact
* @param {string} user_ID - The user which the contac... | true |
2c7da5182fe696f4d53d392c173bdebe02ed200e | JavaScript | pablohariq/animales-salvajes | /assets/js/funciones.js | UTF-8 | 2,378 | 3.296875 | 3 | [] | no_license | //consulta asincrona a la api
const obtenerDatosAnimales = async () =>{
let response = await fetch("/animales-salvajes/animales.json") //comente esta linea para revisión en local
// let response = await fetch("../../animales.json") //use esta ruta para revisión en local
let data = await response.json()
... | true |
5a48c362c7171773c89919b008027432045dde15 | JavaScript | chiefsmurph/johns-electron-playground | /app/backend/app-actions/active-sell.js | UTF-8 | 2,755 | 2.671875 | 3 | [
"MIT"
] | permissive | // starts attempting to sell at 100% of current stock price
// every attempt it goes down from there until it successfully gets sold or it reaches MIN_SELL_RATIO
// const keepers = require('../keepers');
const limitSellLastTrade = require('../rh-actions/limit-sell-last-trade');
const jsonMgr = require('../utils/json-... | true |
4a28d9d8fdc8879fdfc7e4e57500f447d042dfce | JavaScript | Roleary1203/myGame | /myGame/helpers.js | UTF-8 | 1,551 | 2.875 | 3 | [] | no_license | const helpers = {
heroStats: (hero) => {
var heroStats = {};
if (hero.role === 'warrior') {
heroStats = {
health: 25 + (5 * hero.level),
attackDamage: 3 + (2 * hero.level),
resourceType: 'Rage',
resource: 0
}
}
else if (hero.role === 'mage') {
heroStats = {
health: 10... | true |
056ba2755a8c81286afb2d7d4e620c99220e1f98 | JavaScript | caplin/gc-cli | /global-compiler/src/utils/utilities.js | UTF-8 | 7,154 | 3.015625 | 3 | [] | no_license | import capitalize from 'capitalize';
import {
types
} from 'recast';
const {
builders: {
callExpression,
identifier,
literal,
memberExpression,
variableDeclaration,
variableDeclarator
},
namedTypes: {
Identifier,
Literal,
MemberExpression
}
} = types;
/**
* Returns true if the provided Express... | true |
c062f7982d9977db6421c454d171deccfcede06e | JavaScript | bboykk1234/frontend-mentor-challenges | /blogr-landing-page/script.js | UTF-8 | 1,929 | 2.796875 | 3 | [] | no_license | const togglerBtn = document.getElementById('menu-toggler');
togglerBtn.addEventListener('click', function () {
const btnImage = this.getElementsByTagName('img')[0];
const isCurrentExpanded = btnImage.getAttribute('aria-expanded') == "true";
const modelElementId = document.querySelector(this.getAttribute('d... | true |
e8406045dc47751f414b78f292c6e34ced444503 | JavaScript | EthanVV/subclass-dance-party | /src/dancer.js | UTF-8 | 3,697 | 3.078125 | 3 | [] | no_license | // Creates and returns a new dancer object that can step
// var makeDancer = function(top, left, timeBetweenSteps) {
// var dancer = {};
// // use jQuery to create an HTML <span> tag
// dancer.$node = $('<span class="dancer"></span>');
// dancer.step = function() {
// // the basic dancer doesn't do anyth... | true |
3c781c30b9643cfa34419433f31b6ae4a694c193 | JavaScript | ranjithrd/atlas | /src/helpers/validateGuess.js | UTF-8 | 280 | 2.78125 | 3 | [] | no_license | const { places } = require("../assets/places.json")
export const validateGuess = (guess) => {
const existsIndex = places.findIndex(
(place) => guess.toLowerCase().trim() === place.toLowerCase().trim()
)
const isIndexValidated = existsIndex !== -1
return isIndexValidated
}
| true |
922f63f30ac6183c3c53e495d59c963089694e25 | JavaScript | dernae/Module_12_Plotly_Bellybutton | /Module_12_Plotly_Bellybutton/data-12-3-2-resources/plots.js | UTF-8 | 2,741 | 3.453125 | 3 | [] | no_license | //spaceX.js file
//const url = "https://api.spacexdata.com/v2/launchpads";
//d3.json(url).then(receivedData => console.log(receivedData));
// display the metadata of any individual from the dataset:
//d3.json("samples.json").then(function(data){
//firstPerson = data.metadata[0];
//Object.entries(firs... | true |
d83b3ebafd3be201c76b5efc7e63271de1bbac4c | JavaScript | hdelarosa86/family-tree | /family-tree.js | UTF-8 | 913 | 3.171875 | 3 | [] | no_license | class FamilyTree {
constructor(value) {
if (typeof value !== 'string') {
throw 'Error, provide a valid value!';
}
this.children = [];
this.value = value;
}
insert(name) {
let child = new FamilyTree(name);
this.children.push(child);
}
familySize() {
return this.children.leng... | true |
6184aaf97c234d5624bf420b63038fa3896fd287 | JavaScript | wajeshubham/Javascript-on-steroids | /static/js/change-btn-clr.js | UTF-8 | 1,723 | 3.640625 | 4 | [] | no_license | // CHANGE THE COLOR OF BUTTON
var all_buttons = document.getElementsByTagName("button");
var btn = [];
for (let i = 0; i < all_buttons.length; i++) {
btn.push(all_buttons.item(i).classList[1]);
}
function btnRed() {
for (let i = 0; i < all_buttons.length; i++) {
all_buttons[i].classList.... | true |
a46725a99cee78946c0d93391bba72439fe3fffd | JavaScript | cwill833/clockerApp | /src/App.js | UTF-8 | 1,117 | 2.9375 | 3 | [] | no_license | import React, {Component} from 'react';
import getCurrentLatLng from './utils/Geolocator'
import './App.css';
class App extends Component{
constructor(){
super();
this.state = {
myLat: null,
myLng: null,
weWorkLat: 30.2685,
weWorkLng: -97.743
}
}
componentDidMount(){
... | true |
61621304ec5cd4289ac4938ee4540df477168ac1 | JavaScript | KovalenkoSerj/speechDetection | /index.js | UTF-8 | 605 | 2.8125 | 3 | [] | no_license | var recognition = new webkitSpeechRecognition();
recognition.lang = 'ru-RU';
var p = document.createElement('p'),
words = document.querySelector('.words');
words.appendChild(p);
recognition.addEventListener('result',function(e){
p.textContent = Array.from(e.results).map(... | true |
851aadb274c4f933bd0cc8364b8a1dc4c09ec491 | JavaScript | elaineshimabukuro/SAP003-burger-queen | /src/pages/saloon/saloon.js | UTF-8 | 3,559 | 2.625 | 3 | [] | no_license | import React, { useState } from 'react';
import Command from '../../components/command/command.js'
import './style.css'
import Menu from '../../components/Menu/menu.js'
import Extras from '../../components/extras/extras'
import firebase from '../../utils/firebase.js';
export default function Saloon() {
const [it... | true |
a8ba2a2ace3613ccc8df1a393aada58a000e4113 | JavaScript | YiZhang-Paul/Daily_Programmer | /challenge_328/easy/latinSquares.js | UTF-8 | 3,489 | 3.78125 | 4 | [] | no_license | /* jslint esversion: 6 */
(() => {
document.addEventListener("DOMContentLoaded", () => {
/**
* check if a square has valid numbers
* @param {int} [width] - square width
* @param {Array} [numbers] - numbers in square
*
* @return {boolean} [test result]
*/
function hasValidNum(width, numbers) {
... | true |
b674f66e44390866cf95af28c75c868ea7b9f91e | JavaScript | imranhsayed/indecision-app | /src/components/Action.js | UTF-8 | 455 | 2.515625 | 3 | [] | no_license | import React from 'react';
/**
* Functional Based component.
*
* @param props
* @return {*}
* @constructor
*/
const Action = ( props ) => (
<div>
{/* The disabled value will be flipped to true to false and vice versa,
depending on the boolean value of this.props.hasOptions */}
<button className="big-bu... | true |
de01f0a65e7664fbbc7b26848a366b52f592b3df | JavaScript | CalebAllard/Newsfeed-Components | /Menu/Menu.js | UTF-8 | 1,506 | 4.21875 | 4 | [] | no_license | /* This is the data we will be using, study it but don't change anything, yet. */
let menuItems = [
'Students',
'Faculty',
"What's New",
'Tech Trends',
'Music',
'Log Out'
];
function createMenu(arr){
const menuCont = document.createElement('div');
menuCont.classList.add('menu');
const menuUl = docum... | true |
e90391b982c2669933bc4cf643bcd2d74ec3b9cf | JavaScript | MikeTheFyke/FrontendGLExperimentation | /public/logic/canvas/hudLogic.js | UTF-8 | 3,231 | 2.890625 | 3 | [] | no_license | var canvas = document.getElementById('hudCanvas');
var ctx = canvas.getContext('2d');
var framesPerSecond = 30;
var Xcord = 0;
var Ycord = 0;
var topYCorner = 20;
var topXCorner = 20;
const xthick = 950;
const ythick = 525;
var ammoCount = 8;
// Background variables
var imgMouseX = 0;
var imgMouseY = 0;
var imgY = -... | true |
201ba4ef82deedb96645f6e9e639fbf42adf87d9 | JavaScript | codefellows/seattle-code-javascript-401d42 | /class-26/typed-demo/functional-react/src/App.js | UTF-8 | 2,385 | 3.40625 | 3 | [] | no_license | import logo from './logo.svg';
import './App.scss';
import React, { useState } from 'react';
import Header from './Header.js';
// let state = {} => react is not aware of this variable being importantt to a component.
// The only difference from a syntax point of view is that a class needs tobe instantiated, a functio... | true |
c0d33cea20dec228985931a3bfd76a1162bd6172 | JavaScript | doc22940/two.js | /src/shapes/rectangle.js | UTF-8 | 5,775 | 2.671875 | 3 | [
"MIT"
] | permissive | import Commands from '../utils/path-commands.js';
import Events from '../events.js';
import defineGetterSetter from '../utils/get-set.js';
import _ from '../utils/underscore.js';
import Path from '../path.js';
import Anchor from '../anchor.js';
import Vector from '../vector.js';
/**
* @name Two.Rectangle
* @class
... | true |
ecd329d5256243e058e14cc473c52b73242cda9d | JavaScript | samgh/Princeton-Eats | /js/main.js | UTF-8 | 7,305 | 2.84375 | 3 | [] | no_license | var meal,
day;
$(function() {
// Hide filters
$("#filters-form").hide();
if (window.location.pathname == '/about') {
$("#filters-button").attr("disabled","disabled");
}
else if (window.location.pathname == '/') {
var tempDay = getQueryVariable("day");
var tempMeal = getQueryVariable("meal");
if (tempDay... | true |
6ef271e2e9079609ae6415e2cac32639d39a4ca6 | JavaScript | desun8/paintballpark-landing | /_old/src/scripts/stickyContacts.js | UTF-8 | 1,212 | 2.65625 | 3 | [] | no_license | import rAF from "./form/rAF";
class StickyContacts {
constructor() {
this.root = undefined;
this.totalScrollSize = undefined;
this.toggleVisibility = this.toggleVisibility.bind(this);
this.handleScroll = this.handleScroll.bind(this);
this.handleResize = this.handleResize.bind(this);
}
toggle... | true |
f6ab640c756e114615ea21da0069dfc87ebb85e1 | JavaScript | nhgoodboy/scala-test1 | /src/main/jdTryout/popup.js | UTF-8 | 7,145 | 2.828125 | 3 | [] | no_license | // Copyright (c) 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* Get the current URL.
*
* @param {function(string)} callback called when the URL of the current tab
* is found.
*/
function getCurrentTabU... | true |
32265ef246372029982e7a702773e37a3c484b22 | JavaScript | flavioespinoza/scanner | /client/src/components/modal/TypeChooser.js | UTF-8 | 773 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react'
import PropTypes from 'prop-types'
class TypeChooser extends Component {
constructor (props) {
super(props)
this.state = {
type: this.props.type
}
this.handleTypeChange = this.handleTypeChange.bind(this)
}
handleTypeChange (e) {
// console.log(e.target.value);... | true |
19f21341258ac68f24d8140c0624dfe28d40fa40 | JavaScript | MahdAhmed2000/Web-Mobile-Hybrid-App-Development-Saylani- | /JavaScript(Assignments)/Chapters/26-30/6.js | UTF-8 | 120 | 3.25 | 3 | [] | no_license | var x;
x = Math.random();
x *= 100;
x = Math.floor(x);
document.write("Number between 1 and 100 in your browser: " + x); | true |
291d5c221f6fa2f794b393af6613b78f770ded25 | JavaScript | stylelint/stylelint | /lib/normalizeRuleSettings.js | UTF-8 | 1,788 | 3.203125 | 3 | [
"MIT"
] | permissive | 'use strict';
const { isPlainObject } = require('./utils/validateTypes');
// Rule settings can take a number of forms, e.g.
// a. "rule-name": null
// b. "rule-name": [null, ...]
// c. "rule-name": primaryOption
// d. "rule-name": [primaryOption]
// e. "rule-name": [primaryOption, secondaryOption]
// Where primaryOpt... | true |
f4704a5d240b55b3833f99b77f52c11ceb0d4896 | JavaScript | minewhat/timequeue.js | /test/every-test.js | UTF-8 | 1,532 | 2.859375 | 3 | [
"MIT"
] | permissive | var TimeQueue = require('..')
, assert = require('assert')
;
var concurrency = 3;
var every = 10;
var jobs = 10;
function runTest(type, worker) {
describe('Create a queue with a time limit with ' + type, function() {
var q = new TimeQueue(worker, { concurrency: concurrency, every: every });
it('Amount... | true |
6b02e261fbc00afa2eaeea8d4518c4a15a4de1a8 | JavaScript | future4code/Thiago-Stephen | /semana10/projetoPlanner/planner-ultimate/src/App.js | UTF-8 | 5,311 | 2.875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import './App.css';
import Axios from 'axios';
import styled from "styled-components"
const baseUrl = "https://us-central1-labenu-apis.cloudfunctions.net/generic/planner-mello-thiago"
const DeleteButton = styled.span`
color: red;
cursor: pointer;
`
function App... | true |
405cd20ae57dbfae41aa732c8c128a27709fad29 | JavaScript | aesmi/sudoku | /src/sudoku.js | UTF-8 | 5,396 | 3.78125 | 4 | [] | no_license | // Sudoku Module - Noah Yamamoto 2018
// Check if a passed board is full for base-case.
const isFull = (board) => {
for (let i = 0; i < 9; i++) {
for (let n = 0; n < 9; n++) {
if (board[i][n] === 0) return false;
}
}
return true;
};
// Randomly shuffle an array.
const shuffle = (arr) => {
let j ... | true |
e9a03a23a7e5d9774403a3fe92dba75d00ac467b | JavaScript | pallativ/vue-demos | /event-binding/app.js | UTF-8 | 897 | 2.875 | 3 | [] | no_license | const app = Vue.createApp({
data: function () {
return {
counter: 0,
error: "",
name: "",
};
},
methods: {
add: function (num) {
this.error = "";
this.counter += num;
},
remove: function (num) {
i... | true |
ed47e8e2c7462c4caa105b1d62c866466163220d | JavaScript | aaroncheungcompsci/SeniorProject | /karmecca-crm2/Backend/routes/api.js | UTF-8 | 2,437 | 2.859375 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');
var Customer = mongoose.model('Customer')
//Used for routes that must be authenticated.
/*
function isAuthenticated (req, res, next) {
// if user is authenticated in the session, call the next() to call the next req... | true |
37ff404789b7f13b2980e4358eb5c2d5114196cb | JavaScript | onowakow/fso-repo | /part1/anecdotes/src/App.js | UTF-8 | 3,204 | 3.46875 | 3 | [] | no_license | import React, { useState } from 'react'
// Notes. Math.random() returns a number between 0 and 1, non-inclusive.
// Math.floor() truncates the decimals on a number
// Math.floor(Math.random()*20), for instance, returns a whole number between 0 and 19.
// anecdotes.length returns highest-index + 1... | true |
9ca7cd5762fa47fab8ec6b138ef8c9f5ecc09f3d | JavaScript | Safe-Mode/220620-code-and-magick-1 | /js/setup.js | UTF-8 | 5,199 | 2.640625 | 3 | [] | no_license | 'use strict';
(function () {
// var NAMES = ['Иван', 'Хуан Себастьян', 'Мария', 'Кристоф', 'Виктор', 'Юлия', 'Люпита', 'Вашингтон'];
// var SURNAMES = ['да Марья', 'Верон', 'Мирабелла', 'Вальц', 'Онопко', 'Топольницкая', 'Нионго', 'Ирвинг'];
// var COAT_COLORS = ['rgb(101, 137, 164)', 'rgb(241, 43, 107)', 'rgb(1... | true |
09d54874a7fa5a050fb3d8413081063ca8df6687 | JavaScript | anneraev/Wishlist-Practice-API | /src/scripts/DomManager.js | UTF-8 | 1,024 | 3.875 | 4 | [] | no_license | /////////////////////////////////////////////////////////////////////
//for each object in the loop from which this function is called,
//inserts that object's properties into an HTML format and returns
//the result.
const buildHTMLforWishList = (wishListObject) => {
return `
<section>
<span>I can purchase... | true |
c86c393052a42bcbf8d663f331de9d42a6d5923e | JavaScript | NaNnin08/bootcamp_week1 | /day01/03-ScopeVariabel.js | UTF-8 | 479 | 3.453125 | 3 | [] | no_license | //global variabel
myvar = "Hello JS";
//var Variabel
var var2= "Hello JS_2";
function test(){
let x=2;
console.log(x);
}
//let tidak bisa menggunakan nama variabel yang sama pada scope yang sama
//seperti pada main inisiasi let x=10 lalu di inisiasi lagi ke let x=6
function test2() {
console.log(x);
}
... | true |
77863248012de1d31a1cb13d75eebdac2ab1ca87 | JavaScript | drewhagni/snippets | /Custom List Styling/list.js | UTF-8 | 299 | 2.78125 | 3 | [] | no_license | jQuery(document).ready(function($){
// Adjust counter for "ol" tags that have a custom start
$( "ol" ).each(function() {
var val=1;
if ( $(this).attr("start")){
val = $(this).attr("start");
}
val=val-1;
val= 'custom-counter '+ val;
$(this).css('counter-increment',val );
});
}); | true |
9ee494709c9845b68db5f32955ca4e1bd9cbbe66 | JavaScript | Dturati/estudos_js | /node/funcionarios.js | UTF-8 | 487 | 3.09375 | 3 | [] | no_license | const url = 'http://files.cod3r.com.br/curso-js/funcionarios.json'
const axios = require('axios')
axios.get(url).then(response => {
const funcionarios = response.data
const chinesa = funcionarios.filter((pessoa) =>{
return pessoa.pais === 'China' && pessoa.genero === 'F'
})
const escrava ... | true |
b29ce81a41f0e274fbd831fea05aa22abbb591d8 | JavaScript | khasan-590/lesson21 | /js/script.js | UTF-8 | 7,414 | 2.84375 | 3 | [] | no_license | window.addEventListener('DOMContentLoaded', () => {
'use strict';
// timer
function countTimer(deadline) {
const timeHours = document.querySelector('#timer-hours'),
timeMinets = document.querySelector('#timer-minutes'),
timeSeconds = document.querySelector('#timer-seconds');
let idInter... | true |
44db10012b4043001ab896925758bf0aa7184892 | JavaScript | davidagitlen/turing-yearbook | /src/components/NewStudentForm/NewStudentForm.js | UTF-8 | 1,590 | 2.78125 | 3 | [] | no_license | import React, {Component} from 'react';
import "./NewStudentForm.css";
class NewStudentForm extends Component {
constructor(props) {
super(props);
this.state = {
name : '',
quote : '',
superlative : '',
id : this.props.totalStudents.length * 2,
photo: 'https://placekitten.com/2... | true |
ddb4388a18be2a3066354e687904e714797a2394 | JavaScript | feats/hello-garden | /src/frontend/index.js | UTF-8 | 2,122 | 2.53125 | 3 | [
"ISC"
] | permissive | 'use strict'
const express = require('express')
const request = require('request')
const backend = require('./config').backend
const frontend = express()
frontend.get('/', (req, res) => {
res.send(`<!DOCTYPE html><html>
<head>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/l... | true |
c5e4936dc67e24cf5e849aa0abd4479b36cd4768 | JavaScript | popwangyang/VideoPlayer | /src/renderer/store/modules/Counter.js | UTF-8 | 1,168 | 2.609375 | 3 | [] | no_license | const state = {
currentVideoIndex: "",
arr:[]
}
const getters = {
currentVideo(state){
var index = state.currentVideoIndex;
state.arr.map((item, num) => {
if(num == index){
item.isPlaying = true
}else{
item.isPlaying = false
}
})
var obj = {
name: state.arr[index].nam... | true |
472c368b9979d4ad807141de572532a81b177f5e | JavaScript | patmooney/to-me-to-you | /index.js | UTF-8 | 7,421 | 2.671875 | 3 | [] | no_license | const defaultOptions = {
margin: 20, // text to box margin
fontSize: 20,
xOffset: 50, // space between boxes
boxHeight: 30,
radius: 5, // box border-radius
colours: ['#ffb3ba', '#ffdfba', '#ffffba', '#baffc9', '#bae1ff'],
triangleSize: 7,
leadingEdgeSize: 20, // how far out the new-line ... | true |
8bbca0a0542063867f8038e1449a5032aed773f5 | JavaScript | EmptySora/UserScripts | /userscripts/16/script.user.js | UTF-8 | 308 | 2.9375 | 3 | [] | no_license | //this is the contents of the script
function main(){
//Your Script here
var a=document.querySelectorAll("a[target]");
for(var i=0;i<a.length;i++)
a[i].removeAttribute("target");
}
if (document.readyState !== "complete") {
window.addEventListener("load",main);
} else {
main();
}
| true |
384ca05ea8f845d302cfb30ab8172ceb90ebf228 | JavaScript | jjjpanda/Facebook-Messenger-JSON-Parser | /lib/postAnalysis/createTextFiles.js | UTF-8 | 595 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | const fs = require('fs');
const path = require('path')
module.exports = (textDump, dirPath) => {
//create text files containing all message contents per user
dir = "./cloud"
if (!fs.existsSync(path.join(dirPath, dir))){
fs.mkdirSync(path.join(dirPath, dir));
}
for(const key of Object.keys(t... | true |
714a0dc5a19479c509565ed3f651c3f9619f24a5 | JavaScript | julienshim/clicky-game | /src/App.js | UTF-8 | 2,453 | 2.875 | 3 | [] | no_license | import React, { Component } from "react";
import ImperialCard from "./components/ImperialCard";
import Wrapper from "./components/Wrapper";
import Nav from "./components/Nav";
import Title from "./components/Title";
import troopers from "./troopers.json";
import "./App.css";
class App extends Component {
// Setting ... | true |
b5a19f9a2be38b6374027437c51967e02d7fbe30 | JavaScript | zuolizhu/github-jobs-frontendmentor | /src/Components/JobsFiltersTablet.js | UTF-8 | 2,110 | 2.578125 | 3 | [] | no_license | import useStore from '../store'
import { useState } from 'react'
export default function JobsFiltersTablet() {
const [isFullTimeOnly, setIsFullTimeOnly] = useState(false)
const [title, setTitle] = useState('')
const [location, setLocation] = useState('')
const setFilterTitle = useStore((state) => state.setFil... | true |
b409797d7c6053436ea045cf85392d78245d8c7d | JavaScript | Wimmind/rs-lang | /src/components/Auth/SignUpForm.js | UTF-8 | 2,048 | 2.671875 | 3 | [] | no_license | import React, { Component } from 'react';
import s from './auth.module.css';
class SignUpForm extends Component {
constructor(props) {
super(props);
this.state = {
email: '',
password: '',
confirmPassword: '',
errorText: '',
};
this.onChangeValue = this.onChangeValue.bind(thi... | true |
9300a20e45f4a94c46f0db262b9d6fe419c522ff | JavaScript | martin-hoger/ember-c-base-pack | /addon/helpers/distinct-values.js | UTF-8 | 3,848 | 3.453125 | 3 | [] | no_license | /*
distinctValues(items, propertyName, true)
inputs: items(array of objects) you want to go through
propertyName(string) you want to test
optional 'true' if you want to count items with undefined property
optional 'true' if you want array to be sorted aplhabetically (and not by item count)
outp... | true |
9cbab4e09b8352d62bdb41b2901be6addbeb442f | JavaScript | NicolasAlejandroGomezEchenique/CursoIngresoJS | /6-InstruccionFor/jsIteracionesFor (1).js | UTF-8 | 329 | 2.90625 | 3 | [] | no_license | function mostrar()
{
//for se utiliza cuando conozco de antemano la cantidad de iteraciones/
//while se utiliza cuando no se la cantidad de repeticiones que presiso para cumplir con el topico
//do while es cuando por lo menos se pude ejecutar una vez
for(var contador=1;contador<=10;contador++)
{
console.log(contad... | true |
4bd2d0316cd4f9a7bb9b7809cc3ee875aebb3eb2 | JavaScript | UN0910/Restaurant | /controller/pointsController.js | UTF-8 | 3,004 | 2.546875 | 3 | [] | no_license | const Loyalty = require("../model/pointsModel");
const User = require("../model/userModel");
const express = require("express");
exports.getpoints = (req,res)=>{
const _id = req.params.id;
Loyalty.findOne({customer : _id},(err,result)=>{
if(err){
res.status(400).json({error : err})
... | true |
7f4fd3f4a8a7941031021aca7b076da6d411ff1c | JavaScript | CyberTechFriend-Outsourcing-Freelancer/Hopper | /호퍼 작동시간.js | UTF-8 | 590 | 2.609375 | 3 | [] | no_license | //시작시간
var stampm = ''
if (msg.payload.starttime == 0) {
stampm = 'AM' ;
} else if (msg.payload.startime == 1) {
stampm = 'PM' ;
}
var sthour = msg.paload.starthour ;
var stminute = msg.payload.startminute ;
//종료시간
var endampm = ''
if (msg.payload.endtime == 0) {
endampm = 'AM' ;
} else if (msg.payload.endime ==... | true |
9a07d66eb8ecf27ae18a96f4e458a04828da467a | JavaScript | itslonson/Eloquent-JavaScript-Exercises | /Chapter4-DataStructures/reverse-array.js | UTF-8 | 1,301 | 4.90625 | 5 | [] | no_license | // Arrays have a reverse method that changes the array by inverting the order in
// which its elements appear. For this exercise, write two functions, reverseArray
// and reverseArrayInPlace. The first, reverseArray, takes an array as argument
// and produces a new array that has the same elements in the inverse order.... | true |
30d3558faf2b149b6aea4dfeb977a6f22aad8aa9 | JavaScript | phoby20/heatmap-analytics | /static/js/read_heatmap.js | UTF-8 | 4,303 | 2.8125 | 3 | [] | no_license | //出典:https://coliss.com/articles/build-websites/operation/javascript/js-real-time-heatmap-used-canvas.html
var carefully_image = document.getElementById('carefully_image');
console.log('carefully_image : ', carefully_image);
window["onload"]=function(){
var canvas, ctx;
// var Xclient = window.innerWidt... | true |
cff48efd8c1225eaef026374f97bd30a227e617f | JavaScript | JohnJoseph2007/CrumpledPaper2 | /sketch.js | UTF-8 | 822 | 2.703125 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
function preload()
{
}
function setup() {
createCanvas(800, 700);
engine = Engine.create();
world = engine.world;
//Create the Bodies Here.
paperBall = new Paper();
dustbinLeft = new Bin(500+2... | true |
e83f185ee827d817752cb7b5bb9457960341ed96 | JavaScript | kilchevskii/React | /tinder/src/task2.js | UTF-8 | 820 | 2.921875 | 3 | [] | no_license | import React from 'react';
const Mycomp = ({firstName, lastName, age, education, exp}) => {
// let {firstName, lastName} =
function getEduc (education) {
return education
}
let obj = {
skills : "HTML, CSS, JS, React"
}
let getExp = (exp) => {
if (exp) {
return <p>Ест... | true |
cbe7e7ff626007b3b2d75d84ea21bb2e70a475f0 | JavaScript | luismeneses97/Curso-02-Nivelacion-NODE-JS | /callback.js | UTF-8 | 343 | 3.25 | 3 | [] | no_license | /*setTimeout(() => {
console.log('Hola mundo');
},2000)*/
const getUsuarioById = (id, callback) => {
const user = {
id,
nombre:'Luis',
}
setTimeout(() => {
callback(user);
return user;
}, 1000);
}
const usuario = getUsuarioById(10, (usuario) => {
console.log(u... | true |
8d218131013e0bd2ce1e7cd98a15deb6e89c50d8 | JavaScript | JuliaTiunova/Boat_full_of_tales | /src/functions/TakeHelper.js | UTF-8 | 854 | 2.6875 | 3 | [] | no_license | const TakeHelper = (helper, protagonist) => {
let text = "";
switch (helper) {
case "меч і щит":
text += `свої вірні меч і щит.`;
break;
case "чарівна палочка":
text += `свою вірну чарівну палочку`;
if (protagonist === "лицар" || protagonist === "принцеса") {
text += `: подар... | true |
931ae2729e10d413dc45cc37af3bc5feeb704b35 | JavaScript | thrld/websiteChris | /js/script.js | UTF-8 | 595 | 3.359375 | 3 | [
"MIT"
] | permissive | $('#alert').click( function(){
alert('You clicked me!');
});
$('#makeGreen').click(function(){
$('#myFirstDiv').css('background-color','green')
// $('#myNumber').text('5');
});
$('#makeBlue').click(function(){
$('#myFirstDiv').css('background-color','blue');
});
$('#makeRed').click(function(){
$('#myFirstDiv... | true |
e8073638d2a591236f002bca3174da4e1e924010 | JavaScript | pben369/Memory-Game | /js/app.js | UTF-8 | 8,179 | 3.25 | 3 | [] | no_license |
let cards = [];
let flippedCards = [];
let numOfMoves = 0;
let noOfMatchedCards = 0;
let sec = 0;
let min = 0;
let gameStart = true;
let endOfGame = false;
let gameTimer;
let timerContainer = document.querySelector(".timer");
let popup = document.querySelector(".popup");
//shuffle cards.
function shuffleCards(){
... | true |
f3ab3b88357e78d22bca1767b74b74a56c5a00f9 | JavaScript | jackil182/nodejs-exercises | /Ex3/src/routes/cars/get-cars-route.js | UTF-8 | 637 | 2.515625 | 3 | [] | no_license | const fs = require('fs');
const path = require('path');
const express = require('express');
const router = express.Router();
const filterById = (id, arr) => {
return arr.filter(el => el.id === id);
};
const filePath = path.join(__dirname, '../../db/cars.json');
const fileData = JSON.parse(fs.readFileSync(filePath))... | true |
9bee068c253a00d6f681ca6c025eda2bfd98ba95 | JavaScript | DmytroIE/2018-11-03_Hackathon | /src/helpers/compareStrings.js | UTF-8 | 221 | 2.734375 | 3 | [] | no_license |
module.exports = function(str, strToCompare, returnValue) {
//debugger
if(str.trim().toUpperCase() === strToCompare.trim().toUpperCase()) {
return returnValue;
}
// else {
// return 'disabled';
// }
} | true |
b49a685baa5ac95055f374db3494b6198c347b64 | JavaScript | tsoni-systango/Konso | /todos/client/templates/components/right-menu/files/components/Files.jsx | UTF-8 | 1,092 | 2.515625 | 3 | [] | no_license | // App component - represents the whole app
FilesReact = React.createClass({
// This mixin makes the getMeteorData method work
mixins: [ReactMeteorData],
getInitialState() {
return {
hideCompleted: false
}
},
// Loads items from the Tasks collection and puts them on this.data.tasks
getMeteo... | true |
e99079ccec9846e56e38f4f59c6d45b04836b92a | JavaScript | yangxin1994/miniature-vue | /step1/XVue.js | UTF-8 | 786 | 2.84375 | 3 | [] | no_license | class XVue {
constructor(options) {
this.$data = options.data
this.observe(this.$data)
}
observe(value) {
if (!value || typeof value !== 'object') {
return
}
Object.keys(value).forEach(key => {
this.defineReactive(value,key,value[key])
})
}
defineReactive(obj, key, val) {... | true |
a647e48784eb1074d870a63fb83946a6a4a60668 | JavaScript | anthonyycku/vroom_frontend | /src/Main.js | UTF-8 | 3,489 | 2.84375 | 3 | [] | no_license | //Import React & CSS
import React from 'react';
//Import axios
import axios from 'axios';
//Import Components
import Companies from './Companies'
import Company from './Company'
import CreateCar from './CreateCar'
import CreateCompany from './CreateCompany'
import EditCompany from './EditCompany'
import EditCar from '.... | true |
34d1f700266d4139deadb59d1626a5496f656762 | JavaScript | arunkumard1988/learningcore3 | /insta3core3/wwwroot/js/googlemap.js | UTF-8 | 3,563 | 3 | 3 | [] | no_license | // This example adds a search box to a map, using the Google Place Autocomplete
// feature. People can enter geographical searches. The search box will return a
// pick list containing a mix of places and predicted search terms.
// This example requires the Places library. Include the libraries=places
// parameter wh... | true |
1333118e050cae7b39e962c2e8ffe994e95afa7f | JavaScript | skyman149/JS_newDailyChallanges | /min positive number in array.js | UTF-8 | 246 | 3.296875 | 3 | [] | no_license | function minPositive(arr){
let minArr = [];
for (let i = 0; i<arr.length; i++){
if (arr[i]>=0){
minArr.push(arr[i]);
}
}
return Math.min(...minArr);
}
//console.log(minPositive([3, 6, 8, -4, -3, 2, 16])); //2 | true |
9bce90248cc0b9c517e6d12eaa32123bd5018921 | JavaScript | mujohn26/voting-app-fontend | /src/actions/candidate.action.js | UTF-8 | 829 | 2.515625 | 3 | [] | no_license | export const GET_CANDIDATES = 'GET_CANDIDATES';
export const VOTING_SUCCESS = 'VOTING_SUCCESS';
import axios from 'axios';
export const getCandidates = () => async dispatch => {
try {
const candidates = await axios.get(`https://vote-app-backend.herokuapp.com/api/v1/candidate`);
dispatch(getCandidateA... | true |
f88e614e7c5106b9b5a2e30396a8bebb61ebd9ba | JavaScript | OlegSharyk/es6examples | /dist/promises.js | UTF-8 | 1,745 | 3.296875 | 3 | [] | no_license | 'use strict';
//function applyForVisa(documents, resolve, reject){
// console.log('Обработка заявления...');
//
// setTimeout(function(){
// Math.random()> 0.5 ? resolve({}) : reject ('В визе отказано: нехватка документов');
// },2000)
//}
//
//function bookHotel(){
//
//}
//
//function buyTickets(){
/... | true |
c346a6be1276a0d0d32c9303f6d1608904ea40a4 | JavaScript | JustinD85/sandbox | /tech/webgl/index.js | UTF-8 | 1,622 | 3.46875 | 3 | [] | no_license | //This holds ids of previous setIntervals, to be cleared
const intervals = [];
//Clears intervals for each id
function clearIntervals() {
intervals.forEach(i => clearInterval(i));
//resets intervals variable by removing all contents of array
intervals.splice(0);
}
//Entry point
function main() {
//Grabs al... | true |
aff4ddb20b9394b4037100ac9091b8616b5f9c95 | JavaScript | gtshepard/ttp-6-crypto-ticker | /src/tickers.js | UTF-8 | 1,877 | 2.5625 | 3 | [] | no_license | import React, {Component} from 'react'
import './tickers.css'
import Cryptocurrency from './cryptocurrency.js'
import axios from 'axios'
class Tickers extends Component {
constructor(props) {
super(props)
this.state = {
data: [
{
id: 'bitcoin',
name: 'Bitcoin',
... | true |
f5918b7dc47fabdaf52810021a56aa6c07f87c88 | JavaScript | Ortega-Dan/cs313-nodejs | /assignments/prove08/httpServer.js | UTF-8 | 630 | 2.640625 | 3 | [] | no_license | var http = require('http')
function onrequest(req, res) {
// console.log(req.url)
if (req.url == '/home') {
res.writeHead(200, { 'Content-Type': 'text/html' })
res.write('<h1>Welcome to the home page</h1>')
res.end()
} else if (req.url == '/getData') {
res.writeHead(200, { '... | true |
3f7d013275f423c002bf609ea28b9ab2c7838da2 | JavaScript | evanshango/savana | /savana-client/src/redux/address/addressReducer.js | UTF-8 | 1,282 | 2.59375 | 3 | [] | no_license | import {ADDRESSES} from "../types";
const initialState = {
loading: false,
addresses: [],
errors: []
}
const addressReducer = (state = initialState, action) => {
switch (action.type) {
case ADDRESSES.FETCH_ADDRESS_REQUEST:
return {
...state, loading: true
... | true |
54b4c49ea5316e9421fda2bf4a5ee4ebec6c90cd | JavaScript | fsannholm/jira-report-tool | /src/reducers/sync-reducer.js | UTF-8 | 2,404 | 2.59375 | 3 | [] | no_license | import { combineReducers } from 'redux';
import issues from '../../mocks/issues.json';
import cloneDeep from 'lodash.clonedeep';
const initialState = issues;
const initialSummaryState = {assignedSummary: []}
function getAssignedTaskSummary () {
let summary = initialState.issues.map((issue) => {
let name, key... | true |
ad795605a1bfde83ecc850f1211539cf5c82b79b | JavaScript | franiglesias/eloquentjs | /js/3-Functions/minimum.js | UTF-8 | 261 | 3.09375 | 3 | [
"MIT"
] | permissive | var it = require('../tools/it.js');
function minimum(x, y) {
if (x < y) {
return x;
}
return y;
}
it('3 is the minimun in 3,5', 3 == minimum(3,5));
it('3 is the minimun in 7,3', 3 == minimum(7,3));
it('Equal numbers', 5 == minimum(5,5)); | true |
946e18be381fa837bdc32392f4e04e66d49b93b8 | JavaScript | chen1zee/wx_node | /src/error-util/ServiceError.js | UTF-8 | 1,631 | 2.875 | 3 | [] | no_license | /**
* 业务层 错误工具类
* */
const JSONTag = 'JSONString:'
const ServiceErrorName = 'ServiceError'
class ServiceError extends Error {
/**
* @param {String} description 描述
* @param {String|Object} detail 附加详情
*/
constructor(description, detail) {
let messageString
if (typeof detail == '... | true |
389dbef66b2c5fa1417cb4883ce434ae7df1f361 | JavaScript | Hinsurance/alpha-beta-Tic-Tac-Toe | /js/index.js | UTF-8 | 7,195 | 3.09375 | 3 | [
"MIT"
] | permissive | var MAX = 100,//玩家胜
DRAW = 0,//平局
MIN = -100,//电脑胜
cmpBestMove = 0,//电脑最佳走步
chess = [],//棋局
dept = 0,//搜索深度
isPlayerNow = true;// 判断当前是否为玩家下子 从html文件得到该布尔值
$(function() {
//点击开始按钮开始游戏
$('#start-game-btn').on('click',function() {
//判断当前哪方下子
var s2 = $("input[name='game']:checked").val();
if (s2 == 'true')... | true |
2d07dd187b4941c5189ff08abc457586995893b5 | JavaScript | asherkobin/Sprint-Challenge-Single-Page-Apps | /src/App.js | UTF-8 | 1,256 | 2.609375 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import { Switch, Route } from "react-router-dom";
import Axios from "axios";
import Header from "./components/Header.js";
import CharacterList from "./components/CharacterList";
import WelcomePage from "./components/WelcomePage";
import SearchForm from "./components/S... | true |
d2dd9f28d58aec4173057cee81d37f3529c36bf1 | JavaScript | valentinHruzinski92/storeReact | /src/components/main/users/CreateUser.js | UTF-8 | 5,015 | 2.59375 | 3 | [] | no_license | import React, {Component} from 'react';
import ValidateErrorForm from '../ValidateErrorForm'
class CreateUser extends Component {
state = {
name: "",
login: "",
role: 0,
user: null,
users: [],
validateErrors: []
}
componentWillReceiveProps(nextProps) {
... | true |
b0e33297e9f5096e2953f422357d9236edf4db40 | JavaScript | krostyle/crud-html-js-poo | /src/classes/UI.js | UTF-8 | 1,561 | 2.875 | 3 | [] | no_license | export class UI {
addProduct(product) {
const productList = document.getElementById('product-list')
const element = document.createElement('div');
element.innerHTML +=
`<div class="card text-center mb-4 bg-primary">
<div class="card-body">
... | true |
65c1207dade917f055e4d3838b73012dd209741b | JavaScript | dianedouglas/shift-cipher | /js/scripts.js | UTF-8 | 3,411 | 3.53125 | 4 | [
"MIT"
] | permissive | var shiftCipher = function(shiftAmount, inputPhrase){
var alphabetChars = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
var numericalChars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
var currentChar; //step through inp... | true |
9a12563bf8e37a3fbef908ed84b9b5ba3e2eb662 | JavaScript | badManPro/webCV | /js/main.js | UTF-8 | 3,200 | 2.78125 | 3 | [] | no_license | // 添加offset类来控制简历模块移动动画效果
let specialTags = document.querySelectorAll('[data-x]')
for(let i=0;i<specialTags.length; i++){
specialTags[i].classList.add('offset')
}
findClosest()
// 监听网页滚动Y轴坐标,调整导航栏的样式
window.onscroll = function(changebar){
if(window.scrollY > 0) {
topNavbar.classList.add('sticky');
... | true |