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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
85d57ebd9c8084f78ab5a12412007c4c23cded12 | JavaScript | ahmedibrahimhassan654/Node_Js-designePattern | /creation-design-patern/constructor/task.js | UTF-8 | 318 | 2.65625 | 3 | [] | no_license | var Task=function (name) {
this.name=name
this.completed=false
}
Task.prototype.complete=function (params) {
console.log('the task '+this.name+' is completed');
this.completed=true
}
Task.prototype.save=function (params) {
console.log('the task '+this.name+' is saved');
}
module.exports =Task | true |
e222be54a6b80ea0ae05e146260b0878c88432f4 | JavaScript | awatson31911/Algo-Practice | /algoExpert/bstConstruction.js | UTF-8 | 3,795 | 3.75 | 4 | [] | no_license | class BST {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
insert(value) {
const newTree = new BST(value);
let currentNode = this;
while(true) {
if (value < currentNode.value) {
if (current... | true |
1344e1d0d895360088ee6b23eeea6d55a0e637e5 | JavaScript | eeplate/decoder-ring-2 | /test/substitution.test.js | UTF-8 | 3,550 | 2.78125 | 3 | [] | no_license | const expect = require("chai").expect;
const substitution = require("../src/substitution");
describe ("substitution", () => {
it ("Should return false if the given alphabet isn't exactly 26 characters long when encoding.", () =>{
const input = "keyword";
const alphabet = "keywordabcfghijlmnpqstuvx"... | true |
caf845eb3e1925f8b36ed3a9330d617a5bbf32a6 | JavaScript | tiffkchang/Lab5_Starter | /assets/scripts/expose.js | UTF-8 | 1,497 | 2.65625 | 3 | [] | no_license | // expose.js
window.addEventListener('DOMContentLoaded', init);
const jsConfetti = new JSConfetti();
function init() {
const horn = document.querySelector('#horn-select');
var horn_img = document.querySelectorAll('img')[0];
var horn_sound = document.querySelectorAll('.hidden');
horn.addEventListener('change'... | true |
a144e337f7cd57e7b633612572f4b39425bdeafd | JavaScript | georgehanu/cloudeditor | /resources/editor/stores/reducers/addButton.js | UTF-8 | 464 | 2.71875 | 3 | [] | no_license | const actionTypes = require("../actionTypes/addButton");
const addImage = (state, action) => {
console.log(state);
const newImage = { ...action.image };
return { ...state, images: state.images.concat(newImage) };
};
const addButton = (state = { title: "Add Image", images: [] }, action) => {
switch (action.typ... | true |
50836124bd3aa9facf691a06826c2e823acde123 | JavaScript | RyanChristian259/g11-course-curriculum | /week01/01_exercises/_solutions/js-chessboard/main.js | UTF-8 | 629 | 4.28125 | 4 | [] | no_license | // attempt # 1
for (var row = 0; row < 8; row++) {
var line = "";
for (var column = 0; column < 8; column++) {
var total = row + column;
// console.log("row: ", row);
// console.log("column: ", column);
// console.log("total: ", total);
if (total % 2 === 0) {
line += " ";
} else ... | true |
c9619e46335e0328097c677d5133f5b5230f481b | JavaScript | napengam/marc21Viewer | /js/makeDraggable.js | UTF-8 | 5,503 | 2.96875 | 3 | [
"MIT"
] | permissive | function makeDraggable(options) {
'use strict';
var opt, dragObj, handle, defaultOpt = {
'dragObj': null, // object you want to drag
'dragHandle': null, // handle inside drag object
'allowY': true, // allow dragging allong Y-axis
'allowX': true, // allow dragging allong X... | true |
2a9558fb7f73bf433421307537426c58270ab9b7 | JavaScript | davidadel/test | /js/mine.js | UTF-8 | 605 | 2.53125 | 3 | [
"MIT"
] | permissive |
$(".color-op").hide()
$("#ops i").click(function(){
$(".color-op").toggle(1000)
})
var colors = ["orange","red","yellow","#09c","teal"]
var lis = $("#ops ul li");
for (var i =0 ; i <lis.length ; ++i){
$("#ops ul li").eq(i).css("backgroundColor",colors[i]);
}
if (localStorage.getItem("clientcolor") == null){
... | true |
8a04870b06dd6d0026dd3e7a3369952f68563296 | JavaScript | StefanDimitrovDimitrov/Js-Applications | /exam 04.04.2021/SoftWiki/views/allData.js | UTF-8 | 774 | 2.5625 | 3 | [] | no_license | import { html } from '../../node_modules/lit-html/lit-html.js';
import {getAllDataCatalog} from '../src/data.js';
const AllDataTemplate = (data) =>html`
<section id="catalog-page" class="content catalogue">
<h1>All Articles</h1>
${data.length == 0 ? html`<h3 class="no-articles">No articles yet... | true |
5ef25748ae2fea6764c02786767b7a0192be7b6c | JavaScript | SimeonTrenev/SoftUniJS | /JS Fundamentals/Arrays - Advanced/.vscode/Array Manipulations.js | UTF-8 | 1,128 | 3.953125 | 4 | [] | no_license | function arrayManipulations(array){
let manipulatedArray = array.shift().split(' ').map(Number);
for(let i = 0; i < array.length;i++){
let[comand, firstNum, secondNum] = array[i].split(' ');
firstNum = Number(firstNum);
secondNum = Number(secondNum);
if(comand ===... | true |
23e749c22eeaccfe8611fddcbf0ba30273d352ed | JavaScript | Jordan-Rowland/svelte-sandbox | /courseproject/src/helpers/validation.js | UTF-8 | 323 | 2.75 | 3 | [] | no_license | export function notEmpty(value) {
if (!value.trim().length) {
return false;
}
return true;
}
export function isValidEmail(value) {
return new RegExp(
"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"
).test(value);... | true |
fe72c7a177eb7de4a405cf7b4025cf7b79bd1222 | JavaScript | guryaniv/sync-googlesheet2firebase | /code.gs | UTF-8 | 4,274 | 2.8125 | 3 | [] | no_license | function getEnvironment() {
var environment = {
spreadsheetID: "****", // replace with spreadsheetID (from url https://docs.google.com/spreadsheets/d/spreadsheetID/edit#gid=0)
firebaseUrl: "*****" // replace with firebase realtime database url (such as https://someappname.firebaseio.com/)
};
return environmen... | true |
989fb4658db38d339ab1a12175d33bab4522b24e | JavaScript | CStuckey/trainScheduler | /assets/javascript/app.js | UTF-8 | 3,310 | 3.171875 | 3 | [] | no_license | // Initialize Firebase
var config = {
apiKey: "AIzaSyAPncUb_MbjwBA6oykAUrrCxsH2QjU4S_A",
authDomain: "trainschedule-1c93f.firebaseapp.com",
databaseURL: "https://trainschedule-1c93f.firebaseio.com",
storageBucket: "trainschedule-1c93f.appspot.com",
messagingSenderId: "470465350915"
};
firebase.initializeApp(c... | true |
6166af2a2b453df51d98cb85209863370ec72e8a | JavaScript | dionkeldei/mathCreator | /dMath.js | UTF-8 | 2,599 | 2.765625 | 3 | [] | no_license | function calcText(input){
var length = input.length;
input = input.split("");
var jsonop = '{';
var prevop = 1;
for(i=0;i<length;i++){
if(input[i] == '*'){
jsonop = printNum(prevop,number,jsonop,numel);
input[i] = ' <span style="color:red;">x</span> ';
jsonop = jsonop+'"el'+i+'":{"op":"... | true |
141f14ee506bc1082f6b75320393a8bd089ea23c | JavaScript | jaoyama73/CS185_PA | /scripts/script.js | UTF-8 | 1,214 | 2.703125 | 3 | [] | no_license | function overlayThisImg(element){
document.getElementById("overlay_img").src = element.src;
document.getElementById("modal").style.display = "block";
}
function overlayThisVideo(element){
document.getElementById("video").addEventListener("click", function(event){
event.preventDefault();
}, false... | true |
5abe70eb56c73a18dfb1634b804e420973e791e1 | JavaScript | jpmarcotte/HeroesDraftHelper | /extension/scripts/role_data.js | UTF-8 | 1,432 | 2.71875 | 3 | [
"MIT"
] | permissive | // I hate having to duplicate this function from scrape_map_data.js but I haven't yet figured out
// how to put it in a common file for inclusion.
wait_for_state = function(test, execute, interval = 100) {
if (test()) { execute(); }
else { setTimeout(function(){ wait_for_state(test, execute, interval); }, interval); ... | true |
0427f35a16f2d28d1d6bf021ea2503781d40fd43 | JavaScript | andrebeu/cswBehavioral | /experiments/exp_2018/exp_0215/task/csw_task-S14.js | UTF-8 | 145,557 | 2.578125 | 3 | [] | no_license |
// load psiturk
var psiturk = new PsiTurk(uniqueId, adServerLoc, mode);
var intro1 = {
type: 'instructions',
pages: ['** After reading this sentence, press spacebar. ** ']
}
var intro2 = {
type: 'instructions',
pages: ['In this experiment you will read stories and answer questions.']
}
var intro3 = {
type: '... | true |
0feec66381c5d0839cc0fecff3efe5f91d94a956 | JavaScript | kungnaja555/testSum | /sum.test.js | UTF-8 | 700 | 2.984375 | 3 | [] | no_license | const sum = require('./sum');
// 1 + 2 เท่ากับ 3
test('1 + 2 เท่ากับ 3', ()=> {
expect(sum(1,2)).toBe(3);
});
// 20 + 1 เท่ากับ 21
test('20 + 1 เท่ากับ 21', () => {
expect(sum(20,1)).toBe(21);
});
// 2 + 5 เท่ากับ ?
test('2 + 5 เท่ากับ 7', () =>{
expect(sum(2,5)).toBe(7)
})
// ทำอีก 3 อัน โดยการพิมพ์เอง อย่า c... | true |
22cc2df0e2fedc4a28308e2a0e5f126b11de7680 | JavaScript | builder-247/node-autotip | /lib/tracker.js | UTF-8 | 2,376 | 3.03125 | 3 | [
"MIT"
] | permissive | /*
* Functions for tracking statistics
*/
const fs = require('fs');
const jsonfile = require('jsonfile');
const logger = require('./logger');
const trackerObj = {
tips_sent: 0,
tips_received: 0,
exp: 0,
karma: 0,
coins: {},
};
function createDirIfNotExist(dirPath) {
if (!fs.existsSync(dirPath)) {
fs.... | true |
4871730dcc6712d3a8c0014e4fe5c721a6a6a235 | JavaScript | ejosafat/poodr | /ch09/sources/gear.js | UTF-8 | 1,293 | 2.6875 | 3 | [] | no_license | 'use strict';
function Gear (args) {
this.chainring = args.chainring;
this.cog = args.cog;
this.wheel = args.wheel;
this.observer = args.observer;
}
Gear.prototype = {
constructor: Gear,
setCog: function (newCog) {
this.cog = newCog;
this.changed();
},
setChainring: f... | true |
713f0a0b244e385ccda961f2c1b3e903ebf34e5f | JavaScript | wes2627/hangman2 | /hwjsconstructorr/gamefiles/Letter.js | UTF-8 | 382 | 3.5625 | 4 | [] | no_license | var Letter = function(theletter) {
this.theletter = theletter;
this.guessed = false;
this.toString = function() {
return this.guessed ? this.theletter : '_';
}
this.makeGuess = function(newGuess) {
if (this.theletter.toLowerCase() === newGuess.toLowerCase()) {
this... | true |
f4df8fee62e1ab9adb77e92d58676c2b44a2594b | JavaScript | oleggromov/contests | /401-binary-watch.js | UTF-8 | 701 | 3.71875 | 4 | [] | no_license | /**
* @param {number} num
* @return {string[]}
*/
var readBinaryWatch = function(on) {
const result = []
if (on === 0) {
return ['0:00']
}
for (let i = 0; i < 1 << 10; i++) {
if (bits(i) === on) {
const h = hours(i)
const m = minutes(i)
if (h < 12 && m < 60) {
result.push... | true |
b27932ccfd010f8a75d591bd4623756d5eb92e3c | JavaScript | VernierST/blink-diff | /lib/pixelComparator.js | UTF-8 | 6,795 | 2.640625 | 3 | [
"MIT"
] | permissive | // Copyright 2015 Yahoo! Inc.
// Copyrights licensed under the Mit License. See the accompanying LICENSE file for terms.
var Base = require('preceptor-core').Base;
var Rect = require('./configuration/atoms/rect');
/**
* @class PixelComparator
* @extends Base
* @module Compare
*
* @property {PNGImage} _imageA
*... | true |
d4046a13097c4fb381c399eb901df10aff734f57 | JavaScript | tjaskolka/tjaskolka.github.io | /lesson5/js/currentdate.js | UTF-8 | 1,092 | 3.75 | 4 | [] | no_license | //compose date consisting of day, date month year
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
var day = days[new Date().getDay()];
var d... | true |
a85f57e432973ad45517ff12bbf8ec59dee4aa34 | JavaScript | justinlevi/capacity4more | /capacity4more/modules/c4m/restful/c4m_restful_quick_post/components/c4m-app/src/services/request.js | UTF-8 | 5,455 | 2.640625 | 3 | [] | no_license | /**
* @file
* Functionality to clean and prepare the RESTful request object.
*/
'use strict';
/**
* Service to clean and prepare the RESTful request object.
*
* @ngdoc service
*
* @name c4mApp.service:Request
*
* @description
* # Cleans and prepares the RESTful request object.
*/
angular.module('c4mApp')
... | true |
d6f486b6a53e8763c6d0b6841c9749fa105ca619 | JavaScript | devendra-2021/opensense-assesment | /index.js | UTF-8 | 543 | 2.765625 | 3 | [] | no_license | const city = document.getElementById('country')
const form = document.getElementById('form')
const currentCity = document.getElementById('city')
const relocate = document.getElementById('countries')
form.addEventListener('submit', (e)=>{
let message = []
if( city.value == 'Other'){
currentCity.attribut... | true |
a213bfe1d8091cce796f47371839d56d674ba5b5 | JavaScript | arseniy-nikitochkin/DeelFrontendTest | /src/components/classes/CountriesList.jsx | UTF-8 | 3,336 | 2.84375 | 3 | [] | no_license | import React from 'react';
import { cn, getSelectedIndex } from '../../utils';
class CountryItem extends React.PureComponent {
onMouseOver = () => {
const { selected, onItemSelect, index } = this.props;
if (!selected) {
onItemSelect(index);
}
}
render() {
const ... | true |
b08deeaab21fb93aea5e9accdc3a1aad046f79b5 | JavaScript | umarmw/Nightvision | /custom/commands/waitForTitle.js | UTF-8 | 3,296 | 2.75 | 3 | [
"MIT"
] | permissive | var WaitForTitle, events,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasPro... | true |
9d2e27099dabf1bd5836ebae62637d8c55a097bf | JavaScript | raylinhonghu/Advanced-JS-Notes | /data structure/stack/candybox.js | UTF-8 | 964 | 4.09375 | 4 | [] | no_license | function Stack(){
this.top = 0;
this.dataStore = [];
this.pop = pop;
this.peek = peek;
this.push = push;
this.length = length;
this.clear = clear;
}
function push(val){
this.dataStore[this.top++] = val;
}
function pop(){
return this.dataStore[--this.top];
}
function peek(){
return this.dataStore... | true |
01d2e2f9673f040a8cb8137a891ea7c398b23550 | JavaScript | ArekLopus/TestWeb | /src/main/webapp/customElements/customElement2.js | UTF-8 | 2,466 | 2.515625 | 3 | [] | no_license | //<template>
// <style>
// .vimeo {
// background-color: #000;
// margin-bottom: 30px;
// position: relative;
// padding-top: 56.25%;
// overflow: hidden;
// cursor: pointer;
// }
// .vimeo img {
// width: 10... | true |
79f3c55d9a9433ee0ff33cffb239524880989e9c | JavaScript | israelmrios/Team-Profile-Generator | /index.js | UTF-8 | 4,446 | 3.265625 | 3 | [
"MIT"
] | permissive | const inquirer = require('inquirer');
const fs = require('fs');
const path = require('path');
const OUTPUT_DIR = path.resolve(__dirname, "dist");
const distributionPath = path.join(OUTPUT_DIR, "index.html");
const generateHtml = require('./lib/generateHtml');
const Manager = require('./lib/Manager');
const Engineer =... | true |
27a58b9ed7555b0c3755fa5a8b443655e5c4a5e5 | JavaScript | vallauri-ict/info-playground-marcoperno | /NodeJs/Es9_DispatcherConlogin/Sito/js/client.js | UTF-8 | 2,182 | 2.71875 | 3 | [] | no_license |
function login(){
let username = $("#username").val();
let password = $("#password").val();
$.ajax({
url:"http://localhost:1337/login",
data: {Username : username, password : password},
type:"POST",
success:function(risposta, status){
//var x = JSON.parse(rispost... | true |
c2d47f055dc28aaaa154688c5fe93b30e3bd7995 | JavaScript | paddonm/IssuerDirect | /js/onsched.js | UTF-8 | 3,868 | 2.53125 | 3 | [] | no_license | // Begin OnSchedJs Logic
var onsched = OnSched(window.clientId, 'sbox');
/// Get instance of elements to use for creating elements
var elements = onsched.elements();
// AppointmentsElement
const mountAppointments = (mountComponent, options, params, meetingHistory) => {
var elAppDiv = document.getElementById('app');... | true |
f8709116b28869cd6d55e811c119df17b9e598ba | JavaScript | sashakukharuk/backend | /logicIssue/differentDate.js | UTF-8 | 363 | 2.65625 | 3 | [] | no_license | const moment = require("moment")
module.exports.differentDate = (date) => {
if (date) {
const date1 = new Date(moment(date).format('M/D/YYYY'));
const date2 = new Date(moment(Date.now()).format('M/D/YYYY'));
// @ts-ignore
return parseInt(Number((date2 - date1) / (1000 * 60 * 60 * 24... | true |
91b02002adf4e6e0df5c598226056a71111c1243 | JavaScript | howardmann/jwt_example | /jwt.js | UTF-8 | 693 | 2.96875 | 3 | [] | no_license | let jwt = require('jsonwebtoken')
let SECRET_KEY = 'chicken'
let data = {
id: 1,
email: 'john'
}
// First party signs the data and creates a token
let token = jwt.sign(data, SECRET_KEY)
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJqb2huIiwiaWF0IjoxNTUyNzMzMDU3fQ.3FOQxJNV_nsK2Dwwhaf0EduSiQzMRz4Ke... | true |
c8814696d9cc8b8143d121580157034c158f8e0d | JavaScript | JuiceTen/tech-blog | /public/js/edits.js | UTF-8 | 1,262 | 3.21875 | 3 | [] | no_license | const update = async (e) => {
e.preventDefault()
const title = document.querySelector('#blog-title').value.trim()
const content = document.querySelector('#blog-content').value.trim()
const id = e.target.getAttribute('data-id')
const response = await fetch(`/api/blogs/${id}`, {
... | true |
09b7f42297e40ac56bba5e1dfd9d7ca2b9acc5e2 | JavaScript | iplanwebsites/Write | /server.js | UTF-8 | 1,960 | 2.5625 | 3 | [] | no_license |
var express = require('express')
// Main App
, app = express();
// Assets Path
app.use(express.static(__dirname + '/public/assets'));
app.set('views', __dirname + '/app/views');
app.set('view engine', 'jade');
// Let jade not print everything in a single line
app.locals.pretty = true;
// Parse POST Data
app.use... | true |
8bdedbc3321c696d039c834fdef67103984e17cf | JavaScript | nilproject/NiL.JS | /TestSets/tests/sputnik/ch15/15.8/15.8.1/15.8.1.2/S15.8.1.2_A4.js | UTF-8 | 444 | 3.25 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2009 the Sputnik authors. All rights reserved.
/**
* Value Property LN10 of the Math Object has the attribute ReadOnly
*
* @path ch15/15.8/15.8.1/15.8.1.2/S15.8.1.2_A4.js
* @description Checking if Math.LN10 property has the attribute ReadOnly
* @noStrict
*/
// CHECK#1
var x = Math.LN10;
Math.LN10 ... | true |
e02da38931af658e1a6b7bdfabc7aa8511cbe009 | JavaScript | birkangit/HouseKeeping_fullStack | /server/ignoreListCheck.js | UTF-8 | 429 | 2.515625 | 3 | [] | no_license | const fs = require("fs");
const logger = require("./logger");
verifyIgnoreList = async (ignoreList) => {
for (path of ignoreList) {
if (!fs.existsSync(path)) {
itemToPop = await ignoreList.filter((item) => item === path);
ignoreList.splice(ignoreList.indexOf(itemToPop), 1);
} else {
null;
... | true |
fef3a0a191953455366e41460b75c7018aaf52cb | JavaScript | Nithinbs18/Advanced-Database---Redis-Mongo-Neo4j---Football-information-system | /Redis-scripts/operations.js | UTF-8 | 12,276 | 2.796875 | 3 | [] | no_license | const redis = require('./connection/redis');
function getMatchInfo(matchId, callback){
redis.getMatch(matchId,function(match){
var jsonMatch = JSON.parse(match);
callback(jsonMatch)
});
}
function getTeamPlayers(teamId, callback){
var array = [];
var j = 1;
redis.getTeamPlayers(tea... | true |
8f9694b074c0343c749f7ca0694f6a653457240c | JavaScript | benlopes/Trybe_Projects | /trybe-exercises/exercises/exercises/4.3/piramideVazia.js | UTF-8 | 690 | 3.390625 | 3 | [] | no_license | // asteriscos-base
let starBase = 9;
// linhas (L) a serem impressas em função (FX) da base
let lines1 = Math.ceil(starBase/2);
// iteração para impressão da pirâmide vazia
for(let index = 0; index < lines1; index += 1) {
// espaços externos (EE) a serem impressos FX das L e do index (IN)
let spaces1 = ' '.rep... | true |
260c616aa56538a0d2c0a77f9d5c3b2925d40028 | JavaScript | ARteapartedelarte/Clase-Algoritmos-I-ASC-PSS | /Clase-#18-250920/Ejercicio-6-TP13-Reformulado.js | UTF-8 | 2,485 | 3.6875 | 4 | [] | no_license | /**
* Ejercicio 6 - TP 13 - Código ajustado en Clase #18
* Consigna:
* Realizar un script que incluya dos funciones.
* Función "ingresarDatos": permite cargar en un array las
* notas de los 15 exámenes finales de los alumnos que cursaron
* la cátedra “Introducción a la Informática” durante el 1er
* cua... | true |
06caaa6b6798adbf35e32ad8f5b2f52b391bcd5b | JavaScript | xya370/web-daily | /tools/mobile_event/mobile.js | UTF-8 | 6,294 | 2.71875 | 3 | [] | no_license | 'use strict';
(function(root, factory) {
if (typeof defined == "function" && defined.amd) {
defined([],factory)
} else if (typeof exports == 'object') {
module.export = factory();
} else {
root.mobileEvent = factory();
}
})(this,function() {
var mobileEvent = function (selectDom) {
... | true |
4f51a47f978bf48b9abcabfdb09b49cb3ff98858 | JavaScript | Cyberlane/kattis | /problems/helper.js | UTF-8 | 316 | 2.609375 | 3 | [] | no_license | const helper = (assert, method, input, expected) => {
const readline = () => input.shift();
const output = [];
assert.plan(expected.length);
const print = result => {
output.push(result);
assert.equal(result, expected[output.length - 1]);
};
method(readline, print);
};
exports.helper = helper;
| true |
d155fac487a01dced062ae1cc89c9ff8cf831de6 | JavaScript | sebamar88/app-poketdex | /src/helpers/sortTableMoves.js | UTF-8 | 1,368 | 3.03125 | 3 | [] | no_license | export const sortTableAscending = (moves, sort) => {
const movesRef = [...moves];
switch (sort) {
case "name":
return movesRef.sort((a, b) =>
a.name > b.name ? 1 : b.name > a.name ? -1 : 0
);
case "power":
return movesRef.sort((a, b) => a.power - b.power);
case "type":
... | true |
d2341586305b92ebc27770932f02cc3d7c11c0f9 | JavaScript | jegiraldp/opentopic | /public/js/login.js | UTF-8 | 716 | 2.75 | 3 | [] | no_license | $(document).ready(function(){
/*var cla=document.f1.txtCla.value;
if(cla=="") $("#loginrespuesta").html("Faltan Datos");
else document.f1.submit();*/
$("input#boton").click(function() {
var clave=$("input#txtCla").val().toLowerCase();
if(clave==""){
$("div#loginrespuesta").show("slow");
$(... | true |
84d2f8324457357142334088448e38080007636d | JavaScript | inidaname/mybackuser | /handlers/Tokens.mjs | UTF-8 | 5,329 | 2.5625 | 3 | [] | no_license | import dataLib from "../lib/dataLib";
import mongodb from "mongodb";
export const tokenMethod = {
// Post for token creation
// required fields ID and email
post(data, callback){
let genStr = typeof(data.payload.genStr) == "string" && data.payload.genStr.trim().length == 24 ? data.payload.ge... | true |
1a2f84a329ce38bbca4869fdfe00e04f846e5df4 | JavaScript | iammidhu/canvasLayers | /js/script.js | UTF-8 | 2,986 | 2.890625 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
$('#image_url').change(function() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
var input = this;
if (input.files && input.files[0]) {
var reader = new FileReader();
rea... | true |
ec220feadda841c4c66cb38f71ddd2e317f70677 | JavaScript | atzepeda/Armando-Projects | /LexisNexis Briefing Report/backend/arrayConstructor.js | UTF-8 | 468 | 3.546875 | 4 | [] | no_license | /**
* Reconstructs the array of IDs into an acceptable array format for GraphQL queries.
* The array passed in is of the format [{'id' : xxxx}, {'id' : xxxx}]
* This method converts it to the format [xxxx, xxxx]
* @param {*} arrayIDs An array of IDs
*/
var arrayConstructor = function(arrayIDs){
let peopleIDs =... | true |
32048a9cf226befab505abb9683a362ccb6c8c6f | JavaScript | AndrewJey/Phyton | /Python-master/PythonBottle/Bottle/JS/index.js | UTF-8 | 1,323 | 2.625 | 3 | [] | no_license | function getProducts(){
$.ajax({
type: "GET",
url: "http://localhost:8080/products.json",
dataType: "json",
success: function (data) {
data=JSON.stringify(data);
data=JSON.parse(data);
console.log(data);
var table='<table id="products" ... | true |
d4b39037bc9076aadac277650f66af0795bb7eab | JavaScript | ajaykumarbk75/Enterprise-Application-Development | /GeaRMIT/src/main/resources/public/js/product-description.js | UTF-8 | 3,442 | 3.40625 | 3 | [] | no_license | //----------------------------------------- Variables ------------------------------------//
// For images
var mainPic = document.querySelector(".main-pic");
var productName = document.querySelector(".product-name");
var productCategory = document.querySelector(".product-category");
var productStatus = document.queryS... | true |
8d7c7f64f449c3b7607e16faf4723dd89d14eabb | JavaScript | nguyenhoanglinh601/ITL-GoogleVision | /toocharge/FrontEnd/src/assets/assets_Desgin/assets/ftl-style/js/validate.js | UTF-8 | 26,218 | 2.578125 | 3 | [] | no_license | $(document).ready(function() {
jQuery.validator.addMethod("noSpace", function(value, element) {
return value.indexOf(" ") < 0 && value != "";
}, "No space please and don't leave it empty");
// 1. Validate support phone call
var requestPhoneCall_vi = {
errorElement: 'span', //default input error message contai... | true |
f7702aa9036fae73ebc96162277fffcdb7e3f0de | JavaScript | EDLuke/Stride | /app/components/class/UserClass.js | UTF-8 | 2,778 | 2.96875 | 3 | [] | no_license | import FitnessRecord from './FitnessRecordClass.js';
import moment from 'moment';
export default class User{
constructor(){
this.username = "";
this.displayName = "";
this.age = "";
this.gender = "";
this.height = "";
this.weight = "";
this.friends = [];
this.FitnessRecord = [];
}
static initLogi... | true |
7c3b7891e61e6304b739858795eabea9fe2f2949 | JavaScript | g-testo/Codewars-Mar-QEA | /halvingSum/halvingSum.js | UTF-8 | 1,711 | 3.96875 | 4 | [] | no_license | // https://www.codewars.com/kata/5a58d46cfd56cb4e8600009d
// Task
// Given a positive integer n, calculate the following sum:
// n + n/2 + n/4 + n/8 + ...
// All elements of the sum are the results of integer division.
// Example
// 25 => 25 + 12 + 6 + 3 + 1 = 47
function halvingSum(n) {
// while(n>=1){
... | true |
6ae7f79a49ed7bc27ead54db1e3d5f4af12910ef | JavaScript | odongohcoder/microservices-architecture-course | /project_1_eventbus_demo/comments_service/index.js | UTF-8 | 2,008 | 2.828125 | 3 | [] | no_license | const express = require("express");
const bodyParser = require("body-parser");
const { randomBytes } = require("crypto");
const cors = require("cors");
const axios = require("axios").default;
const app = express();
app.use(bodyParser.json());
app.use(cors());
const PORT = 5002;
const commentsByPostId = {};
/* get al... | true |
657211ecbb6783b1ef8306f02346fac8a0616994 | JavaScript | qqjameqq1/Javascript-Helper-Functions | /date/func/date_stripzero/code.js | UTF-8 | 1,305 | 3.375 | 3 | [] | no_license |
function date_stripzero(date){
//-------------------------------------------------------
//日期時間去零
//-------------------------------------------------------
//date 日期,格式 yyyy/mm/dd [hh:ii:ss]
//-------------------------------------------------------
//參數檢驗
if((date==undefined)||(date=='')){
return fal... | true |
b127bede7939560e800ff5a3b0e387421777f71f | JavaScript | johnr0/PreCogStudy | /client/components/mturk/gup.js | UTF-8 | 392 | 2.9375 | 3 | [] | no_license |
//this function gets the mturk parameters from the current url
const Gup = (name)=> {
//
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.href);
if(results == null)
... | true |
4a7c0a98b2b04d80dc7d0f8748aa581170bbebfb | JavaScript | hajra40/Responsive-Navbar | /app.js | UTF-8 | 463 | 2.625 | 3 | [] | no_license | const menu = document.getElementById('M');
const cross = document.getElementById('C');
const menu__items = document.getElementById('menu_items');
menu.addEventListener('click',() => {
menu.classList.add('remove-menu');
cross.classList.add("show-cross");
menu__items.classList.add('show');
})
cross.addEventListen... | true |
592e21cfadef0dfaa6ce72399a6d68e93cdacc89 | JavaScript | Bruledamien/dynamic-patterns | /dynamicPatternsD3.js | UTF-8 | 5,554 | 2.71875 | 3 | [] | no_license | // PARAMS : définition des couleurs
var colors = {
ultraMarine: "rgba(19,37,60,0.8)",
vert: "rgba(56,78,60, 0.8)",
rosePoudre: "rgba(243,218,206,0.8)",
justeBleu: "rgba(13,29,236,0.8)",
corail: "rgba(241,88,65,0.8)",
soleilHiver: "rgba(255,248,160,0.8)"
};
var backgroundColors = {
blanc: "rgba(255,255,25... | true |
c2954f6aeab6f350e770645278aeb3515d3b9680 | JavaScript | conorcodes/randuro | /app.js | UTF-8 | 2,142 | 3.078125 | 3 | [] | no_license |
var strava = require('strava-v3');
var segments = [
//"2546010",
//"254905",
"626982",
"685102"
]
//For race, create section in DB
var leaderboards = {};
//For segment in segments
getSegmentsRecursive(leaderboards,segments,0,function(){
var validCompetitors = [];
Object.keys(leaderbo... | true |
ee71b93fec14dd7c101838b329d37a889981ecbe | JavaScript | H1ra1/cursoEH | /d202-javascript/script.js | UTF-8 | 855 | 3.984375 | 4 | [] | no_license | // for(let i = 2; i <= 100; i++) {
// console.log(i);
// i++
// }
// function find(array, word) {
// for(palavra of array) {
// if(word === palavra) {
// return `Palavra "${palavra}" encontrada na lista`;
// }
// }
// return 'palavra não encontrada';
// }
// let lista =... | true |
a3cd56fb4fcb125f22c9c60696a150b2d2bed99b | JavaScript | pkulcsarsz/techband-iw | /node-app/services/requester.js | UTF-8 | 980 | 2.75 | 3 | [] | no_license | const https = require('https');
doRequest = async (options, data = null) => {
return new Promise((resolve, reject) => {
const req = https.request(options, (res) => {
res.setEncoding('utf8');
let responseBody = '';
res.on('data', (chunk) => {
responseBody... | true |
5bf8f81522dd4c521ddd0e71c8fd3cfb5f21ca04 | JavaScript | Roumez/exo-fs-api | /cp.js | UTF-8 | 364 | 2.90625 | 3 | [] | no_license | const fs = require('fs')
// Longueur de nos arguments
if (process.argv.length !== 4) {
console.log(`Error: length is not defined`)
process.exit(1)
}
// check if the path exist
if (!fs.existsSync(process.argv[2])) {
console.log(`Désolé, ${process.argv[2]} n\'existe pas`)
process.exit(1)
}
const txt = fs.copyFi... | true |
9f4a730c8f79c95d654f52f2643ad9d29b5a0db9 | JavaScript | chenken12/kata | /InstructorsN.js | UTF-8 | 686 | 3.671875 | 4 | [] | no_license | const instructorWithLongestName = function(instructors) {
// Put your solution here
let slot = 0, len = 0;
for (let i = 0; i < instructors.length; i++) {
//use only greater so return the first one
if (instructors[i].name.length > len) {
len = instructors[i].name.length;
slot = i;
}
}
r... | true |
35c73e5ecc4d850590399752b65c88804295b60e | JavaScript | arkosarkar343/azurite | /lib/validation/MD5.js | UTF-8 | 1,064 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict';
const crypto = require('crypto'),
AError = require('./../Error'),
ErrorCodes = require('./../ErrorCodes');
class MD5 {
constructor() {
}
/**
* @param {Object} options - validation input
* @param {Object} options.collection - Reference to in-memory database
* @param {O... | true |
7213f49d2cfb395b57436be2251c4780ca1c9e65 | JavaScript | car-cas/ProyectoAremSegundoCorte | /public_html/js/getList.js | UTF-8 | 1,284 | 2.65625 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
function getList()
{
var url = "https://d8yq6vhq43.execute-api.us-east-2.amazonaws.com/prod/mysecondresource"
var xmlHttp = n... | true |
0fb438900868fc405b7dfb0e6241c16f1746db0c | JavaScript | missis-sippi/nd-5_1.3 | /script.js | UTF-8 | 1,413 | 2.734375 | 3 | [] | no_license | const ChatApp = require('./chat');
let webinarChat = new ChatApp('webinar');
let facebookChat = new ChatApp('=========facebook');
let vkChat = new ChatApp('---------vk');
let chatOnMessage = (message) => {
console.log(message);
};
let prepareForAnswer = () => {
console.log('Готовлюсь к ответу...');
};
let chat... | true |
9b132f4c5b4f77604f607ae9bd80070aaab0ab0e | JavaScript | mahesh-arrayppointer/Learning | /42.js | UTF-8 | 278 | 4.03125 | 4 | [] | no_license | //Write a program to print following outputs in C language
// A
// BBB
// CCCCC
// DDDDDDD
let n = 5;
let string = "";
for (let i = 1; i <= n; i++) {
for (let j = 0; j < i; j++) {
string += String.fromCharCode((i - 1) + 65);
}
string += "\n";
}
console.log(string); | true |
77a7a1981b0574786a7ccd89a39e0303a1dd84dd | JavaScript | arjunkathuria/Eloquent_Javascript | /chapter_4/storPhi.js | UTF-8 | 237 | 3.171875 | 3 | [] | no_license | var map = {};
function storePhi(event,phi) {
map[event]= phi;
}
storePhi("pizza",0.69);
storePhi("study",0.75);
console.log(map);
for (var okay in map){
console.log("the correlation for the event " + okay + " is "+ map[okay]);
}
| true |
2b645fb4f661494293cfadde92ae2de324440386 | JavaScript | heiastart/EduonixMEANcourse-project7 | /src/schema.js | UTF-8 | 2,642 | 3.015625 | 3 | [] | no_license | const graphql = require('graphql')
const {buildSchema} = graphql
// Next, I define the GraphQL-schema for this app using buildSchema template. Can also use gql instead of buildSchema...
// exclamation mark denotes that the field is non-null or MANDATORY!
// no exclamation mark denotes that the field is nullable ... | true |
c6a11ce081c72c260dd4e43f2907f078bb961cb2 | JavaScript | BenAlaa/CoderByteSolutions | /Easy/Binary Reversal/sol1.js | UTF-8 | 478 | 3.59375 | 4 | [] | no_license | function BinaryReversal(str) {
var num = Number(str);
var newBin=[];
while (num > 0) {
newBin.push(num%2);
num = Math.floor(num/2)
}
while (newBin.length%8 !==0) {
newBin.push(0)
}
var ans=0, orgBin = newBin.join("").split("").reverse();
for (var i=0; i<newBin.length; i++) {
... | true |
5c2a0f84089a518f91e8687677defeb5a5a12092 | JavaScript | cosmolightfoot/madlib-project | /main.js | UTF-8 | 6,734 | 3.140625 | 3 | [] | no_license |
function madLib() {
//links string input to js variables
var adjective1 = document.getElementById('adjective-1').value;
var adjective2 = document.getElementById('adjective-2').value;
var adjective3 = document.getElementById('adjective-3').value;
var adjective4 = document.getElementById('a... | true |
959321c568dbe723e052c83c57faac53af5a95b6 | JavaScript | tsergeytovarov/poker-player-setkajs | /lib/checkAllIn.js | UTF-8 | 351 | 2.6875 | 3 | [
"MIT"
] | permissive | module.exports = checkAllIn = (players) => {
for (let i = 0; i < players.length; i++) {
const player = players[i];
if (player.status === 'active' && player.stack == 0)
return true;
}
return false;
}
// const players = [
// { bet: 200, stack: 100 },
// { bet: 100, stack: 100 }
// ];
//
// conso... | true |
17da67bf4e48eea9b16b57808e1b776b6733ae14 | JavaScript | jdy130/TuringTest | /Fetch/api/managed-records.js | UTF-8 | 2,952 | 2.6875 | 3 | [] | no_license | import fetch from "../util/fetch-fill";
import URI from "urijs";
import { resolve } from "url";
// /records endpoint
window.path = "http://localhost:3000/records";
// Your retrieve function plus any additional functions go here ...
const limit = 10;
// Additional helpers
function isPrimaryColors(color) {
const pr... | true |
019aa985f2d3be9a97c5c58d96b51d2ce49cda10 | JavaScript | RinHZ/pythonBrother | /jQueryFirst/jQuery事件和选择器/EventTarget.js | UTF-8 | 601 | 2.859375 | 3 | [
"MIT"
] | permissive | /**
* Created by zhang on 16/5/13.
*/
$(document).ready(function(){
$("body").bind("click",bodyHandler);
$("div").bind("click",divHnadler1);
$("div").bind("click",divHnadler2);
});
function bodyHandler(event){
conlog(event)
}
function divHnadler1(event){
conlog(event);
//event.stopPropaga... | true |
03e9ca3c697eea434afcab20ffeacf3be326d420 | JavaScript | Alireza9651501005/native-restaurant2 | /src/redux/reducer.js | UTF-8 | 784 | 2.703125 | 3 | [] | no_license | const initialState = [];
const reducer = (state = initialState, action) => {
switch (action.type) {
case 'ADD_TO_CART':
const item = state.find(e => e.id === action.payload.id);
if (item) {
item.count += 1;
return [...state];
}
return [...state, {...action.payload, count: ... | true |
b0427aea3369ba35b4bff98aafa4ed46ddf93856 | JavaScript | CliffLeopard/js-practice | /js-advance/jsclusor.js | UTF-8 | 1,407 | 3.875 | 4 | [] | no_license | // JS 事件模型
// let time1 = new Date().getTime()
// console.log(time1)
// // alert("Hello World")
// let time2 = new Date().getTime()
// setTimeout(()=>{
// console.log('time1',new Date().getTime() - time1)
// console.log('time2',new Date().getTime() - time2)
// },200)
// console.log(new Date().getTime() - time2)
//... | true |
4549a066fc8869d613e3090c8945c0a84e363194 | JavaScript | Liadrinz/BR-MS | /mods/backend.js | UTF-8 | 5,815 | 2.84375 | 3 | [] | no_license | /*
Post to backend APIs.
api: String
the postfix of api url.
data: PlainObject
Parameters of the api that will be post as the request header.
callback: function (data, err)
where data: PlainObject | undefined | null,
... | true |
87f8a5837a3b21a027cbfd6f63ad6867d96a4700 | JavaScript | PROTECO/web_enero2017 | /Avanzado/Martes/js/main.js | UTF-8 | 1,196 | 3.15625 | 3 | [
"MIT"
] | permissive | /*
PRIMERA PARTE
ejercicio que comprueba jQuery este bien linkeado
if(jQuery){
alert("JQuery esta Instalado")
}
*/
//HACIENDO REFERENCIA A ELEMENTOS DENTRO DE JS
/*
$(".circulo").click(function(){
alert("Clickeaste un circulo");
});
*/
/*
$("#cuadrado").click(function(){
alert("Clickeaste un cuadrad... | true |
17a586b7123a94fcb50da821eff49acf7b7c6c92 | JavaScript | felipeventorim/trybe-exercises | /bloco-7-Introducao-a-JavaScript-ES6-e-Testes-Unitarios/1.JavaScript-ES6--let,-const,-arrow-functions-e-template-literals/exercise2.js | UTF-8 | 2,264 | 5.03125 | 5 | [] | no_license | // 1. Crie uma função que receba um número e retorne seu fatorial.
let resposta = 1;
// --- Versão 1
const fatorialV1 = (numero) => {
while (numero) {
resposta *= numero;
numero -= 1;
}
return resposta;
};
console.log(fatorialV1(4));
// --- Versão 2
resposta = 1;
const fatorialV2 = (numero) => {
if (n... | true |
86df1a2df851ddda6533b317f0ce82dfc49fedf1 | JavaScript | heysoypaez/challenge-modyo | /src/js/index.js | UTF-8 | 1,482 | 3.171875 | 3 | [] | no_license | const render = (async () => {
const fetchDataApi = async (url) => {
try {
const data = await fetch(url);
response = await data.json();
console.log(response);
return response;
}
catch(error) {
console.error(error);
}
}
const users = await fetchDataApi("https://jsonplaceholder.typicode.com/us... | true |
e4f6064fb399fa3617a741a0bc4a7569ab4650aa | JavaScript | tfaramar/shelter-in-space | /src/App.js | UTF-8 | 3,409 | 2.53125 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import axios from 'axios';
import DateSection from './components/DateSection';
import Loader from 'react-loader-spinner';
import ReactPlayer from 'react-player';
import './App.css';
import Image from './components/Image';
function App() {
const [errMsg, setErrM... | true |
4ce20f005334b3748e6b91736c17497e468e93a6 | JavaScript | imandel/pulseoxweb | /src/index.js | UTF-8 | 3,386 | 2.765625 | 3 | [] | no_license | import './style.css';
import { ImageCapture } from 'image-capture';
const rect = document.getElementById('rect');
const toggleColor = () => {
rect.classList.toggle('red');
rect.classList.toggle('blue');
};
function nextPaint() {
return new Promise(requestAnimationFrame);
}
const canvasEl = document.createElem... | true |
49de01d2299f59c22d66ecdfbf6008508898f29a | JavaScript | doxxitxxyoung/movieql | /graphql/db_person.js | UTF-8 | 535 | 2.984375 | 3 | [] | no_license | export const people = [
{
id: "0",
name: "A",
age: 18,
gender: "female"
},
{
id: "1",
name: "B",
age: 19,
gender: "female"
},
{
id: "2",
name: "C",
age: 20,
gender: "male"
},
{
id: "3",
... | true |
edebd1b708e57fbf5b367d6ff34ed8a72825f4c8 | JavaScript | pratik2709/JavaScript-Playground | /js/catch_the_monster_game.js | UTF-8 | 5,305 | 2.828125 | 3 | [] | no_license |
function gameplay()
{
//game is active
game_active = 1;
catch_monster = temporary;
catch_monster_context = temporary_context;
document.getElementById("mycanvas4").style.zIndex="7";
document.getElementById("mycanvas4").style.visibility="visible";
//var catch_mon... | true |
27789b2a5f019f3a02dca7cbd06dc59807021a1b | JavaScript | ren1244/libs | /binJS/easyuse.js | UTF-8 | 2,227 | 2.703125 | 3 | [] | no_license | const BINJS_STATUS_STR=1;
const BINJS_STATUS_BIN=2;
const BINJS_STATUS_ERR=-1;
function BinJS(data)
{
return new BinJSBase(data);
}
function BinJSBase(data)
{
this.status=typeof(data)==='string'?BINJS_STATUS_STR:BINJS_STATUS_BIN;
this.data=data;
}
BinJSBase.prototype.str=function(type)
{
if(this.status!==BINJS_... | true |
83998e8faedcc646d1ade71b921dd4b023a5e84b | JavaScript | Guardian820/duellinks | /js/cards.js | UTF-8 | 1,818 | 2.8125 | 3 | [] | no_license | $(document).ready(function()
{
GetCardApi();
GetCards();
});
function GetCardApi()
{
$.getJSON("/data/card-api.json", function(data)
{
cardApi = data;
});
}
function GetCards()
{
$.getJSON("/data/cards-dl.json", function(data)
{
allCards = data;
});
}
function GetCardU... | true |
904ff6143e025dd6f476da905684eae579df7e6a | JavaScript | jostylr/pieceful-programming | /build/utilities/tests/indexof.js | UTF-8 | 1,523 | 2.65625 | 3 | [] | no_license | const tap = require('tap');
const myutils = require('../index.js');
const main = async function () {
tap.test('f=indexOf', async (t) => {
const s = myutils.makeScanners();
console.log('hello');
let subs = [];
{ a = s.indexOf('c(ob)ool', 'o');
t.equals(a, 5, 'str'); }
{ a = s.indexOf('c... | true |
2adbd2d8056367e407e7c8b5e81f6df0ff7a0bcc | JavaScript | samuelwong613/simdux-logger | /index.js | UTF-8 | 1,419 | 2.53125 | 3 | [] | no_license | /**
* @providesModule simdux-logger
*/
import verifyOption from './verifyOption';
export const createLogger = custOption => {
let option = verifyOption(custOption);
let { logger, colors, title, stateTransformer, timestamp, whitelist, blacklist, level } = option;
return (key, prevState, nextState) => ... | true |
55a1121a2e733cd835ea91a9c83a87bd16755aa9 | JavaScript | delfimassa/9-arreglos-funciones-poo | /js/g)ejercicio2fun.js | UTF-8 | 665 | 4.15625 | 4 | [] | no_license | document.write("<h5>2)2- Definir una función que muestre información sobre una cadena de texto que se le pasa como argumento. A partir de la cadena que se le pasa, la función determina si esa cadena está formada sólo por mayúsculas, sólo por minúsculas o por una mezcla de ambas.</h5>")
function texto(cadena) {
i... | true |
efe60669af19090150813e041c1f2d15a5490537 | JavaScript | CelestialLemon/league-simulator | /src/layout/TeamsTab.js | UTF-8 | 2,181 | 2.53125 | 3 | [] | no_license | import React from 'react'
import '../pages/Home.css';
import { useState, useEffect } from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';
import TeamsTable from '../components/TeamsTable';
import { AiOutlinePlusCircle } from 'react-icons/ai'
const TeamsTab = ({onTeamsChange}) => {
const [addTeamInput, s... | true |
2e379880669b6634afb9c78f2a460ebe5c6eace9 | JavaScript | amaliluthfi/ecommerce-server | /controllers/product-controller.js | UTF-8 | 2,538 | 2.765625 | 3 | [] | no_license | const { Product } = require('../models')
class ProductController{
static createProduct(req, res, next) {
let newProduct = {
name: req.body.name,
image_url: req.body.image_url,
price: req.body.price,
stock: req.body.stock
... | true |
ff9ef206fa75116d2c1c6c3f607a82243e598dc4 | JavaScript | vmlime/engineer-ai-react | /src/App.js | UTF-8 | 1,564 | 2.640625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import './App.css';
import Header from "./components/Header";
import DataTable from "./components/DataTable";
import fetchData from "./helpers/fetchData";
function App() {
const [localData, setLocalData] = useState([]);
const [shownData, setShownData] = useState... | true |
7fd34ad2d676bfd9ee71aa2b9e04373971a2e390 | JavaScript | kbkk/advent_of_code | /day_4/2.js | UTF-8 | 325 | 2.765625 | 3 | [] | no_license | const fs = require('fs');
const input = fs.readFileSync('./input', {encoding: 'utf-8'});
const out = input
.split('\r\n')
.map(row => row.split(' '))
.map(row => row.map(word => [...word].sort().join('')))
.map(row => +[...new Set(row)].length === row.length)
.reduce((a, b) => a + b);
console.log(... | true |
3df96e95a1020c22971ffe3d69887dfeb69afbac | JavaScript | Ellebkey/paystand-challengue | /server.js | UTF-8 | 2,155 | 2.953125 | 3 | [] | no_license | const fs = require( 'fs' );
const request = require( 'request-promise' );
const getAvgAge = array => {
let ages = array.map( person => person.age );
let avg = Math.floor( ages.reduce( ( acumulator, current, index,
currentReduced ) => {
return acumulator + ( current / currentReduced.length )
}, 0 ) );
r... | true |
a1a03ce5ca706573ab9d5c025d6cf0b2d6b552be | JavaScript | amnh-digital/hope-climate-ia | /consequences-mitigation/js/map.js | UTF-8 | 1,537 | 2.84375 | 3 | [] | no_license | 'use strict';
var Map = (function() {
function Map(options) {
var defaults = {};
this.opt = $.extend({}, defaults, options);
this.init();
}
Map.prototype.init = function(){
this.$el = $(this.opt.el);
this.$body = $('body');
this.stories = _.map(this.opt.stories, function(story, i){
... | true |
40e6cb2acb47fcfa57ad13fa8dd77c2bccca68f7 | JavaScript | uwspstar/DataStructures-Algorithms | /Data-Structure/Nodejs/500 Must Know/stack_queue/Reverse a stack using recursion.js | UTF-8 | 670 | 4.4375 | 4 | [] | no_license | //Reverse a stack using recursion
/*
Write a program to reverse a stack using recursion. You are not allowed to use loop constructs like while, for..etc, and you can only use the following ADT functions on Stack S:
isEmpty(S)
push(S)
pop(S)
*/
//The idea of the solution is to hold all values in Function Call Stack unti... | true |
c9d54e3c11af814a81007fc1236b85c973dd0db9 | JavaScript | mapmeld/POI-Dough | /public/scripts/kansas.js | UTF-8 | 2,913 | 2.609375 | 3 | [] | no_license | var ctx;
var shape = [ [ 10, 10 ], [ 150, 275 ], [ 228, 100 ], [ 10, 10 ] ];
function replaceAll(src, oldr, newr){
while(src.indexOf(oldr) > -1){
src = src.replace(oldr,newr);
}
return src;
}
function testCanvasCode(){
var codescan = $("codedraft").value;
codescan = replaceAll(replaceAll(codescan.toLowerC... | true |
c81d2da9456a9c984b4ebc9e7c540ac1626533ca | JavaScript | secreter/algorithm | /leetcode/StringtoInteger.js | UTF-8 | 331 | 2.953125 | 3 | [] | no_license | /**
* Created by So on 2017/3/3.
*/
/**
* https://leetcode.com/problems/string-to-integer-atoi/?tab=Description
*/
/**
* @param {string} str
* @return {number}
*/
var myAtoi = function(str) {
let n=parseInt(str)
n=n!=n?0:n
if(n>2147483647){
n=2147483647
}
if(n<-2147483648){
n=-2147483648
}
... | true |
87f22d4187d05d3c3f55d68260952f7b5628befe | JavaScript | NMadiyar/iMarketing | /js/main.js | UTF-8 | 315 | 2.984375 | 3 | [] | no_license | let nav = document.querySelector('#nav');
let navToggle = document.querySelector('#navToggle');
navToggle.addEventListener("click",function (event){
event.preventDefault();
if(!nav.classList.contains("show")){
nav.classList.add("show");
} else{
nav.classList.remove("show");
}
});
| true |