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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cc5061a621d04cc686c99ec3e621c6754149de63 | JavaScript | aleritty/present | /assets/extensions/zoom/deck.zoom.js | UTF-8 | 2,378 | 2.71875 | 3 | [] | no_license | /*!
Deck JS - deck.zoom
Copyright (c) 2011 Grayside
Dual licensed under the MIT license and GPL license.
https://github.com/imakewebthings/deck.js/blob/master/MIT-license.txt
https://github.com/imakewebthings/deck.js/blob/master/GPL-license.txt
*/
/*
This module allows to reach the start or end of the presentation imm... | true |
699497c8eb9253b5339ee7fe8becf5bbcf05a0d5 | JavaScript | HaiderMalik12/Mogodb | /example-findOne-document.js | UTF-8 | 934 | 2.609375 | 3 | [] | no_license | var mongodb=require('mongodb');
var MongoClient=mongodb.MongoClient;
var url="mongodb://localhost:27017/users";
MongoClient.connect(url,function(err,db){
if(err){
console.log('Unable to connect the Db');
}
else{
var users=db.collection('users');
//where name=Haider Malik
//projection name,city
users.... | true |
ac319234fe959017363dc4a35104a7109427a7f9 | JavaScript | plazmediaLab/alain-boutique-client | /helpers/count-products.js | UTF-8 | 886 | 2.609375 | 3 | [] | no_license | export function countStateProducts(products, groupID) {
let active = [];
let total = [];
if (products.length > 0) {
active = products.filter(
(x) => x.state === 'ACTIVE' && x.group[0]._id === groupID && x.state !== 'SOLD'
);
total = products.filter((x) => x.group[0]._id === groupID && x.state !=... | true |
4485c353201f38c52e24fe00cb4e4cf5427d350f | JavaScript | JoaoCostaIFG/LAIG | /TP3/MyGameOrchestrator.js | UTF-8 | 13,690 | 2.53125 | 3 | [] | no_license | const GameState = {
NOTSTARTED: 0,
RUNNING: 1,
PAUSED: 2,
ENDED: 3,
};
class MyGameOrchestrator {
static reservedUIPickIds = 100;
/* || CONSTRUCTOR */
constructor(scene) {
this.scene = scene;
scene.gameOrchestrator = this;
this.state = GameState.NOTSTARTED;
// debug option for showing g... | true |
5079572ab36385942061f98adfe1241ca594d481 | JavaScript | ArthurHsing/DataStructure | /50.knapSack_fractional.js | UTF-8 | 813 | 3.609375 | 4 | [] | no_license | const knapSack = (capacity, weights, values) => {
let totalValue = 0;
let load = 0;
const n = weights.length;
for (let i = 0; i < n; i++) {
if (weights[i] <= capacity - load) {
load += weights[i];
totalValue += values[i];
} else {
const r = (capacity - load) / weights[i];
totalVa... | true |
faaa938b08640ec9593785730eac6db70ed9d957 | JavaScript | brob/eleventy-plugin-blog-tools | /src/related.js | UTF-8 | 575 | 2.609375 | 3 | [] | no_license | module.exports = function(items, categorizeBy, categoryArray, threshold = 1, excludedSlug = "") {
let posts = Array.from(items).filter(item => {
return item.fileSlug != excludedSlug // removes "excluded item" aka the current item
});
let filteredPosts = posts.filter(item => {
let matchedCount =... | true |
b6166477a47847576314c854f29a77a15fd8b7b4 | JavaScript | cuhk-lambda/spark-wiki-task-nodejs | /parse_wiki.js | UTF-8 | 843 | 2.671875 | 3 | [
"MIT"
] | permissive | const checkYes = require('./utils').checkYes
function parseWikiText(text) {
inQuote = 0;
ignoreLater = false
currentBuffer = ""
currentList = []
for (i of text) {
if (i === "[") {
inQuote++;
} else if (i === "]") {
if (inQuote > 0) inQuote--;
if (... | true |
c80447250dbcdc478a25d1dfbda14e3ffd15668d | JavaScript | Staryce/assignments | /learnyounode/mymodule.js | UTF-8 | 518 | 2.5625 | 3 | [] | no_license | const fs = require('fs')
const path = require('path')
// const dirPath = process.argv[2]
// const ext = process.argv[3]
function myModule(dirPath, ext, callback) {
const aRay = []
fs.readdir(dirPath, (err, files) => {
if (err) return callback(err)
files.forEach(file => {
if (path.... | true |
295b423198da2aa02a1dade582ca69617e365b5f | JavaScript | selectiveduplicate/todo-list | /src/components/TodoItem.js | UTF-8 | 2,127 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faTrash } from '@fortawesome/free-solid-svg-icons'
export class TodoItem extends Component {
/* method for CSS styling */
/* doing styling in JSX is fucki... | true |
d6e36eb42f648071aefc005749ee145a2f7a443c | JavaScript | batwood001/rate-limit-server | /spec/serverSpec.js | UTF-8 | 10,370 | 2.640625 | 3 | [] | no_license | var expect = require('chai').expect;
var request = require('request');
var apiCaller = require('../HTTP_helpers/api-caller').apiCaller;
var name = 'Blogtastic';
var testUrl = 'https://na.api.pvp.net/api/lol/na/v1.4/summoner/by-name/' + name;
describe('the server', function() {
// Set Mocha timeout to 1 minute
th... | true |
5d509d87354efea400a1ddaf6617b331c3433a75 | JavaScript | icantplay/WhatNow | /public/javascripts/spot.js | UTF-8 | 826 | 2.59375 | 3 | [] | no_license | function showSpots() {
var userId = localStorage.getItem("userId");
var spotsCard = document.getElementById("events");
$.ajax({
url: "/SpotbyContact/" + userId,
method: "get",
success: function (result, status) {
var spots = "";
console.log(result);
... | true |
71ad14b4fbd0e9106688682405718bbbebc22a55 | JavaScript | rbtr/classic-arcade-game-fend | /js/app.js | UTF-8 | 7,121 | 3.515625 | 4 | [] | no_license | var score = 0;
function setScore( s ) {
score = s;
updateScore( score );
}
// A parent Sprite object
// This object is the base for both the enemy and the player sprites
// It has an x and y coordinate and a sprite image field
var Sprite = function(spriteImg) {
this.x = 0;
this.y = 0;
this.sprite =... | true |
1f975bee9b329fe24e8545b98d3f33763d62fee8 | JavaScript | Phoboes/WDi23-Homework | /jae-hee_park/week_01/day_03/js/ex3.js | UTF-8 | 327 | 4.6875 | 5 | [] | no_license | // Write a function that takes a character (i.e. a string of length 1) and returns true if it is a vowel, false otherwise.
const truthyOrFalsey = function(char){
var i = char.toLowerCase();
if (char === 'a' || 'e' || 'i' || 'o' || 'u'){
return true;
} else {
return false;
}
}
console.log(truthyOrFalsey(... | true |
e2421b17cd7d15602d9489dbd965c86414a76140 | JavaScript | nlujan/fignest | /api/util.js | UTF-8 | 304 | 2.546875 | 3 | [] | no_license | 'use strict';
var _ = require('underscore');
class Util {
static milesToMeters(miles) {
return miles * 1609.344;
}
static ensureLength(collection, len) {
while (collection.length < len) {
collection.push(_.sample(collection));
}
return collection;
}
}
module.exports = Util; | true |
41a15a90229651cbe2706ee798b57bfe08e124e6 | JavaScript | CoherentLogic/ehmp20 | /ehmp/product/production/vx-sync/handlers/record-enrichment-request/record-enrichment-location-xformer.js | UTF-8 | 4,467 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
//--------------------------------------------------------------------------------
// This is a record enrichment transformer for operational location data.
//
// @Author: Les Westberg
//--------------------------------------------------------------------------------
var _ = require('underscore');
var... | true |
5ba25a1d89547a6d15b4ef752ac97f2d12fe7cb1 | JavaScript | erhs-53-hackers/housekeeping | /js/greetVisitors.js | UTF-8 | 291 | 3.3125 | 3 | [] | no_license | var d = new Date()
var time = d.getHours()
if (time<10)
{
document.write("<b>Good morning. </b>");
}
else if (time>=10 && time<16)
{
document.write("<b>Good day. </b>");
}
else
{
document.write("<b>Hello World! </b>");
}
document.write("<b>\nThe time is currently " + d + "</b>") | true |
071c6eb098157bb3342f301ce1e23ce9900dbfbf | JavaScript | aland1013/coding-interview-questions | /chapter-4/4.7-build-order.js | UTF-8 | 1,187 | 3.671875 | 4 | [
"MIT"
] | permissive | /*
input:
projects: a, b, c, d, e, f
dependencies: (a,d), (f,b), (b,d), (f,a), (d,c)
output: f, e, a, b, d, c
*/
class Graph {
constructor() {
this.vertices = {};
}
addVertex(id) {
this.vertices[id] = new Set();
}
addEdge(v1, v2) {
if (
!this.vertices.hasOwnProperty(v1) ||
!this... | true |
958d9883d5d2a6ed50e6900d0d5d03c9fc2047a6 | JavaScript | JaiberS/holbertonschool-higher_level_programming | /0x12-javascript-warm_up/10-factorial.js | UTF-8 | 248 | 3.109375 | 3 | [] | no_license | #!/usr/bin/node
function fact(a, b){
if (a == 1){
return b
}
b *= a
return fact(--a, b)
}
let myVar = process.argv.slice(2)
const numb = parseInt(myVar[0], 10)
if (isNaN(numb)){
console.log(1)
} else {
console.log(fact(numb, 1))
}
| true |
9be66f56b384f3cb9661a7f3dddf4a77791b4887 | JavaScript | sayakakaka/freemarket_sample_74e | /app/assets/javascripts/items.js | UTF-8 | 5,044 | 2.5625 | 3 | [] | no_license | $(function(){
var index = [0,1,2,3,4,5,6,7,8,9];
// 商品編集画面開いた際に、画像編集時の画像差し替え処理に入らないよう初期値を設定
var editIndex = 10;
var request = $("#image-area").attr("action");
if(request != undefined && request.indexOf("edit") != -1){
$.ajax({
url: "/items/set_images",
data: {id:request.replace(/[^0-9]/g, '')}... | true |
99348a822e853e8cfd7a3771e43220d994ea0336 | JavaScript | jenpoole/js-looping-and-iteration-map-lab-cb-000 | /index.js | UTF-8 | 1,148 | 4.4375 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // this function takes an array of drivers, and returns an array of the drivers names in lowercase
// returns all drivers lowercased
// does not modify the original array
function lowerCaseDrivers (list) {
return list.map(function (driver) {
return driver.toLowerCase();
});
}
// this function takes an array of... | true |
9dd00018971a3f838e7a25f4ea22d143f9481a68 | JavaScript | wheresmyjetpack/crispy | /app/assets/javascripts/components/finalized_shopping_list.js.jsx | UTF-8 | 2,701 | 2.625 | 3 | [] | no_license | const shortid = require('shortid');
class FinalizedShoppingListContainer extends React.Component {
constructor(props) {
super(props);
this.state = {items: this.props.data};
}
render() {
return <FinalizedShoppingList items={this.state.items} authToken={this.props.authToken}/>;
}
}
class FinalizedS... | true |
14941539d6c5d07f4fea1b5695cb851192f4ee4f | JavaScript | zhutengfei1990/findjob | /vdom/createElement.js | UTF-8 | 839 | 3.265625 | 3 | [] | no_license |
/* 数据
{
tag: 'ul',
attrs: { id: 'list' },
children: [
{
tag: 'li',
attrs: { className: 'item' },
children: ['Item1']
}, {
tag: 'li',
attrs: { className: 'item' },
children: ['Item2']
}
]
}*/
function creatElement(vnode) {
var tag = vnode.tag
var attrs = vno... | true |
33a2956ad0bda0af5346ea9f006e9e31dff44f02 | JavaScript | yu3211/studyCode | /js_sample/js/chap03/scripts/wrapper.js | UTF-8 | 232 | 2.8125 | 3 | [] | no_license | // http://127.0.0.1:8887/chap03/2.wrapper.html
/**
* null以外のオブジェクトをtureとみなすため、今回はtureとなる
*/
var flag = new Boolean(false);
if (flag) {
console.log('flagはtrueです!');
} | true |
cb4ca60cfa41294f299d57454a8fac67e1edc6c0 | JavaScript | TerencesGit/React-Examples | /react-todolist/src/components/TodoItem.js | UTF-8 | 1,428 | 2.59375 | 3 | [
"MIT"
] | permissive | import React, {Component} from 'react';
const TodoItem = React.createClass({
getInitialState(){
return{
editState: false
}
},
toggleDone(){
this.props.toggleDone(this.props.id)
},
removeTodo(){
this.props.removeTodo(this.props.id)
},
editTodo(){
this.setState({
editState : !this.state.editState
... | true |
75e1f7bc7398cafc9a9e9bda6415db15db646936 | JavaScript | webcomcafe/digitalinnovation-nodejs | /es6avancado/functions/3-functions.js | UTF-8 | 1,530 | 4.0625 | 4 | [] | no_license | // rest operator, spread operator ...
// strings, arrays, objetos literais, objetos interáveis
const str = 'Airton Lopes';
const arr1 = [1, 2, 3, 4];
function strChars(...chars) {
console.log(chars);
console.log(arguments);
}
strChars(...str);
const arr2 = [5, 6, 7, 8];
//const conc = arr1.concat(arr2);
con... | true |
4fbb9c0d3a8f3296cf247efdef7e4dd1054d9ac2 | JavaScript | zenlykoi/p5js-examples | /games/snack/sketch.js | UTF-8 | 1,177 | 3.34375 | 3 | [
"MIT"
] | permissive | /**
* Setup
*/
function setup() {
createCanvas(SCREEN_WIDTH, SCREEN_HEIGHT);
setCanvasPosToCenter();
frameRate(SNACK_SPEED * 5);
}
/**
* Draw
*/
const snack = new Snack();
const foods = [];
function draw() {
background(0);
snack.update();
snack.checkEatFood(foods);
if (snack.die... | true |
ab2f9f05ffae28e845001e81bea1e1496d174fa0 | JavaScript | AlexHoyos/Coderbook | /resources/js/functions/routing.js | UTF-8 | 569 | 2.78125 | 3 | [] | no_license | function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
function getPageName(){
l... | true |
69a78d69e27717911d0e5ee131327e89784ad5ee | JavaScript | foripepe/zCanvas | /dist/es5/Collision.js | UTF-8 | 6,786 | 2.921875 | 3 | [
"MIT"
] | permissive | /**
* The MIT License (MIT)
*
* Copyright (c) 2013-2016 Igor Zinken / igorski
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the ri... | true |
5456d584ff1bdfc8ae170d062ae8fa14695aab50 | JavaScript | pjr11/camelect | /camelect.js | UTF-8 | 8,361 | 2.859375 | 3 | [
"MIT"
] | permissive | // I may put a web front end on this at some point, but for now you'll need to run it
// with node.js
var _ = require('underscore');
// The number of seats not up for election this time
var baseSeats = { ld: 10, lab: 16, con: 1, grn: 0, ind: 1 };
var totalSeats = 42;
var partyNames = {
ld: "Lib Dem",
lab: 'Labou... | true |
92fe0c6657f40ff330382a2050d5b9e0ccf87377 | JavaScript | mjstromberg/toy-problems | /isUnique/isUniqueSpec.js | UTF-8 | 671 | 3.109375 | 3 | [
"MIT"
] | permissive | describe('isUnique', function() {
it('should return a boolean', function() {
var result = isUnique('test');
expect(result).to.be.a('boolean');
});
it('should handle false example case', function() {
var result = isUnique('hello');
expect(result).to.be.false;
});
it('should handle true exa... | true |
a2514750b02664d01c077f716998d73bbb7424a8 | JavaScript | anders529/reducer-todo | /todo-app/src/reducers/reducerThingy.js | UTF-8 | 502 | 2.75 | 3 | [] | no_license | export const initialState = [{id:{},item: 'Refactor Things Until They Break!',finished: false}];
export const ListItem = (state, action) => {
switch(action.type) {
case 'ADD-ITEM': return [...state,{item: action.payload, finished: false, id: Date.now()}];
case 'FINISHED': return state.map(item =>{re... | true |
70bd21ebeede41078bdd7e6587329093008b0b69 | JavaScript | Jamal4/module23ES6pratice | /destructure.js | UTF-8 | 524 | 3 | 3 | [] | no_license | const person = {
name: "Jack william",
age: 17,
job: "facebook",
gfname: "ema watsom",
address: "jakir hosan rd",
phone: 4705104850,
};
// const name = person.gfname;
// const phone = person.phone;
// const { phone, gfname } = person;
// console.log(phone, gfname);
const friends = ["amaoir", "kaar", "vella... | true |
30cb114613bd4027da687637436d9a1fe23bdd2c | JavaScript | skp96/DS-Algos | /Grokking/Top K Elements/topKNumbers.js | UTF-8 | 3,139 | 3.84375 | 4 | [] | no_license | class MinHeap {
constructor() {
this.heap = [];
this.size = 0;
}
buildHeap(arr){
this.heap = arr;
this.size = this.heap.length;
for (var i = this.heap.length - 1; i >= 0; i--){
this.minHeapify(i)
}
}
insert(val) {
// Time Complexity: O(logn)
//We do not resize the heap... | true |
a1dfb6f95541ec3e95e548f1d1810e58b8556b4c | JavaScript | mick-whats/args2-node | /lib/index.js | UTF-8 | 9,581 | 2.71875 | 3 | [] | no_license | // Generated by CoffeeScript 1.12.7
(function() {
var Args2,
_,
slice = [].slice;
_ = require('lodash-core');
Args2 = (function() {
var choiceInternalFunction;
function Args2(args1) {
var args, res;
this.args = args1;
if (this['arguments'] != null) {
args = Array.proto... | true |
bd355ec790ca2a6c3928046c9839ab3dbb02476a | JavaScript | sancuba/accionciudadana | /webac/src/main/java/ar/com/thinksoft/ac/webac/web/js/basePage.js | ISO-8859-2 | 3,987 | 2.875 | 3 | [] | no_license | $(document).ready(function() {
if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i))
{
alert("El sistema web no es compatible con su dispositivo mvil.");
}
});
/*
* FUNCIONES DE VALIDACION
*/
... | true |
888fe6991ea079e0fb18344c2bd735ad0ca7bbe2 | JavaScript | gruntjs-updater/grunt-reconfigure | /tasks/reconfigure.js | UTF-8 | 4,495 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // grunt-reconfigure
// https://github.com/jlindsey/grunt-reconfigure
// Copyright (c) 2013 Joshua Lindsey
// Licensed under the MIT license.
'use strict';
module.exports = function(grunt) {
// ## Baseline setup
// Include Underscore
var _ = require('underscore');
// Include Node's util
... | true |
6eb6680027c690bf4443135595e1beaccfe2b484 | JavaScript | webmakaka/React-React-Redux-and-Redux-Saga-Master-React-State-Hooks | /app/client/saga/src/sagas/entriesSaga.js | UTF-8 | 931 | 2.515625 | 3 | [] | no_license | import {
default as entriesTypes,
populateEntries,
populateEntryDetails,
} from 'actions/entries.actions';
import axios from 'axios';
import { call, fork, put, take } from 'redux-saga/effects';
export function* getAllEntries() {
console.log('GET ALL ENTRIES');
yield take(entriesTypes.GET_ENTRIES);
const { ... | true |
e038b89145243756eb0e968a850ba34654d5df5f | JavaScript | SeunMatt/OpenShare | /lib/initializeWatcher.js | UTF-8 | 324 | 2.59375 | 3 | [
"MIT"
] | permissive | module.exports = initializeWatcher;
function initializeWatcher(watcher, fn) {
[].forEach.call(watcher, (w) => {
var observer = new MutationObserver((mutations) => {
// target will match between all mutations so just use first
fn(mutations[0].target);
});
observer.observe(w, {
childList: true
});
})... | true |
6a91f97e03ea824b0936d594e6ebeea4e062e7f1 | JavaScript | hujgup/vriskas-kinky-adventure | /game/script/ng/configObjectModel.js | UTF-8 | 38,759 | 3.171875 | 3 | [] | no_license | function strnatcasecmp (str1, str2) {
// http://jsphp.co/jsphp/fn/view/strnatcasecmp
// + original by: Martin Pool
// + reimplemented by: Pierre-Luc Paour
// + reimplemented by: Kristof Coomans (SCK-CEN (Belgian Nucleair Research Centre))
// + reimplemented by: Brett Zamir (http://brett-zamir.me)
// + bugfixe... | true |
eb16cdcca31c1141b10501e5127eba050609e4d2 | JavaScript | ZagalJ/TeamGenerator | /__tests__/Employee.test.js | UTF-8 | 987 | 3.171875 | 3 | [
"MIT"
] | permissive | const Employee = require ('../lib/Employee');
test ('creates an employee', () => {
const employee = new Employee ('Jonathan', 2, "jonathan.zagal@hotmail.com");
expect (employee.name).toEqual(expect.any(String));
expect (employee.id).toEqual(expect.any(Number));
expect (employee.email).toEqual(expect.a... | true |
5ebfd6a7f5f5191c7dbc069fb7fb3455290e4ba1 | JavaScript | willd/h801-led | /nodejs/socket.js | UTF-8 | 3,834 | 2.5625 | 3 | [] | no_license | var data;
var cid;
var presetvalue;
var pin;
var socket = io();
var host;
var element;
var self = this;
socket.on('presets', function (presets, data) {
select = document.getElementById('choosePreset');
names = [];
for (var i in presets) {
select.options[select.options.length] = new Option(presets[i].shortname, [p... | true |
499e0107334d0082d564b8b535e72d2d6c534c20 | JavaScript | agoodstart/coffeemachine | /src/state.js | UTF-8 | 2,272 | 2.625 | 3 | [] | no_license | import SweetCoffeeMock from './controller/SweetCoffeeMock';
class State {
constructor() {
this.sweetCoffeeMock = new SweetCoffeeMock();
this.coffees = this.createCoffees();
this.extras = this.createExtras();
this.errorCallback = this.sweetCoffeeMock.errorCallback;
this.read... | true |
fadaf077059acc73000dc7c8bddcc40900d3021e | JavaScript | xiaobingxiansheng/xiaobingxiansheng.github.io | /demo/music-pai/js/dataBaseConfig.js | UTF-8 | 3,988 | 2.75 | 3 | [] | no_license | /**
* Created by lenovo on 2018/2/7.
*/
/**
* Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found. 说明找不到存储对象空间
* Uncaught InvalidStateError: Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running 更新数据库的事务在执行
* Uncaught DOMException: ... | true |
9dc3c4ea25c4bc5925d2aacac3c8ec78226c22ee | JavaScript | SimonAlbani/wdiwork | /sandbox/quote-machine/index.js | UTF-8 | 1,408 | 2.796875 | 3 | [] | no_license | const express = require("express");
const app = express();
const bodyParser = require("body-parser");
app.use(express.static(__dirname + "/public"));
app.use(bodyParser.urlencoded({ extended: true }));
app.set("views", "./views");
app.set("view engine", "ejs");
let quotes = [
{
author: "Darth Vader",
text: ... | true |
6add21a3a9a5aa0044744340eb954c8dc886c30b | JavaScript | theofournier/phonebook-wemanity | /client/src/utils/helper.js | UTF-8 | 1,372 | 3.21875 | 3 | [] | no_license | import moment from 'moment';
import { phoneRegex } from './config';
export function isEmpty(value) {
return (
value === undefined
|| value === null
|| (typeof value === 'object' && Object.keys(value).length === 0)
|| (typeof value === 'string' && value.trim().length === 0)
);
}
export function isV... | true |
9bbfd3cb8a36cdf818cfc11fa2106565fdd32635 | JavaScript | LeaoDev/CodigosNewAgain | /Codes/JavaScript/curso1/arquivosVscode/array/reduce1.js | UTF-8 | 344 | 3.125 | 3 | [] | no_license | const alunos = [
{nome:'marcelo',nota: 7.7,bolsista:true},
{nome:'joao',nota: 8.9,bolsista:false},
{nome:'maria',nota: 6.3,bolsista:true},
{nome:'jose',nota: 3.2,bolsista:false}
]
const resultado = alunos.map(a => a.nota).reduce(function(acumulador,atual){
console.log(acumulador,atual)
return ... | true |
60a257bf855186adcc53041be3a3dd06121331ef | JavaScript | grconrad/tic-react-toe | /src/App.js | UTF-8 | 3,402 | 3.46875 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Board from './Board';
const TURN_NONE = '';
const TURN_X = 'X';
const TURN_O = 'O';
class App extends Component {
constructor() {
super();
// Using NaN for empty squares is a trick that just saves us a tiny bit of work when checking
... | true |
a1e989ccc688b42383bd22cc5dbd31949054f846 | JavaScript | getrona/information | /js/scripts.js | UTF-8 | 419 | 3.28125 | 3 | [] | no_license |
$(document).ready(function(){
var j = false;
do {
var input = prompt("Which Animal do you want to learn about? Turtles, Snakes, Insects");
if (input === "turtles") {
$("#turtles").show();
j = true;
}
if (input === "snakes") {
$("#snakes").show();
j = true;
}
if (inpu... | true |
dc5dd5a71a3ab8c72d4431ccec69843f11bcbc2b | JavaScript | Nathan-B21/product-manager-part3 | /client/src/components/AllProducts.js | UTF-8 | 1,605 | 2.578125 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import axios from 'axios';
import {Link, navigate} from '@reach/router';
const AllProducts = () =>{
const [products, setProducts] = useState([]);
const [deleteClicked, setDeleteClicked] = useState(false);
useEffect(()=>{
axios.get("http://loca... | true |
0a9dbb74b50accabf5e5fa87ab4a84aa37732946 | JavaScript | mlbpro417/data-structures | /sprint-one/src/functional/queue.js | UTF-8 | 638 | 3.3125 | 3 | [] | no_license | var Queue = function() {
var someInstance = {};
// Use an object with numeric keys to store values
var storage = {};
var nextToLeave = 0;
var recentlyAdded = 0;
// Implement the methods below
someInstance.enqueue = function(value) {
recentlyAdded ++;
storage[recentlyAdded] = value;
};
someI... | true |
532c93c189c4040e58b58181bc2c691191912dd1 | JavaScript | DocMcCoy/sait | /2018/js/day8/activities/activity-10/js/code.js | UTF-8 | 652 | 3.40625 | 3 | [] | no_license | console.log("Linked!")
// INSTRUCTIONS: You're managing IT inventory and want to check if
// all of your available laptops have at least 16 GB of RAM. If not, do
// some of them have at least 16 GB of RAM?
const availableLaptops = [
{ name: 'MacBook', RAM: 8 },
{ name: 'As... | true |
59049e8de79c79cf7de74a2c195624589b8ac698 | JavaScript | Nikolice/nikolice.github.io | /andersen/task_3.js | UTF-8 | 255 | 3.421875 | 3 | [] | no_license | function task_3(array) {
let result = '';
const numbers = array.split(' ');
numbers.forEach(element => {
if (element % 3 == 0) {
// alert(element);
result += element + ' ';
}
});
alert(result);
} | true |
ff240fdc10bb1c37f67b6dfdc3465623f4354e32 | JavaScript | akoreh/Fireworks | /particle.js | UTF-8 | 1,201 | 3.21875 | 3 | [] | no_license |
function Particle(x, y, color, firework){
this.position = createVector(x, y);
this.isFirework = firework;
this.lifespan = 300;
this.color = color;
if(this.isFirework){
this.velocity = createVector(0, random(-12,-17));
}else{
this.velocity = p5.Vector.random2D();
var k = random(1);
if(k... | true |
2facc5acc860b1509969741ddeba1c8c6ed2a49b | JavaScript | fahadsaeed/react-practice | /src/Person/Person.js | UTF-8 | 655 | 2.53125 | 3 | [] | no_license | import React from 'react';
import style from './Person.css'
const person = (props) => {
const styleBtn = {
backgroundColor: '#fff',
border: '1px solid red',
color: 'red',
padding : '5px 15px',
margin : '0 15px',
cursor: 'pointer'
};
return (
<div c... | true |
7560c67918a7cceaabbf7e0ea8d0979bc39a251d | JavaScript | MEthoD112/bsu-frontend | /public/js/user.js | UTF-8 | 760 | 2.5625 | 3 | [] | no_license | import { domService } from './app';
export default class User {
constructor() {
const that = this;
let user = document.getElementById('signup').innerHTML;
const promise = new Promise((resolve, reject) => {
const oReq = new XMLHttpRequest();
oReq.open('POST', '/lo... | true |
3ec832b4f9f1428b93a8b599f8144fd513d8e6e1 | JavaScript | riyadzaigirdar/nodo.js-passport-authentication | /routes/users.js | UTF-8 | 2,208 | 2.515625 | 3 | [] | no_license | const express = require("express");
const route = express.Router();
const bcrypt = require("bcryptjs")
const User = require("../models/users");
const passport = require("passport");
route.get("/login", (req, res) => res.render("login"));
route.get("/register", (req, res) => res.render("registration"));
// Handle R... | true |
68f5696867baaa45110f71df4b526155993c7596 | JavaScript | AVER343/ds-algo | /leetcode/sumofTwo.js | UTF-8 | 457 | 3.03125 | 3 | [] | no_license |
var twoSum = function(nums, target) {
let i,indexes=[];
let c=[]
let lens= nums.length
for(i=0;i<lens;i++)
{
for(j=0;j<lens&&j!=i;j++)
{
if(nums[j]==target-nums[i])
{
indexes.push(i,j)
if(indexes.length==2)
{
... | true |
8f7c407b71dc36305bfec8a7ab348790a4a819f5 | JavaScript | jddk/FAQ | /其他常见问题/rem-caochong.js | UTF-8 | 874 | 2.640625 | 3 | [] | no_license | <script src="jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
<script>
$(function(){
function resetRootFontSize(){
var winWidth=$(window).width();
$('html').css('font-size',winWidth/20);
}
resetRootFontSize();
... | true |
f7707a96d578aa7b5472ffd61245d162edaf09b0 | JavaScript | codeSmith13/linesOfCode | /app.js | UTF-8 | 1,610 | 3.40625 | 3 | [] | no_license | let friends = ["Auri", "Kvoth", "Bast", "Ambrose", "Denna"];
let sing = document.getElementsByClassName("sing")[0];
// selects friends and decreases the number of codes numCode
sing.addEventListener("click", function () {
for (i = 0; i < friends.length; i++) {
let friend = friends[i];
let div = document.creat... | true |
2302e6900139c54c6ea2f8c1db409938c17e2a0e | JavaScript | kapena/myCodeCad | /jQuery/jQueryEvents/1/script.js | UTF-8 | 487 | 3.34375 | 3 | [] | no_license | $('document').ready(function(){
// click event on our button class
$('button').click(function(){
// using a varaible named toAdd which is storing a effect that is effecting our message field with a `val` method.
var toAdd = $('input[name=message]').val();
// here we are accessing the `#messages` id an... | true |
49da8226d8d1e0ed45d3e40b4e8b0816839f4fdb | JavaScript | CuteCat911/crm | /assets/js/general/go-to-section.js | UTF-8 | 7,288 | 2.53125 | 3 | [] | no_license | // // GoToSection - ver 1.1.0
// import {findElemsClass, findFirstClass} from "./find";
// import {findCurrentParent} from "./find-current-parent";
// import {getWindowScroll} from "./window-scroll";
// import {scrollTo} from "./scroll-to";
// export let GoToSection = class {
// constructor(params) {
/... | true |
f943562f16932b4dbd612272835b02cffcaf5a2f | JavaScript | Yotsuyubi/textlint-rule-arekoresore | /src/index.js | UTF-8 | 1,119 | 2.546875 | 3 | [
"ISC"
] | permissive | "use strict";
module.exports = function(context, options = {}) {
const {Syntax, RuleError, report, getSource} = context;
return {
[Syntax.Str](node){ // "Str" node
const text = getSource(node); // Get text
const matchesAre = /あれは/g.exec(text);
const matchesKore = /これは... | true |
87cadcb1d61ef0e1dc550203613c189847cc5b17 | JavaScript | wengjiaojiao/guess_number | /src/model/compare-number.js | UTF-8 | 486 | 3.03125 | 3 | [] | no_license | /**
* Created by wengjiaojiao on 15/7/13.
*/
'use strict';
function compareNumber() {
}
compareNumber.compare = function(answer, input) {
var numberA = 0;
var numberB = 0;
for(var i=0; i < answer.length; i ++) {
if(answer[i] === input[i]) {
numberA ++;
continue;
... | true |
abcb7c62ac3f30cd31ef9de3147fbe5f2904fa31 | JavaScript | rUmbelino/code-hero | /src/components/Pagination/paginationController.test.js | UTF-8 | 1,774 | 2.8125 | 3 | [] | no_license | import {
getButotns,
getPageValue,
getResponsiveStyle,
getFirstButtonDescription,
} from './paginationController';
describe('getFirstButtonDescription', () => {
it('should get 1 as the fisrt number', () => {
const zero = getFirstButtonDescription(0);
const one = getFirstButtonDescription(1);
cons... | true |
3ce5ba3e7d8fa06b026d1b66e05ac2c966230afe | JavaScript | SEOKWOOPARK/2020-Algorithm | /programmers-carpet.js | UTF-8 | 1,483 | 3.515625 | 4 | [] | no_license | function solution(brown, yellow) {
let final = [];
let overLap;
if(yellow > 2){
for( let i = 2 ; i < yellow ; i++){
if( yellow % i === 0){
answer.push([ i, yellow / i] );
}
}
}else if(yellow === 2){
return [4,3];
}else{
ret... | true |
c86135f0532ce53e02bbc4c2088636d9e4e2bf77 | JavaScript | sashockster/Study-Tracker-App | /random_numbers.js | UTF-8 | 215 | 2.703125 | 3 | [] | no_license | var randomDate = [
]
const randomDaily = function (){
const min = Math.ceil(0);
const max = Math.floor(40);
return Math.floor(createDate() * (max - min + 1)) + min;
}
//create a function that will display 10
| true |
c0c4bb1459ce7ed8df761543ddc58379935b16b8 | JavaScript | dobrapyra/Orion | /src/vendors/polyfills/Object/assign.js | UTF-8 | 772 | 2.640625 | 3 | [] | no_license | /**
* Object.assign from EasyPure by dobrapyra
* date: 2018.05.10
* url: https://github.com/dobrapyra/EasyPure/blob/master/src/polyfills/Object/assign.js
*/
Object.assign || (
Object.assign = function( obj/*, srcObjs*/ ) {
if( obj !== Object( obj ) ) throw new TypeError( 'Object.assign called on a non-object... | true |
e35150aec66a56e584816915c8854796b21d787b | JavaScript | DorRomano94/Ecommerce-Shop | /client/src/Components/DeleteProduct/DeleteProduct.js | UTF-8 | 2,248 | 2.59375 | 3 | [] | no_license | import React, { useState, } from "react";
import { baseUrl } from "../../utils";
const DeleteProduct = () => {
const [success, setSuccess] = useState(null);
const [error, setError] = useState(null);
const [productId, setProductId] = useState(null);
const handleChange = (e) => {
const { name, ... | true |
2aa9dcfc8fd067d3d3dc5abe4c911bbe9efa405f | JavaScript | Aleleonel/py_codes | /Aulas_javascript/aula12/ex00012.js | UTF-8 | 815 | 3.703125 | 4 | [] | no_license | var agora = new Date()
var diaSem = agora.getDay()
var hora = agora.getHours()
console.log(`Agora são exatamente ${hora}`)
// console.log(`Dia da Semna ${diaSem}`)
switch (diaSem) {
case 0:
console.log('Domingo')
break;
case 1:
console.log('Segunda-feira')
break
... | true |
0325e11f0a0182e3522e67b014cd4d671f98112c | JavaScript | lachhebo/ProjetEmploi | /public/js/verif_formulaire.js | UTF-8 | 8,039 | 2.78125 | 3 | [] | no_license | window.onload=function(){
var onlyletters = /^[A-Za-z]+$/;
var colorclass;
var name = document.getElementById("name");
var name_desc = document.getElementById("name_problem");
var firstname = document.getElementById("firstname");
var firstname_desc = document.getElementById("firstname_problem");
var m... | true |
00612f65efc06aac35f8290df53f9bfa57fc40df | JavaScript | noortotah/happyShop | /projects/backend/models/category.model.js | UTF-8 | 2,874 | 2.515625 | 3 | [] | no_license | const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const categorySchema = new Schema({
title : {type: String, required: true},
img : {type: String, required: false},
subCategories : [{
title : {type: String, required: true},
img : {type: String, required: false},
}]
});
module.expor... | true |
55e3d3c5f141b58d3a3aac9252e02f1f6aa4a11b | JavaScript | AlexandreBarbez/WebComponents-Playground | /polymer/PolymerClicker.js | UTF-8 | 806 | 2.625 | 3 | [] | no_license | import {PolymerElement, html} from '@polymer/polymer/polymer-element.js';
import '@polymer/iron-icons/iron-icons.js';
class PolymerClicker extends PolymerElement {
constructor() {
super();
this.counter = 0;
}
increment() {
this.counter += 1;
}
static get template() {
... | true |
0c5b72f20e27b90593c9bfabd423e0410ea4be68 | JavaScript | codistica/codistica-js | /packages/codistica-core/src/modules/compose-fn.js | UTF-8 | 578 | 3.046875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | /** @module core/modules/compose-fn */
/**
* @description Uses chaining to compose a single function from input functions.
* @this {*}
* @param {...Function} fns - Functions.
* @returns {function(...*): *} Composed function.
*/
function composeFn(...fns) {
const length = fns.length;
return (...args) => {
... | true |
d0fe310588d96ce3160d5c2043fdd051cd1603fc | JavaScript | kartikeya-123/academic-council | /public/script.js | UTF-8 | 1,878 | 2.921875 | 3 | [] | no_license |
const navToggleBtn=document.querySelector(".navbar-nav-toggle");
const navbarNav=document.querySelector(".navbar-nav");
const subMenuToggleBtn=document.querySelectorAll(".navbar-nav .sub-menu-toggle");
navToggleBtn.addEventListener("click",function () {
if(navbarNav.classList.contains("open")){
navbarNav.cla... | true |
aecb3ffc03d6f04b577fc56d5ef0f974a0ed5799 | JavaScript | jetiny/test-repo | /2017-12/charlie/lib/randomString.spec.js | UTF-8 | 448 | 2.671875 | 3 | [
"MIT"
] | permissive | import test from 'ava'
import randomString from '../lib/randomString'
test('test random string', t => {
const r = randomString()
const r0 = randomString(8)
const r1 = randomString(10, '$lu', '{}')
const r2 = randomString(12, '$lu')
t.true(typeof r === 'string')
t.true(r.length === 6)
t.true(typeof r0 ==... | true |
a757153df75a7a392826ba2a5a3a0788d65cedd5 | JavaScript | CarolSum/PGMS | /src/api/p-user.js | UTF-8 | 3,206 | 2.625 | 3 | [] | no_license | import axios from 'axios'
import { stringify } from 'querystring'
import { throwErrorIfExists } from '../util/apiHelper'
const ROOT = '/api/puser/'
/**
* Login with a post to login url with the data {username, password, remember}.
* If login succeeds, the promise will be resolved.
* Otherwise the promise will be r... | true |
39ffca7e49963f1ec8b6c2bd60710032568183bb | JavaScript | drewtato/chikin | /game.js | UTF-8 | 8,577 | 2.96875 | 3 | [] | no_license | // Kickstart everything
window.addEventListener("load", () => {
let delayer = sleep(1000);
screenlog("Loaded page");
Promise.all([metaPromise, tilesPromise, delayer]).then(list => {
gameload(list[0], list[1]);
});
});
window.addEventListener("resize", updateSize);
// Promises for loading files
... | true |
f515abdf8671953b4d139e95133164ef54b3ca09 | JavaScript | brw31415/StrategyDesign | /rpg_stats.js | UTF-8 | 3,295 | 2.875 | 3 | [] | no_license | // A module for basic stats
// Initialize stats at the start of a game, including possibly after a loss
var InitStatOps = [];
InitStatOps.push(function() {GameState.FrameNum = 0;});
InitStatOps.push(function() {SetLocation(GameData.InitLocation);});
InitStatOps.push(function() {GameState.Stats = {HP:10, MaxHP:10... | true |
dc4edef79b5c2f1919d3085b379c60c92851739b | JavaScript | treazer12345/treazer_frontend | /src/reducer/locationReducer.js | UTF-8 | 491 | 2.71875 | 3 | [] | no_license | export const initialState = {
latitude: null,
longitude: null,
locality: null,
landmark: null,
};
export const reducer = (state, action) => {
if (action.type === "SET_LOCATION") {
return {
...state,
latitude: action.payload.latitude,
longitude: action.payload.longitude,
};
} else ... | true |
1f3356c4f4f29b3458f81e519851ccd3f7c6eef3 | JavaScript | Hellenic/hellenic.github.io | /playground/js/main.js | UTF-8 | 3,468 | 2.6875 | 3 | [] | no_license | "use strict";
var SCREEN_WIDTH = window.innerWidth,
SCREEN_HEIGHT = window.innerHeight,
SCREEN_WIDTH_HALF = SCREEN_WIDTH / 2,
SCREEN_HEIGHT_HALF = SCREEN_HEIGHT / 2;
var isWebkit = /Webkit/i.test(navigator.userAgent),
isChrome = /Chrome/i.test(navigator.userAgent),
isMobile = !!("ontouchstart" in window),
... | true |
91da3011ef1f9f7420442feae7a34c3ee2166bf8 | JavaScript | DorukhanDoruk/Flappy-AI | /src/App.js | UTF-8 | 6,960 | 2.65625 | 3 | [] | no_license | import React from 'react';
import {NeuralNetwork} from './nn';
import './App.css';
const GENISLIK = 1280;
const YUKSEKLIK = 720;
const BORU_GENISLIK = 80;
const BORU_BOSLUK = 180;
const TOPLAM_KUS = 250;
const FPS = 1000;
class Kus {
constructor(ctx, beyin, kuvvetlikus) {
this.ctx = ctx;
this.x = 100;
t... | true |
9c766d0a35d4099ffcf0dfb26104370c3bb08de7 | JavaScript | s19022/TIN | /04/4e.js | UTF-8 | 442 | 3.671875 | 4 | [] | no_license | function findLongestWord(string){
if(string === undefined) return string;
let spliterator = " ";
let arrayOfWords = string.split(spliterator);
let max = arrayOfWords[0].length;
let position = 0;
for(let i = 1; i < arrayOfWords.length; i++){
if(arrayOfWords[i].length > max){
max = arrayOfWords[i].length... | true |
5fc006c3af6a4461b5cd5728ede161e754e025e3 | JavaScript | ryabovamarie/guessmelody | /js/game-model.js | UTF-8 | 1,000 | 2.796875 | 3 | [] | no_license | import getScore from './get-score';
import {TOTAL_TIME, TOTAL_LIVES} from './consts';
export default class GameModel {
constructor() {
this.lives = TOTAL_LIVES;
this._time = TOTAL_TIME;
this._lastAnswerTime = TOTAL_TIME;
this._answers = [];
}
addAnswer(answer) {
if (!answer) {
this.liv... | true |
3db7a736ac36b599307aeb6d8e8d68ea1fda0424 | JavaScript | nobiruwa/gistish | /push-server-cometd/src/main/webapp/01-connection-establishment.js | UTF-8 | 4,097 | 2.53125 | 3 | [] | no_license | /*global jQuery:false */
(function($, window, document, undefined) {
window.addEventListener("load", function() {
/* クエリパラメータの処理 */
let names = ["path", "transport", "fallback-transport", "user", "room"];
// クエリパラメータを取得します
function getQueryParameter() {
return new window.URLSearchParams(window.... | true |
d5ea4caec69e09753ebc352112ccf2f982bd1014 | JavaScript | PraveenMatthewPhilip/react-code-snippets | /src/hooks/useEffect/UseEffectMouseMove.js | UTF-8 | 739 | 3 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
const UseEffectMouseMove = () => {
const [ x, setX ] = useState(0);
const [ y, setY ] = useState(0);
const MouseMoveHandler = (e) =>{
setX(e.clientX);
setY(e.clientY);
}
useEffect((e)=>
{
console.log("useEffect ... | true |
5181c87953028ad1d7f3d371447ec90b9ecf21d1 | JavaScript | AlexSm13/javascript-task-2 | /phone-book.js | UTF-8 | 3,846 | 3.234375 | 3 | [] | no_license | 'use strict';
/**
* Сделано задание на звездочку
* Реализован метод importFromCsv
*/
exports.isStar = true;
/**
* Телефонная книга
*/
var phoneBook = [];
function inputValidation(phone, name, email) {
return phone !== undefined && phone !== null && /^\d{10}$/.test(phone) &&
typeof name === 'string' ... | true |
f4e0a00efe22e2830f9245e45bbbf0106cf6e4fd | JavaScript | tasos14/reactQueens | /src/components/App/context.js | UTF-8 | 6,433 | 2.65625 | 3 | [
"MIT"
] | permissive | import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';
const QueensContext = React.createContext(null);
function drawRedBlocks(row, col, gridSize, redBlocks) {
let absDist;
const _redBlocks = redBlocks.slice(0);
for (let i = 0; i < gridSize; i++) {
... | true |
0d5cd4bb6801ff4dac970f5d76df7117434698f5 | JavaScript | MitchvanWijngaarden/snippets | /13.2 subtypes.js | UTF-8 | 254 | 2.671875 | 3 | [] | no_license | class Bird {
fly() {
return "*flap flap*";
}
}
class Parrot extends Bird {
}
class Chicken extends Bird {
fly() {
throw "I can't fly..";
}
}
alert(new Parrot().fly(); // returns flap flap
alert(new Chicken().fly(); // error "I can't fly.."
| true |
330a0d6ef709c519e861c1d657f0b467a9536ffd | JavaScript | nci-hcmi-catalog/portal | /ui/src/utils/modelImageProcessor.js | UTF-8 | 484 | 3 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Processes file hits from models into an array of image objects
* if there are images in the file hits.
* @param {Array} files - File hits from GraphQL query
* @returns {Array || false} - Returns either the processed images or false
*/
const modelImageProcessor = function(files) {
const images = files.filte... | true |
90eb2f1518a984fbb185c8586986ac6de3032ebe | JavaScript | JamesKuta/JamesKuta.github.io | /Thrice_Match/js/Background.js | UTF-8 | 1,121 | 3.265625 | 3 | [
"MIT"
] | permissive | class Background
{
constructor(canvas, imageURL)
{
// reference to self
let background = this;
//properties
background.canvas = canvas;
background.context = background.canvas.getContext("2d");
background.x = background.canvas.width - background.... | true |
debd68f2e9d9d430157d69210abf94ee3da79847 | JavaScript | gustavofreitasdev/aprendendo-pixijs | /src/js/stage2.js | UTF-8 | 1,907 | 3.390625 | 3 | [] | no_license | /**PIXI.Application descobre se é necessário usar a API de desenho do Canvas ou WebGL para renderizar gráficos,
* dependendo de qual está disponível no navegador da web que você está usando.
* Seu argumento é um único objeto chamado objeto de opções.
* Você pode definir muito mais propriedades opcionais dentro de... | true |
8ed42efd9ee05db4771eba5d9f5c4c58c636024e | JavaScript | AaronBuxbaum/codinginterviewquestions | /4. Trees and Graphs/__tests__/4.4 - Check Balanced.js | UTF-8 | 448 | 2.75 | 3 | [] | no_license | import { buildBinaryTree } from "../../Data Structures/BinaryTree";
import { range } from "lodash";
import { isBalanced } from "../4.4 - Check Balanced";
test("Check Balanced", () => {
const balanced = buildBinaryTree(range(10));
expect(isBalanced(balanced)).toBe(true);
const extraTree = buildBinaryTree(range(5... | true |
bf09f356868f2c566c61f55a5367d4f6c27d0739 | JavaScript | vrodgreg/beerd | /src/components/Breweries.js | UTF-8 | 2,313 | 2.640625 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import { Link, useHistory } from "react-router-dom";
import axios from "axios";
//>>>>>>> If ever to use full database - may need to paginate this list of breweries
function Breweries(props) {
let [breweries, setBreweries] = useState([]);
let history = useHist... | true |
0ac3935ee91324f8b641fad471f4a729114c3672 | JavaScript | fjaviergs/Matacuas | /es.upm.dit.isst.matacuas/war/js/subirImagen.js | UTF-8 | 613 | 2.8125 | 3 | [
"MIT"
] | permissive | function subirImagen(input) {
var reader = new FileReader()
reader.onload = function (e) {
var imageString = e.target.result;
// HACER VISIBLE LA MINIATURA CON LA IMAGEN SUBIDA
var miniature = document.getElementById("miniature");
miniature.style.display="block";
miniature.src = imageString;
document.g... | true |
7557d4605a4a675488c752a724bf471188320888 | JavaScript | knut0815/web-experiments | /webgpu/basics-04-compute-shader-multiply-matrices/app.js | UTF-8 | 4,796 | 2.828125 | 3 | [
"MIT"
] | permissive | import { getGpuDevice } from "../../js/webgpu/device.js";
import glslangModule from "../../thirdparties/glslang.js";
import { getShaderSource } from "../../js/webgpu/shader_loader.js";
// https://gpuweb.github.io/gpuweb/#GPUBufferq
// https://github.com/gpuweb/gpuweb
// https://developers.google.com/web/updates/... | true |
d4bde898e129082d0c823a916df949794a8049cf | JavaScript | DimaTrue/ShowProducts | /src/reducers/userData.js | UTF-8 | 1,132 | 2.640625 | 3 | [] | no_license | import * as user from '../action-types/userData'
const initialState = {
isLoading: false,
signUpResponse: {},
isLogin: false,
userData: '',
error: '',
}
export default function (state = initialState, action) {
switch (action.type) {
case user.SIGN_UP_INIT:
return { ...state, isLoading: true };
... | true |
fb39dbcbff857ff765760a3339bbcd5fd51ada4f | JavaScript | hypn05/EShopee | /js/Installation.js | UTF-8 | 3,146 | 2.859375 | 3 | [] | no_license | /**
* Created by Siddhant Mehta on 1/4/2015.
*/
function submitInstallationForm()
{
var installationForm=document.getElementById("installationForm");
var serverName=installationForm.serverName;
var databaseName=installationForm.databaseName;
var username=installationForm.username;
var pas... | true |
5a20b8b6963fe9c4cb904f90ff4eb603501c30c1 | JavaScript | simrangleason/HTML5-Experiments | /js/vec3.js | UTF-8 | 2,850 | 3.296875 | 3 | [] | no_license |
function Vec3(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}
Vec3.prototype.vec3 = function() {
return [this.x, this.y, this.z];
}
Vec3.prototype.zero = function() {
this.x = 0;
this.y = 0;
this.z = 0;
return this;
}
Vec3.prototype.clone = function() {
return new Vec3(this.x, t... | true |
a02d22efdb7c52b336dbc764e435212ef5b77a5e | JavaScript | partg952/HTML-Editor3 | /script.js | UTF-8 | 785 | 2.59375 | 3 | [] | no_license | let button = document.getElementById('run')
let iframe = document.getElementById('running-platform')
let editor = document.getElementById('editor')
let clear = document.getElementById('clear')
clear.addEventListener('click' , ()=>{
iframe.src = ""
})
button.addEventListener('click', () => {
execute()
})
edito... | true |
a620a1424da44fb3e3f5949d15b511c4684fad4a | JavaScript | xiaohesong/bill | /client/app/bundles/HelloWorld/components/records/record.jsx | UTF-8 | 2,647 | 2.640625 | 3 | [] | no_license | import React from 'react';
export default class Record extends React.Component{
constructor(props) {
super(props);
this.state = {
edit: false
}
// this.handleClickDelete = this.handleClickDelete.bind(this)
// this.handleClickSetToForm = this.handleClickSetToForm.bind(this)
// this.handle... | true |