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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
50266db7024d0572123e35127a79d47155aa87a6 | JavaScript | noritakaIzumi/coding-drills | /html/assets/js/problem-area.js | UTF-8 | 943 | 2.515625 | 3 | [
"MIT"
] | permissive | const displayHeight = window.innerHeight;
const offset = document.getElementById('problem-area-bottom').offsetTop;
const h1Margin = window.getComputedStyle(document.getElementsByTagName('h1')[0])
.getPropertyValue('margin-bottom')
.replace('px', '');
const h3Margin = window.getComputedStyle(document.getElements... | true |
7b1805f4ea67c1e7bff8697811c5544b215cffc7 | JavaScript | AlexanderHeo/challenges | /twoNumberSum.js | UTF-8 | 266 | 3.484375 | 3 | [] | no_license | const twoNumberSum = (arr, target) => {
for (let i = 0; i < arr.length; i ++) {
for (let j = i + 1; j < arr.length; j ++) {
if (arr[i] + arr[j] === target) {
return [arr[i], arr[j]]
}
}
}
}
console.log(twoNumberSum([3, 5, -4, 8, 11, 1, -1, 6], 10))
| true |
56a074f5dfebd3146d3ba9397f98ad4ca5f3446a | JavaScript | PeterStampfli/images | /newKaleidoscopes/fancyCircles.js | UTF-8 | 3,340 | 2.65625 | 3 | [
"MIT"
] | permissive | /* jshint esversion:6 */
function creation() {
"use strict";
//=====================================================================================================================================
// UI elements depending on actual image and its symmetries
//===========================================... | true |
aada0aefce34ce2b72fa39da8dfa0105a02fbbdb | JavaScript | akhayat21/ImageSearch | /assets/js/Javascript.js | UTF-8 | 761 | 2.71875 | 3 | [] | no_license | function runQuery(){
var query = $(".imgSearchInput").val()
var settings = {
"url": "https://api.unsplash.com/search/photos/?per_page=25&page=1&client_id=2162c09ca7ae984caf1bc3f5d7e744f735982861bba651eead6dfe374d346b09&query="+query,
"method": "GET",
}
$(".insText").html("");
$(".resultCom... | true |
7530b164265c1977154d3d7df5d675f6deb8cf64 | JavaScript | zhyjor/HappyLeetCode | /423/dfs.js | UTF-8 | 1,339 | 3.609375 | 4 | [
"MIT"
] | permissive | function permute(nums) {
const len = nums.length;
const current = [];
const res = [];
const visited = {};
function dfs(nth) {
// 递归结束
if (len === nth) {
res.push(current.slice());
return;
};
for (let i = 0; i < len; i++) {
if (!visited[i]) {
visited[i] = true;
... | true |
29588d297173b20eedb9dd3499e0cebffbf4a676 | JavaScript | S1ither/ServiceStatusProj | /src/public/js/components/Line.js | UTF-8 | 810 | 2.984375 | 3 | [] | no_license | export default class {
constructor() {
this.element = document.createElement("div");
this.element.classList.add("diag");
this.display = "none";
}
set deg({ withX, withY }) {
const x = innerWidth / 2 - withX;
const y = withY - innerHeight / 2;
if (x == 0 || y =... | true |
dc18609ee1e9bbdd88ff760741cafe9c50bf8341 | JavaScript | Alackey/Weatherme | /server/routes/alert.js | UTF-8 | 902 | 2.59375 | 3 | [] | no_license | import express from 'express';
import { createAlert, getUsersAlerts } from '../database/db';
const router = express.Router();
/* GET alerts for user. */
router.get('/:username', (req, res) => {
let response;
getUsersAlerts(req.params.username).then((alerts) => {
response = { status: 'success', Items: alerts.... | true |
eeb64472bf7ac118a47eafd005da83ba7228bcb5 | JavaScript | cxxyao2/REACT_CRM | /src/components/PDFPrint/MyDocument.jsx | UTF-8 | 1,674 | 2.578125 | 3 | [] | no_license | import React from "react";
import { Document, Page, Text, View, StyleSheet } from "@react-pdf/renderer";
import { LineNumberPerPage } from "../../config/config.json";
// Create styles
const styles = StyleSheet.create({
page: {
flexDirection: "row",
backgroundColor: "#E4E4E4",
},
section: {
margin: 10... | true |
0d7c2ce584a8c5ba5cee7ed2ec999481a1072f28 | JavaScript | shervindadashzade/bimaton_dashboard | /src/helpers/fake-backend.js | UTF-8 | 2,399 | 2.953125 | 3 | [] | no_license | let users = [];
let usersStorage = JSON.parse(localStorage.getItem('users'));
users = usersStorage!=null ? usersStorage : [];
// configure fake backend for test
export function configureFakeBackend() {
// for other cases use
let realFetch = window.fetch;
window.fetch = function (url, options) {
re... | true |
14aeb45c4d21f147106faba45498979311067e13 | JavaScript | sparlos/MIDI-Particles | /src/logic/mapComputeds.js | UTF-8 | 429 | 2.765625 | 3 | [] | no_license | export default (properties) => {
let computeds = {};
properties.forEach(property => {
let capitalizedProperty = property.charAt(0).toUpperCase() + property.slice(1);
computeds[property] = {
get() {
return this[`store${capitalizedProperty}`];
},
set(value) {
this[`change${ca... | true |
8d08af78eb116b33d9ce7adff4edaf8eabad0fd1 | JavaScript | sdq-sts/site--in-time | /js/canvas/Renderer.js | UTF-8 | 683 | 2.546875 | 3 | [] | no_license | export default (THREE) => {
let width
let height
let renderer
width = window.innerWidth // largura da tela
height = window.innerHeight // altura da tela
// Cria o renderer
renderer = new THREE.WebGLRenderer({
// Permite transparência para que aceite a cor de background com CSS
alpha: true,
... | true |
04c64c9d36b4afba79387f6a19a86e0f2ca27629 | JavaScript | futpib/mozmill | /mutt/mutt/tests/js/testL10n/testGetEntity.js | UTF-8 | 854 | 2.53125 | 3 | [] | no_license | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at http://mozilla.org/MPL/2.0/. */
const { getEntity } = require("l10n");
const TEST_DATA = "chrome://branding/locale/brand.dtd";
function test() {... | true |
21078a31e66594d6a92746d56b8c801b5bfd1d64 | JavaScript | Lordbear117/crack-javascript-jobs | /array and String/pattern-validation.js | UTF-8 | 1,856 | 4.15625 | 4 | [] | no_license | let isMatchingBrackets = function (str) {
let stack = [];
let map = {
'(': ')',
'[': ']',
'{': '}'
}
for (let i = 0; i < str.length; i++) {
// If character is an opening brace add it to a stack
if (str[i] === '(' || str[i] === '{' || str[i] === '[' ) {
... | true |
00177f157511085cc2ca90ff6f403f36815d2e39 | JavaScript | mpcen/ctci-js | /ch-03-stacks-and-queues/3-1-threeInOne.js | UTF-8 | 1,713 | 4.375 | 4 | [] | no_license | /*
Three in One:
Describe how you could use a single array to implement three stacks.
*/
class TripleStack {
constructor() {
this.stacks = [null, null, null];
this.stackSizes = [0, 0, 0];
this.stackTops = [0, 1, 2];
}
push(stack, data) {
// If stack n is empty
if(this.stackSizes[stack] === 0) {
this... | true |
3c0a1027ea11f4bf68efb7df9d5577efbd5c4a14 | JavaScript | Aaronwkk/nut-utils | /core/debounce.js | UTF-8 | 777 | 3.421875 | 3 | [] | no_license | /**
* 该函数为高阶函数,接收一个普通函数,返回一个新的匿名函数
* 调用该匿名函数需要等待给定的"等待时间"才会生效,
* 而多次调用该匿名函数时会刷新"等待时间",只有当超时时才会真正执行最后一次调用。
*
* @param func - 需要执行的函数
* @param wait - 等待时间
* @returns {Function}
*/
const debounce = (func, wait) => {
let timeout;
return (...args) => {
clearTimeout(timeout);
return new Promise((resolve... | true |
a53d2399864962f6f600d46878cfaf226bbcd69c | JavaScript | sondosAlansi/js-advanced-first-class-functions-practice-lab-re-coded-yemen-2018 | /index.js | UTF-8 | 879 | 3.640625 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // Code your solution in this file!
function logDriverNames(driver){
const cb=function(el, i, driver){
console.log(el.name);
}
driver.forEach(cb);
}
function logDriversByHometown(driver,location){
const cb=function(el, i, driver){
if(el.hometown===location){
console.log(el.name);
}
... | true |
7e2995024634612ea7264b091d79a67a85c49a01 | JavaScript | Rutemberg/Aulas-JAVASCRIPT | /Node/funcionarios/funcionarios.js | UTF-8 | 438 | 3.171875 | 3 | [] | no_license | const url = "http://files.cod3r.com.br/curso-js/funcionarios.json"
const axios = require("axios")
const sexo = f => f.genero === "F"
const pais = f => f.pais === "China"
const getSalarioMin = (func, funcAtual) => {
return func.salario < funcAtual.salario ? func : funcAtual
}
axios.get(url).then(response => {
... | true |
e2484fb39869d2edac4541d7f5ebab4320b53736 | JavaScript | Robotois/robotois-motors-v2 | /tests/motors.js | UTF-8 | 406 | 2.890625 | 3 | [] | no_license | const ServoController = require('../');
const servoController = new ServoController(0);
let speed = 0;
let sum = 10;
setInterval(() => {
servoController.drive(speed, speed, speed, speed);
if (speed === 60) {
sum = -10;
}
if (speed === -60) {
sum = 10;
}
speed += sum;
}, 1000);
process.on('SIGTER... | true |
a91d039017b19e23cdfa2ca983686788b2339f40 | JavaScript | maxerbox/fisherman-discord.js | /lib/exceptions/CommandNotFoundException.js | UTF-8 | 821 | 2.84375 | 3 | [
"ISC"
] | permissive | /**
* When a command is not found
* @class CommandNotFoundException
* @extends {Error}
*/
class CommandNotFoundException extends Error {
/**
* Creates an instance of CommandNotFoundException.
* @param {string} command the command
* @memberof CommandNotFoundException
*/
constructor (command... | true |
9b1ac6125d4ee7d2eca2f6a41515ed730f801b7a | JavaScript | VitaliiLakusta/frontend-nanodegree-resume | /js/resumeBuilder.js | UTF-8 | 3,555 | 2.71875 | 3 | [] | no_license |
// var firstName = "Vitalii";
// var age = 18;
// console.log(firstName);
// $("#main").append(firstName);
// var awesomeThoughts = "I am Vitalii and I am AWESOME!";
// console.log(awesomeThoughts);
// var email = "lakusta96@gmail.com";
// var newEmail = email.replace("gmail", "udacity");
// console.log(email);
//... | true |
688706af69596ec49f76aa4796a60d04731ff40c | JavaScript | Egodrone/Linux | /kmom05/node2/answer.js | UTF-8 | 9,726 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env node
"use strict";
const dbwebb = require("./.dbwebb.js");
var ANSWER = null;
console.log(dbwebb.prompt + "Ready to begin.");
/** ======================================================================
* Lab 4 - JavaScript with Nodejs
*
* JavaScript using nodejs. During these exercises we train on... | true |
6512b46035064eff046918c3693f1bfd999eea6c | JavaScript | kogosoftwarellc/open-api | /packages/fetch-openapi/test/fixtures/basic-usage/output.js | UTF-8 | 3,710 | 2.609375 | 3 | [
"MIT"
] | permissive | 'use strict';
module.exports = createApi;
function createApi(options) {
const basePath = '/v2';
const endpoint = options.endpoint || 'http://petstore.swagger.io';
const cors = !!options.cors;
const mode = cors ? 'cors' : 'basic';
const buildQuery = (obj) => {
return Object.keys(obj)
.filter(key => t... | true |
6e9398c007777466a6a7df807d6bccf7d374fd3e | JavaScript | viszhnu/test | /src/App.js | UTF-8 | 1,294 | 2.515625 | 3 | [] | no_license | import logo from "./logo.svg";
import "./App.css";
import Card from "./Card.js";
import Cart from "./Cart.js";
import Cartmani from "./Cartmani.js";
import { useState } from "react";
function App() {
var items = [
{ name: "Item one", price: "15$", description: "xxx" ,no:0},
{ name: "Item two", price: "25$", d... | true |
144bd017f0647283af209f8db667bc08101632cd | JavaScript | JasonFreedman1992/Skarpiez-Back | /index.js | UTF-8 | 773 | 2.84375 | 3 | [] | no_license | var fs = require('fs');
var casper = require('casper').create({
verbose: true
});
casper.start().then(function() {
this.echo("Starting");
});
const link = "https://builtwith.com/robots.txt";
// casper.run(writeRobotsToFile(link));
casper.run(writeRobotsToString(link));
function writeRobotsToFile(link){ //,... | true |
f9fa9570703d6e91fd1c39e8cbf8846427c07198 | JavaScript | evilcandybag/JSHC | /src/Test/tests.js | UTF-8 | 1,437 | 2.609375 | 3 | [
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
// requires src/Test/utility.js
if( JSHC.Test.Tests === undefined )JSHC.Test.Tests = {};
////////////////////////////////////////////////////////////////////////////////
JSHC.Test.Tests.unparsable = function(){
// TODO
return {};
}();
JSHC.Test.Tests.parsable = function(){
var l;
var ls = new JSHC.... | true |
8329a3f77d7e0bcc15a5affd71cfa4e2cc546b02 | JavaScript | multiii/GARUDA | /commands/maths.js | UTF-8 | 1,390 | 3.109375 | 3 | [
"MIT"
] | permissive | const Maths = require("mathjs");
module.exports = {
name: 'maths',
type: 'maths',
usage: '&{prefix}mahts <expression>',
description: 'solves a maths expression',
aliases: [],
permissions: ['SEND_MESSAGES'],
async execute(message, args, bot, Discord, prefix) {
let botPerms = [];
... | true |
91452eec554a47b4898c06fa501ab20ff12fe9e3 | JavaScript | no1harm/node_learn | /Day2/template/Apache.js | UTF-8 | 723 | 2.515625 | 3 | [] | no_license | var http = require('http')
var fs = require('fs')
var template = require('art-template')
var server = http.createServer()
server.on('request', function (req, res) {
var url = req.url
fs.readFile('use_art_template.html', function (err, data) {
if (err) {
console.log('读取失败...')
... | true |
02e1b85cf8c9a71a6ca031f6195f94f6bf622cbc | JavaScript | Trettin/Cubos-Academy | /Back-end/Modulo-01/back-m01-a03/m01-a03-casa-17/index.js | UTF-8 | 417 | 3.375 | 3 | [] | no_license | //valor do produto comprado.
const valorDoProduto = 100000;
//quantidade de parcelas
const quantidadeDoParcelamento = 10;
//valor pago
const valorPago = 300;
const valorEmReal = valorDoProduto/100;
const valorDaParcela = valorEmReal / quantidadeDoParcelamento;
const parcelasAPagar = quantidadeDoParcelamento - (valo... | true |
b7158ba81b44d11a1c925f0b340551794930ccb4 | JavaScript | saltbo/vuepress-plugin-sign | /index.js | UTF-8 | 703 | 2.53125 | 3 | [
"MIT"
] | permissive | const {createHash} = require('crypto');
const NodeRSA = require('node-rsa');
const encrypt = (algorithm, content) => {
let hash = createHash(algorithm)
hash.update(content)
return hash.digest('hex')
}
/**
* @param {any} content
* @return {string}
*/
const sha1 = (content) => encrypt('sha1', content)
... | true |
954725889534ba79fe6f1b0f9a47eed093870ba8 | JavaScript | mschultz4/practice | /answers/likes.js | UTF-8 | 1,040 | 4.40625 | 4 | [
"MIT"
] | permissive | /**
*
likes [] // must be "no one likes this"
likes ["Peter"] // must be "Peter likes this"
likes ["Jacob", "Alex"] // must be "Jacob and Alex like this"
likes ["Max", "John", "Mark"] // must be "Max, John and Mark like this"
likes ["Alex", "Jacob", "Mark", "Max"] // must be "Alex, Jacob and 2 others like this
*
... | true |
3d9e75a5e65ebb8a7324b0caacb35b1f618cadbd | JavaScript | baitianxin111/web1 | /案例/js/js-16.js | UTF-8 | 343 | 2.921875 | 3 | [] | no_license | /**
* Created by Administrator on 2017/3/29 0029.
*/
window.onload = function () {
var a = [1,2,6,3,5,4];
var b = [3,4];
// a.push(b);
// alert(a);
a = a.sort();
a = a.reverse();
// alert(a);
var s = 3.57462;
// var k = Math.round(s*1000)/1000;
var k = Math.floor(Math.random()*... | true |
344e6a8c39bb650a072594e775a85f92cbabfa6d | JavaScript | warlinsgit/ministore | /public/javascripts/gameform.js | UTF-8 | 654 | 2.6875 | 3 | [] | no_license |
//Script for notification https://css-tricks.com/pop-from-top-notification/
close = document.getElementById("close");
close.addEventListener('click', function() {
note = document.getElementById("success");
note.style.display = 'none';
}, false);
// fly to cart effect
var url = window.location.href;
var ... | true |
b73e13db48aee5f9e923d9bd4deaf31d500ceb9e | JavaScript | asambvani/react-events-in-detail-lab-web-060517 | /src/components/CoordinatesButton.js | UTF-8 | 423 | 2.546875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Code CoordinatesButton Component Here
import React from 'react'
import ReactDOM from 'react-dom'
class CoordinatesButton extends React.Component {
constructor(){
super()
}
render(){
return(
<button onClick={this.buttonClick}/>
)
}
buttonClick =(event)=>{
let x = event.clientX
le... | true |
df4f1e89104c0757a0203d5ce543f5d5f9b24af4 | JavaScript | samliks/coding-bootcamp-testimonials-slider | /javascript.js | UTF-8 | 1,002 | 3.171875 | 3 | [] | no_license | const con1=document.getElementById('con-1');
const con2=document.getElementById('con-2');
const con3=document.getElementById('con-3');
const img=document.getElementById('img-slider');
var i=0;
var images=["images/image-tanya.jpg","images/image-john.jpg"];
var cont1=["“ I’ve been interested in coding for a while but ne... | true |
9ab52898fb7f42728e8931538cca84ebe2444945 | JavaScript | TranBaNgoc/Caro-MidtermProject | /src/reducers/Game.js | UTF-8 | 2,632 | 2.65625 | 3 | [] | no_license | import * as types from '../constants/ActionTypes';
const initialState = {
history: [
{
squares: Array(400).fill(null),
position: -1
}
],
xIsNext: true,
stepNumber: 0,
isIncrease: true,
pending: false,
user: null,
error: null,
messages: [],
playWithBot: false,
... | true |
e04b62f62732b894bffc0bea6aa06879aff865b1 | JavaScript | yutingliang/trayio | /main.js | UTF-8 | 3,212 | 3.40625 | 3 | [] | no_license | // Tray SE Technical Assessment: https://gist.github.com/alirussell/2d200d21f117f8d570667daa7acdbae5
// YT Liang, Feb. 15th, 2020
// Runtime environment: Node.js v12.16.0
// include the File System module
var fs = require('fs');
// start reading the file and get the content
fs.readFile('input.txt', function r... | true |
92aa3ebb8a6de2a910daeca2208c83f5b87a7fb9 | JavaScript | Toscoes/dungeon_dashers_pixi | /src/caster.js | UTF-8 | 2,347 | 2.640625 | 3 | [] | no_license | import Enemy from "./enemy.js";
import Data from "./entitydata.js";
import Projectile from "./projectile.js"
import GameObject from "./gameobject.js";
import Globals from "./globals.js"
import Player from "./player.js"
const CastTime = Data.caster.castTime
const CastRate = Data.caster.castRate
export default class Ca... | true |
a78dc44eaf573f45039a2c2da708bafb22c9519a | JavaScript | Sch3lp/javascript-courses | /jasmine/grayscale1/spec/GrayscaleTest.js | UTF-8 | 1,070 | 2.875 | 3 | [] | no_license | define(["../Pixels"], function(Pixels) {
describe("Pixels", function() {
it("I can create a pixel and ask for it's RGB values", function() {
var aPixel = Pixels.create(1, 2, 3, 4);
expect(aPixel.red).toBe(1);
expect(aPixel.green).toBe(2);
expect(aPixel.blue).toBe(3);
e... | true |
548b92b9b2abd18add8e6e6a6769c0a281e1337e | JavaScript | SkSufiyan/PDAC-JULY2021-ECMASCRIPT | /greatestNum.js | UTF-8 | 244 | 3.3125 | 3 | [] | no_license | const greatestNum =(arrNum) =>{
let maxNum = 0;
arrNum.forEach((element) =>{
if (element >maxNum) {
maxNum =element ;
}
});
return maxNum;
};
console.log(greatestNum([2,5,9,15])) | true |
85542e29330cdd9f2347ec907cb1b33890d13684 | JavaScript | popo1221/google-chrome-plugin-demo | /content.js | UTF-8 | 694 | 2.59375 | 3 | [
"MIT"
] | permissive | $('a[href]').each(function(){
console.log(this.href, this);
});
// var $hover = $('<div>点点点</div>').css({
// display: 'none',
// position: 'absolute',
// left: 0,
// top: 0,
// width: 40,
// height: 40,
// cursor: 'pointer'
// }).click(function(){
// var link = $hover.data('link');
... | true |
f24b47a1331d2f31112aa9247efbde40ea5d7923 | JavaScript | PetersenAndreas/Flow3Week1 | /Fre-27-03-2020/ReactStateandFetch-master/src/App.js | UTF-8 | 1,124 | 2.9375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import CountryTable from "./CountryTable";
import './App.css';
import countryFacade from './countryFacade';
const App = (props) => {
const[labData, setLabData] = useState([]);
const[countData, setCountData] = useState([]);
const labelTab = async () => {
co... | true |
a9fb25b013f05761663d4521e5147b310fab2b0f | JavaScript | fxos/messages | /app/views/thread/thread.js | UTF-8 | 1,148 | 2.546875 | 3 | [] | no_license | var pipe = new Pipe({
src: [
'/views/thread/worker.js',
'/views/shared_logic.js'
],
overrides: overrides
});
// Handle the gaia-header back
var gaiaHeader = document.querySelector('gaia-header');
gaiaHeader.addEventListener('action', e => {
e.preventDefault();
window.close();
});
var h1 = document.q... | true |
d7ecedeee99550920437b966244525f126098878 | JavaScript | Aamsegal/amsegal-react-portfolio | /src/ProjectData/ProjectData.js | UTF-8 | 3,472 | 2.953125 | 3 | [] | no_license | import React, { Component } from 'react';
import quizAppImage from '../portfolioImages/quizAppImage.png';
class ProjectData extends Component {
uniqueId() {
const idCharacters = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
const id_Length = 10;
let randomId = '';
... | true |
311f4d0810e17c6e85ada9a342e07c96fda13c7b | JavaScript | ryanxgraham/itg-frontend | /src/reducers/queryFilters.js | UTF-8 | 1,373 | 2.625 | 3 | [] | no_license | import { createReducer } from '@reduxjs/toolkit';
import {
queryFilterValueChange,
queryFilterFieldChange,
queryFilterAdd,
queryFilterRemove
} from '../actions';
import { DEFAULT_QUERY_FILTER } from '../constants';
/*
Indexes are used in `createReducer` as we can have an arbitrary amount of
QueryFilters, poten... | true |
cdd9e98433f0fa3547cfaa302a9b0434db3a110e | JavaScript | timdream/jszhuyin-firefox | /data/panel.js | UTF-8 | 3,159 | 2.828125 | 3 | [
"MIT"
] | permissive | // This is a page script run in panel.html to handle the input and UIs.
'use strict';
var CandidatesDisplay = function CandidatesDisplay(display) {
this.candidates = [];
this.candidatePage = 0;
this.display = display;
this.candidatesElement = document.getElementById('candidates');
this.candidatesElement.a... | true |
f91af720fa476bdfc0e809684dc4b3c5509858c4 | JavaScript | abhinavdhasmana/adventOfCode | /2019/6/partOne.js | UTF-8 | 1,052 | 2.9375 | 3 | [] | no_license | const fs = require('fs');
const path = require('path');
const data = fs.readFileSync(path.resolve(__dirname, 'partOneData.txt')).toString().split('\n');
const planetFollowers = {};
const planetOrbitCount = {};
const updateOrbitsCount = (planet, increment) => {
planetOrbitCount[planet] = increment + 1;
if (planet... | true |
6c4c1a59bbbbae20e0a1d544b9e49b863340b282 | JavaScript | achemkhi/REACT01 | /Tokens.js | UTF-8 | 1,720 | 3.0625 | 3 | [] | no_license | import React from 'react';
class Tokens extends React.Component {
constructor(props) {
super(props)
this.denominations = [1, 5, 10, 20, 50, 100, 200];
this.denominations.sort(function (a, b) {
return b - a
});
this.state = {
montant: '',
change: []
}
this.valid = false
... | true |
5dee0018beb5bc265ed4ad9012b1aa559e689934 | JavaScript | gyuque/MobmapChrome2 | /inner/js/ui/localfile-picker.js | UTF-8 | 1,020 | 2.5625 | 3 | [] | no_license | if (!window.mobmap) { window.mobmap={}; }
(function(aGlobal) {
'use strict';
function LocalFilePicker(callback) {
this.callback = callback || null;
this.inputElement = this.generateFileInput();
this.jInputElement = $(this.inputElement);
document.body.appendChild(this.inputElement);
this.jInputElement.ch... | true |
897c7f712f828627ba39f4036f7ec624418f9cc3 | JavaScript | samuellea/yamlviewer | /src/client/App.js | UTF-8 | 1,087 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react';
import './app.css';
import * as api from './api';
import Result from './Result';
export default class App extends Component {
state = {
url: '',
result: null,
error: null,
};
handleChange = (event) => {
const { value } = event.target;
this.setState({... | true |
34a004fc71d57eaaaff5e4a6c618921faf9435be | JavaScript | garthoff/snippets | /gulpfile-2.js | UTF-8 | 1,198 | 2.59375 | 3 | [] | no_license | /**
Basic example of a gulpfile.js with the watch functionality
run gulp with gulp watch
**/
var gulp = require( 'gulp' );
var rename = require( 'gulp-rename' );
var sass = require( 'gulp-sass' );
var autoprefixer = require( 'gulp-autoprefixer' );
var sourcemaps = require( 'gulp-sourcemaps' );
var styleSRC = './src... | true |
47c9e7ac263a3900889146d6c181522e6ddf3b88 | JavaScript | tejas1211/LeetCode-Solutions | /javascript/7. Reverse Integer.js | UTF-8 | 383 | 3.34375 | 3 | [] | no_license | var reverse = function(x) {
const isNegative = x < 0;
const xStrArr = Math.abs(x).toString().split("");
const reversStr = xStrArr.reverse().join("");
const num = Number(reversStr);
if (isNegative && num > Math.pow(2, 31)) {
return 0;
}
if (!isNegative && num > Math.pow(2, 31) - 1) {
... | true |
0cb44d7f22565f28024682572215615403e43d9e | JavaScript | TejaswiniMerla/JS-Day5-Assignment | /Day5/scripts/que1.js | UTF-8 | 886 | 4.46875 | 4 | [] | no_license | //Question 1.
//1.
var num = prompt("Take positive number from the user.")
function myFunction() {
console.log(Math.abs(num));
}
myFunction();
//2.
function rangeBetwee(start, end)
{
if (start > end) {
var arr = new Array(start - end + 1);
for (var i = 0; i < arr.length; i++, sta... | true |
dab49e6e9d9d2f43b0cdbcac08416bed54c9fdc6 | JavaScript | jamescarternyc/JSDC2 | /index.js | UTF-8 | 150 | 3.34375 | 3 | [] | no_license | // This is a change//
var num1 = 1;
var num2 = 2;
var result = num1 + num2;
var product = num1 * num2;
console.log(result);
console.log(product);
| true |
15200ce183d7a1c016a00597af9d40e1ccd4945c | JavaScript | anuragkeerthi/practice-react-app | /src/App.js | UTF-8 | 1,084 | 2.90625 | 3 | [] | no_license | import React, { useState } from 'react';
import './App.css';
import Person from './Person/Person';
const app = props => {
const [personsState, setPersonsState] = useState({
persons : [
{name: 'Anurag', age: 23},
{name: 'Bond', age: 29}
],
otherState : "someother Value"
});
... | true |
af3c01699001eaca1cbd19327516458529b344ea | JavaScript | talgat-ruby/powr-task-react | /src/state/reducer.js | UTF-8 | 1,798 | 2.625 | 3 | [] | no_license | import TYPE from './types';
import {generateRandomColor, deepenState, flattenState} from './utils';
export const ACTIONS = {
SET_DATA: 'SET_DATA',
ADD_BOX: 'ADD_BOX',
DELETE_BOX: 'DELETE_BOX',
ADD_CONTAINER: 'ADD_CONTAINER',
CHANGE_COLOR: 'CHANGE_COLOR'
};
export function reducer(state, action) {
switch (action... | true |
fc6b08d267748e7d14c1ddb6f99d7d4daf9a1396 | JavaScript | joisadler/leetcode | /__tests__/0088_merge-sorted-array/index.test.js | UTF-8 | 591 | 2.96875 | 3 | [] | no_license | import merge from '../../src/solutions/0088_merge-sorted-array';
const nums1 = [1,2,3,0,0,0];
const m = 3;
const nums2 = [2,5,6];
const n = 3;
const result1 = [1,2,2,3,5,6];
const nums3 = [1];
const m2 = 1;
const nums4 = [];
const n2 = 0;
const result2 = [1];
const nums5 = [0];
const m3 = 0;
const nums6 = [1];
const... | true |
4835da461e79a40e4bdfa57a004114ebe21f3b76 | JavaScript | long-lazuli/react-colorful | /tests/utils.test.js | UTF-8 | 5,925 | 2.875 | 3 | [
"MIT"
] | permissive | // HEX
import hexToHsv from "../src/utils/hexToHsv";
import hsvToHex from "../src/utils/hsvToHex";
import equalHex from "../src/utils/equalHex";
import validHex from "../src/utils/validHex";
// HSL
import hsvToHsl from "../src/utils/hsvToHsl";
import hslToHsv from "../src/utils/hslToHsv";
// HSL string
import hsvToHslS... | true |
1b0281feb611775f95577b2fe176dd6cc466f211 | JavaScript | Sejan157218/volunteer-react-site | /src/Components/Admin/Admin.js | UTF-8 | 1,218 | 2.59375 | 3 | [] | no_license | import axios from 'axios';
import React, { useEffect, useState } from 'react';
const Admin = () => {
const [user, setUser] = useState([])
const [deleteCount, setDeleteCount] = useState(false)
useEffect(() => {
fetch('http://localhost:9000/registeruser')
.then(res => res.json())
... | true |
322fd1cab916c200f489638f7525809873b93ebd | JavaScript | lharri73/EF2019 | /stages/stage4.js | UTF-8 | 4,478 | 3.078125 | 3 | [] | no_license | function stage4Constructor() {
//The constructor for the stage
instructionStage = 2;
maxInstruction = instructions[stageNumber].length;
equationImage = loadImage("images/eqns/acceleration_eqns.jpg");
ballPosition = createVector(
floor(random(10, 50)),
random(80, (windowHeight * 2) / 3)
);
targetP... | true |
730b0afa024dcc442d37344027f04c896803bb1a | JavaScript | FATG76/UdemyJSES-ES9 | /exercice9b.js | UTF-8 | 547 | 3.578125 | 4 | [] | no_license | //Destructuring sur le objets
const villes = {
paris : {nom: "Paris", lat : 48.8534, long : 2.3488},
toulouse : {nom: "Toulouse",lat : 46.6043, long : 1.4437},
lyon : {nom: "Lyon",lat : 45.75, long : 4.85}
};
let{paris, toulouse, lyon} = villes;
function affichageCoordonnees(ville){
let{nom, lat, long}... | true |
95b117cc3311613d2a7d6ca8b89e0b145b437536 | JavaScript | HamoudaBenAbdennebi/Router | /src/component/movie/MovieForm.js | UTF-8 | 2,658 | 2.625 | 3 | [] | no_license | import React,{useState} from 'react';
import uuid from 'react-uuid';
import "./card.css";
const MovieForm = ({addMovie}) => {
const [movie,setMovie] = useState({
id:"",
url:"",
title:"",
desc:"",
rating:""
});
const handleUrlInputChange = e =>{
setMovie({...m... | true |
1e44780d53e8244578bfc63071242e9a09101074 | JavaScript | GRPMIPSVisualizer/HardwareLogic | /Assembler/src/js/Stack.js | UTF-8 | 836 | 2.875 | 3 | [
"MIT"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stack = void 0;
class Stack {
constructor() {
this.items = [];
}
push(element) {
// 向栈顶压入一个元素
this.items.push(element);
}
pop() {
// 从栈顶弹出一个元素
return this.items.pop();
}
... | true |
201996fb95997a23c4740e74c4cb0feb276b48c7 | JavaScript | adrian007i/e-appointment | /server/routes/api/profile.js | UTF-8 | 1,813 | 2.71875 | 3 | [] | no_license | /**
* Profile (Account) related requests
* @module routes/api/profile
*/
const express = require('express');
const router = express.Router();
const passport = require('passport');
// Validation
const { validateUserList } = require('../../validation/profile');
/**
* Test if route works. Returns a success message.... | true |
69be51c8f1db920f179bd96aa64a227d6e5b4c2a | JavaScript | Yekku/brain-games | /src/games/brain.js | UTF-8 | 952 | 2.890625 | 3 | [] | no_license | import readlineSync from 'readline-sync';
import colors from 'colors/safe';
import evenGame from './even';
import calcGame from './calc';
import gcdGame from './gcd';
import balanceGame from './balance';
import progressionGame from './progression';
import primeGame from './prime';
const choice = () => {
const choice... | true |
15f17e9feff9320050e43ad9e2dfe9cf7cb01726 | JavaScript | sneha705/form-validation.github.io | /JQuery/assest/js/main.js | UTF-8 | 2,746 | 3.1875 | 3 | [] | no_license | //error msg function
function errorMsg(flag,id1,error){
if(flag==false){
$(id1).css("border","2px solid red");
$(error).text("Please enter the correct input");
return flag;
}
else{
$(id1).css("border","2px solid green")
$(error).text("");
return flag;
}
}
//Empty and number Field Validation func
... | true |
78cfbee6df74ecaa878d673b6b9cb951bcc9ff28 | JavaScript | shashi2030/find-second-highest-number-javascript-code | /find-second-largest-number.js | UTF-8 | 658 | 4 | 4 | [] | no_license | /* first way*/
var numbers = [5,10,30,40,60,180,90,80];
const lenth1 = numbers.length;
var result = [];
for(var i = 0; i < lenth1;i++){
var maxNumber = Math.max(...numbers);
result.push(maxNumber);
numbers.splice(numbers.indexOf(maxNumber), 1);
}
console.log(result[1]);
/* second way */
var arr = [1,2,3,4,5,6... | true |
f5f547b1c659643bb42ac2e8bd668edf65d446d2 | JavaScript | BulgakViktoriya14/JavaScript | /homework14/script.js | UTF-8 | 7,456 | 3 | 3 | [] | no_license | var plan=document.getElementById("plan");
var list=document.getElementById("list");
var allTasks=document.getElementById("tasks");
var actions=document.getElementById("actions");
class Task{
constructor(name,priority,dateEnd){
this.name=name;
this.priority=priority;
this.dateEnd=dateEnd;
}
}
class TaskPlan{
... | true |
797285bda88275ea2e33060aa0dcf94208fc3251 | JavaScript | DanielRussell19/WebTechAssignment_DanielRussell | /pt2/ScotsPolitec/scripts/Main.js | UTF-8 | 1,406 | 3 | 3 | [] | no_license | //Daniel Russell
//external javascript used for main functionality common accross multiple pages
//navigates to homepage, used for website logo when clicked
function navHome(){
window.location.href = "./Home.html";
}
//navigates to jobs statistics, used by regionmap and constituency, utalizes a set postcode local... | true |
d34464a0deba753e5118e4421692db6732d8bad4 | JavaScript | RVRes/GeekBrains_hometasks | /JS_ADV_course/Home_task_2/task 1-2/SubMenu.js | UTF-8 | 508 | 2.6875 | 3 | [] | no_license | class SubMenu extends Menu {
constructor(href, subMenuItemclass, title, subMenulinkclass, id, className, items){
super(id, className, items);
this.href = href;
this.title = title;
this.subMenuItemclass = subMenuItemclass;
this.subMenuLinkclass = subMenulinkclass;
}
re... | true |
5625a8e17ab46cfa0d35c495de570fd68f32e04a | JavaScript | KTingLee/Python100D | /100D_Front_stack/learning_nodejs/youtueber_Program/day03/03.js | UTF-8 | 1,160 | 3.015625 | 3 | [] | no_license | /*
mongoDB 學習,如何刪除數據
mongodb 中,每一筆數據都稱為 document
*/
const MongoClient = require('mongodb').MongoClient;
// Connection URL
const url = 'mongodb://localhost:27017';
// Database Name
const dbName = 'school';
const client = new MongoClient(url, {useNewUrlParser: true});
// 選擇要操作的 collection
const collecName = 'colleg... | true |
4d32cf182a2cf52a39be6c773ac02796f9e9005d | JavaScript | exploding-hue/NewTutorialBot | /commands/utility/timer.js | UTF-8 | 1,552 | 2.859375 | 3 | [] | no_license | const ms = require('ms')
const{MessageEmbed}=require('discord.js')
const{Timers}=require('../../variable')
module.exports={
name:"timer",
description:"Set a timer for your self!",
usage:"<#d/h/m>",
category:"utility",
run:async(bot,message,args)=>{
if(!args[0]){
return message.ch... | true |
2bec3eca802936172b655c2c47d9a3f5f230be36 | JavaScript | Nikozhang996/yuewen | /js/banner.js | UTF-8 | 2,275 | 2.796875 | 3 | [] | no_license | function Banner(element, config) {
this.wrapper = element;
this.banner = $.firstChild(this.wrapper);
this.tips = $.lastChild(this.wrapper);
this.divList = this.banner.getElementsByTagName('div');
this.imgList = this.banner.getElementsByTagName('img');
this.tipsList = this.tips.getElementsByTagName('li');
... | true |
e5ec29717bb3924f2ae1ec71eb6b9826603be724 | JavaScript | yangjufo/Stock-Trading-System | /trade.js | UTF-8 | 17,729 | 2.5625 | 3 | [] | no_license | /**
* Created by yangj on 2017/6/15.
*/
var io = require("socket.io")('2233');
var db = require("./models.js");
var request = require("http").request;
//交易指令
function TradingInstruction() {
this.instructionID = "";
this.initiatorID = "";
this.instructionType = "";
this.stockID = "";
this.StockN... | true |
36f03b3bdf4206a547a1c81cbccd1c232c6e0369 | JavaScript | infoshareacademy/jfdzw1-ipmdotdev-app | /src/reducers/challenges.js | UTF-8 | 1,652 | 2.640625 | 3 | [] | no_license | // REDUCER DLA KOMPONENTU AddChallenge
const initState = {
addChallengeStatus: {
pending: false,
success: false,
hasError: false
},
getAllChallengesStatus: {
pending: false,
success: false,
hasError: false
},
allChallenges: null
};
const challengesReducer = (state = initState, action... | true |
7188c29604ceba44c3422bd9963b2b760e59c803 | JavaScript | DominicJosephMitchell/FamilyTree | /src/login.js | UTF-8 | 934 | 3.09375 | 3 | [] | no_license | document.getElementById("loginForm").addEventListener("submit", function (e) {
debugger;
e.preventDefault();
login();
});
var login = function () {
const user = {
email: document.forms["loginForm"]["email"].value,
password: document.forms["loginForm"]["password"].value
}
// doc... | true |
fb62b8ee241d68a9b9ca712a6f9eaaa636c05e3b | JavaScript | ngduchoang/ClothesShop | /js/userprofile2.js | UTF-8 | 1,220 | 2.609375 | 3 | [] | no_license | function listI(){
$(document).ready(function(){
$.ajax({
url: "http://localhost:3000/users?id="+sessionStorage.getItem('id'),
dataType: 'json',
type: 'get',
cache:false,
success: function(data){
/*console.log(data);*/
var event_... | true |
90c2d9a26cab4b5b6aa1ad7a4de0d9ccba73a97b | JavaScript | arthurtucker/JHUSocialNetworking | /src/main/webapp/resources/js/courses.js | UTF-8 | 10,007 | 3 | 3 | [
"MIT"
] | permissive | // used from http://www.w3schools.com/js/js_cookies.asp
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) != -1) return c.substring(... | true |
a939d614f9079ddaa28c935d7fccc0ecf6b57390 | JavaScript | webslinger/mwoh-battle-sim | /dev/src/modules/simulator.js | UTF-8 | 12,916 | 2.953125 | 3 | [] | no_license | /*
This file defines the Simulator object which is primarily responsible for running battle simulations
and housing deck objects, and session objects. It also is responsible for working with the card
catalogue, e.g. filtration.
*/
define(["./encounter","./session", "./deck", "./presets"], function (encounter, ses... | true |
33762893e00c0df0b2a010a81bdfa0a38546738c | JavaScript | OpenAirCgn/firmware | /feather_boards/calibrate-wifi/server.js | UTF-8 | 1,536 | 2.875 | 3 | [] | no_license |
// each packet looks like
// <ts> <mac> <vnox> <vred> \n
// ts ::= \d+
// mac ::= xx:xx:xx:xx:xx:xx (xx -> 0-9a-f)
// vnox, vred ::= \d+
var net = require('net')
var options = {
port : 5012,
host: "0.0.0.0"
}
var server = net.createServer( (sock) => {
log ("new connection: "+sock.address().address +":"+sock... | true |
a9f6ddc93beb433051a59fc5ea07b8bf164a6308 | JavaScript | lenamax2355/web-codebook | /src/charts/dotPlot/drawOverallMark.js | UTF-8 | 978 | 2.625 | 3 | [
"MIT"
] | permissive | import { format as d3format } from 'd3';
export default function drawOverallMark(chart) {
//Clear overall marks.
chart.svg.selectAll('.overall-mark').remove();
//For each mark draw an overall mark.
chart.config.overall.forEach(d => {
if (chart.config.y.order.indexOf(d.key) > -1) {
const g = chart.sv... | true |
bcde24329c2bfe5f2e49d9d10dae852b38312fbe | JavaScript | kushal2908/coronavirus-tracker | /src/Pages/Total/index.js | UTF-8 | 1,987 | 2.71875 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import axios from "axios";
import moment from "moment";
export default function Index() {
//States
const [death, setDeath] = useState("");
const [recover, setRecover] = useState("");
const [confirm, setConfirm] = useState("");
const [date, setdate] = useSta... | true |
a956037359fa5d48517ed09fb27e8ed16f5b7dca | JavaScript | future4code/Yvini-Mayza | /semana3/variaveis/js-vanilla-template/src/index.js | UTF-8 | 1,966 | 3.78125 | 4 | [] | no_license |
a = 10
b = 10
// console.log(b)
b = 5
// console.log(a, b)
/*
Será impresso 10
10 5
*/
a = 10
b = 20
c = a
b = c
a = b
// console.log(a, b, c)
/*
Será impresso 10 20 10
*/
/*1- A */
let nome;
/* B*/
let idade;
/*C*/
// console.log(typeof(nome))
// console.log(typeof(idade))
/... | true |
80069c382076ff14760a0a1253f45f102380949e | JavaScript | DavidDeArmon/react-1-afternoon | /src/components/Topics/Sum.js | UTF-8 | 1,233 | 3.25 | 3 | [] | no_license | import React, {Component} from 'react';
export default class Palindrome extends Component{
constructor(){
super()
this.state={
number1:0,
number2:0,
sum:null
}
this.handleChange = this.handleChangeNumOne.bind(this);
this.addNumbers = this.addNum... | true |
499efbe9acdc5184766bff61fc3f2c903179e76a | JavaScript | francis-star/NSP | /Web/JS/HCWeb2016.js | UTF-8 | 5,559 | 2.75 | 3 | [
"MIT"
] | permissive | /*******************************/
/******户传js共用操作方法*******/
/*******************************/
/****2016.6.2******************/
$(function () {
//创建遮罩div
if (document.getElementById("mask") != null)
document.body.removeChild(document.getElementById("mask"));
var Div = document.createElement("div");... | true |
78a79862ee2d3f67074a26f6a3f989bbdf1f6c62 | JavaScript | step-batch-7/jsTools-bcalm | /test/testParseInput.js | UTF-8 | 968 | 2.53125 | 3 | [] | no_license | const assert = require('chai').assert;
const {OptionParser} = require('../src/parseInput.js');
describe('#OptionParser', () => {
describe('#parser', () => {
it('should give a object which includes all options and their values', () => {
const cmdLineArgs = ['-d', 'e', '-f', '1', 'one.txt'];
const... | true |
a70e0cd79338e53cf4b2499aa127873238175e5b | JavaScript | spiralsix/codingchallenge-tradeshift | /tradeshift.js | UTF-8 | 8,834 | 3.8125 | 4 | [] | no_license | /**
* Words Finder
*
* Given an input of a list of strings representing a matrix of characters
* find all the valid words in that matrix.
*
* A valid words is a vertical or horizontal sequence of characters that
* are present in a dictionary
*
* The dictionary is defined by the following interfa... | true |
e47a4e10b7bc769deba528436b9c9e72668f616e | JavaScript | Shawn-29/Code-Camp-Solutions | /src/Sum_Odd_Fib_Nums.js | UTF-8 | 1,941 | 4.21875 | 4 | [] | no_license | /*
Problem:
Given a positive integer num, return the sum of all odd Fibonacci numbers
that are less than or equal to num.
The first two numbers in the Fibonacci sequence are 1 and 1.
Every additional number in the sequence is the sum of the two previous numbers.
The first six n... | true |
cc94b38ae63da93466d6db38eb2bb46315c6cd1c | JavaScript | GameIndus/editor-2d | /js/app/config.js | UTF-8 | 1,322 | 2.90625 | 3 | [] | no_license | function EditorConfig(){
this.cookieName = "gameindusconf";
this.json = {};
this.load();
}
EditorConfig.prototype = {
load: function(){
var c = this.readCookie(this.cookieName);
if(c == null) c = {};
else c = JSON.parse(c);
this.json = c;
},
get: function(key){
return this.json[key];
},
set: fu... | true |
6729eee4d44766efb57564ee3a101a92bd6830e0 | JavaScript | vesnaguja/Web | /30BitShowProject/backToTop.js | UTF-8 | 566 | 3.21875 | 3 | [] | no_license | //Get the button
const mybutton = document.getElementById("btn-back-to-top");
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = () => {
if (
document.body.scrollTop > 20 ||
document.documentElement.scrollTop > 20
) {
mybutton.style.display = "block";
}... | true |
600bb49b3cf4dad7092ced9bface7bf47623f15f | JavaScript | Brothman/Mystify | /backend/utils/crudControllers.js | UTF-8 | 2,769 | 3 | 3 | [] | no_license | //This is a generic controller creator for basic CRUD actions
//.lean() returns a plain Javascript Object instead of a Mongoose Document
//.exec() returns a regular Promise object
export const getOne = (model) => async (req, res) => {
try {
const doc = await model.find({ createdBy: req.user._id, _id: req.p... | true |
9b4f13e9dec1ff1159c3ebd85dc7978a1f7cadaf | JavaScript | DimejiAre/lambda-calculator | /src/components/ButtonComponents/SpecialButtons/Specials.js | UTF-8 | 818 | 2.8125 | 3 | [] | no_license | import React, {useState} from "react";
//import any components needed
import SpecialButton from "./SpecialButton";
import "./Specials.css";
//Import your array data to from the provided data file
import {specials} from "../../../data";
const Specials = () => {
// STEP 2 - add the imported data to state
const [s... | true |
3ce84a17e1e9dcc8cc1ce0a407b022bc4d1a7163 | JavaScript | wosoff/portfolio-index-react | /test/ProgressBar.test.js | UTF-8 | 1,244 | 2.625 | 3 | [] | no_license | import React from "react";
import { render, unmountComponentAtNode } from "react-dom";
import { act } from "react-dom/test-utils";
import renderer from 'react-test-renderer';
import ProgressBar from '../public/js/progress-bar/ProgressBar'
jest.useFakeTimers();
describe('ProgressBar', () => {
let container = null
... | true |
093ac50c914b2479d17ee21f8d66dfe35d5a3885 | JavaScript | surajjayraman/lighthouse_lectures | /w01d04/higher_order_functions.js | UTF-8 | 2,319 | 4.59375 | 5 | [] | no_license | const creatures = ['bigfoot', 'yeti', 'pizza the hut'];
// it is often that we find ourself doing something
// to each value in an array. Currently, we have a way of doing this
// with an iterator
// what does this look like?
// for (const creature of creatures) {
// const phrase = `hello, ${creature}`;
// consol... | true |
f192f736962a60399a4d2cf4f14a162c8e682dd3 | JavaScript | Mr-Malomz/MakeMe-Project | /resources/js/components/GetAPI.js | UTF-8 | 342 | 2.6875 | 3 | [] | no_license | export const GetAPI = (endPoint) => {
let baseURL = 'http://localhost:8000/api/';
return new Promise((resolve, reject) => {
fetch(baseURL + endPoint)
.then(response => response.json())
.then(resJson => {
resolve(resJson)
})
.catch(err => re... | true |
09ecfde52811618dad6a132b44929feb173a798a | JavaScript | corand/es6-boilerplate | /test/model/Person.spec.js | UTF-8 | 318 | 2.546875 | 3 | [] | no_license | import {Person} from '../../src/model/Person'
var person;
describe('Person', function() {
beforeEach(function() {
person = new Person('firstName', 'lastName');
});
it('should return the first and last name', function() {
expect(person.fullName).toEqual('firstName lastName');
})
});
| true |
5227397ae8b65903dceaaf5d29f44de4ed38a6a5 | JavaScript | yoojeonghan/algorithm | /javascript/carpet/test.js | UTF-8 | 494 | 2.59375 | 3 | [] | no_license | const solution = require('./index');
const asssert = require('assert');
describe('solution Test', () => {
it('brown 10, red 2일 경우 [4,3]을 반환한다.', function() {
asssert.equal(solution(10, 2), [4, 3]);
});
it('brown 8, red 1일 경우 [3,3]을 반환한다.', function() {
asssert.equal(solution(8, 1), [3, 3]);... | true |
4eac40a711a650547545214fc66cdef25ca15586 | JavaScript | zeroDevs/dev-resources-backend | /events/raw.js | UTF-8 | 1,137 | 2.625 | 3 | [
"MIT"
] | permissive | const Discord = require('discord.js');
module.exports = async (client, event) => {
const events = {
MESSAGE_REACTION_ADD: 'messageReactionAdd',
MESSAGE_REACTION_REMOVE: 'messageReactionRemove'
};
if (!events.hasOwnProperty(event.t)) return;
const { d } = event; //gets useful data from ... | true |
429c7fdd726345374c2381db6c4ff1bcec870f83 | JavaScript | MyWebIntelligence/MyWebIntelligence | /crawl/approve.js | UTF-8 | 1,306 | 2.59375 | 3 | [
"MIT"
] | permissive | "use strict";
/*
The approve function decides whether a page is worth keeping.
Roughly, criterias are :
* the page has the words to match in its coreContent/<title>/<h1>
* the page isn't too far away from the oracle results (quantified by depth)
* the page belongs to an expression domain that has been cited by enough... | true |
36d0d7ed0dc212b61a219978b96f9d8b58a5504d | JavaScript | zxd8510016/mini-app | /utils/util.js | UTF-8 | 851 | 2.828125 | 3 | [] | no_license | function toStarArray(stars){
var num = stars.substring(0,1);
var starsArr=[];
for(var i=1;i<=5;i++){
if(i<=num){
starsArr.push(1);
}else{
starsArr.push(0);
}
}
return starsArr;
}
function http(url,callBack){
wx.request({
url: url,
success: res => {
callBack(res.data);
... | true |
cc37685ed5e296df8d7c34f409f6db6483bb3292 | JavaScript | BriGuy520/second-chance-around-web | /src/components/contact/Contact.js | UTF-8 | 1,663 | 2.578125 | 3 | [] | no_license | import React, { useState } from 'react';
import Consultation from './Consultation';
import General from './General';
function Contact(){
let values = {
fname: '',
lname: '',
email: '',
project: '',
startDate: '',
endDate: '',
message: '',
mailSent: false,
error: null
}
const... | true |