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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a9ab0ec06c717b32da03559300696c90671038aa | JavaScript | maggieneterval/elevator-problem | /elevator_test.js | UTF-8 | 3,127 | 3.125 | 3 | [] | no_license | const assert = require('assert');
const {timeUpAndDown, mapBatchesToTripTimes, sum, maxSubSum, balanceBatches, elevator} = require('./elevator.js');
describe('Elevator program', () => {
describe('timeUpAndDown', () => {
it('should return total trip time (int) given an array of destination floors (arr of ints)',... | true |
6f01552c94d3ecec9ce22556de8c44121ac1ee71 | JavaScript | Helen-Yang/Lindale | /VexFlowSource/src/dot.js | UTF-8 | 4,214 | 2.796875 | 3 | [
"MIT"
] | permissive | // VexFlow - Music Engraving for HTML5
// Copyright Mohit Muthanna 2010
//
// This class implements dot modifiers for notes.
/**
* @constructor
*/
Vex.Flow.Dot = (function() {
function Dot() {
this.init();
}
Dot.CATEGORY = "dots";
var Modifier = Vex.Flow.Modifier;
// Arrange dots inside a ModifierCon... | true |
71d15c48f942f119688db34dd54a639f894ffb71 | JavaScript | Roman-Yarinski/rslang | /src/components/routing/Routing.js | UTF-8 | 675 | 2.5625 | 3 | [] | no_license | import renderComponent from '../renderComponent';
class Routing {
constructor(data) {
this.routes = data;
}
initRoutes() {
window.addEventListener('hashchange', this.renderRoute.bind(this));
this.renderRoute();
}
renderRoute() {
let route = this.routes.find((el) => el.path === window.locati... | true |
cd3bdd5e0b80c06e6a1ebfbbf153789f16cdea23 | JavaScript | Morteningemann86/JavaScript | /Module 2/loops.js | UTF-8 | 536 | 3.984375 | 4 | [] | no_license | var count = 0
while (count < 10) {
document.write('Hello world! ')
count++
}
var count2 = 1
while (count2 < 11) {
document.write(count2 + ' ')
count2++
}
for (i = 1; i < 10; i++) {
document.write('Hey There ')
}
/**
FOR LOOP:
for(initialization, condition, modification)
{
// code goes here
// do so... | true |
49eeae81bd11402daa7313753e6a787500c76073 | JavaScript | ksuscbk/my-oct-code | /03_nodejs/1025/website/app.js | UTF-8 | 3,344 | 2.578125 | 3 | [] | no_license | let http = require('http');
let fs = require('fs');
let path = require('path');
let mime = require('mime');
let server = http.createServer();
server.listen(3000, () => {
console.log('服务器已启动!');
});
server.on('request', (req, res) => {
let a = req.url;
if (a == '/' || a == '/doc' || a == '/blog') {
... | true |
24eae3048576aa126e4c73f12fe1374661cfedb5 | JavaScript | thzinc/thzinc.github.io | /_includes/code_kata/missingBits/solution.js | UTF-8 | 468 | 3.140625 | 3 | [] | no_license | function missingBits(input = []) {
const result = [];
let prev = null;
for (const curr of input) {
if (prev === null) {
prev = curr;
result.push(curr);
continue;
}
switch (curr) {
case prev + 1:
result.push(curr);
break;
case prev + 2:
result.pus... | true |
d37751a2dc57452045b9050d75d2dbe1f8c037b1 | JavaScript | bluezine/react-todo-list | /src/todo/TodoComponent.js | UTF-8 | 1,486 | 2.703125 | 3 | [] | no_license | import React from 'react';
import TodoWriter from './TodoWriter.js';
import TodoList from './TodoList.js';
import './TodoComponent.css';
class TodoComponent extends React.Component {
constructor() {
super();
this.addItem = this.addItem.bind(this);
this.changeItem = this.changeItem.bind(this... | true |
1f02f1f646526a6bb4d764601eab54ba3d4ec552 | JavaScript | ziadhegazi/Node-checkpoint | /baby-steps.js | UTF-8 | 161 | 2.890625 | 3 | [] | no_license | const process = require("process")
let args = process.argv
let sum = 0;
for (i = 3; i <= args.length; i++) {
sum += parseInt(args[i-1]);
}
console.log(sum) | true |
5265fd62effe84134fe86bc1aa6ad33b16183005 | JavaScript | Sohamkadam333/Js-Begineer-to-Advance | /Dom Projects/Number Guessing Game/script.js | UTF-8 | 2,049 | 3.625 | 4 | [] | no_license | let count = 3;
// generating a random number
const random = Math.round(Math.random() * 10);
console.log(random, 'random');
document.querySelector('.guess').addEventListener('submit', function (e) {
console.log('checking...');
// var get
const userInput = document.querySelector('#userInput'... | true |
7d5ab6e427726213f6be16f37ce2242ab9fb1f00 | JavaScript | dennyhong96/algorithm-datastructure | /s18_Class/class.js | UTF-8 | 1,100 | 3.9375 | 4 | [] | no_license | class Student {
constructor(fName, lName, year) {
// "this" always refers to the instance objects
this.fName = fName;
this.lName = lName;
this.grade = year;
this.tardies = 0;
this.scores = [];
}
// instance methods - refers to individual instance
fullName() {
return `Your full name ... | true |
c860337795c556cb119d6cfe1b8b6389c6a332a3 | JavaScript | uol-arcade/arcade-ui | /games/adis-maze-unlimited/js/enemies.js | UTF-8 | 15,732 | 3 | 3 | [] | no_license | var enemyGroup;
var enemyNames = ["DITSY", "STINKY", "SQUIFFY", "CHOMP", "RED"];
function randomFreeIndex()
{
while(true)
{
var randIndex = Math.floor(Math.random() * grid.length);
if(grid[randIndex] == 0)
return randIndex;
}
}
function addEnemies()
{
enemyGroup = game.add.group... | true |
d73035f5953222f086dc8c7b5fcd2a4656c22da7 | JavaScript | jmptrader/SimpleScript | /test/compile.js | UTF-8 | 4,184 | 2.8125 | 3 | [
"MIT"
] | permissive |
var simplescript = require('../');
function compile(text) {
return simplescript.compile(text);
}
exports['Compile integer'] = function (test) {
test.equal(compile('123'), '123;');
}
exports['Compile string without quotes inside'] = function (test) {
test.equal(compile("'foo'"), "'foo';");
... | true |
10d5a7fdb06716b9f16642b7a52473faa2ce69a0 | JavaScript | yixiudashi/APIDEMO | /routes/login.js | UTF-8 | 493 | 2.515625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var _ = require('underscore');
var userlist = require('../data/user.json');
/* GET users listing. */
router.post('/', function(req, res, next) {
var user = _.filter(userlist.users, function(user){
return (user.username == req.body.username && user.p... | true |
88c43d8a583f10bcbe7a0b6af3e922e7b0556412 | JavaScript | mayboroda1985/code-practice | /useful_info/check_positive.js | UTF-8 | 99 | 2.53125 | 3 | [] | no_license | console.log(Math.sign(5)); //1
console.log(Math.sign(-5)); //-1
console.log(Math.sign(0)); // 0
| true |
f8e88c7f337444cde352ac1e2881f94d40778e3f | JavaScript | navapro/navapro.github.io | /imagemanipulation/sketch.js | UTF-8 | 895 | 3.21875 | 3 | [
"Unlicense"
] | permissive | let clownfish;
let filteredImage;
function preload() {
clownfish = loadImage("assets/website.jpg");
}
function setup() {
createCanvas(windowWidth, windowHeight);
filteredImage = makeGrayscale(clownfish);
}
function draw() {
background(220);
image(filteredImage, 0, 0);
}
function makeGrayscale(sourceImag... | true |
6a8735d7ffee56db8c4b61e1a176a2b19bc991df | JavaScript | byadav02717/discussit | /client/src/components/InviteUser.js | UTF-8 | 3,208 | 2.59375 | 3 | [] | no_license | import React,{useState} from 'react'
import axios from 'axios';
import Button from '@material-ui/core/Button';
import TextField from '@material-ui/core/TextField';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/Dia... | true |
0c6df60c4daaeccc779057028cd58368801a876f | JavaScript | Kemberly-Eliscar/React-Todo | /src/components/TodoComponents/TodoList.js | UTF-8 | 628 | 2.5625 | 3 | [] | no_license | // your components will all go in this `component` directory.
// feel free to change this component.js into TodoList.js
import React from 'react'
import ToDo from './Todo'
const TodoList = props => {
return (
<div className = 'todo-list' >
{props.list.length > 1 ?
<p>Cli... | true |
45613be5a4ae18eee3ddf5181e2b37cf47a46630 | JavaScript | mattfredericksen/CSCE-3444-Group | /GUI/src/components/LiveView.jsx | UTF-8 | 2,520 | 2.53125 | 3 | [] | no_license | import React from 'react';
import ListGroup from "react-bootstrap/ListGroup";
import Spinner from "react-bootstrap/Spinner";
import { fetchLive } from "./prometheus";
class LiveView extends React.Component {
constructor(props) {
super(props);
this.state = {
error: null,
i... | true |
b6ccf95734e21219ac24cadca08688ee38e233b3 | JavaScript | g0dgamerz/writtingcsv | /server.js | UTF-8 | 896 | 2.6875 | 3 | [] | no_license | express = require('express');
app = express();
const port = 3000;
app.set('view engine','ejs');
const csv = require('csv-parser');
const fs = require('fs');
const createCsvWriter = require('csv-writer').createObjectCsvWriter;
const csvWriter = createCsvWriter({
path: 'our.csv',
header: [
{id:'name',t... | true |
ba7305c1bfb9e9641ddad9cd356d6c7005a58227 | JavaScript | kl2karpenko/nodejs-example | /4_require_integrated_modules/read.js | UTF-8 | 633 | 3.28125 | 3 | [] | no_license | // Загрузка модуля fs (файловая система)
var fs = require('fs');
// Считывание содержимого файла в память
// works async
fs.readFile('example_log.txt', function (err, logData) {
// Если произошла ошибка, то мы генерируем исключение,
// и работа приложения завершается
if (err) throw err;
// logData имеет тип Buf... | true |
054216a31bbc1754dcd97b10f21a37d04d4fda0a | JavaScript | hguetlin/EventLabs | /utils/DeleteStorage.js | UTF-8 | 3,892 | 2.78125 | 3 | [] | no_license | const request = require('request');
var argv = require('minimist')(process.argv.slice(2));
// console.log(argv);
// Do some explaining
var theHelp = argv['h'];
if (theHelp != undefined) {
console.log('Arguments to use : ');
console.log(' -d domain : for example gse00002323');
console.log(' -u username : ... | true |
fc51e3eee48cae188988b94e54e20df58582c209 | JavaScript | marinazareka/cinema | /api/data.js | UTF-8 | 2,519 | 2.859375 | 3 | [] | no_license | const film = require('./db.json');
const rows = require('./rows.json');
const dayjs = require('dayjs');
const showDaysProbability = 0.9;
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function randomWithProbabi... | true |
64e6bdd05ae80224026cf3d946ee424611c8457e | JavaScript | viktorpopescu/node_test | /expressRequestHandle.js | UTF-8 | 767 | 2.53125 | 3 | [] | no_license | const express = require('express');
const app = express();
const bodyParser = require('body-parser');
let urlencodedParser = bodyParser.urlencoded({extended: false});
app.use(express.static('public'));
app.get('/index.htm', function (req, res) {
res.sendFile(__dirname + '/' + 'index.htm');
});
app.p... | true |
fae58054df78e150add27918aaa6708d94efeb16 | JavaScript | ArttuYlikotila/software-testing-assignment | /test/eq.test.js | UTF-8 | 753 | 2.828125 | 3 | [
"MIT"
] | permissive | import chai from "chai";
import eq from "../src/eq.js";
const expect = chai.expect;
// TC-7, TC-8, TC-9 and TC-10
describe("Compare strings", () => {
it("TC-7: Compare two strings with same values to find out if their values are equal", () => {
expect(eq('product a', 'product a')).to.equal(true)
});
it("TC... | true |
c1050e27d42eaac49ec325855728a4128c8674ca | JavaScript | gdiccini/trybe-exercises | /bloco_4/4_2/ex5.js | UTF-8 | 210 | 3.578125 | 4 | [] | no_license | let numbers = [5, 9, 3, 19, 70, 8, 100, 2, 35, 27];
let max = 0;
for (let index = 0; index < numbers.length; index += 1){
if (max < numbers[index]){
max = numbers[index];
}
}
console.log(max); | true |
726f9968010dab7f2401fef644b326b0a05e0349 | JavaScript | adavid13/senior-design-capstone | /game/src/components/StealthPiece.js | UTF-8 | 3,497 | 2.609375 | 3 | [
"MIT"
] | permissive | import { Constants } from '../utils/constants';
import { verifyBoardContinuityOnMove, findFreeTileAtDirection } from '../utils/boardUtils';
import { getAllNeighborsOfTileXY, getAllPiecesAtTileXY, getPieceTexture, getDisplayName } from '../utils/piecesUtils';
import BoardPiece from './BoardPiece';
export default class ... | true |
ab4014b3a4769a23140dd5b4fe0cf828e398b466 | JavaScript | TootEgozy/AppleSeedsBootcamp | /Exercises/JS/4.1_number_of_siblings/4.1_number_of_sibligs.js | UTF-8 | 1,195 | 5.21875 | 5 | [] | no_license | // Prompt method
// Use the prompt method to get information from the user.
// The Exercise
// 1. Declare a variable 'numSiblings' based on a prompt input
// like this:
// prompt('How many siblings do you have?');
// 2. If you have one sibling, log to the console '1 sibling!'
// (use loose equality == for now)
// 3. Us... | true |
0f3b552d365b1e3ee4a4946cd8e64a34aafbe80a | JavaScript | JonHenningsson/nextstop | /functions/recaptchaV2-validate/recaptchaV2-api-validate.js | UTF-8 | 1,397 | 2.640625 | 3 | [] | no_license | const querystring = require('querystring');
const https = require('https');
class recaptchaV2validate {
constructor(secret) {
this.secret = secret;
this.recaptchav2_validate_hostname = "www.google.com";
this.recaptchav2_validate_path = "/recaptcha/api/siteverify";
}
validate = (response) => {
... | true |
c69a5c148c6a303bfba21ffd01751f416c5c1e4d | JavaScript | freshprincekla/readinglist | /src/App.js | UTF-8 | 1,687 | 2.546875 | 3 | [] | no_license | import React from 'react';
import { Route, BrowserRouter, Switch , Link} from 'react-router-dom';
import './App.css';
import * as BooksAPI from './BooksAPI';
import Search from './search';
import ListBooks from './listBooks';
class BooksApp extends React.Component {
constructor(props){
// set the intial state... | true |
2f88ba1e5475311209c9117853bbec70665982d0 | JavaScript | maugares/restAPI | /index.js | UTF-8 | 3,654 | 3.25 | 3 | [] | no_license | ///////////////////////////////
/// API SETUP ///
///////////////////////////////
//-- Require Express --//
const express = require('express')
const app = express()
//-- Create server on port 4000 --//
const port = 4000
app.listen(port, () => `Listening on port ${port}`)
//-- Connect Sequelize with th... | true |
6c713b3e4894d618aa1aaf1051963a55836c0483 | JavaScript | avawing/human-rights-first-asylum-be-a | /api/middleware/cache.js | UTF-8 | 2,409 | 2.578125 | 3 | [
"MIT"
] | permissive | const cacache = require('cacache');
const CSV = require('csv-string');
const checkCache = (req, res, next) => {
const cachePath = '/tmp/data';
let key = String(req.originalUrl);
cacache
.get(cachePath, key)
.then((data) => {
if (data) {
result = JSON.parse(data.data.toString('utf-8'));
... | true |
a88ce585205b2be3322efdd30a25678ac75e9e09 | JavaScript | Tehy/portfolio-site | /client/src/Contact.js | UTF-8 | 2,468 | 3.03125 | 3 | [] | no_license | import React, { Component } from "react";
import axios from "axios";
/* TODO
redo inconsistent code between components
ie. this.state / useState
*/
class Contact extends Component {
render(){
return(
<div className="content">
<a className="email-text" href = "mailto:terohyttinen@outlook.com">
Message... | true |
ce9cdb81dadbd1bd902528f2369513fb34311b84 | JavaScript | atanassov-daniel/Softuni | /JS Fundamentals January;May 2020/Fundamentals-january;May-files/3 arrays-basic/lab/sum-first-and-last-array-elements.js | UTF-8 | 176 | 3.75 | 4 | [
"MIT"
] | permissive | function sumFirstAndLastElement(array) {
let sum = Number(array[0]) + Number(array[array.length - 1]);
console.log(sum);;
}
sumFirstAndLastElement(['20', '30', '40']) | true |
897725261a973bcc17991190b529239aa98c57c2 | JavaScript | hlhielkema/flowchart | /src/scripts/CanvasController.js | UTF-8 | 4,280 | 3.171875 | 3 | [
"MIT"
] | permissive | import { NODE_ELEMENT_HEIGHT, NODE_ELEMENT_WIDTH } from './Constants';
function CanvasController(parent) {
this.parent = parent;
this.canvas = null;
this.context = null;
}
CanvasController.prototype.init = function init() {
this.canvas = document.createElement('canvas');
this.context = this.canvas... | true |
42885187e88ba08ce75ecddeef39ec1e7317a565 | JavaScript | Grimlix/Teaching-HEIGVD-RES-2020-Labo-Orchestra | /docker/image-musician/src/index.js | UTF-8 | 1,405 | 2.671875 | 3 | [] | no_license | const dgram = require('dgram');
const {v4: uuidv4} = require('uuid');
require('date-and-time');
const s = dgram.createSocket('udp4');
const instruments = new Map();
instruments.set("piano","ti-ta-ti");
instruments.set("trumpet","pouet");
instruments.set("flute", "trulu");
instruments.set("violin","gzi-gzi");
instrum... | true |
bd231482b2dd35ec20520b0fc91273e250b172fe | JavaScript | lipeprado/lupe-api | /src/modules/User/controller.js | UTF-8 | 2,414 | 2.5625 | 3 | [] | no_license | import HTTPSTATUS from 'http-status';
import UserModel, { encrypt } from './model';
import isAllowed from '../../services/utils';
export const getAllUsers = async (_, res) => {
const users = await UserModel.fetchAll();
res.send({ users });
};
export const registerUser = async (req, res) => {
const {
firstNa... | true |
fbe3196eb819a16d0a723ff82d066aa3c2e5110f | JavaScript | dorpi/news-links | /client/src/components/news/News.js | UTF-8 | 1,863 | 2.640625 | 3 | [] | no_license | import React, { useState, } from 'react'
import Article from './Article.js'
import Search from './Search.js'
import {getArticles}from '../../services/api'
import './articles-page-style.scss'
const News=()=> {
const [articles, setArticles] = useState([]);
const [loading, setLoading] = useState(false);
cons... | true |
809601dde921405ad6b7b254cbf8aaf4255c10b1 | JavaScript | Nooowayjose/The-Web-Developer-Bootcamp | /6. Introduction to JavaScript/Javascript Demo/script.js | UTF-8 | 186 | 3.375 | 3 | [] | no_license | // script.js
// Simple Script to run javascript
var userName = prompt("What is your name?");
alert("Nice to meet you, " + userName);
console.log("Also great to meet you, " + userName);
| true |
e274d6b0c369cc8b97806b0a103d7fdd42af8235 | JavaScript | kou1okada/jsunit-svn | /tags/JsUnit_2-0-alpha-1/jsunit/samples/money/Money.js | UTF-8 | 2,659 | 2.75 | 3 | [] | no_license | /*
JsUnit - a JUnit port for JavaScript
Copyright (C) 1999-2001 Joerg Schaible
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation in version 2 of the License.
This program is distributed in the hope tha... | true |
9201db66017979cf0320e9cde5e3a040d1cb92f5 | JavaScript | persimonn/295733-kekstagram | /js/image_edit.js | UTF-8 | 4,514 | 2.8125 | 3 | [] | no_license | 'use strict';
(function () {
// 2.2 наложение эффекта
document.querySelector('#effect-heat').removeAttribute('checked');
document.addEventListener('change', function () {
var effectButtons = document.querySelectorAll('.effects__radio');
var activeEffectButton = null;
var getEffectClassName = func... | true |
d10bfa3aba627fb1b361f0e3faa6d48b39051a7f | JavaScript | Yeison2020/react-hooks-practice-sushi-saga | /src/components/Sushi.js | UTF-8 | 1,021 | 2.859375 | 3 | [] | no_license | import React, { useState } from "react";
function Sushi({ data, setMoney, money, setPlates }) {
const [empty, setEmpty] = useState(false);
const handlePlate = () => {
if (money >= data.price) {
setPlates((current) => {
const copy = [...current, 1];
const Copy1 = copy.splice(1, 1);
... | true |
554e8e1d380e101f0f40568bb2c3dbbf09af6589 | JavaScript | gnowenegue/movies-tvshows-browser | /src/components/Pagination/Pagination.js | UTF-8 | 2,479 | 2.5625 | 3 | [] | no_license | import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import './styles.scss';
class Pagination extends PureComponent {
static propTypes = {
currentPage: PropTypes.number.isRequired,
totalPages: PropTypes.number.isRequired,
goToPage: PropTypes.func.isRequired,
}
getRange ... | true |
508bfa7eb23c7ea29dfb84e596cec15caf5eb068 | JavaScript | Snowsunzhang/response | /WebRoot/js/ajx.js | UTF-8 | 2,720 | 2.6875 | 3 | [] | no_license | var tech1;
var tech2;
var tech3;
jQuery(function($){
var t1 = $("#ApplyWork1"),
t2 = $("#ApplyWork2"),
t3 = $("#ApplyWork3");
t1.append("<option value='NULL'>请选择</option>");
t2.append("<option value='NULL'>请选择</option>");
t3.append("<option value='NULL'>请选择</option>")... | true |
e1c432010fef28915b1d9d892621b989786b86fe | JavaScript | astoyanow/astoyanow.github.io | /csci340/labs/lab7/script.js | UTF-8 | 1,402 | 2.515625 | 3 | [] | no_license | $(document).ready(function(){
$("#shibe-chooser-1").click(function(){
$.ajax({
crossOrigin: true,
dataType: "json",
url: "http://shibe.online/api/shibes?count=1&urls=true&httpsUrls=true",
success: function(results){
$("#image1").attr("src",results["image url 1"]);
},
er... | true |
72d16847d43e45c80bba90da4ba5791e2bea2864 | JavaScript | aleksahappy/hoc-time | /src/components/withTimePretty.jsx | UTF-8 | 2,029 | 2.828125 | 3 | [] | no_license | import React from 'react';
function declOfNum(number, titles) {
var cases = [2, 0, 1, 1, 1, 2];
return titles[(number % 100 > 4 && number % 100 < 20) ? 2 : cases[(number % 10 < 5) ? number % 10 : 5]];
}
export const withTimePretty = Component => {
return class extends React.Component {
state = {};
stat... | true |
1492757e724f9b376f179b6eed5bd761d502ce95 | JavaScript | merzbow7/cryptonomicon | /src/api.js | UTF-8 | 1,666 | 2.703125 | 3 | [] | no_license | const API_COIN_LIST = 'https://min-api.cryptocompare.com/data/all/coinlist?summary=true'
const API_KEY = '44e13f016ce1bc6fdc3d289c770949fe2787903525fc4b65d35ea3abd443187e'
// const API_COINS = 'https://min-api.cryptocompare.com/data/pricemulti'
// const API_COIN = 'https://min-api.cryptocompare.com/data/price'
const WE... | true |
cf55ab05eab145d513ec95a27d4726543384a3c9 | JavaScript | karimsa/superq | /src/__tests__/test-events.js | UTF-8 | 1,662 | 2.65625 | 3 | [] | no_license | /**
* @file src/__tests__/test-events.js
* @copyright 2019-present Karim Alibhai. All rights reserved.
*/
import { createQueue } from '../module'
import { Worker } from '../worker'
test('should emit valid events on both queue and worker objects', async () => {
const queueOne = await createQueue({
name: 'queue-o... | true |
ef20f0a1e67dd62d448d3c398f81016724cc1fa8 | JavaScript | arthur-honorio/react-basico | /src/pages/Albums.js | UTF-8 | 745 | 2.53125 | 3 | [] | no_license | import React, {useState, useEffect} from "react"
import Loading from "../components/Loading.js"
const Albums = _ => {
const [isLoading, setIsLoading] = useState(false)
const [albums, setAlbums] = useState([])
useEffect( () => {
setIsLoading(true)
fetch("https://jsonplaceholder.typicode.com/albums")
... | true |
9799a524b28a66f85eccf2f0557b1f3ab4268a01 | JavaScript | tpwls318/toy-problems | /01-rockPaperScissors/rockPaperScissors.js | UTF-8 | 1,383 | 4.1875 | 4 | [] | no_license | /*
* Write a function that generates every sequence of throws a single
* player could throw over a three-round game of rock-paper-scissors.
*
* Your output should look something like:
* [["rock", "rock", "rock"],
* ["rock", "rock", "paper"],
* ["rock", "rock", "scissors"],
* ["rock", "paper", "rock"],
... | true |
9803f50c6c380143bcdb640eec233ff87ce9223d | JavaScript | tylersnyder/micro-crud | /index.js | UTF-8 | 1,563 | 2.515625 | 3 | [] | no_license | const { send, createError } = require('micro')
const fetch = require('node-fetch')
module.exports = exports = function crud(resource, url, headers) {
return async(req, res) => {
res.setHeader('Access-Control-Request-Method', ['GET, POST, PUT, PATCH, DELETE'])
const { method = '' } = req
switch (method) ... | true |
b0075de33a2341c3a8465796701fce11a77a3db7 | JavaScript | GerrardE/luhnapp | /app.js | UTF-8 | 1,719 | 3.59375 | 4 | [] | no_license | "use strict";
// declare acceptable keys
const keys = ' 0123456789';
// Input validator by Xotic750
// https://stackoverflow.com/questions/17526406/form-text-field-to-only-accept-nuvmbers-and-whitespace
let input = document.getElementById('number');
//watch for key press event,
input.addEventListener('keypress', (e) ... | true |
a2d0da087d136d715e619bcb3866de78a6dabeae | JavaScript | Patrick-G-Oliver/Auth-Friends | /friends/src/components/AddFriends.js | UTF-8 | 1,919 | 2.703125 | 3 | [] | no_license | import React from "react";
import { axiosWithAuth } from "../utils/axiosWithAuth";
class AddFriends extends React.Component {
state = {
newFriend: {
name: "",
age: "",
email: ""
}
};
handleChanges = e => {
this.setState({
newFriend: {
...this.state.newFrie... | true |
b9267482369e8544b2e7f4a5b52cc4a48dcba546 | JavaScript | Obelisksoft/Obelisksoft | /views/search/js/search.js | UTF-8 | 1,826 | 2.640625 | 3 | [] | no_license | $(document).ready(function(){
$('#searchtrd').click(function(){
var formulario = $("#formtrd").serializeArray();
//alert(formaulario);
$.ajax({
type: "GET",
dataType: 'json',
url: "/search/getsearchtrd/",
data: formulario,
}).done(function(resp... | true |
b81f868e7a3afbb0466c102f98053c9045b6ae91 | JavaScript | nearxu/have-fun-js | /interview/strcount/index.js | UTF-8 | 458 | 3.703125 | 4 | [] | no_license |
// so simple solution
const strCount = str => {
let obj = {}
for(let i=0;i<str.length;i++){
obj[str[i]] = (obj[str[i]]+1) || 1;
}
return obj;
}
console.log(strCount('hello world'))
let arr = [];
arr[4] = null;
console.log(arr)
let rand = () => Math.floor(Math.random()*32+2);
console.log(rand(... | true |
eab9986a251b12e0ae1bc6e9119317d5f928b439 | JavaScript | lolrepeatlol/rebble-help | /res/js/helpPost.js | UTF-8 | 3,940 | 2.65625 | 3 | [
"MIT"
] | permissive | var steps = {};
var currentStep = 0;
function createQRCodes() {
$( "qr" ).each(function(index) {
var elm = $(this)
console.log("Index is " + index)
var url = elm.attr("url");
console.log("Create QR to " + url)
new QRCode(elm.get(0), {
text: url,
... | true |
39ce1ac99e90f421729f05fa3cbbb80ceeefc7f6 | JavaScript | gabrielbssantos/ctd-programacao-imperativa-aula-8 | /pode-subir.js | UTF-8 | 1,611 | 4 | 4 | [] | no_license | //Microdesafios
/*
Em um parque de diversões nos pedem um programa para verificar se os passageiros da montanha-russa podem entrar no brinquedo.
1. Crie uma função podeSubir() que receba dois parâmetros:
- altura da pessoa - se está acompanhada.
Deve retornar um valor booleano (TRUE, FALSE) que indique se a pes... | true |
56f569c219bdb5f431862aadbb628b44842559c4 | JavaScript | GargGamer/CRUMPLED-BALLS---1 | /sketch.js | UTF-8 | 819 | 2.671875 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var engine, world
var ground
var bin1, bin2, bin3
var paperball
function preload()
{
}
function setup() {
createCanvas(1000, 700);
engine = Engine.create();
world = engine.world;
ground = new Grou... | true |
489fc3d938dbfa08517cf83bec98d2212182880a | JavaScript | rosexw/js-exercises | /promises/exercise-1.js | UTF-8 | 610 | 3.84375 | 4 | [] | no_license | require('es6-promise');
// Create a promise. Have it fulfilled with a value of 'FULFILLED!' in executor after a delay of 300ms, using setTimeout.
// Then, print the contents of the promise after it has been fulfilled by passing console.log to then.
//
const promise = new Promise(function(resolve, reject) {
setTimeou... | true |
6fdba7423ff56837329de2256bb15f2a22fd7ad6 | JavaScript | fabiohbarbosa/olimpiadas-web | /app/news/news-request.js | UTF-8 | 1,765 | 2.6875 | 3 | [] | no_license | import HttpStatus from 'http-status-codes';
import moment from 'moment';
import { log } from '../utils';
import ErrorException from '../exceptions/error-exception';
const DATE_FORMAT = 'YYYY-MM-DD,HH:mm:ss.SSS,ZZ';
module.exports = class NewsRequest {
constructor(limit, pubDate, type) {
this.limit = parseInt(l... | true |
6619b322c3f6d661c4c63da3206817c4d5f179b1 | JavaScript | SashaSasha1993/MAPS | /peter.js | UTF-8 | 1,435 | 2.953125 | 3 | [] | no_license | var array2 = [];
$(document).ready(function () {
// $("#chicagoB").click(function () {
function nana() {
var API = "http://apiv3.iucnredlist.org/api/v3/country/list?token=9bb4facb6d23f48efbf424bb05c0c1ef1cf6f468393bc745d42179ac4aca5fee";
$.getJSON(API, conditions);
... | true |
4c60cfe59f545c042a343a8581812b0f3cb9a3db | JavaScript | elroyantao/mclaren-demo | /src/shared/actions/patientAction.js | UTF-8 | 2,664 | 2.59375 | 3 | [] | no_license | import 'isomorphic-fetch'
export function fetchPatientsRequest() {
return {
type: 'FETCH_PATIENTS_REQUEST'
}
}
export function fetchPatientsResponse(patients) {
return {
type: 'FETCH_PATIENTS_RESPONSE',
patients
}
}
export function fetchPatientsFailure() {
return {
type: 'FETCH_PATIENTS_FAI... | true |
b77989325c44d3dd22bbde018b5edf1d7c98de38 | JavaScript | Jacoappolinario/PrivateLessons | /src/app/controller/TeachersController.js | UTF-8 | 2,219 | 2.578125 | 3 | [
"MIT"
] | permissive | const Teachers = require('../models/Teachers')
const { age, date, graduation } = require('../../lib/utils')
module.exports = {
async index(req, res) {
let { filter, page, limit } = req.query
page = page || 1
limit = limit || 2
let offset = limit * (page - 1)
let results =... | true |
1a2f35880002a335efb277609cc7f4c5622f40e6 | JavaScript | r-shahid/algorithms | /to_do/isPalindrome.js | UTF-8 | 657 | 3.96875 | 4 | [] | no_license | Is palindrome
Given a string, write the recursive function to check if it is palindrome or not. A string is said to be palindrome if reverse of the string is same as string. For example, “radar” is palindrome, but “radix” is not palindrome.
Steps
Write the pseudocode first
Think of the base case(s). For an example, wh... | true |
92ef725d765bddee9350a661ed1c62f28fa354ec | JavaScript | npmcdn-to-unpkg-bot/memori | /app/assets/javascripts/components/app-landing/photos_box.es6.jsx | UTF-8 | 644 | 2.71875 | 3 | [] | no_license | class PhotosBox extends React.Component {
constructor() {
super();
this.state = {
photos: []
};
}
showPhotos(response) {
this.setState({
photos: response
})
}
getPhotos(URL) {
$.ajax({
type: "GET",
dataType: 'json',
url: URL,
success: (response) ... | true |
baebae184b4b76dba6fb27410470a7d5ef989c15 | JavaScript | tangoslee/vue-practice | /src/stores/todo.store.js | UTF-8 | 1,715 | 2.515625 | 3 | [] | no_license | import todoService from "@/services/todo.service.js";
// initial state
const state = {
todos: []
};
// getters
const getters = {
// closeTodoCount: ({ todos }, gettters) => {
closeTodoCount: ({ todos }) => {
return todos.filter(todo => todo.done === true).length;
},
openTodoCount: ({ todos }) => {
... | true |
3d2288c72591907c205f4dab51d4a02e0128344a | JavaScript | Dreadpipe/ComeAtMe | /app/routing/apiRoutes.js | UTF-8 | 2,520 | 3.234375 | 3 | [] | no_license | // LOAD DATA
// linking brawlArray via require
const brawlData = require("../data/brawlers");
// ===============================================================================
// ROUTING
// ===============================================================================
module.exports = function (app) {
// API G... | true |
915c3dd6811ad5d4e916a2dd43c93db9d6a22484 | JavaScript | VirginiaAl/juego-Where-s-my-dog- | /main.js | UTF-8 | 687 | 3 | 3 | [] | no_license |
var newGame;
var context;
window.onload = function() {
context=document.getElementById("canvas").getContext("2d");
console.log("hola");
newGame= new Game ();
console.log(newGame);
//console.log(newGame);
setInterval(function(){
newGame.update();
},60);
};
document.onkeydown = functio... | true |
3d8cc7da84ffc2043140b0274ea1d39a042b336c | JavaScript | GuoBinyong/vnode-tls | /src/index.js | UTF-8 | 18,183 | 3 | 3 | [] | no_license | //获取tag和name:开始
/**
* 获取虚拟节点的 tag 和 name
* @param vNode : VNode
* @return {tag,name}
*/
export function getVNodeTagAndName(vNode){
return getTagAndNameFrom(vNode,vNode.componentInstance);
}
/**
* 获取 Vue 组件实例 的 tag 和 name
* @param vueInst : VueComponent
* @return {tag,name}
*/
export function getVueInstTagA... | true |
ed60569cc25b12d027251a221acabf46d9cbd014 | JavaScript | knownasilya/denali | /lib/runtime/addon.js | UTF-8 | 10,629 | 2.578125 | 3 | [
"MIT"
] | permissive | /**
* @module denali
* @submodule runtime
*/
import path from 'path';
import fs from 'fs';
import glob from 'glob';
import findup from 'findup-sync';
import resolve from 'resolve';
import topsort from '../utils/topsort';
import eachDir from '../utils/each-dir';
import isDir from '../utils/is-dir';
import requireDir ... | true |
ab8e963900f6b71dc8c85bd67d964f023d22146f | JavaScript | spkelly/Legitrack | /src/reducers/search_reducer.js | UTF-8 | 604 | 2.59375 | 3 | [] | no_license | import { REQUEST_SEARCH, RECEIVED_SEARCH } from '../actions/types';
import * as _ from 'lodash/core';
const defaultState = {
items:[],
isFetching: false,
query:''
};
export default function (state=defaultState, action){
switch(action.type){
case REQUEST_SEARCH:
return Object.assign({},state,{
... | true |
09ba7097bce6c542d9191921919c188fbaa4efb3 | JavaScript | NathanPhilliber/Panoptyk-Server | /models/room.js | UTF-8 | 6,726 | 3.140625 | 3 | [] | no_license | 'use strict'
class Room {
/**
* Room model.
* @param {string} name - name of room
* @param {int} room_id - Room id, if null one will be assigned.
*/
constructor(name, max_occupants, room_id=null) {
this.name = name;
this.adjacents = [];
this.occupants = [];
this.items = [];
this.conv... | true |
7b5f0a98b913161fedbd8e0a5eb31e9f4263308b | JavaScript | jeanmmlima/checkinparoquia | /helper/getData.js | UTF-8 | 334 | 2.78125 | 3 | [] | no_license | module.exports = function(data, horas, minutos){
//var moment = require('moment')
//var fd = moment(data).format('DD/MM/YYYY');
var d = new Date(data);
d.setMinutes(d.getMinutes() + d.getTimezoneOffset());
d.setHours(horas);
d.setMinutes(minutos);
d.setMilliseconds(0);
d.setSeconds(0);
... | true |
3d014f4c7212730f930152d1e17d3438c1b961cd | JavaScript | neguso/TaskApp | /modules/util/test.js | UTF-8 | 5,271 | 2.671875 | 3 | [] | no_license |
var util = require('./index.js'),
assert = require('assert');
var p_undefined,
p_text = ' teXt ',
p_alphanumeric = ' 123abc ',
p_email = ' name@domain.com ',
p_text_int = ' 123 ',
p_int = 123,
p_fields = ' a, B , c ';
var v, res;
v = util.validator.create();
v.optional(p_undefined, 'p_undefined');
ass... | true |
c0e4d0f881121be5e0dd49a076305e5bb635fbcd | JavaScript | Ethelt/drmario | /modules/scoreSystem.mjs | UTF-8 | 1,684 | 3.4375 | 3 | [] | no_license | "use strict";
import { Utilities } from "./utilities.mjs"
// This class handles reading, saving and showing score on a scoreboard,
export class ScoreSystem {
constructor(gameManager) {
this.gameManager = gameManager
this.score = 0
this.scoreIncrement = 100 // How many points should player... | true |
382239921e077818c5e4d6ec6df9189cb71ccec1 | JavaScript | sudhirverma/data-structure | /leetcode/array/easy/1.TwoSum.js | UTF-8 | 495 | 3.71875 | 4 | [] | no_license | // https://leetcode.com/problems/two-sum/
var twoSum = function(nums, target) {
let hash = {};
let result;
for (let i = 0; i < nums.length; i++) {
let targetResult = target - nums[i];
if (nums[hash[targetResult]] + nums[i] === target) {
result = [hash[targetResult], i];
... | true |
1b98f03360213c8e1806d9fa10bdf77918c38961 | JavaScript | Ricardo1991-creator/entregas-hab | /js2/dia-1/www/js/windowproperties.js | UTF-8 | 755 | 3.640625 | 4 | [] | no_license | // Altura de la ventana
console.log(window.innerHeight, "alto");
console.log(window.innerWidth, "ancho");
//altura completa de la ventana del navegador
console.log(window.outerHeight);
console.log(window.outerWidth);
//Informacion sobre la URL
console.log(window.location); // objeto con informacon sobre la url
con... | true |
0eb3764c439915dcf5304e428e5a78a5a2432a6f | JavaScript | MicahStevens/DojoMixins | /PathToolsMixin.js | UTF-8 | 6,844 | 2.578125 | 3 | [
"MIT"
] | permissive | /**
* Path Tools
*
* This mixin provides the ability to specify get/set and bind functions based on a dot seperated path such as 'a.b.c.d'
*
* The advantage is that this allows you to always see the latest object copies. This can be troublesome
* when you use and update object references in Stateful dojo objects ... | true |
441fb6e5fcded8168b750a7fe5f00ff08d60f5e6 | JavaScript | sayanything830/code-wars | /abbreviate-two-word-name/solution.js | UTF-8 | 818 | 4.25 | 4 | [
"MIT"
] | permissive | 'use strict';
// option one
function abbrevName(name){
let arr = name.split(' '); // arr now represents an array of names given from fuction arguments
return `${arr[0].charAt(0).toUpperCase()}.${arr[1].charAt(0).toUpperCase()}`; // takes first name in array and grabs the first character, then adds a period between... | true |
2e25ff4b73e1e4341a9396e79bd6123e36492f7c | JavaScript | 6461/www_memegen | /tests/app.test.js | UTF-8 | 1,765 | 2.515625 | 3 | [] | no_license | "use strict";
const request = require('supertest');
const mongoose = require('mongoose');
mongoose.Promise = global.Promise;
const app = require('../app');
const database = require('../config/database');
const Meme = require('../models/memeModel');
describe('Test Mongoose database connection', () => {
... | true |
5041a81d657d8025f262d915fc64953c153abc6a | JavaScript | joaovictor1205/Full-Stack-JS-WebApp | /backend/src/controllers/TaskController.js | UTF-8 | 4,437 | 2.765625 | 3 | [] | no_license | const TaskModel = require('../models/TaskModel');
const current_date = new Date();
const { startOfDay, endOfDay, startOfWeek, endOfWeek, startOfMonth, endOfMonth, startOfYear, endOfYear } = require('date-fns');
class TaskController {
async create(req,res){
const task = new TaskModel(req.body);
aw... | true |
7919d469be5e5ca9491a6e246902472ec2b6f928 | JavaScript | edwincorea/react_redux | /RallyCoding/redux_thunk_example/src/actions/index.js | UTF-8 | 489 | 2.609375 | 3 | [
"MIT"
] | permissive | import axios from "axios";
export const FETCH_PROFILES = "FETCH_PROFILES";
export const fetchUsers = () => {
const request = axios.get("http://jsonplaceholder.typicode.com/users");
// Vanilla redux expects us to return an action object.
// With redux-thunk we return a function
return (dispatch) => {
... | true |
39ff8d44a1fe3f70310e5796493705372f414a75 | JavaScript | speich/fotodb | /website/scripts/js/GeonamesGeocoder.js | UTF-8 | 1,674 | 2.75 | 3 | [] | no_license | define(['dojo/_base/declare'], function(declare) {
return declare(null, {
/** initial radius for reverse geocoding */
radius: 1,
radiusMax: 33,
/** user name for geonames service */
user: 'speichnet',
url: 'https://secure.geonames.org/findNearbyPlaceNameJSON',
/**
*
* @para... | true |
196ea0870b2dec6fce0ac6b891f64af7b95f974f | JavaScript | shumpei0407/DailyChallenge_p5js_threejs | /shumpei_20200618/script.js | UTF-8 | 1,736 | 2.765625 | 3 | [] | no_license | //Rispect https://www.openprocessing.org/sketch/857874
let pallete = ["#A6E1EA", "#4660D2", "#E6F9FA", "#B2DDDD", "#B8E5E1","#F0FDFC"];
let sep = 5;
let rs;
function setup() {
createCanvas(800, 800);
colorMode(HSB, 360, 100, 100, 100);
rs = random(20);
}
function draw() {
background(0);
randomSeed(rs);
... | true |
36f1797365a8e44e0959817bfede71badf79630f | JavaScript | ArnoldNunez/WarframeAlerts | /src/components/Fissures.js | UTF-8 | 2,623 | 2.625 | 3 | [] | no_license | import React from 'react';
import Fissure from './Fissure';
const API = 'https://api.warframestat.us/{platform}/fissures';
class Fissures extends React.Component {
constructor(props) {
super();
this.state = {
fissures: [],
isLoading: false,
};
this.fetchD... | true |
9ec45d956b984bfb92d24ae0d9bf274eec01ab5a | JavaScript | devfiliperocha/update-cloudflare-dns-record | /index.js | UTF-8 | 2,528 | 2.546875 | 3 | [] | no_license | const axios = require('axios')
const { cloudflareDNSId, cloudflareToken, cloudflareZoneId, urlDNSRecord, interval } = require('./config.json')
const getIp = async () => {
try{
const response = await axios.get("http://checkip.dyndns.org/")
const ip = String(response.data).replace(/[^0-9.]/g,'').trim... | true |
1983972e38d06603a45689d73be7839bbefbf8c5 | JavaScript | SomeHats/servercraft | /client/helpers/utils.js | UTF-8 | 365 | 2.59375 | 3 | [] | no_license | export const formatError = error => {
if (typeof error === 'string') return error;
if (error && error.data && error.data.message) return error.data.message;
if (error && error.message) return error.message;
return 'Unknown error';
};
export const find = (arr, cond) => {
for (let item of arr) {
if (cond(i... | true |
88c10fa4eca6689fc392455e9532c572b5f09682 | JavaScript | xtine88/basic_algorithms | /01-basic.js | UTF-8 | 406 | 3.984375 | 4 | [] | no_license | // REVERSING A STRING 28Oct2017
function reverseString(str){
var a = str.split("");
var b = a.reverse();
var c = b.join("");
console.log(c);
}
reverseString("hello")
reverseString("hello world")
reverseString("Greetings from Earth")
// REFACTORED VERSION
function reverseString(str){
console.log(str.split("").... | true |
af1e71a3c986e0e7ef7a47a9877a8eda59721750 | JavaScript | riefive/my-vue2-ssr | /src/libraries/util-text.js | UTF-8 | 2,496 | 3.546875 | 4 | [
"MIT"
] | permissive | export function capitalize(value) {
// based on - https://www.w3resource.com/javascript-exercises/javascript-string-exercise-8.php
return value.charAt(0).toUpperCase() + value.slice(1)
}
export function capitalizeWords(value) {
// based on - https://www.w3resource.com/javascript-exercises/javascript-string... | true |
56fc0bfbf30f091ffda243f6c1b91c5aac65dac8 | JavaScript | lacunadream/co-hire-fruit | /public/js/fruitangular.js | UTF-8 | 1,527 | 2.796875 | 3 | [] | no_license |
var FruitsApp = angular.module('fruitsApp', []);
//Data loading controller calling API
FruitsApp.controller('ListFruitsController', ['$scope', '$http', '$location', function($scope, $http, $location) {
var fruitType = window.location.href.match(/search\/(.*)/)
//For star rendering
$scope.getNumber = fun... | true |
fffc8bfabec7429e9c2089edf4270258a617c0ae | JavaScript | 92annaszabo/bh-fst01 | /docs/lectures/20200109/recitation/Logger.js | UTF-8 | 394 | 3.265625 | 3 | [] | no_license | function padded(width, char, value) {
const str = String(value)
return char + str + char.repeat(width - str.length - 1)
}
export default class {
constructor(width) {
this.width = width
}
box(value) {
console.log('*'.repeat(this.width))
console.log('*' + padded(this.width - ... | true |
9b1022f91938310686118e8077b7863e12c5f0cf | JavaScript | Ara-laurice12/barterit-mern-prototype | /controllers/authControllers.js | UTF-8 | 5,984 | 2.53125 | 3 | [] | no_license | const { User } = require('../models/User');
const jwt = require('jsonwebtoken');
const cryptoRandomString = require('crypto-random-string');
const { sendVerificationMail } = require('../utils/nodemailer');
//handling Login errors
const handleLoginErrors = (err) => {
const errors = { email: '', password: '' };
... | true |
35952e1b1383e28cf4e3ceea2f8be7dd70ce77b3 | JavaScript | Shreya-appsimpact/ai-gk | /app/assets/javascripts/admin/question_form_validation.js | UTF-8 | 361 | 2.609375 | 3 | [] | no_license | $(document).ready(function(){
$("#question_form").validate({
error: function(label) {
$(this).addClass("error");
},
rules: {
'question[title]' : "required",
'question[answer]' : "required"
},
messages: {
'question[title]' : "Please enter title",
'question[answer]' : "... | true |
d301394c6382dbd58fbee13a0135951a618a7174 | JavaScript | afroxi/portafolio-web | /js/main.js | UTF-8 | 4,277 | 2.578125 | 3 | [] | no_license | $(document).ready(function() {
/* Apariencia de navegación al hacer scroll */
$(window).scroll(function() {
if (this.scrollY > 50) {
$('.navbar').addClass("sticky")
} else {
$('.navbar').removeClass("sticky")
}
})
/* Menu toggle | Navbar */
$('.menu-h... | true |
655be0af40a35a75f80d5b8b522c5e5f188e3505 | JavaScript | 0xKD/0xKD.github.io | /random/processing/js/bounce.js | UTF-8 | 2,024 | 3.34375 | 3 | [] | no_license | (function() {
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// from SO: 3437786
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
WIDTH = w.innerWidth || e.clientWidth || g.clientWidth,
HEIGHT = w.innerHeight|| e.... | true |
fab7af9a467ae941b3c34634ee5e9887754c44fb | JavaScript | jchernan/mapwith.me | /server/search.js | UTF-8 | 3,094 | 2.6875 | 3 | [] | no_license | var http = require('http');
var parallel_load = require("../lib/parallel_load.js").parallel_load;
var venue_find = require("./venue_find.js").venue_find;
/* TODO: Deprecate ? */
var venue_merge = require("../lib/venue_merge.js").venue_merge;
/* TODO: add logic for arbitrary number of geopoints */
/* TODO: Rename venu... | true |
212233423c406e607e4762a53c8d42408a5fec87 | JavaScript | DmJavaScript/project5 | /src/pages/13-sum-of-two/script.js | UTF-8 | 1,244 | 3.984375 | 4 | [] | no_license | /*
* Задача 13: «Сумма двух»
*
* Напишите функцию sumOfTwo(arr, num). Её аргументы: массив целых чисел arr
* и целое число num. Функция должна вернуть true, если в переданном массиве
* есть какие-то два числа, чья сумма равна num. Если же такой пары чисел нет,
* функция должна вернуть false.
*
*/
function sumOf... | true |
20944cd79e92a68eb951690cf40da6ccf96b8714 | JavaScript | ziggity/eloquent.js | /countIslandsRecurisve.js | UTF-8 | 1,846 | 3.03125 | 3 | [] | no_license | /* Generated from Java with JSweet 2.0.0 - http://www.jsweet.org */
var Islands = (function () {
function Islands() {
}
Islands.prototype.isSafe = function (M, row, col, visited) {
return (row >= 0) && (row < Islands.ROW) && (col >= 0) && (col < Islands.COL) && (M[row][col] === 1 && !visited[row][co... | true |
c48460a55829aa9f7ed1f1614a3561ad580d4eee | JavaScript | richieholsenback/laughtrack | /src/components/follower/FollowerProvider.js | UTF-8 | 2,139 | 2.59375 | 3 | [] | no_license | import React, { useState, createContext } from "react"
export const FollowerContext = createContext()
export const FollowerProvider = props => {
const [followers, setFollower] = useState([])
const [ searchTerms, setSearchTerms ] = useState("")
const getFollowers = () => {
const parsedActiveUser =... | true |
6be2ec71a7721d31dfb4c4f27c3bf825c0d0e7f5 | JavaScript | jaromap4/action_thru_pr | /models/git-command.js | UTF-8 | 2,121 | 2.96875 | 3 | [] | no_license | class GitCommand {
constructor(working_directory){
this.working_directory = working_directory;
}
//Command: git init
init(){
this.staging = [];
this.local_repository = [];
return "Initialized as empty Git repository.";
}
//Command: git status
status(){ ... | true |
8379de266fbc180ee914dcfed2ba771272297363 | JavaScript | raulpatel/flappy-react | /flappybird/src/App.js | UTF-8 | 5,554 | 2.890625 | 3 | [] | no_license | import React, { Component } from 'react';
let maxScore = 0;
export default class App extends Component {
componentDidMount() {
const bird = document.querySelector(".bird");
const gameDisplay = document.querySelector(".game-container");
const ground = document.querySelector(".ground-moving... | true |