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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0d7c7edee63a692ca13e8330528cf261df8333be | JavaScript | micuat/bci_art | /svm_control_nodejs/static/mobile/draw.js | UTF-8 | 1,290 | 3.03125 | 3 | [
"MIT"
] | permissive | // p5js
var N = 2;
var hemis;
function Hemi() {
this.bang = 5;
this.bangMax = 10;
this.predicted = function() {
this.bang += 1;
if(this.bang > this.bangMax) this.bang = this.bangMax;
}
this.unpredicted = function() {
this.bang -= 1;
if(this.bang < 0) this.bang = 0;
}
};
function setup() {... | true |
37b1220e5fa0e8f52c611db37b64e7012919a7c7 | JavaScript | elianetl/elbdpoo | /src/dao/comen.js | UTF-8 | 1,047 | 2.796875 | 3 | [] | no_license | const Comenta = require("../model/comenta")
var comenta = {
create: async function (objeto){
try{
let comen = await comenta.create(objeto);
console.log(comen);
}
catch(e){
throw new error (name = "Erro ao adicionar o objeto ")
console.log(e.name)
}
}
,
let: async function (){
try{
... | true |
f5a9fff50c3fb409094cbad5d6ed28664d86ee10 | JavaScript | clamusO46002056/HW2-O46002056 | /public/js/script_aziende.js | UTF-8 | 6,906 | 2.859375 | 3 | [
"MIT"
] | permissive |
function onResponse(response){
return response.json();
}
function onJsonAzienda(json){
for(let i=0; i<json.length; i++){
const elemento = document.createElement('div');
elemento.id='marca'+i;
const contenitore= document.querySelector('#contenitore');
contenitore.appendChild(ele... | true |
9e5eafd9a0697dd5ca5670b6ec781fb103b31665 | JavaScript | farivindra11/Logic-Javascript | /8.js | UTF-8 | 897 | 3.9375 | 4 | [] | no_license |
// console.log(pola("42#3 * 188 = 80#204"));
// // console.log(pola("42#3 * 188 = 80#204"));
// // console.log(pola("8#61 * 895 = 78410#5"));
/*
output :
[8, 9]
[7, 9]
*/
function pola(str) {
let hasil = [];
let hasilSplit = str.split('=');
// console.log(hasilSplit)
let hasil3 = hasilSplit[1].trim... | true |
c50b507ec815cf0cec663c9bbd458172db90538f | JavaScript | tejitak/react-state-animation | /lib/Loop.js | UTF-8 | 2,538 | 2.515625 | 3 | [] | no_license | "use strict";
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps)... | true |
d57b5dc2952770d60410f74a6f4690dcf33aee2c | JavaScript | Yunsol/nodejs_study | /mission02/client.js | UTF-8 | 420 | 2.890625 | 3 | [] | no_license | //net Module 호출
var net = require('net');
var client = net.connect({port:8107, host:'localhost'}, function(){
console.log('서버에 접속되었습니다.');
client.write('안녕! \r\n');
});
client.on('data',function (data) {
console.log('서버가 보낸 메세지 : '+data.toString());
client.end();
});
client.on('end',function () {
... | true |
1e43e7bceaba87c1431e741738d400dcab67b50f | JavaScript | BohdanBilous/mapApi | /js/select-search.js | UTF-8 | 5,101 | 2.578125 | 3 | [] | no_license | /* MODULE IMPORTS */
import {
animateScroll
} from "./generic-helpers";
export class selectSearch {
constructor(selectsContainer, selectClose, emptyElement, imageIcon = false, secondList = false, callBackOnSelectChange) {
this.selectedContainerElement = selectsContainer;
this.selectsContainer ... | true |
997da96ad5fc591be039c3e015fa9df05b20fd0e | JavaScript | Shawnwood97/ArrayOfTweets | /app.js | UTF-8 | 2,850 | 3.390625 | 3 | [] | no_license | // Collaborated with Brittany.
// Crates an array of objects with different items in each one.
var tweets = [
{
tweet: `Getting older. I used to be able to run a 4-minute mile, bench press 380 pounds, and tell the truth.`,
username: `@ConanOBrien`,
created_at: `10-25-2020`,
age: 57,
},
{
twe... | true |
59369b7f2ebc2ee9ecf4bd3ee5dfc15970ca6b69 | JavaScript | mjkonieczny/devenv-design-patterns | /movies/1. builder-director/src/graphBuilder.js | UTF-8 | 371 | 2.859375 | 3 | [
"MIT"
] | permissive | export const graphBuilder = (type) => {
const graph = {};
return {
addVertex: function addVertex(vertex) {
graph[vertex] = [];
return this;
},
addEdge: function addEdge(from, to) {
graph[from].push(to);
if (type === 'undirected') {
graph[to].push(from);
}
r... | true |
2f4f04b8e9372799047e03ba12047ef7820b13dd | JavaScript | jeseokKim/spring-boot-test | /src/main/webapp/assets/js/mask.js | UTF-8 | 3,070 | 2.546875 | 3 | [] | no_license | $.extend($.inputmask.defaults, {
placeholder: ""
});
$.fn.unmask = function () {
if (this[0].tagName == "FORM") {
$(":input", this).each(function(index, el) {
remove(el);
});
} else {
remove(this);
}
function remove(element) {
var $element ... | true |
9a52982e9ef8ddbed2cd923b5cab10aa5ff1d7a1 | JavaScript | muraken12003032/poker | /src/classes/card.js | UTF-8 | 718 | 3.234375 | 3 | [] | no_license | class Card {
constructor(number) {
this.numeric = this.get_numeric(number);
this.suit = this.get_suit(number);
this.mark = this.get_mark(this.suit);
this.is_visible = false;
}
get_numeric(number) {
return ( number % 13 ) + 1;
}
get_suit(number) {
let suits = ['spade', 'heart', 'diam... | true |
16f88d77fabbf648bee1d2ee7ae778b1c71d7abe | JavaScript | AndrewMedvedev42/Event-Calendar | /script/form.js | UTF-8 | 1,429 | 3.359375 | 3 | [] | no_license | const createNewBtn = document.getElementById("createbtn")
const formMessage = document.getElementById("formImputfield")
const selectDay = document.getElementById("selectday")
const selectTime = document.getElementById("sectecttime")
const selectPerson = document.getElementById("selecperson")
//makes a key for local st... | true |
8b48a1cb38cdbb3749af2ddb5c6b5210fd18d2db | JavaScript | LukeM11701/PixelPizza | /pixel-pizza/src/functions/color/hexToRgb.js | UTF-8 | 586 | 3.390625 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* Converts a hexidecimal string
* into red (0-255), green (0-255) and blue (0-255) values
* @param {string} hex The hexidecimal string
* @returns {{
* red: number,
* green: number,
* blue: number
* }} A dictionary with the red, green and blue values
* @since 2020-12-12
*/
const hexToRgb... | true |
f160a5f2505d11cf122052c3aa8cb418b6610e8e | JavaScript | mattcreager/talks | /bin/util.js | UTF-8 | 289 | 2.78125 | 3 | [] | no_license | 'use strict'
exports.bool = function (str) {
if (str === void 0) return false
return str.toLowerCase() === 'true'
}
exports.int = function (str) {
if (!str) return 0
return parseInt(str, 10)
}
exports.float = function (str) {
if (!str) return 0
return parseFloat(str, 10)
}
| true |
72baafdec4188fd3a4aad5b28b82623bd8b8e5fe | JavaScript | itsar19-20/mes | /springmes/target/classes/static/js/home.js | UTF-8 | 1,754 | 3.078125 | 3 | [] | no_license | /**
* HOMEPAGE
*/
$(() => {
/*
* SETUP
*/
localStorage.clear();
/*
* UPDATE
*/
window.setInterval( aggiorna, 5000);
/*
* BUTTONS
*/
$('#linea001').click(() => {
localStorage.setItem('codice', '001');
location.href = '/log... | true |
17843e7edc1eaf59b1b7b4198dc28dbc15ea1a08 | JavaScript | JanetBird/shielarose_Janet_Marc_Project6 | /src/App.js | UTF-8 | 10,982 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
import './styles/App.css';
import firebase from './firebase';
import Nav from './Components/Nav';
import SignInPopUp from './Components/SignInPopUp';
import SignUpForm from './Components/SignUpForm';
import RegistryDashboard from './Components/RegistryDashboard';
import Registr... | true |
6ac149d8edbbbd937f47e4028eb23e49e7914fee | JavaScript | clabby/medio | /app/lib/dispatcher.js | UTF-8 | 555 | 2.53125 | 3 | [
"MIT"
] | permissive | module.exports = {
dispatch,
dispatcher,
setDispatch
};
const dispatchers = {};
let _dispatch = function () {};
function setDispatch (dispatch) {
_dispatch = dispatch;
}
function dispatch (...args) {
_dispatch(...args);
}
function dispatcher (...args) {
const str = JSON.stringify(args);
let handler = ... | true |
cef1c113c78bbd4d4b3424e424dedc9debb4c7e6 | JavaScript | jhaberle/unit-4-game | /assets/javascript/game.js | UTF-8 | 2,331 | 4.125 | 4 | [] | no_license | // assigning a random number to each crystal at the start of the game
var computerRandomNumber = 19 + Math.floor(Math.random() * 120);
var crystalValue1 = 1 + Math.floor(Math.random() * 12);
var crystalValue2 = 1 + Math.floor(Math.random() * 12);
var crystalValue3 = 1 + Math.floor(Math.random() * 12);
var crystalValue4... | true |
eeebee695c54fb6c2102249bdfe83dd24745e0b5 | JavaScript | cleancoderocker/javascripthandbuch | /Kapitel04/Listing_04_160/main.js | UTF-8 | 216 | 3.5625 | 4 | [] | no_license | 'use strict';
const numbers = [2,3,4,5];
function print(item) {
console.log('Item: ' + item);
}
function modulo(item) {
console.log(item + ' % 2 = ' + item % 2);
}
numbers.forEach(print);
numbers.forEach(modulo); | true |
4d4c6858a61d9668276cddb9a9164797f011ee88 | JavaScript | sabine33/tictactoe-vue | /src/Game.js | UTF-8 | 2,820 | 3.171875 | 3 | [] | no_license | class Game {
constructor() {
this.players = []
this.winningCondition = [
["00", "01", "02"],
["00", "11", "22"],
["00", "10", "20"],
["02", "11", "20"],
["10", "11", "12"],
["02", "12", "22"],
["01", "11", "21"],
["20", "21", "22"]
];
this.currentTurn = ... | true |
60a854da9877e8447904260f96adbe0c231aecf8 | JavaScript | bigchange/Node-js | /src/examples/web_server/express_demo.js | UTF-8 | 4,383 | 2.8125 | 3 | [] | no_license | //express_demo.js 文件
var express = require('express');
var util = require('util')
var path = require("path")
var bodyParser = require('body-parser');
var fs = require('fs')
const child_process = require('child_process');
var app = express();
var multer = require('multer');
// 创建 application/x-www-form-urlencoded 编码... | true |
c9e81cc87348fbb912e1ad4f0f54f5ace0b20cf1 | JavaScript | AAI-USZ/FixJS | /input/100+/after/1eaa72437bef983fe225a28f6d4e3b2ff7a656ec_0_1.js | UTF-8 | 2,830 | 2.625 | 3 | [
"MIT"
] | permissive | function() {
// todays date values
var todayDate = new Date(),
todayYear = todayDate.getFullYear(),
todayMonth = todayDate.getMonth() + 1,
todayDay = todayDate.getDate(),
// currently selected values
selectedYear = parseInt($year.val(), 10)... | true |
8f820e6f045f18398ee3d4fd4276d0548cbde055 | JavaScript | borzecki2/Zadania | /JS4/script.js | UTF-8 | 2,078 | 3.9375 | 4 | [] | no_license | //Zadanie 1//
var z1 = 5;
var z2 = 9;
if (z1 > z2) {
console.log( "Wieksza jest z1");
} else {
console.log("Wieksza jest z2");
}
//Zadanie2//
var n1 = 5;
var n2 = 9;
var n3 = 22;
if (n1 > n2 && n1 > n3) {
console.log( "Wieksza jest n1");
} else if(n2 > n1 && n2 > n3) {
console.log("Wie... | true |
a0eaf950b2ed0f61231bffdbf4f030aba2e83ed8 | JavaScript | Stan1399/Recreational-areas-catalogue | /public/views/pages/registration.js | UTF-8 | 1,961 | 2.625 | 3 | [] | no_license | let Registration = {
render: async () => {
return /*html*/`
<main class="form">
<div class="registration">
<h2>We are glad you decided to join us</h2>
<form id="registration-form">
<div class="registration-form">
... | true |
237f866ae53ab6b576b7abf53476d01193623e20 | JavaScript | sljudge/chess_openings | /src/reducers/castling.js | UTF-8 | 2,808 | 2.6875 | 3 | [] | no_license | import {
MOVE_PIECE,
CASTLE_KING_SIDE,
CASTLE_QUEEN_SIDE,
} from '../actions/movePiece'
import { RESET } from '../actions/updateData'
const initialState = {
//null / true / false
white: {
kingSide: null,
queenSide: null
},
black: {
kingSide: null,
queenSide:... | true |
6cbe4ccf7eeba1883212027570c271be2db204cb | JavaScript | maxx-coffee/docket | /src/utils/dates.js | UTF-8 | 441 | 3.078125 | 3 | [] | no_license | import moment from 'moment';
export function monthStartDate(month, year) {
let date = moment(`${month} ${year}`).startOf('month');
return weekStartDate(date);
};
export function monthEndDate(month, year) {
let date = moment(`${month} ${year}`).endOf('month');
return weekEndDate(date);
};
export function week... | true |
cb2cc53f4b39915a1d03d94551e0319271ef7e82 | JavaScript | murrayjbrown/hello-cycle-react | /src/app/cycle-hello-react.es6 | UTF-8 | 686 | 2.78125 | 3 | [
"MIT"
] | permissive | //
// cycler-hello-react.js
// - demonstrates simple Cycle.js framework with React UI components.
//
const Cycle = require('cycle-react');
const React = require('react');
const ReactDOM = require('react-dom');
const CycleReactor = Cycle.component('Hello', function computer(interactions) {
return interactions.get('O... | true |
156e635ac2bac37d209a8e8250c37a5a851e375a | JavaScript | Heog/asteroid | /scripts/rock.js | UTF-8 | 3,744 | 2.6875 | 3 | [] | no_license | define(["three.min", "utils"], function (th, ut){
//console.log("player cons");
return{
rock: function(name, size, world, startPosition, startVelocity){
this.name = name;
this.geometry = new THREE.SphereGeometry(size, 6, 4 );
this.material = new THREE.MeshPhongMaterial( {color: 0xffff00, sha... | true |
46d2de4870acb8ebd595c6ec258a5a0cd23019fd | JavaScript | stoic-plus/FCC_Front-End-Development-Certification_Projects_BasicAndIntermediate | /buildAWikipediaViewer/wikiViewer.js | UTF-8 | 965 | 2.671875 | 3 | [] | no_license | $(document).ready(function(){
$("#search").on("click", function(){
var searchTerm = $("#searchTerm").val();
var url = "https://en.wikipedia.org/w/api.php?action=opensearch&search=" + searchTerm + "&format=json";
var apiData = [];
$.ajax(url, {
dataType: "json",
... | true |
e45ca3c357e2f9721d3938be7e37de587ef65b1b | JavaScript | akgngr/solar | /pages/form.js | UTF-8 | 1,250 | 2.65625 | 3 | [] | no_license | import React from "react";
import axios from "axios";
export default class MyForm extends React.Component {
constructor(props){
super(props)
this.state = {
email: "",
message: ""
}
}
handleEmailChange = (event) => {
this.setState({
email : event.target.value
})
}
... | true |
9a03307bb1ee11a2ce5c99e33293e3afe05f6018 | JavaScript | watcharaphonJ/PowerSpotTravelThailand | /client/src/app/component/search.js | UTF-8 | 18,255 | 2.703125 | 3 | [] | no_license | import React, { Component } from "react";
import "./search.css";
import water from "../img/water.png";
import spirit from "../img/spirit.png";
import earth from "../img/earth.png";
export default class search extends Component {
constructor(props) {
super(props);
this.state = {
Earth: "",
Spiritua... | true |
e3f21655016cae9d39920f721d1395529b502d44 | JavaScript | vishwaspaikra007/FIT-X | /src/redux/reducers/userReducer.js | UTF-8 | 295 | 2.609375 | 3 | [] | no_license | let initialState = {
}
const userReducer = (state = initialState, action) => {
if(action.type == "USER")
{
const stateCopy = JSON.parse(JSON.stringify(state))
stateCopy.user = action.user
return {...stateCopy}
}
return state
}
export default userReducer | true |
32d32900e081408a1cc696e2b0fdcbc3a50763b9 | JavaScript | ven0226/coding-exercises | /generate-parenthesis.js | UTF-8 | 1,623 | 3.734375 | 4 | [] | no_license |
// var generateParenthesis = function(n) {
// const permute = (val, l, r, perms) => {
// if (l === r){
// perms.add(val.join(''));
// return perms;
// }
// for (let i=l; i< r; i++){
// let t = val[i];
// val[i] = val[l];
// val[l] = t;
// perms = permute(val, l+1, r, p... | true |
cb335fb8eea3dfa560044ebcf2b82ea1f3edf8e2 | JavaScript | asciimo82/cleantheroom | /main.js | UTF-8 | 971 | 4.28125 | 4 | [] | no_license | /*Question 1: Clean the room function: given an input of [1,2,4,591,392,391,2,5,10,2,1,1,1,20,20],
make a function that organizes these into individual array that is ordered.
For example answer(ArrayFromAbove) should return: [[1,1,1,1],[2,2,2], 4,5,10,[20,20], 391, 392,591].
Bonus: Make it so it organizes strings... | true |
487593110d22a6dc534090c70140af9313e507ca | JavaScript | DaoudMoussa/js-jsnacks-blocco-1 | /js-jsnack3/main.js | UTF-8 | 852 | 4.0625 | 4 | [] | no_license | // JSnack 3: Il software deve chiedere per 5 volte all’utente di inserire un numero.
// Il programma stampa la somma di tutti i numeri inseriti.
var somma = 0;
for (var i = 0; i < 5; i++) {
//inserimento numero
var numeroInserito = parseFloat(prompt("inserire il numero " + (i + 1)));
//verifica che ... | true |
1897dda338c56ef96efbc6deb8c0cd8be5fcf3c8 | JavaScript | MostlyJS/mostly-poplarjs | /src/api_builder.js | UTF-8 | 9,127 | 2.546875 | 3 | [
"MIT"
] | permissive | const { EventEmitter } = require('events');
const makeDebug = require('debug');
const util = require('util');
const assert = require('assert');
const _ = require('lodash');
const path = require('path');
const ApiMethod = require('./api_method');
const debug = makeDebug('mostly:poplarjs:api-builder');
/**
* @class A... | true |
d554b97676bcc8e7b7d83eb044daa78ffb1f6156 | JavaScript | lebrun-x/NLPFV2 | /NLPF1/web/js/client/menu.js | UTF-8 | 586 | 2.6875 | 3 | [] | no_license | $(document).ready(function () {
/*** Met à jour le menu lors du changement de page ***/
$(".menu a[href!='#']").click(function () {
$(".menu a").removeClass("current");
$(this).addClass("current");
});
setCurrentPage();
});
function setCurrentPage() {
$(".menu a").removeClass("c... | true |
a0f4b010f70c46b2d434f5b8f89bd25ecb974fd6 | JavaScript | boi4o95/JavaScript-Advanced | /09. Objects and Inheritance Exercises/01.Array extension.js | UTF-8 | 668 | 3.734375 | 4 | [
"MIT"
] | permissive | (function () {
Array.prototype.last = function () {
return this[this.length - 1];
}
Array.prototype.skip = function (n) {
let count = Number(n);
return this.slice(count, this.length);
}
Array.prototype.sum = function () {
let sum = 0;
for (let i = 0; i < this.... | true |
d2b4eae0cb80b18d9b3833b54f93b790671527c4 | JavaScript | tbrandle/Flash-Cards | /tests/round-test.js | UTF-8 | 2,583 | 3.140625 | 3 | [] | no_license | import { expect } from 'chai';
import { Round } from '../scripts/round.js';
import { Deck } from '../scripts/deck.js';
import { Card } from '../scripts/cards.js';
describe('Testing Round', function () {
let card1 = new Card("What is the capital of Alaska?", "Juneau")
let card2 = new Card("Approximately how many... | true |
d0c2490fadb04e36a5f60d034e5b1b8d4700ae60 | JavaScript | Burning-Shadow/leetcode | /mean-of-array-after-removing-some-elements[1619].js | UTF-8 | 264 | 3.125 | 3 | [] | no_license | /**
* @param {number[]} arr
* @return {number}
*/
var trimMean = function (arr) {
const n = arr.length;
arr.sort((a, b) => a - b);
let partialSum = 0;
for (let i = n / 20; i < 19 * n / 20; i++) partialSum += arr[i];
return partialSum / (n * 0.9);
};
| true |
ce4e3a8db4ba536efe758feffc83a2ce8fc5e1ae | JavaScript | wade1990/navierula.github.io | /hw/A2/clock_1.js | UTF-8 | 2,523 | 3.234375 | 3 | [] | no_license | //var cursive;
// function preLoad() {
// cursive = loadFont('Amarillo.otf');
// }
function setup() {
createCanvas(640, 690);
//cursive = loadFont("CurlzMT.ttf");
}
function draw() {
// define relevant time arrays
var seconds_minutes_array;
var hours_array;
//var cursive = loadFont("CurlzMT.ttf");
secon... | true |
4b8218c6fd716e8dcd5b19b1668ae104704eaaed | JavaScript | kingr/observables | /weather-app/main.js | UTF-8 | 2,693 | 3.21875 | 3 | [] | no_license | // dom elements
const appContainer = document.getElementById('app-container');
const zipcodeInput = document.getElementById('zipcode-input');
const addLocationBtn = document.getElementById('add-location');
const test = document.getElementById('test');
const BtnClickStream =
Rx.Observable
// create a stream... | true |
48b2546d681346bddf0fcfc12c91eff2e13ab68c | JavaScript | seangrant118/Bamazon | /bamazonCustomer.js | UTF-8 | 2,063 | 3.03125 | 3 | [] | no_license | const mysql = require("mysql");
const inquirer = require("inquirer");
const connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
// be sure to enter your own password before running
password: "password",
database: "bamazon_db"
});
// connect to mysql server and database
c... | true |
fcb79521054c823747b7fa25cc8d0aabc2e743d0 | JavaScript | luisrevilla20/A01022320-GraficasComputacionales | /Tarea2-SistemaSolar/threejsSolarSystem.js | UTF-8 | 15,441 | 2.796875 | 3 | [] | no_license | let renderer = null,
scene = null,
camera = null,
astrosObjects = [],
solarSystem = null,
orbitController = null
let duration = 5000; // ms
let currentTime = Date.now();
function animate() {
let now = Date.now();
let deltat = now - currentTime;
currentTime = now;
let fract = deltat... | true |
5c02b1c11deeaa8c4339a19dc8fa1dff61b6eec3 | JavaScript | LeviBerciu/LeviBerciu.github.io | /WIP/scripts/navigation.js | UTF-8 | 614 | 2.859375 | 3 | [] | no_license | var hamburgerCheckbox= document.getElementById("hamburger");
var navTabs = document.getElementById("nav-tabs");
function showHideTabs() {
if (hamburgerCheckbox.checked == true){
navTabs.classList.add("nav-open");
navTabs.classList.remove("nav-closed");
} else {
navTabs.classList.add("nav-closed");
... | true |
fe60857d0f97e45419ea635c08cad7f7d21c5bd5 | JavaScript | rkc007/Software-Architecture | /Book_Finder/helpers/validations.js | UTF-8 | 408 | 2.890625 | 3 | [
"MIT"
] | permissive | const isEmpty = input => {
if (input === undefined || input === "") {
return true;
}
if (input.replace(/\s/g, "").length) {
return false;
}
return true;
};
/**
* empty helper method
* @param {string, integer} input
* @returns {Boolean} True or False
*/
const empty = input => {
if (input === und... | true |
e431f87a08d6207915a182b2f098d8029e977e6e | JavaScript | PabloMolleda/Jumper-Game | /js/jumper.js | UTF-8 | 2,883 | 3.09375 | 3 | [] | no_license | class Jumper {
constructor(ctx, jumperPosX, keys) {
this.ctx = ctx
this.jumperPos = { x: jumperPosX, y: 600 }
this.jumperSize = { w: 80, h: 100 }
this.imageInstance = undefined
this.keys = keys
// this.jumperBottom = this.jumperPos.y + this.jumperSize.h + this... | true |
303036bdb4fcee610f35a92012f80785390539f4 | JavaScript | weylermaldonado/dacodes-api-challenge | /src/helpers/jwt.js | UTF-8 | 927 | 2.6875 | 3 | [] | no_license | const jwt = require('jsonwebtoken');
const crypto = require('crypto');
/**
* Generate the JWT token.
* @param {Object} user Is the payload to append in the token.
* @returns {String} Token
*/
function generateToken(user) {
const verificationToken = crypto.randomBytes(16).toString('hex');
const token = jwt.sign... | true |
3395c0737bbb0dc946160878b38aed0052d89aeb | JavaScript | rdewan05/Interviews_Frontend | /throttle.js | UTF-8 | 512 | 3.15625 | 3 | [] | no_license | const expensive = () => {
console.log("expensive fun making api calls");
}
window.addEventListener("resize", betterExpensiveFunction);
const throttle = (fn, limit) => {
let flag = true;
return function () {
let context = this, args = arguments;
if (flag) {
fn.apply(context, ar... | true |
8d15b7793935b324ba07c800d9974c137b4ded99 | JavaScript | changeclass/IssueBlog | /src/utils/postFormatTime.js | UTF-8 | 361 | 3 | 3 | [] | no_license | // eslint-disable-next-line import/no-anonymous-default-export
export default function (time) {
const date = new Date(time)
const Year = date.getFullYear()
const Month = date.getMonth() + 1 > 10 ? date.getMonth() + 1 : '0' + date.getMonth() + 1
const Day = date.getDate() > 10 ? date.getDate() : '0' + date.getDa... | true |
f9a5c70f5502481ea75e52f517ba3861e527422c | JavaScript | usainzg/FreeCodeCampCodes | /Algorithms/sumAllNumbersInRange.js | UTF-8 | 193 | 3.25 | 3 | [
"MIT"
] | permissive | function sumAll(arr) {
var min, max;
min = Math.min(arr[0], arr[1]);
max = Math.max(arr[0], arr[1]);
var temp = 0;
for(max; max >= min ; max--){
temp += max;
}
return temp;
}
| true |
5309f8ac662bc90c759e0cee2ddc89b853407401 | JavaScript | chamaracse15/Friska | /src/Screens/Graphs.js | UTF-8 | 1,578 | 2.609375 | 3 | [] | no_license | import React, { Component } from 'react';
import {
View,
Dimensions,
StyleSheet
} from 'react-native';
import Svg, {
Polyline,
Path,
Line
} from 'react-native-svg';
const screen = Dimensions.get('window');
const SCRN_WIDTH = screen.width;
const SCRN_HEIGHT = screen.height;
const VIEW_HEIGHT = (SCRN_HEIGHT... | true |
c2c473193e9e3adbaec06a44a4bdb4e8fb3b3f7b | JavaScript | Pholisa-Fatyela/NelisaTest | /routes/nelisaSpaza.js | UTF-8 | 3,647 | 2.546875 | 3 | [] | no_license | var bcrypt = require('bcrypt');
admin = false;
var user={};
exports.signUp = function(req,res,next) {
if(req.body.user && req.body.pass){
user={
username: req.body.user,
password: req.body.pass,
role: req.body.userRole
};
req.getConnection(function... | true |
7c110ac495a515356398b04a8f4eb007414cc55a | JavaScript | Dmitry16/SOLUTECS2 | /src/actions/modalActions.js | UTF-8 | 2,918 | 2.609375 | 3 | [] | no_license | import * as modalActionTypes from '../actionTypes/modalActionTypes'
export function showModal(e) {
const actualPic = e.target.getAttribute('src')
let nextImg = (getNextImg(actualPic)) ? getNextImg(actualPic) : ''
let prevImg = (getPrevImg(actualPic)) ? getPrevImg(actualPic) : ''
return {type: modalActionTypes.... | true |
ddd3193e4b0d8743b23023e644101f937422c4d3 | JavaScript | Albert6429/WAP2-Assignment2-server | /routes/posts.js | UTF-8 | 1,992 | 2.671875 | 3 | [] | no_license | /*eslint no-unused-vars: "off" */
let Post = require("../models/posts.model")
let express = require("express")
let router = express.Router()
router.findOnePost=function(req, res) {
Post.findById(req.params.id, function(err,post){
if (err){
res.json({message: "The post does not exist", errmsg: err})
}
... | true |
6e1dc3389248f0c9eada119ac985cae7a4d06150 | JavaScript | 44dw/brackets | /src/index.js | UTF-8 | 750 | 2.90625 | 3 | [
"MIT"
] | permissive | module.exports = function check(str, bracketsConfig) {
const isOdd = (num) => num % 2 == 0;
let arr = [];
const flatConfig = bracketsConfig.flat();
for (let bracket of str.split('')) {
const index = flatConfig.indexOf(bracket)
const isOpen = isOdd(index);
const isCloseEqualsToOpen = isOdd(index) && ... | true |
3021565b414fa2d123bb3a528a735693c9e4eabb | JavaScript | Vikaloveyou/todo_list | /js/main.js | UTF-8 | 10,023 | 2.796875 | 3 | [] | no_license | 'use strict'
// VARS:
let $loginBlock = document.getElementById('login');
let $form = document.createElement('form');
let $formFieldset = document.createElement('fieldset');
let $formTitle = document.createElement('h1');
let $emailLabel = document.createElement('label');
let $emailTitle = document.createElement('span... | true |
7456fbf8b988616e83037c5f9ac46078e1bb0cec | JavaScript | KhorAMus/course-project | /MyProject/myproject/static/game/Game.js | UTF-8 | 1,686 | 2.90625 | 3 | [] | no_license | var canvas = document.getElementById('game_canvas');
var game = new GameCanvas(500,500, canvas);
$(function() {
window.requestAnimFrame = (function(){
return function(/* function FrameRequestCallback */ callback, /* DOMElement Element */ element){
window.setTimeout(callback, 1000 / 60)||
window.req... | true |
39caec83da82e01c4a68e655a9d09d730fe1e521 | JavaScript | kaiquemribeiro/weatherapp | /script.js | UTF-8 | 2,593 | 3.140625 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | let myAPI = "32226dc9cba44aa4ee6dd5aa71c0a863";
const unit = "metric";
let searchCity;
function getLocation() {
navigator.geolocation.getCurrentPosition(function (position) {
searchLoc(position.coords.latitude, position.coords.longitude);
});
}
document.getElementById("searchBtn").addEventListener("click", ()... | true |
5a5ab4eb70c4fbed3aba5dfe452edbe2cff88f18 | JavaScript | mrakshat20/mrakshat20.github.io | /lovecalculator.js | UTF-8 | 377 | 3.328125 | 3 | [] | no_license | //LOVE CALCULATOR
prompt("enter your name");
prompt("enter your partners name");
var lovepercentage = Math.random()*100;
lovepercentage = Math.floor(lovepercentage) + 1;
if (lovepercentage > 70 && lovepercentage < 30){
alert("Your Lovepercentage is" + lovepercentage + "% You both made for eachother");
}else(
a... | true |
c44dee8a32134678fd1b9d8cd9e365866c070924 | JavaScript | waldoaraque/zero | /node.js/server-express/index.js | UTF-8 | 391 | 2.65625 | 3 | [] | no_license | const express = require('express');
const app = express();
const port = process.env.PORT || 3000;
app.get('/', (req, res) => {
res.send(`I'm in home page.`);
});
app.get('/app', (req, res) => {
res.send(`I'm in /app page.`);
});
app.get('*', (req, res) => {
res.send(`I don't know where is here.`);
})
app.list... | true |
a1eb009d5d1270dcc3da04015d76e601eeb190bf | JavaScript | liaolonghui/JS-DEMO | /other/jQueryDemo(待补充)/index.js | UTF-8 | 4,067 | 3.078125 | 3 | [] | no_license | $(function(){
//加载数据的方法
function loadDate(){
var collection = localStorage.getItem('todo');
if(collection){
return JSON.parse(collection);
}else{
return [];
}
}
//保存数据的方法
function saveDate(data){
localStorage.setItem('todo',JSON.stringify(data));
}
//加载网页数据
load();
fun... | true |
5069634182e30e16867e5b5771c32bcc4b115694 | JavaScript | ahurdis/SchemaDesigner | /source/control/EditLabel.js | UTF-8 | 5,213 | 2.609375 | 3 | [] | no_license | 'use strict';
define(['source/control/ControlBase', 'source/control/EditBox', 'source/control/Label'], function (ControlBase, EditBox, Label) {
try {
return function EditLabel(options) {
var self = this;
// call parent constructor
ControlBase.call(self, options);
... | true |
2bc5467b35c79d574d27531d0c2127be23f0d622 | JavaScript | MiguelOcegueraM/the_giphy_prj | /src/index.js | UTF-8 | 2,580 | 2.734375 | 3 | [] | no_license | import "./styles.css";
const searchOnGiphy = document.getElementById("searchForm");
const searchInput = document.getElementById("searchInput");
const resultsElements = document.getElementById("gifGallery");
const buttonModal = document.getElementById("btnModal");
let counter;
waitingSearch();
showModal();
function wa... | true |
261c4c26636d3a9365f2eba3530706741104c10d | JavaScript | kuomolew/js-course | /07-es6/challenge.js | UTF-8 | 7,575 | 3.71875 | 4 | [] | no_license | // class Element {
// constructor(name, buildYear) {
// this.name = name;
// this.buildYear = buildYear;
// }
// }
// class Park extends Element {
// constructor(name, buildYear, area, treesNumber) {
// super(name, buildYear);
// this.area = area;
// this.treesNumbe... | true |
993e2169af78b053c9ef9e04f7e87e6ecf130d46 | JavaScript | hiqbal97/puppeteerAutomation | /hotelTest.js | UTF-8 | 1,307 | 2.78125 | 3 | [] | no_license | const puppeteer = require('puppeteer');
let bookingUrl = 'insert booking URL';
(async () => {
const browser = await puppeteer.launch({ headless: true });
const page = await browser.newPage();
await page.setViewport({ width: 1920, height: 926 });
await page.goto(bookingUrl);
// get hotel details
... | true |
3c4c92eaf585d4f27d7c2715f4e5cfd458cc4c9a | JavaScript | tomByrer/effectfuljs | /packages/js/test/samples/switch-stmt/test2-out-f.js | UTF-8 | 524 | 2.53125 | 3 | [
"MIT"
] | permissive | function a() {
var pat;
return M.chainBH(eff(1), _1, _5);
function _1(a) {
pat = a;
return M.chainBH(check(1), _2, _5);
}
function _2(a) {
if (pat === a) {
return M.chainBH(effB(1), _4, _5);
} else {
return M.chainBH(check(2), _3, _5);
}
}
function _3(a) {
if (pat ==... | true |
adb248c7212e1420843265f2bc7f212423c6dc18 | JavaScript | leee-dw/algorithms | /leetcode/226.js | UTF-8 | 284 | 3.203125 | 3 | [] | no_license | function invertTree(root) {
let res = [];
root.forEach((elem, idx) => {
let arr = root.slice((Math.pow(2, idx) - 1), Math.pow(2, idx + 1) - 1).reverse();
res = res.concat(arr);
})
return res;
};
console.log(invertTree([4, 2, 7, 1, 3, 6, 9, 1, 3, 7, 8, 6, 6, 1, 5])); | true |
5a79141ea599d0580595f3446fdb0c8786beea50 | JavaScript | george-arnold/DSA-Stacks-And-Queues | /Queueclass.js | UTF-8 | 2,364 | 3.84375 | 4 | [] | no_license | // Creates a node containing the data and a reference to the next item
class _Node {
constructor(value) {
this.value = value;
this.next = null;
}
}
class Queue {
constructor() {
this.first = null;
this.last = null;
}
enqueue(data) {
const node = new _Node(data);
if (this.first === nu... | true |
e3c180b7ff03fa80d100ef08ea2d13dbd546e40c | JavaScript | DispatchMe/meteor-signature | /example/example.js | UTF-8 | 924 | 2.53125 | 3 | [
"MIT"
] | permissive | if (Meteor.isClient) {
Template.example1.events({
'click button': function (event, template) {
Signature('example1').clear();
}
});
Template.example1.helpers({
isEmpty: function () {
var signature = Signature('example1');
return signature ? signature.isEmpty() : true;
}
});
... | true |
999d716c7a0f4b0b8efbb8770b4d80a1b75b7203 | JavaScript | NafilaNafi/react-task-7-crud | /src/Productedit.js | UTF-8 | 3,022 | 2.5625 | 3 | [] | no_license |
import { useContext, useEffect, useState } from "react"
import ProductContext from "./ProductContext"
export default function Productedit(props) {
let [productname, setproductname] = useState('')
let [Brand, setBrand] = useState('')
let [price, setprice] = useState('')
let [department, setdep... | true |
f78f043b588e4583e7fb731d2e0d86a567651eff | JavaScript | stellar/js-stellar-base | /src/operations/path_payment_strict_receive.js | UTF-8 | 2,654 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import xdr from '../xdr';
import { decodeAddressToMuxedAccount } from '../util/decode_encode_muxed_account';
/**
* Creates a PathPaymentStrictReceive operation.
*
* A `PathPaymentStrictReceive` operation sends the specified amount to the
* destination account. It credits the destination with `destAmount` of
* `de... | true |
74ae0c164c8df75f291455e7f08d434b494ab20a | JavaScript | SergeyDragunov/film-challenge-app | /src/reducers/movies.js | UTF-8 | 689 | 2.640625 | 3 | [] | no_license | import { moviesConstants } from '../constants';
const initState = {
settings: {
isFetching: false
},
data: []
}
export default (state = initState, action) => {
switch(action.type) {
case moviesConstants.GET_MOVIES_REQUEST: {
return ({
...state,
settings: {
...state.settings,
isFetching: t... | true |
fb5f0a37dd5bdbf18a693a4661a5adad7ea55e2f | JavaScript | KornHolio216/CountDeltApp | /src/js/toggle.js | UTF-8 | 519 | 3.171875 | 3 | [] | no_license | //getting needed elemtns from documentt
const closeBtn = document.querySelector(".closebtn")
const toggleBtn = document.querySelector(".menu-icon")
const navbar = document.querySelector("#navbar")
function closeMenu(){
navbar.style.height = "0vh"; // navbar hehigt after an event
}
function openMenu(){
na... | true |
ba1bca49a34f33b7967bd21a36a5c7efa83fcd27 | JavaScript | JosueMA/DFaceR | /app/www/js/pager-ui.tpl.js | UTF-8 | 5,116 | 2.875 | 3 | [] | no_license | // delegate a click event handler for pager page-number buttons
$(document).on("click", "#{{pager}} button.page-num-button", function() {
var page_num = $(this).data("page-num");
$("#{{pager}} .page-current").val(page_num);
$("#{{pager}} .page-current").change();
});
$(document).on("click", "#{{pager}} button.pa... | true |
c5627661ac402deb810dca389654373152248791 | JavaScript | MahathiKalakonda/JS-Strings-Assignment | /camelCase.js | UTF-8 | 465 | 3.578125 | 4 | [] | no_license | function getTitleCase(word)
{
return word[0].toUpperCase()+word.slice(1).toLowerCase();
}
function getCamelCase(words)
{
return words.slice(1).reduce((accumulator,word) =>
accumulator.concat(getTitleCase(word)),
words[0].toLowerCase());
}
function main()... | true |
c45ae99e4478bfe2a7c2787c0785243cbc2a5939 | JavaScript | canbora/cc-lea-word-customizer | /replacer.js | UTF-8 | 1,487 | 3.671875 | 4 | [
"MIT"
] | permissive | /*jshint esversion: 8 */
// This function is used to decide which character to stretch in the replacement word.
function lastVowelIndex(string) {
for (let i = string.length - 1; i >= 0; i--) {
if ("aeiouy".includes(string.charAt(i))) {
return i;
}
}
return string.length - 1;
}
export function splitReplaceme... | true |
f6b795672110cfc7400078f1bf065a166e9b0c3f | JavaScript | DoroshukA/project | /app(0).js | UTF-8 | 9,271 | 2.78125 | 3 | [] | no_license |
// // Випадаюче меню для обрання локації для доставки радіогідів
// let cityO = $("#city")[0];
// let placeO = $("#place")[0];
// let lviv = ["Площа Ринок. Нептун", "Парковка автобусна. Біля Порохової", "Порохова Вежа. вхід", "Опера. Навпроти входу", "Пам'ятник Т.Г.Шевченку", "автостанця Стрийська", " -- Свій варі... | true |
c70a8222cd6d6f7e7ccb3e60d96e3695deb2ef42 | JavaScript | syy0408/todo | /assets/js/app.js | UTF-8 | 5,185 | 2.859375 | 3 | [] | no_license | angular.module('todo',[])
.controller('todoCtrl',['$scope',function ($scope) {
// 1.添加任务
/*
1.获取到用户输入的任务名字
2.准备一个存储任务列表的数组
3.监听用户的回车事件
4.将用户输入的任务名字添加到任务列表中
5.利用ng-repeat指令将任务列表展现到页面中
*/
//准备一个任务列表
$scope.taskList=[];
... | true |
b90ac04f1e8506b3ff28bca93602680a9a657ce6 | JavaScript | rocky-191/LearnReact | /src/tabs/tab.js | UTF-8 | 1,517 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react'
import TabItem from './tabItem';
import './style.css';
class Tab extends Component {
constructor(props) {
super(props);
this.state = {
tabs:[{
text:'tab1',
active:true
},{
text:'tab2',
... | true |
83e9ae88c6664de31550b8edba58f62a559a4bb7 | JavaScript | oneleif/olWebsite-React | /src/contexts/UserContext.jsx | UTF-8 | 1,340 | 2.828125 | 3 | [
"MIT"
] | permissive | import React, { useContext, useEffect, useState } from 'react';
const UserContext = React.createContext([undefined, undefined]);
function UserProvider ({ children }) {
/************************************
* State
************************************/
const [user, setUser] = useState(null);
/**... | true |
d8bd063a7be2119b9ffe7f04421ca1f1318ef044 | JavaScript | Phoebe0126/58Spider | /controllers/rentInfo.js | UTF-8 | 3,335 | 2.65625 | 3 | [] | no_license | let request = require('request');
let cheerio = require('cheerio');
let totalPage = require('../config/config').page;
let RentModel = require('../models/rent')
// todo 记得在app.js中初始化
let cookie = ''
// 存入url的数组
let urlPipe = []
// 访问次数
let times = 0
/**
* 用途: 获取第page页的url
* @param {*} page 页码
* @return {string} ur... | true |
8ef3bb819655837b1d8eee6c105dd74cb58222c8 | JavaScript | SuperRun/spokenman | /ota-web/src/main/webapp/media/2/js/exam/member/createExam.js | UTF-8 | 2,378 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | function createExam(){
var flag=1;
$("#examNameError").empty();
$("#examNameError").hide();
$("#examTypeError").empty();
$("#examTypeError").hide();
$("#signupStartTimeeError").empty();
$("#signupStartTimeeError").hide();
$("#signupEndTimeError").empty();
$("#signupEndTimeError").hide();
$("#examStartTimeErro... | true |
34e8dde307b9bf31fc9930373070886cdae39459 | JavaScript | timmarsh/yql_query_tool | /yql | UTF-8 | 1,807 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/local/bin/node
var argv = require('optimist').argv;
var colors = require('colors');
var request = require('request');
var query = argv.query;
var color = argv.color;
if(!query){
console.log("minimally pass in --query \"your query\", --color toggles highlighting");
process.exit(0);
}
search(query, color);
funct... | true |
09d3c331befbfcdefecf809329889719799483cf | JavaScript | syah3791/telemedic | /assets/js/videos.js | UTF-8 | 4,455 | 2.5625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive |
// Enable video on the page.
function enableVideo() {
loadSimpleWebRTC();
}
// Dynamically load the simplewebrtc script so that we can
// kickstart the video call.
function loadSimpleWebRTC() {
var webrtc = new SimpleWebRTC({
// the id/element dom element that will hold "our" video
localVideoEl: 'selfVide... | true |
d01b9756017c50f3a7c159dfcb92d8872b8a85c7 | JavaScript | jyh7a/NomadCoders | /Vanilla_Javascript_1/3_Make_your_first_JS_App/background.js | UTF-8 | 2,039 | 3.265625 | 3 | [] | no_license | const remainTime = document.querySelector(".remainTime");
const IMG_NUMBER = 6;
let paintFlag = true;
function handleImageLoad() {
console.log("Load Start");
}
function handleImageLoadEnd() {
console.log("Load End");
}
function paintImage() {
const el = document.querySelector(".bgImage");
const optionDef... | true |
f297bf03b38be0a04a9b28d8da6653ef7d16b75e | JavaScript | mohamedoraibi/jsdom-fetch-dog-ceo-challenge-recoded-baghdad-2019 | /src/index.js | UTF-8 | 471 | 2.859375 | 3 | [] | no_license | console.log('%c HI', 'color: firebrick')
document.addEventListener("DOMContentLoaded", function(event) {
fetch('https://dog.ceo/api/breeds/image/random/4')
.then(function(response) {
return response.json();
}).then(function(json) {
let list;
for (let i = 0; i < 4; i++) {
list = document.createElement("li"); ... | true |
c6ec98c0ec328046b5540492bceebfe5aaaccefb | JavaScript | learn-co-students/dumbo-web-082619 | /22-intro-to-DOM/index.js | UTF-8 | 1,669 | 3.8125 | 4 | [] | no_license | // READ Elements from the DOM
// document.getElementById("heading") // -> Return the first element with that ID
// let allBads = document.getElementsByClassName('bad')
// let allBads2 = document.querySelectorAll(".bad")
// document.getElementsByTagName('li')
// document.getElementsByName('name')
let allLis = docume... | true |
a26362ec3eec61461e4bfd19096aa2f9bf85e717 | JavaScript | joeldzv95/InteractuandoDB | /DesarrolloWebDB_NODE_JoelDiez/server/routes/index.js | UTF-8 | 1,844 | 2.671875 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const Task = require('../task.js');
const Users = require('../users.js');
// Validación ususario
router.post('/login', async (req, res) => {
var user = req.body.user;
var pass = req.body.pass;
const users = await Users.find({
... | true |
9f6cdeaae2b1b4a6fb5a8f1583d19f6329272f1e | JavaScript | alaxa27/AIPCloud_Software | /src/views/Entry/emotionChart.js | UTF-8 | 6,769 | 2.625 | 3 | [] | no_license | import React, {Component} from 'react';
import {connect} from 'react-redux';
import {Line} from 'react-chartjs-2'
class EmotionChart extends Component {
constructor(props) {
super(props);
this.state = {
playing: false,
pos: 0
};
this.handleTogglePlay = this.handleTogglePlay.bind(this);
... | true |
efdcf3bcf78e3b6ed0f73f91ffa886e1178f3c7b | JavaScript | alukinykh/test-aviasales | /src/components/FilterStops/index.js | UTF-8 | 1,704 | 2.578125 | 3 | [] | no_license | import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { Checkbox } from './Checkbox'
import './style.css'
import { plural } from '../../utils'
const labels = [
'пересадок',
'пересадка',
'пересадки',
]
export class FilterStops extends PureComponent {
filterByOne = (count) => ... | true |
81689b7a09ddee75884569c2471dc4db1d907596 | JavaScript | vetrivelcsamy/leetcode-solutions | /array-chunks/arrayChunks.js | UTF-8 | 369 | 3.53125 | 4 | [] | no_license | const arrayChunks = (arr, len) => {
if(!len) {
return arr;
}
const result = [];
let i = 0;
while(i < arr.length) {
result.push(arr.slice(i, i + len));
i += len;
}
return result;
}
console.log(arrayChunks([2,3,4,5,6,7,7,8,8,10], 2))
console.log(arrayChunks([2,3,4,5,6,7,7,8,8,10], 3))
con... | true |
2bb35da6980255a2e034f783d2efec22d516e381 | JavaScript | tranquang9a1/ECRM | /App/ECRM/src/main/webapp/resource/js/quang.js | UTF-8 | 893 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | function setChooseEquipment(){
$(".equipment").click(function(){
if($(this).attr("data-choose") === "true"){
$(this).removeClass("choose");
$(this).removeAttr("data-choose");
document.getElementById("list-equipment").removeChild(document.getElementById("equipment-" +... | true |
92a460b1976df38ad3ced25a7ac1038a025ce888 | JavaScript | vaticorp/ssabirov | /chapter_013/src/main/resources/static/js/enter.js | UTF-8 | 580 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | function registration() {
var formData = {
accountID : document.getElementsByName("account")[0].value
}
$.ajax({
method: "post",
contentType : "application/json",
url: "/account",
data: JSON.stringify(formData),
dataType : 'json',
complete: function (m... | true |
b5163b37633ea7e7bb739876887e6b5e30622d61 | JavaScript | giocosmiano/random-code-snippets | /promises_in_js/09_race/sample.js | UTF-8 | 889 | 3.609375 | 4 | [] | no_license | let createPromise = function(timems) {
return new Promise(function(resolve, reject) {
setTimeout(resolve.bind(null, timems), timems);
});
};
let promise1 = createPromise(2000);
let promise2 = createPromise(1000);
Promise.race([promise1, promise2])
.then(function(result) { console.log(result); })
.catch(fu... | true |
2911fb7ed45b37951c85af399b17143cba685f9e | JavaScript | bosscheng/simple-aop | /simple-aop.js | UTF-8 | 1,473 | 2.59375 | 3 | [] | no_license | "use strict";
!(function () {
/**
* aop
* @param target 绑定的对象
* @param key 绑定的对象的方法
* @param callback 回调事件
* @param options 参数
* @returns {boolean}
*/
function aop(target, key, callback, options) {
if (!target) {
return false;
}
var _func... | true |
ef35ce93dff14efa8ddc7287c360a03e4a4b9418 | JavaScript | dwatson251/screeps | /Test.js | UTF-8 | 593 | 2.71875 | 3 | [] | no_license | module.exports = class Test
{
constructor()
{
this.uid = '12345678';
this.requirement = 'SomeRequirement';
if(!Memory.testRequirements) {
Memory.testRequirements = {};
}
this.mockRequirements();
}
mockRequirements()
{
thi... | true |
d0125f3035c77e299430b7c5609616ef30485cdc | JavaScript | vmurali100/swati | /app5/src/Child.jsx | UTF-8 | 745 | 2.8125 | 3 | [] | no_license | import React, { Component } from "react";
export default class Child extends Component {
static getDerivedStateFromProps(props, state) {
console.log("Updating time", props);
console.log("Updating time", state);
return {};
}
shouldComponentUpdate() {
console.log("shouldComponentUpdate() is called... | true |
3b5ef40f0d4013ba67044872c14d8ad77194bc49 | JavaScript | gorbachevsergey/request | /script.js | UTF-8 | 3,996 | 3.40625 | 3 | [] | no_license | // командой getElementById получаем ссылка на эелмент, которая дает нам возможность на изменения свойств элемента
// почитай, что ты присваиваешь
const button = document.getElementById('btnLoad'); // присваем переменной id элемента
let text = document.getElementById('textLoad')
// Обработчик событий
// "слушатель" нав... | true |
a1b184d731d73270870880ad44f261f8095b4bde | JavaScript | haohongyang1/test-managent-one | /more_advance/iterator.js | UTF-8 | 467 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | // 迭代器模式
// 如何使用?
function* iteratorGentor() {
yield "1";
yield "2";
yield "3";
}
const iterator = iteratorGentor();
iterator.next();
iterator.next();
// 写一个生成器
function iteratorGentor(lsit) {
var idx = 0;
var len = list.length;
return {
next: function () {
var done = idx >= len;
var value ... | true |