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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
726afa51b4e504153693eb8cf1d05d6d37ba2193 | JavaScript | The-Merry-Men/related-stocks | /client/src/components/CarouselApp.jsx | UTF-8 | 2,153 | 2.578125 | 3 | [] | no_license | import React from 'react';
import Carousel from './Carousel.jsx';
import style from '../styles/carousel_app.css';
import LeftArrow from './LeftArrow.jsx';
import RightArrow from './RightArrow.jsx';
class CarouselApp extends React.Component {
constructor(props){
super(props);
this.state = {
companies: ... | true |
edb2c6f53080e18426e8f70ab1364012cb8ddf6f | JavaScript | rcbat73/space-invaders-game | /src/components/Game.js | UTF-8 | 8,065 | 2.609375 | 3 | [] | no_license | import React from 'react';
import styled from 'styled-components';
import cnt from '../helpers/Constants.js';
import Player from './Player.js';
import Alien from './Alien.js';
import LaserShot from './LaserShot.js';
import DisplayScreen from './DisplayScreen.js';
import Sound from '../helpers/Sound.js';
import laserAud... | true |
710ba7c41e5a3a7382f8779d0f4268d4fb8b78c2 | JavaScript | adkahane/bamazon | /bamazonCustomer.js | UTF-8 | 2,539 | 2.9375 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var Table = require("cli-table");
var clear = require("clear");
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
// Your username
user: "root",
// Your password
password: "iamR00t",
database: "bamazon"
});
// con... | true |
5b4de1ffd3d97b5fa352e5c37ef93c93c0ef3554 | JavaScript | bignallt07/td2-data-pagination-and-filtering-app | /js/script.js | UTF-8 | 5,789 | 3.328125 | 3 | [] | no_license | /*
Treehouse Techdegree:
FSJS Project 2 - Data Pagination and Filtering
*/
/*
For assistance:
Check out the "Project Resources" section of the Instructions tab: https://teamtreehouse.com/projects/data-pagination-and-filtering#instructions
Reach out in your Slack community: https://treehouse-fsjs-102.slack.com/ap... | true |
7e70af1ece96fa741a2360d97bd0e629a60183a6 | JavaScript | 1350562074/tw.hao | /practices/superposition_operation/own_elements_operation/subscript_is_even/single_element.js | UTF-8 | 419 | 2.90625 | 3 | [] | no_license | 'use strict';
var single_element = function(collection){
var result = [];
for(var i=0;i<collection.length;i++)
{
if(i%2!=0)
{
result.push(collection[i]);
}
}
for(var j=0;j<result.length;j++)
{
if(result[j+2]==result[j])
{
result.splice(j+2,1);
}
if(result[j]==result[... | true |
705c44f4c86f0e22f7466296265122c480a55b35 | JavaScript | VoidMercy/Particle-System | /source/spiral.js | UTF-8 | 1,717 | 3.296875 | 3 | [] | no_license | var current_direction = 0;
var SPIRAL_VELOCITY = 2;
var SPIRAL_RADIUS = 5;
var SPIRAL_PERIOD = 10;
var SPIRAL_MAX_SPEED = 8;
// Add a spiral particle
function add_spiral() {
mouse_coord = app.renderer.plugins.interaction.mouse.global;
let spiral = {};
spiral.theta = current_direction;
spiral.x = mou... | true |
83745a03cdf32250d9fc7c5e9232cfabf9486c27 | JavaScript | tim1020/ec-array | /func/split.js | UTF-8 | 278 | 3.296875 | 3 | [
"MIT"
] | permissive | //将str以sep分隔成一个数组,如果设置了limit,则最多返回limit个元素 (limit为负数表示不限)
module.exports = ( str , sep="", limit = -1) => {
if(typeof str !='string' || typeof sep != 'string') return false;
return str.split(sep,limit);
} | true |
62d9f8c235f84e2f1702cb792323390b0c244d1d | JavaScript | khareesmith/Node.js-HW | /greeting.js | UTF-8 | 236 | 2.796875 | 3 | [] | no_license | //Creates a variable for a greeting as a String
const greeting = "Welcome! Please verify user information here:";
//Uses export module to export the "greeting" string as a "greeting" object
module.exports = {
greeting: greeting
}; | true |
104a32bedfa9f0d63044bd6f49b37d53df3b3bb9 | JavaScript | adamshafiz2/kingdodoo | /src/components/Counter.js | UTF-8 | 386 | 2.609375 | 3 | [] | no_license | import { useState } from "react";
function Counter() {
const [count, setCount]=useState(0)
return(
<div className="clients">
<button onClick={() => setCount(count + 1)}>BOOK NOW</button>
<div>NUMBER OF CLIENTS:{count} </div>
<button onClick={() => setCount(count - 1)... | true |
9055c7a0a4c16e98e25c133edc75e08102c71b1e | JavaScript | EUdds/MLTasks | /flappybird/bird.js | UTF-8 | 1,261 | 3.09375 | 3 | [] | no_license | function Bird(brain) {
this.y = height / 2;
this.x = 64;
this.gravity = 0.7;
this.velocity = 0;
this.lift = 12;
this.src = "images/bird.png";
this.img;
this.hitGround = false;
if (brain) {
this.brain = brain.copy();
} else {
this.brain = new NeuralNetwork(4, 4, 2);
}
this.score = 0;... | true |
a9f090d1288b3b8dcc1ab306bc126c5755d1a4b2 | JavaScript | mirfanrafif/ui-test-cypress | /cypress/integration/firstTest.spec.js | UTF-8 | 1,461 | 2.5625 | 3 | [] | no_license | /// <reference types="cypress" />
describe("First Test", () => {
it("visit and click", () => {
cy.visit("/");
cy.contains("Forms").click();
cy.contains("Form Layouts").click();
});
it("Inline Form", () => {
cy.get('[placeholder="Jane Doe"]').type("Irfan Rafif");
cy.get('[type="text"][placeh... | true |
e6b0cf0cb106525b8fcae31149a56d7f987d04ce | JavaScript | ydalimir/PADAWAN | /for-loop.js | UTF-8 | 123 | 3.203125 | 3 | [] | no_license | var total = 0
var limit = 10
for (let i = total; i < limit; i++) {
// log the numbers 0 through 9
console.log(i)
} | true |
80138e9ab7fdbd88c48712bebc49f30c49070ccd | JavaScript | siddu1998/PreTrained-Models | /p5/empty-example/feature_extractor.js | UTF-8 | 1,441 | 3.109375 | 3 | [] | no_license | let mobilenet;
let classifier;
let video;
let label ='';
let ukeButton;
let whistleButton;
let trainButton;
function modelReady() {
console.log('Model is ready!!!');
mobilenet.predict(gotResults);
}
function gotResults(error, results) {
if (error) {
console.error(error);
} else {
console.log(result... | true |
c5b90974ae679a97ceb849ac607bef7fc123e0b3 | JavaScript | Martina7777/Workshop | /workshop/workshop.js | UTF-8 | 1,982 | 4.375 | 4 | [] | no_license | // alert("hello!");
// exercise01
let number = prompt("Enter a number!");
var length = number.length;
function dashes(dash){
var stringArray = dash.split('');
var numberArray = stringArray.map(Number);
for(var i = 0; i < numArr.length; i++) {
if(numberArray[i-1]%2===0 && numberArray[i]%2===0) {
... | true |
a6f1578d84dac14c52db0bdfbf5d3a11067754ce | JavaScript | ohxyz/beteasy-code-challenge | /src/util.js | UTF-8 | 754 | 2.8125 | 3 | [] | no_license | /**
* Get count down literals between two dates
*/
function countDown( startDate, endDate ) {
let startTime = startDate.getTime();
let endTime = endDate.getTime();
let distance = endTime - startTime;
let days = Math.floor( distance / ( 1000 * 60 * 60 * 24 ) );
let hours = Math.floor( ... | true |
2fdd65fd488d041c1e4d765cbfab8c4fe6f8f643 | JavaScript | c-boot/capstone2020 | /web/javascript/employee.js | UTF-8 | 14,033 | 2.84375 | 3 | [] | no_license | var counter = 0;
var currentOrders = [];
let timerId = setTimeout(function tick() {
refreshOrders();
timerId = setTimeout(tick, 5000); // (*)
}, 5000);
function startTimer() {
}
//setInterval(refreshOrders(), 1000);
function refreshOrders() {
$(document).ready(function() {
$.get("Empl... | true |
0efe8349031df991ae72fe1c5cfc69a89fd09a21 | JavaScript | JamesDonnelly/xiv-achievements | /src/js/components/ComparisonForm.js | UTF-8 | 3,409 | 2.828125 | 3 | [] | no_license | import React from "react";
export default class ComparisonForm extends React.Component {
constructor() {
super();
this.state = {
char1: "",
char2: "",
loading: true
}
this.handleCharacter1Change = this.handleCharacter1Change.bind(this);
this.handleCharacter2Change = this.handl... | true |
22d8261933d7598a4d116c2b53c2db2bff85c277 | JavaScript | mikaelvesavuori/acmecorp-microservices-webshop | /src/app/js/delivery.js | UTF-8 | 1,014 | 3 | 3 | [] | no_license | const getDeliveryTimes = async () =>
await fetch(DELIVERY_TIMES_ENDPOINT)
// Parse and return JSON response
.then((res) => res.json())
.then((res) => res.deliveryOptions)
// Handle errors
.catch((error) => {
console.log(error);
alert(error.message);
});
const bookDelivery = async ... | true |
d40f80616b1e6fc800acb690d0ddc24c2c1f555c | JavaScript | Nevvulo/remindo | /js/structures/Reminder.js | UTF-8 | 1,675 | 2.890625 | 3 | [
"MIT"
] | permissive | const Storage = require('./Storage.js')
class Reminder {
constructor(reminder) {
const last = this.lastReminder || {};
console.log(last.id)
let id = isNaN(Number(last.id+1)) ? 0 : Number(last.id + 1);
this.id = id;
this.title = reminder.title || null; //string
this.d... | true |
f50d5f73bc7f8339023d51a91ffbc6dcc042aead | JavaScript | helix-re/marzipano | /test/waitForCall.js | UTF-8 | 1,382 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2016 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicabl... | true |
3872466a8a2c9a0264b313d711298dc31aa794c5 | JavaScript | imaginate/algorithmIV-question-manager | /src/pre-compiled-parts/public-api.js | UTF-8 | 1,378 | 2.578125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | /**
* ---------------------------------------------------
* Global Variable (aIV)
* ---------------------------------------------------
* @desc Holds the public API for aIV's apps, tools, and libraries.
* @struct
* @global
*/
window.aIV = window.aIV || {};
/**
* --------------------------... | true |
3331c9f34614ad0d8b84b98abdf3ab03d0c92f40 | JavaScript | sinkosi/matcha | /api/app/models/activation.model.js | UTF-8 | 1,228 | 2.59375 | 3 | [] | no_license |
const sql = require("./db");
const bcrypt = require('bcrypt');
//Constructor
const ActivationCode = function({userId, code}) {
this.profile_id = userId;
this.code = code;
};
//CREATE A NEW CUSTOMER
ActivationCode.create = (newCode, result) => {
sql.query("INSERT INTO activation_code SET ?", newCode, (err, res) =... | true |
c7dba5776bfe69cb4aec4a6868a0a8d9edf8b493 | JavaScript | tmmluis/Tic-tac-toe | /tictactoe.js | UTF-8 | 7,859 | 3.09375 | 3 | [] | no_license | $( document ).ready(function() {
var playerMark = "";
var computerMark = "";
var computerFirst = false;
var gameBoard = new Board();
$("button").on("click", function() {
var mark = $(this).data("mark");
if (mark === "X") {
playerMark = '<p class="blue">X</p>';
computerMark = '<p class="r... | true |
009a605812c649ae4d6abddf32d434d9be7fd0d8 | JavaScript | RafaBrito7/rafabrito7.github.io | /checklist/assets/script.js | UTF-8 | 1,396 | 3.296875 | 3 | [] | no_license | let data = [];
function renderList() {
document.querySelector('.list').innerHTML = '';
data.forEach((task) => {
let li = document.createElement('li');
li.innerHTML = `
<input type="checkbox" id="task-${task.id}"/>
<label for="task-${task.id}">${task.title}</label>
<button type="button">x</bu... | true |
e53bc77cf79a753f9cd5fb2170affad25dbefad4 | JavaScript | MarinaRH/MemoryReact | /src/components/Cards.js | UTF-8 | 2,357 | 3 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
class Cards extends Component {
constructor(props) {
super(props);
this.cards = ['och', 'och', 'cua', 'cua', 'onc', 'onc', 'sie', 'sie'];
this.tempCheckArr = [];
this.state = {
image: Array(this.cards.length).fill('hidden'),
divClick: true,
... | true |
bfe4596a4d424f8013531a2cddb1eca4516ce70f | JavaScript | yorkHan/resume-2018 | /scripts/topNavBar.js | UTF-8 | 995 | 2.6875 | 3 | [] | no_license | !function () {
var view=document.querySelector('#topNavBar')
var controller={
view:null,
init:function (view) {
this.view=view
this.bindEvents()
},
bindEvents:function () {
var view=this.view
window.addEventListener('scroll',()=>{
... | true |
c8811cee6ccda79d4b28d4cc8da45c38b425c854 | JavaScript | israelifrach/milliun | /project.js | UTF-8 | 2,589 | 2.90625 | 3 | [] | no_license | var missionArr = [];
var idx = missionArr.length
var missionInput = document.getElementById('mission-input');
var targetHour = document.getElementById('target-hour');
var targetDate = document.getElementById('target-date');
var submit = document.getElementById('submit');
submit.addEventListener('click', addMissionToArr... | true |
c8ec6e74b1a08f40bdaa2e088e3462c77f48ce1f | JavaScript | jroji/raspibot | /src/web/main.js | UTF-8 | 1,951 | 2.625 | 3 | [] | no_license | (() => {
const init = function() {
const config = {
apiKey: "",
authDomain: "raspibot-21ac3.firebaseapp.com",
databaseURL: "https://raspibot-21ac3.firebaseio.com",
storageBucket: "raspibot-21ac3.appspot.com",
};
firebase.initializeApp(config);
const ordersRef = firebase.dat... | true |
d558a1443cda34cd47f82e2d385e65db9e25bf6d | JavaScript | stephensong/react-testing-library | /src/utils.js | UTF-8 | 354 | 2.6875 | 3 | [
"MIT"
] | permissive | //eslint-disable-next-line import/prefer-default-export
export function matches(textToMatch, node, matcher) {
if (typeof matcher === 'string') {
return textToMatch.toLowerCase().includes(matcher.toLowerCase())
} else if (typeof matcher === 'function') {
return matcher(textToMatch, node)
} else {
retur... | true |
ad7be32260768f6f988e20388f036a041c5b86c4 | JavaScript | ArtemKhairov/algs_structures | /linear.js | UTF-8 | 312 | 3.828125 | 4 | [] | no_license | // линейный поиск
const arr = [10, 12, 15, 18, 20, 26];
let item = 20;
let count=0
function linear(ar, item) {
for (let i = 0; i < ar.length; i++) {
count++
if (ar[i] === item) {
return i;
}
}
// return null;
}
console.log(linear(arr, item));
console.log("count= " + count);
| true |
bfb652cbbf32120220ff3f30540229dac4214139 | JavaScript | albothyl/fun | /market/src/main/webapp/include/javaScript/user/memberValidationCheck.js | UTF-8 | 1,836 | 2.765625 | 3 | [] | no_license | function recoverFormValidationCheck(){
if( !nullCheck("email", $("#email").val()) || !nullCheck("randomKey", $("#randomKey").val()) ){
return false;
}
return true;
}
function updateFormValidationCheck(){
if( !nullCheck("password", $("#pw").val()) || !nullCheck("nick", $("#nick").val()) ){
return false;
... | true |
2bfa52aaec2bbbc9b6f7df775f32da8cc53d6e51 | JavaScript | Zio7711/decision-maker | /public/scripts/render-links.js | UTF-8 | 4,720 | 2.90625 | 3 | [] | no_license | /*
* Use this to render the links for the user after they create their poll
* This will check for any character limit errors first
* Will then chain ajax requests to POST to the db, then GET the last poll
* added and show the correct links to the user.
*/
$(document).ready(() => {
$('form').submit((event) => {
... | true |
1d89f608d3d9597a5ee954087253784c682d6af6 | JavaScript | cudjoeab/react-grocery-list | /grocery-list/src/List.js | UTF-8 | 861 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import Item from './Item';
class List extends Component{
initialItems = [
{
item: "steaks",
category: "meat"
},
{
item: "apples",
category: "produce"
},
{
item: "milk (1L,... | true |
e72d8c7cb859dea405d82824ba4d214bf3453c0c | JavaScript | toofpaste/blackjack | /bjJs/scriptedBJs.js | UTF-8 | 6,181 | 2.890625 | 3 | [] | no_license | function randVal(){
return Math.floor(Math.random() * 13);
};
function randSuit(){
return Math.floor(Math.random() * 4);
};
function dealUser(value, suit, suitName, valueName){
var imagePath = ["spade", "diam", "heart", "club"];
$("ul.user").append("<li><img src = 'img/" + imagePath[suit] + value + ".jpg'" ... | true |
58cfb01c1acdaacb48e474449c573ff18e424ead | JavaScript | chavilla/heroes-app | /src/test/auth/authReducer.test.js | UTF-8 | 1,066 | 2.671875 | 3 | [] | no_license | const { authReducer } = require("../../components/auth/authReducer");
const { types } = require("../../components/types/types");
describe('authReducer testing', () => {
const state={
name:'Jesús',
logged:false
}
test('return the default state', () => {
const result=authReducer... | true |
23bd1d732de8c18b71ab1a2521b42bbbb59fb30f | JavaScript | MadRiver44/NYTimes_memory_game | /src/components/Game/Game.js | UTF-8 | 2,485 | 2.578125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import React, { Component } from 'react'
import axios from 'axios'
import PropTypes from 'prop-types'
import Instructions from '../Instructions/Instructions'
import Timer from '../Timer/Timer'
import Cards from '../Cards/Cards'
import Button from '../Button/Button'
import styles from './Game.scss'
class Game extends C... | true |
519d4adaaae8384ea6de80b1e476ccc6e5ca4f77 | JavaScript | xhd2015/Pyserver | /html/Plandev/freeform.js | UTF-8 | 2,493 | 2.9375 | 3 | [] | no_license | //=====Example Freeform START====
/**
<!--需要编写的就是 onresp,targeturi,class="freeforminput",name; 这就是模式化-->
<div class="freeform" targeturi="/Plandev/ajax-services/postfeedback.html" onresp="setItems">
<textarea name="text" class="freeforminput" access="val"></textarea> <br/>
<button name="submit">Submit</button>
... | true |
dc6128d4acdafd7fac14e4b2cbbf8efd5cb7a981 | JavaScript | SilenceRichard/js-exercises | /codings/2.25/curry.js | UTF-8 | 728 | 4.09375 | 4 | [] | no_license | /***
* curry.js
* 把接收n个参数的函数转变为接收1或x个参数
* 并返回接收余下参数并返回结果的函数
* const add = (a, b) => a + b
* const curryAdd = curry(add);
* curryAdd(a)(b)
*/
function curry(fn, args) {
const len = fn.length;
args = args || [];
return function () {
const _args = Array.prototype.slice.call(arguments);
for (let i = 0;... | true |
e1a698cf67c3c2716cd2c78823afc66c604ac73c | JavaScript | tnouska/weekend-project-3 | /server/routes/todo.routes.js | UTF-8 | 1,793 | 2.8125 | 3 | [] | no_license | //consts
const express = require('express');
const router = express.Router();
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
let todoSchema = new Schema({
task: {type: String},
location: {type: String},
notes: {type: String},
catagory: {type: String},
completed: {type: Boolea... | true |
2b5a2b097090d975c662759a5fdcbea885c5fe2c | JavaScript | Gege00/novoresume_challenge | /backend/app.js | UTF-8 | 1,741 | 2.5625 | 3 | [] | no_license | 'use strict';
const https = require('https');
const fs = require('fs');
const app = require('express')();
const cors = require('cors');
const bodyParser = require('body-parser');
const dotenv = require('dotenv');
const users = require('./routes/users');
const PORT = 5000;
dotenv.config();
app.use(cors());
app.use( b... | true |
431ae93fdd2121b6413d477f4977652f0651501d | JavaScript | ghosharnab969/color-flipper | /hex.js | UTF-8 | 581 | 3.546875 | 4 | [] | no_license | const btn = document.getElementById('btn');
const color = document.querySelector('.color');
const colors = ["1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];
btn.addEventListener("click", function(){
// console.log(randomNumber);
var randomColor='#';
for(var i=0;i<6;i++){
rand... | true |
39b681cd05ede4a33934a25634124929920f55ba | JavaScript | mhobesong/simple-fade-slider | /src/simple-fade-slider.js | UTF-8 | 7,656 | 2.578125 | 3 | [
"MIT"
] | permissive | function FadeViewer(){
var delay = 3000;
if (arguments.length == 0) return null;
if(document.getElementById(arguments[0]) == null) return null;
if (arguments.length>1 && (parseInt(arguments[1]) > 0))
delay = parseInt(arguments[1]);
var id = 'fadeviewer-'+(new Date()).getTime();
var timer;
var args = argu... | true |
d81b382635848dff51bef63455b8168304623250 | JavaScript | Lucasezidro/Projeto-login | /script.js | UTF-8 | 349 | 2.796875 | 3 | [] | no_license | const Btn = {
open() {
document.getElementById('login').classList.add('active')
},
close() {
document.getElementById('forgot').classList.remove('active')
}
}
let login = document.getElementsByTagName('input')
function isEmpty(){
if(!login == " ") {
throw new Error('Please ... | true |
f9a0210e4bc0b34f05710b1ecdeea002219fff7f | JavaScript | zetec30/dotaroundhistory1 | /sketch.js | UTF-8 | 4,664 | 2.84375 | 3 | [] | no_license | // Create a new Mappa instance using Leaflet.
const mappa = new Mappa('Leaflet');
let myMap;
let firstVisit = true;
let Btn1 = true;
let Btn2 = true;
let Btn3 = true;
// Lets put all our map options in a single object
let userMarker;
let mousePos;
let mapLoaded;
let zone;
let tarArray = [
[50.36557170459509, -4.14224... | true |
484a2d3d14eda7daba65a5b0663d7c6c57c8522a | JavaScript | marjoori/jsd5-homework | /Maryam-Marjoori/homework_6/1_ajax_exercise/main.js | UTF-8 | 1,718 | 3.828125 | 4 | [] | no_license | /*
- Refactor the codealong to work with user interaction. In the index.html file
there is a "Get Consumer Finance Data" button. When the user clicks the button,
pull data from the provided link above (http://data.consumerfinance.gov/api/views.json).
Handle the link success and error responses accordingly, displaying ... | true |
c002470122af8c25e6122c597a6a648f0af8cdb8 | JavaScript | Cool94/awards.github.io | /files/animation.js | UTF-8 | 1,000 | 2.765625 | 3 | [] | no_license | //событие для запуска анимаций
(function () {
function scrollElemObserve (tgt) {
var options = {
root: null,
rootMargin: '0px',
threshold: 0.4,
}
var observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
... | true |
bf9907c998bf76c51c7132d737aca71c0293967e | JavaScript | dmaynard24/lodash-clone | /javascript/keyBy/keyBy.test.js | UTF-8 | 664 | 3.078125 | 3 | [] | no_license | const keyBy = require(`./keyBy`);
const users = [
{
id: `a123`,
name: `Dave`,
age: 26,
},
{
id: `ab14`,
name: `Mark`,
age: 28,
},
{
id: `ba35`,
name: `Sam`,
age: 29,
},
];
test(`expects that when the users array is keyed by id, the resulting object will be { 'a123': { i... | true |
3cf3dc2cd6eedd91ec0e8873d9ce23ac65c82600 | JavaScript | rockshivam999/simple-game | /play.js | UTF-8 | 1,377 | 2.546875 | 3 | [] | no_license | var btnclr=["dummy", "red", "blue", "green", "yellow"];
var gameptrn=[];
var curr=0;
gameover=true;
$('.btn').click(function(){
if(!gameover){
var us=$(this).attr("id");
$(this).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
if(us==gameptrn[curr]){
curr++;
... | true |
ba8a4d39ec247cd0ab99c248eccee699cf5e0da7 | JavaScript | christyns92/NoteTaker | /server.js | UTF-8 | 1,317 | 2.59375 | 3 | [
"MIT"
] | permissive | // Require Dependencies
const express = require('express');
const fs = require('fs');
const path = require('path');
const { v4: uuidv4 } = require('uuid');
const db = require('./db.json');
const app = express();
const PORT = process.env.PORT || 8080;
app.use(express.static('public'));
app.use(express.json(... | true |
23e0517feea6d1edff7664dd35693a12151b7942 | JavaScript | fedliyenovardi/API-Penilaian | /controller/JabatanController.js | UTF-8 | 2,299 | 2.640625 | 3 | [] | no_license | 'use strict';
var response = require('../reqcode');
var connection = require('../koneksi');
// Controller Structure
// + controller
// |- List Data
// |- Detail Data
// |- Insert Data
// |- Update Data
// |- Hapus Data
// |- Custom Data
// LIST DATA JABATAN
exports.Jabatan = function(req, res){
connection.query(... | true |
2201880197b59475ed89792a95ac5c99f5928550 | JavaScript | ala-bouzeghaia/pathfinding-visualizer | /src/components/navbar.js | UTF-8 | 3,819 | 2.546875 | 3 | [] | no_license | import React from "react";
import { useDispatch, useSelector } from "react-redux";
import { dijkstraAlgo, a_starAlgo } from "../actions/algorithms";
import { clearBoard } from "../actions/clearboard";
import { clearPath } from "../actions/clearpath";
import { RandomMaze, RecursiveDivision } from "../actions/mazes";
imp... | true |
3234d83c904f021e77503b65029df2069b0da733 | JavaScript | SpAiNiOr/mystudy | /learning/javascript/RaceDay.js | UTF-8 | 459 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | let raceNumber = Math.floor(Math.random() * 1000);
let registerEarly=true;
let runnerAge = 37;
if (runnerAge>=18 && registerEarly === true){
raceNumber+=1000;
}
if (runnerAge>=18 && registerEarly ===true ){
console.log(`You ${raceNumber} will run at 9:30 am.`);
} else if (runnerAge>=18 && registerEarly !== true)... | true |
f741ec047a010022e4cf46c8938dcafbee1ca0d9 | JavaScript | NMaxwell93/Deliverable-2 | /Deliverable 2/js/script.js | UTF-8 | 640 | 3.953125 | 4 | [] | no_license | let name = prompt("Name your pet.")
let happy = 0
let energy = 0
for (let i = 0; i<=5; i++) {
let input = prompt("feed, pet, or walk?")
if(input === "feed"){
energy = energy + 2
}
else if(input === "pet"){
happy= happy + 1
}
else if(input === "walk"){
if... | true |
2cf7b42455a56cbb2045f1d6a467266ec74ca985 | JavaScript | ctiller15/YDKJS | /this&objectprototypes/Chapter_2/Ex_07.js | UTF-8 | 563 | 3.84375 | 4 | [] | no_license | // when we pass a callback function losing the implicit binding is more subtle.
function foo() {
console.log( this.a );
}
function doFoo(fn) {
// 'fn' is just another reference to 'foo'
fn(); // <-- call-site!
}
var obj = {
a: 2,
foo: foo
};
var a = "oops, global"; // 'a' also property on global object.
doFo... | true |
b84337794674d75e609fa12fa3f33bb47edbeb71 | JavaScript | k09rthana/OrderPizza | /src/redux/largePizza/largePizzaReducer.js | UTF-8 | 592 | 2.546875 | 3 | [] | no_license | import { BUY_LARGE_PIZZA } from "./largePizzaTypes";
import { ADD_LARGE_PIZZA } from "./largePizzaTypes";
const initialState = {
numOfLargePizzas: 0,
};
const largePizzaReducer = (state = initialState, action) => {
switch (action.type) {
case BUY_LARGE_PIZZA:
return {
...state,
numOfLar... | true |
c72c513661e381a2c2187f2120cc6c1169f27108 | JavaScript | emilyparkes/NorthTeamQuote | /data.js | UTF-8 | 4,160 | 2.890625 | 3 | [] | no_license | const adamImg = '/profiles/png/adam.png'
const belmaImg = '/profiles/png/belma.png'
const catImg = '/profiles/png/cat.png'
const elyseImg = '/profiles/png/elyse.png'
const emilyImg = '/profiles/png/emily.png'
const ethanImg = '/profiles/png/ethan.png'
const judyImg = '/profiles/png/judy.png'
const juliaImg = '/profiles... | true |
d7bf650fd77ffe2184d8291d89b157c15e531128 | JavaScript | dwmkerr/app-splash | /src/validate-parameters.specs.js | UTF-8 | 1,179 | 2.65625 | 3 | [
"MIT"
] | permissive | const assert = require('assert');
const validateParameters = require('./validate-parameters');
describe('validateParameters', () => {
function validParameters() {
return {
sourceImage: 'splash.png',
searchRoot: './',
platforms: 'ios',
};
}
it('should provide a default source image', ()... | true |
768545737ce820da1c90b45e76e24bb932d33282 | JavaScript | attack-theoRy/ProjectWknd | /js/validate.js | UTF-8 | 4,584 | 3.25 | 3 | [
"MIT"
] | permissive | // Variable declarations
// api Key to be used
var apiKey = 'ba4e9c96082b0721c5c3dbaf01177cf2'
// starting URL
var url = 'https://apilayer.net/api/check?access_key='
// example API call
var queryURL = url + apiKey + '&email='
// the user's email
var userEmail = ''
// array of objects that will be used to store us... | true |
6d0d738db846622f1e3b09d4683b1d9618e672ca | JavaScript | ianmarx/quantiteam-client | /src/components/forms/AddResultForm.js | UTF-8 | 7,763 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import timeStringToSeconds from '../../utils/workout';
class AddResultForm extends Component {
constructor(props) {
super(props);
this.state = {
type: '',
distance: '',
athleteName: '',
timeString: '',
... | true |
399ad6dbf56a2dd1521d7626f17b826c511882d0 | JavaScript | Anastasiiia17/collage | /scripts/script.js | UTF-8 | 890 | 3.53125 | 4 | [] | no_license | // 1
const p = 3.14;
let calcConeVolume = (r, h) => (1/3*p)*(r**2)*h;
let calcConeArea = (r, l) => p*r*l;
alert ("Вычислим объем конуса");
alert (calcConeVolume(
prompt ("Введите радиус основания"),
prompt ("Введите высоту")
) );
alert ("Вычислим площадь боковой поверхности конуса");
alert (ca... | true |
df1491e3b09f59134a723d6bf599165fa338abe9 | JavaScript | danielns-op/CursoEmVideo | /Javascript/Aula16ex/ex18/script.js | UTF-8 | 1,937 | 3.71875 | 4 | [] | no_license | const num = window.document.getElementById('iptnum')
const addnum = window.document.getElementById('addnum')
const areatexto = window.document.getElementById('txtbloc')
const finalizar = window.document.getElementById('iptfim')
const res = window.document.getElementById('res')
var listaNum = []
function adicionaNumer... | true |
0f392c99ba8a616304e43e890069fda582a9de94 | JavaScript | QuaSanse/js2 | /unit_4/js/script.js | UTF-8 | 5,730 | 2.734375 | 3 | [] | no_license | // Task 1 --------------------
let button_t1 = document.getElementById('button_t1');
button_t1.onclick = () => {
alert('Task 1');
}
// Task 2 --------------------
let input_t2 = document.getElementById('input_t2');
input_t2.onclick = () => {
alert('Task 2');
}
// Task 3 --------------------
let p_t3 = docum... | true |
e009f7aeeefc92da2e968f731c7e3f64e0f01947 | JavaScript | alexandrevoliveira/budget-control | /backend/seed.js | UTF-8 | 701 | 2.671875 | 3 | [] | no_license | const faker = require('faker')
const OrderModel = require('./src/app/models/Order')
async function createOrders() {
let Order = new OrderModel()
const orders = await Order.findAll()
while (orders.length <= 222) {
orders.push({
po: faker.datatype.number(99999).toString(),
b... | true |
b5818df05dc7e69f4f691c8c06173d6a26d50f83 | JavaScript | ko0j/nodeTutorial | /http.js | UTF-8 | 487 | 2.8125 | 3 | [] | no_license | const http = require('http');
//request, response
const server = http.createServer((req,res) => {
if (req.url === '/') {
res.end("Welcome to our home page")
}
if (req.url === '/about'){
res.end("Welcome to our about page")
}
//res.write("Welcome to the ab... | true |
23a2e955827cfecfeb98531a56c064395b5c6b6b | JavaScript | emilb/adventofcode2020 | /11/seatingsystem.js | UTF-8 | 5,813 | 3.09375 | 3 | [] | no_license | const fs = require('fs');
const { prependOnceListener } = require('process');
const readline = require('readline');
const seats = new Array();
let width = 0;
async function processLineByLine() {
const fileStream = fs.createReadStream('data');
const rl = readline.createInterface({
input: fileStream,
crlf... | true |
f1f930846e00fb18fe4f4c5bc8b37259bff62662 | JavaScript | chayan101/nurturelabs | /functions/functions.js | UTF-8 | 587 | 2.625 | 3 | [] | no_license | const bcrypt = require('bcrypt');
const jwt = require('jsonwebtoken');
exports.hashPassword = async (password) => {
try{
const hashedPassword = await bcrypt.hash(password, 10);
return hashedPassword;
}catch{
res.status(500).send('not working');
}
}
exports.isAuthorised = (req, res, next) => {
cons... | true |
3d624bc27389c065db2961018199cf0c03dd6643 | JavaScript | gitlvtao/timount-dcapp | /public/static/js/tools.js | UTF-8 | 1,627 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | function layerArea(full) {
//var w = document.documentElement.scrollWidth || document.body.scrollWidth;
//var h = document.documentElement.scrollHeight || document.body.scrollHeight;
var w = document.documentElement.clientWidth || document.body.clientWidth;
var h = document.documentElement.clientHeight ... | true |
e51e6775df4eacf4b448edd0dddc05730d61b01a | JavaScript | gabriellacrystina/ProjetoTegra | /.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/book-store/controle-compra.js | UTF-8 | 539 | 3.359375 | 3 | [] | no_license | /**
* Controle de Compra. Arquivo que valida dados do arquivo index.jsp
*/
//valida se carrinho contém itens!!
function validaCarrinho(){
var qtdeItens = document.getElementById("qtde-itens").textContent;
if(qtdeItens == 0){
alert("Não há itens no carrinho!!");
return false;
}
return tr... | true |
dd38736e052295e97a91bd9a17f8a0f9d48cd1ca | JavaScript | fhda-ets/canvas-event-broker | /local-packages/fhda-pubsub-logging/src/MetadataUtilities.js | UTF-8 | 3,910 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Copyright (c) 2016, Foothill-De Anza Community College District
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright n... | true |
da90921f070e05b3d2a96731cff8686392371cca | JavaScript | SaigeGithub/Data-Scraping-Tool | /us.js | UTF-8 | 5,494 | 2.640625 | 3 | [] | no_license | const fs = require('fs');
const axios = require('axios');
const express= require('express');
const app= express();
var http = require('http');
var path =require('path');
var bodyParser =require('body-parser');
app.use(express.static('public'));
const fileName = 'schoolinfo.json';
function main() {
getData(1)
... | true |
375a9ea3ba88fe8e2817214be3b51b8fc938d327 | JavaScript | pvgrajalesg/hb-javascript-test-101 | /script.test.js | UTF-8 | 2,961 | 3.203125 | 3 | [] | no_license | import{
filterNegativeNumbers,
functionalfilterNegativeNumbers,
functionalMapNumbersIntoStrings,
mapNumbersIntoStrings,
generateRandomColor,
isPalindrome,
printType,
Person,
printOutPersonAge
} from './functions.js';
describe(filterNegativeNumbers, () =>{
it('Should return a ... | true |
dd42270d02451a27d4976740bdd209938309608e | JavaScript | CantFindItAnymore/my-rn-cli | /src/utils/utils.js | UTF-8 | 3,896 | 3.25 | 3 | [] | no_license | /*
* @Author: ranjun
* @Date: 2020-07-17 10:52:27
* @Last Modified by: ranjun
* @Last Modified time: 2020-09-22 16:13:26
*/
// 判断两个对象值是否相等
const isObjectValueEqual = (a, b) => {
var aProps = Object.getOwnPropertyNames(a)
var bProps = Object.getOwnPropertyNames(b)
if (aProps.length !== bProps.length) {
return ... | true |
692296137ae88346ad13ac3dcf4003982e2e8446 | JavaScript | abhijit99biswas/Weathe-App-by-ReactJs | /src/components/MainPage.js | UTF-8 | 3,503 | 2.578125 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import './css/style.css';
const MainPage = () => {
const [city, setCity] = useState(null)
const [weatherr, setWeatherr] = useState()
const [searchValue, setsearchValue] = useState("Kharagpur")
useEffect( () => {
const fetchApi = async (... | true |
bc4186ad6d0406f32c205fbf2fea784937f0a075 | JavaScript | nikhil-g777/quizApp | /assets/masterjs/main_master.js | UTF-8 | 2,651 | 2.546875 | 3 | [] | no_license | io.socket.on('connect',function socketConnected(){
var master_qnum = 0;
io.socket.put('/question/flushQuestions');
// io.socket.on('user',function messageRecieved(message){
// switch(message.verb){
// case 'created' :
// addUser(message.data);
// console.log("new user created");
// }
// });
... | true |
48cb8b95a252ce6da1c3d0c56d5e9e4dd294dcf7 | JavaScript | jdkealy/sinatra-backbone-example | /public/js/app.js | UTF-8 | 326 | 2.53125 | 3 | [] | no_license | $(function() {
Medical = {};
Medical.App = Backbone.View.extend({
initialize: function(){
_.bindAll(this,'render');
},
render: function(){
$(this.el).html('hello backbone');
return this;
}
});
Medical.app = new Medical.App();
$(".app_container").html(Medical.app.render().el)... | true |
2fc10106c3490d2687608911a74d092d36e59014 | JavaScript | oscargm/lasalle-workshop-js | /src/App.js | UTF-8 | 1,001 | 2.59375 | 3 | [] | no_license | import * as React from "react";
import "./App.css";
import { ChuckNorrisQuotes } from "./pages/chuck-norris.component";
import { Kittens } from "./pages/kittens.component";
const pages = ["chuck-norris", "kittens"];
function App() {
const [selectedPage, setSelectedPage] = React.useState(pages[0]);
const optionChan... | true |
e005586c688d80304cf9870a70035c81eb4649b2 | JavaScript | Crachman/homework | /day06/servlet/src/main/webapp/js/common.js | UTF-8 | 1,985 | 2.890625 | 3 | [] | no_license | /***********************项目通用js代码***************************/
var EventUtil = {
addHandler: function (element, type, handler) {
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else if (element.attachEvent) {
element.attachEvent("on" + typ... | true |
a6b2b9dffa0010c97d1b52286f19c38f2ecd5f86 | JavaScript | AdityaKumar-01/MS-Teams-clone | /client/src/Components/DMChats/DMChats.component.jsx | UTF-8 | 2,224 | 2.796875 | 3 | [] | no_license | // React libraries
import React, { useState, useEffect } from "react";
// Components
import ChatCard from "./../ChatCard/ChatCard.component";
import BlankDashboard from "./../BlankDashboard/BlankDashboard.component";
// npm packages
import axios from "axios";
// External CSS
import "../TeamsSection/TeamsSection.styl... | true |
13959a587a40169f2ed0ea6737a8fb91fb939502 | JavaScript | Hyunse/coding-exercise | /Javascript/underscore/isArray.js | UTF-8 | 488 | 3.671875 | 4 | [] | no_license | var nativeIsArray = Array.isArray;
// Is a given value an array?
// Delegates to ECMA5's native Array.isArray
var isArray = nativeIsArray || function (obj) {
return toString.call(obj) === '[object Array]';
};
var testArr = [1, 2, 3];
function isArrayFunc(obj) {
return Object.prototype.toString.call(obj) ===... | true |
ad0aa124246d12ed5cc469130489cb11e57ad606 | JavaScript | dtestyk/js_utils_plain | /debounce.js | UTF-8 | 166 | 2.921875 | 3 | [] | no_license | function debounce(ms, func){
var timeout = null;
return function(){
if(timeout) clearTimeout(timeout);
timeout = setTimeout(func, ms);
}
} | true |
5f69511d8302741bcfcb069ff5de070a24c601cc | JavaScript | mparkcode/new_modern_js_bc_p1 | /10_apply_functions_to_collections_of_data/102_filter/script.js | UTF-8 | 1,673 | 3.46875 | 3 | [] | no_license | const nums = [54,23,78,95,101,33,67,32];
const oddNums = nums.filter(n => n % 2 === 1);
console.log(oddNums);
const bigNums = nums.filter(n => n > 50);
console.log(bigNums);
const books = [
{
title: "Norweigan Wood",
authors: ["Haruki Murakami"],
rating: 4.5,
genres: ['drama', 'magical', 'fiction']
... | true |
d462d69da75355ad31bae9223b2868f8334bb483 | JavaScript | Daga2001/Html-css-and-js-course | /Cursos Udemy/HTML, CSS Y JavaScript/Lessons/JavaScript/Lesson_9_JavaScript-classes/classes.js | UTF-8 | 2,438 | 4.0625 | 4 | [] | no_license | class Person{
static howMuchPeople = 0; //It's associated with class "Person".
email = "value by default" // this attribute associates with objects.
static get MAX_OBJ(){
return 5;
}
constructor(name, lastName){
this._name = name;
this._lastName = lastName;
if(... | true |
e80377aa371c2ed9edf5827952da7400688d3cf2 | JavaScript | neternefer/codewars | /javascript/highAndLow.js | UTF-8 | 251 | 3.578125 | 4 | [] | no_license | /*Given a string of space separated numbers,
return the highest and lowest number.
*/
function highAndLow(numbers){
let arr = numbers.split(" ").map(e => Number(e));
return Math.max(...arr).toString() + " " + Math.min(...arr).toString()
}
| true |
2eb53accff9fd1480b84aac01936b482604cd923 | JavaScript | jsg3121/study-nodeJs | /default/server.js | UTF-8 | 1,894 | 2.734375 | 3 | [] | no_license | const http = require('http'); // 서버를 만드는 모듈 불러옴
http.createServer((request, response) => { // 서버 만드는 메소드
request.on("data", (data) => {
console.log(data.toString());
})
// 외부에서 값을 보낼 때 받은 데이터를 data로 출력 할 수 있다.
// toString()을 해주어야 문자열로 확인이 가능
response.end();
// 서버 요청이 끝나면 닫기
}).listen(8088);
// localho... | true |
7c0825c0d863a97dd57a2065684753e7ad527918 | JavaScript | Williampangestu/phase_0_unit_1 | /week_3/2_code_combat/my_solution.js | UTF-8 | 4,432 | 3.578125 | 4 | [] | no_license | // I worked on this challenge [by myself, with:]
// For each mission, write the title as a comment. (Shown here). Also include pseudocode as a comment.
// Note: to make commenting easier, you can highlight the section you want to comment and hold
// command + / This will comment the line.
I worked on this challe... | true |
c7a7888c5055e69ff126aeed1fa03ff12b3bfe98 | JavaScript | commanderi/mokapc | /src/assets/js/pk10.js | UTF-8 | 11,147 | 2.65625 | 3 | [] | no_license | // 单选
function singleSelect(e,y,x,me){
if(me.userArr[y].indexOf(x) === -1){
me.userArr[y].push(x);
}else{
me.userArr[y].splice($.inArray(x,me.userArr[y]),1);
}
switch (me.NavTwo_index) {
case 91:case 92:
let nums = 0;
for (let i = 0; i < 5; i++) {nums += m... | true |
9e30453a8377c30e8fc0aa8004f5dea7f07dcc94 | JavaScript | Misinin/star-db | /src/components/item-list/item-list.js | UTF-8 | 842 | 2.625 | 3 | [] | no_license | import React from "react";
import Spinner from "../spinner";
import style from "./item-list.module.css";
class ItemList extends React.Component {
state = {
items: null,
};
componentDidMount() {
this.props.getData().then((items) => this.setState({ items }));
}
renderItems(arr) {
return arr.map(... | true |
adb833d477812268e6a163fe1899466249d7aba0 | JavaScript | philipfranchi/kmeans_background | /sketch.js | UTF-8 | 3,171 | 3.296875 | 3 | [] | no_license | const isdebug = 1;
const KGROUPS = 4;
const MAX_ITR = 20;
const MAX_INT = 999;
var canvas;
//Image user preloaded, used to determine the size of the canvas
var img;
function debug(t){
if(isdebug == 1){
console.log(t)
}
}
function preload(){
img = loadImage("assets/test.jpg")
}
function getRandomColor(){
... | true |
ac15f8de1bc378053a2e1a13795f77a616cb3098 | JavaScript | raiet13/js-advanced-scope-closures-lab-v-000 | /index.js | UTF-8 | 635 | 3.109375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | const produceDrivingRange = function(blockRange) {
return function(blockStart, blockEnd) {
const requestedRange = blockEnd.slice(0,2) - blockStart.slice(0,2);
if (requestedRange < blockRange) {
return `within range by ${blockRange - requestedRange}`;
}
return `${requested... | true |
e8dc1c02e8a1a1c658bb5b63985335f7184abc7e | JavaScript | nuhman/timestamp | /server.js | UTF-8 | 2,175 | 3.0625 | 3 | [
"MIT"
] | permissive | const express = require('express');
const bodyparser = require('body-parser');
const app = express();
app.use(bodyparser.urlencoded({extended: false}));
app.use(bodyparser.json());
app.set('view engine', 'ejs');
app.use(express.static('public'));
app.get("/", (req, res) => {
//res.sendFile(__dirname + '\\index.ht... | true |
0a21a17ea4c837c24e1a9c85ca8357c4ca759fa0 | JavaScript | masoomagrawal1/do-or-die | /sketch.js | UTF-8 | 3,206 | 2.75 | 3 | [] | no_license |
var bg,bgI
var p1,p2,p3,p4;
var pWater,pFood,pFirstAid;
var START=0;
var PLAY=1;
var END=2;
var gameState=START;
var water=3;
var FoodStock=4;
var First_Aid=5;
function preload()
{
bgI = loadImage("bg3.jpg");
//needWaterImage=loadImage("needWater.jpg");
heliImage=loadImage("heli.png")
}
... | true |
5916d967afea50fb657c0d8844fec5045c9b0dda | JavaScript | NickHath/rescue-huy | /src/App.test.js | UTF-8 | 648 | 2.5625 | 3 | [] | no_license | import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
// shallow makes a clone of your component and renders it (kind of like a headless browser)
import { shallow } from 'enzyme';
Enzyme.configure({ adapter: new Adapter() });
// import React and the component you want to test!
import React from ... | true |
3b704d5c197a7383fffa3c3af8f41c047c1e4166 | JavaScript | RebeccaHA/js-advanced-functions-functional-library-project-online-web-pt-120919 | /index.js | UTF-8 | 872 | 2.953125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | const fi = (function() {
return {
libraryMethod: function() {
return 'Start by reading https://medium.com/javascript-scene/master-the-javascript-interview-what-is-functional-programming-7f218c68b3a0'
},
each: function(collection, iterate) {
const newCollection = Array.isArray(collection)? col... | true |
97cc3996c56337ef1733c4d47f830dabeaa98d34 | JavaScript | hualiii/Data-structure-and-algorithm | /剑指offer/剑指 Offer 40. 最小的k个数.js | UTF-8 | 248 | 2.890625 | 3 | [] | no_license | // link:https://leetcode-cn.com/problems/zui-xiao-de-kge-shu-lcof/
/**
* @param {number[]} arr
* @param {number} k
* @return {number[]}
*/
var getLeastNumbers = function (arr, k) {
arr.sort((n1, n2) => n1 - n2)
return arr.slice(0, k)
}; | true |
5fc51be50b9d69c0321fb9e7e1cd3f984a19e405 | JavaScript | kmflight/IntroToWebDev | /restaurantScript.js | UTF-8 | 1,410 | 3.03125 | 3 | [] | no_license | function clearErrors(){
for (var loopCounter=0; loopCounter < document.forms["contactUs"].elements.length; loopCounter++){
if(document.forms["contactUs"].elements[loopCounter].parentElement.className.indexOf("has-") != -1){
document.forms["contactUs"].elements[loopCounter].parentElement.class... | true |
cf95e4a0cd4c5ceca6b24e1d7f10378ff0c63b39 | JavaScript | mccorn/IFMOnodejs | /JSHomework/lesson-8/script__day-8.js | UTF-8 | 4,391 | 3 | 3 | [] | no_license | var par1 = 0;
var par2 = 0;
var messagestr = 'abc123cba$#@!?20AC';
var arr_1 = [1, 1, 2, 3, 5, 8, 13, 21];
var arr_2 = [100, 2, 32, 5, 8, 113, 21];
let product = {
article: '232300',
photoURL: 'img/choco.jpg',
properties: [12, 23, 'sweety'],
showProduct: function(somedivID) {
let somediv = doc... | true |
28b74bceeca899f4390447a42c62c18bb3bddf06 | JavaScript | jdstroup10/TV-Tracker | /routes/api-data-routes.js | UTF-8 | 1,574 | 3.03125 | 3 | [
"ISC"
] | permissive | /*===============================================================
Dependencies
===============================================================*/
// Using Axios to make API calls.
const axios = require("axios");
const helper = require("./helper.js");
/*===========================================================... | true |
ba05a14add468874047b27fb202aac3fb54e7d63 | JavaScript | ChaoFanYa/Phase-project | /src/js/ajaxGet.js | UTF-8 | 337 | 2.640625 | 3 | [] | no_license | function ajaxGet(url){
return new Promise(function(succ){
var xhr = new XMLHttpRequest();
xhr.open("get",url);
// xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8;");
xhr.send(null);
xhr.onload = function(){
succ(xhr.response)
... | true |
38b6356adf4648f05c896ccd4b842363cc2833c3 | JavaScript | as17501/play-wuzi | /public/js.js | UTF-8 | 1,124 | 2.875 | 3 | [] | no_license | //处理基础js效果
//弹窗效果
function g(o) { return document.getElementById(o); }
// function ShowBox() {
// var romTable = "";
// for (var i=0;i<5;i++){
// romTable += "<tr>";
// for(var j=0;j<5;j++)
// {
// romNum = i*5+j+1;
// romTable += "<td onclick='intoRom("+romNum+"... | true |
2437eae61765c7dad09687d8db255356e9b8ccc4 | JavaScript | Defragger12/node-checkers-react-redux | /src/server/opponent.js | UTF-8 | 5,346 | 2.6875 | 3 | [] | no_license | // import {isForcedMovePresent, isForcedQueenPresent, switchTurn} from "./administration";
// import * as positioning from "../positioning";
// import {COLOR, FIELD_LENGTH, RANK} from "../constants";
// import {Turn} from "../model/turn";
// import {OPPONENT_COLOR, PLAYER_COLOR} from "../client/constants";
//
// export... | true |