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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2bd74ad50cafa873ad7fac4bb3d2121aea1363ac | JavaScript | BoykoPetevBoev/SoftUni-JS-Fundamentals-May-2019 | /Fundamentals Mid Exam - 18 December 2018 ( Retake )/02.js | UTF-8 | 1,155 | 3.40625 | 3 | [] | no_license | function solve(input) {
let kids = input.shift().split('&');
let array = input;
for (let i of array) {
if (i === 'Finished!') {
break;
}
let line = i.split(' ');
if (line[0] == 'Bad') {
let alreadyExist = kids.includes(line[1]);
if (!alread... | true |
1689cf4385e986758e759d2be58449702ef419e0 | JavaScript | Shivanshi-chadha/assignment | /hittingJackpot.js | UTF-8 | 494 | 3.328125 | 3 | [] | no_license | const testJackpot = (arr) => {
let firstWord = arr[0];
const obj = {
element: firstWord,
};
for (var i = 1; i <= arr.length - 1; i++) {
if (arr[i] !== obj.element) {
return false;
}
}
return true;
};
console.log(testJackpot(["@", "@", "@", "@"]));
console.log(testJackpot(["abc", "abc", "... | true |
963a794648ed0109ad04b9d7835e30f5a93a2751 | JavaScript | JasonBrown2K13/elebase | /js/slideshow-old.js | UTF-8 | 1,531 | 3.03125 | 3 | [] | no_license | // Siema slideshow
//Slideshow on home page
var mySiema1 = new Siema({
selector: '.js-siema1',
loop: true
});
//'Mini Monkeys' slideshow on groups page
var mySiema2 = new Siema({
selector: '.js-siema2',
loop: true
});
//'Little Lions' slideshow on groups page
var mySiema3 = new Siema({... | true |
869525dd0ee2d207b07e5de89b930f5d7a829513 | JavaScript | NikolaySavenko/Alice-Skill-Training | /index.js | UTF-8 | 917 | 2.640625 | 3 | [] | no_license | // Для асинхронной работы используется пакет micro.
const { json } = require('micro');
// Запуск асинхронного сервиса.
module.exports = async (req, res) => {
const { request, session, version } = await json(req);
let answer;
let astroPhrase = "Бессовестный незнающий жалости человек который всем ставить к... | true |
9778e3898cb598a11662fb1568aa27e0f0b5550a | JavaScript | plotly/simplicial-complex-contour | /lib/codegen.js | UTF-8 | 8,251 | 2.5625 | 3 | [
"MIT"
] | permissive | 'use strict'
module.exports = getPolygonizer
var allFns = [
function cellPolygonizer_0() {
function B(C, E, i, j) {
var a = Math.min(i, j) | 0,
b = Math.max(i, j) | 0,
l = C[2 * a],
h = C[2 * a + 1]
while (l < h) {
var m = (l + h) >> 1,
v = E[2 * m + 1]
... | true |
9e1b8ece34358dae82546d6365446b822b0b2b59 | JavaScript | AskForTheWolf/js-gladiator | /gladiator.js | UTF-8 | 620 | 3.484375 | 3 | [] | no_license | var audio = new Audio('American Gladiators - Intro.mp3');
audio.play();
//except sound wouldn't work for me, that would have been worth at least 11 bonus points
class Gladiator {
constructor(name, weapon){
this.name = name;
this.weapon = weapon;
if (weapon === "Spear" || weapon === "Club" || weapon === "... | true |
b582bb142f60cf44c06c2c3c62e6244a309abacb | JavaScript | valgaze/sugar | /examples/ex2_peoplecount/index.js | UTF-8 | 1,380 | 2.828125 | 3 | [
"MIT"
] | permissive | /*
*
* Instructions:
* - Copy the contents of this file to the Macro editor for your device
* - Create the user interface by hand or using the included 'interface.xml' file
*
*/
const xapi = require("xapi");
// 1) Handle button click event
xapi.event.on("UserInterface Extensions Panel Clicked", event => {
... | true |
86aede77b286c848959e79625b1887e4b9114316 | JavaScript | ZMR2194888146/select-course-system-view | /src/pages/courses/store/reducer.js | UTF-8 | 1,520 | 2.671875 | 3 | [] | no_license | import {
fromJS
} from "immutable";
import { message } from "antd";
import { ADD_CREATED_COURSE_LIST, TO_SHOW_COURSE_INFO, CHANGE_SHOW_INFO_STATUE, HANDLE_RESULT, DO_NOT_FRESH } from "./actionTypes";
const courseState = fromJS({
courses: [],
wantShowInfo: false,
courseInfo: { },
fresh: false
});
c... | true |
1cf47698ce6f841b533b43d9dd4e49a6de7e1275 | JavaScript | a-laughlin/redux-machine | /index.js | UTF-8 | 954 | 2.65625 | 3 | [] | no_license | "use strict"
function createMachine(lifecycleHooks) {
const defaultLifecycleHooks = {
getStatus:(state,initialStatus)=>(state && state.status) || initialStatus,
getReducer:(status)=>{},
getNextState:(state, nextState,status)=>state === nextState ? state : Object.assign({status}, nextState)
};
const {... | true |
ab6e7d7e577a2e61fbbd159450b8d44ca1ee9a31 | JavaScript | gheezl/pokedex | /src/App.js | UTF-8 | 2,051 | 2.828125 | 3 | [] | no_license | import React, { Component, Fragment } from 'react';
import './App.css';
import Header from "./components/Nav/Header.js";
import Pokemon from "./components/pokemon/Pokemon.js";
import PlaceHolder from "./components/placeHolder/PlaceHolder.js"
import PokemonDisplay from "./components/PokemonDisplay/PokemonDisplay.js"
c... | true |
7790a5723b41a45e11108b225aa4ad79724a9604 | JavaScript | SeQRentry/seqrentry | /website/js/index.js | UTF-8 | 2,730 | 2.578125 | 3 | [] | no_license |
$(document).load(function() {
// Enable fading pages if Javascript is available
$('article').each(function (idx, el) {
$(el).addClass('stacked');
});
});
$(document).ready(function() {
$(window).hashchange(function() {
var id = location.hash.substring(1);
var el = document.... | true |
0cfaeb9d9566fba4fd58392b1ad50b33c5bd8931 | JavaScript | tiancaifox/wedo | /src/main/webapp/assets/js/wedo.ajax.js | UTF-8 | 11,571 | 2.546875 | 3 | [] | no_license | /**
* author bmf
* wedo ajax相关工具
*/
(function($) {
if (!_webRoot && _webRoot == undefined) {
throw new SyntaxError('the _webRoot is not defined!.');
}
var escape = /["\\\x00-\x1f\x7f-\x9f]/g,
meta = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"': '\\"',
'\\': '\\\\'
},
... | true |
5f47b86cefdfb9bd827052abbe4e24e1f856a43f | JavaScript | tomarskt/cerberus-node-client | /lib/linereader.js | UTF-8 | 1,136 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | 'use strict'
module.exports = {
readLine: linereader
}
var readline = require('readline')
function linereader (options) {
return new Promise((resolve, reject) => {
let rl = readline.createInterface({
input: process.stdin,
output: process.stdout
})
rl.on('line', input => {
rl.input.... | true |
d657a982c147e10379af47e7ccf964e476e07021 | JavaScript | bluemorgan23/ternary-traveler | /src/scripts/htmlFactory.js | UTF-8 | 718 | 3.53125 | 4 | [] | no_license | // htmlFactory Module has my create element function and clear container function. The create element creates an HTML element with text and id if I want. The clear container will clear the contents of a container when called on in order to undergo CRUD process.
const htmlFactory = {
createElementWithText: (elemen... | true |
04d659eaa01b38c92c8b001feeef53dd3c2f2688 | JavaScript | alcantariel/javascript-masterclass | /03_objetos/05_objetos.js | UTF-8 | 437 | 3.578125 | 4 | [] | no_license | // objetos - propriedades computadas em tempo de execução
const key1 = "title";
const key2 = "author";
const key3 = "pages";
const key4 = "language";
const key5 = "available";
const book = {
[key1]: "Clean Code",
[key2]: "Robert C. Martin",
[key3]: 464,
[key4]: "English",
[key5]: true,
};
console.log(book)... | true |
a8e3d7e697265ced94f607222fb9e5ab234f1509 | JavaScript | nadavoran/Pini | /Jest/deck.test.js | UTF-8 | 1,511 | 2.96875 | 3 | [
"MIT"
] | permissive | const { Deck } = require('../src/Deck');
// var Hand = require('pokersolver').Hand;
// test('adds 1 + 2 to equal 3', () => {
// expect(sum(1, 2)).toBe(3);
// });
describe('Create Deck', () => {
beforeEach(() => {
this.deck = new Deck();
})
it("should have 52 cards", () => {
expect(th... | true |
ffe0429ab3cf77c32d9bd5beef233647924c82e0 | JavaScript | nverno/stonks | /src/search/search.js | UTF-8 | 2,502 | 3.125 | 3 | [] | no_license | /**
* Handles searching for companies/symbols.
* When a selection is made, the `current-symbol` is updated on the page
* with the result;
*/
import $ from 'jquery';
import { partition } from 'lodash';
import searchMenu from './search_menu.ejs';
import searchMenuSection from './search_menu_section.ejs';
import './s... | true |
191a6fb4f385e2f613e2361d2f9593863405e59a | JavaScript | Anantm007/Dev-Bookstore | /validator/index.js | UTF-8 | 738 | 2.625 | 3 | [
"MIT"
] | permissive | exports.userSignupValidator = async(req, res, next) => {
req.check('name', 'Name is required').notEmpty();
req.check('email', 'Email must be between 3 and 32 characters')
.matches(/.+\@.+\..+/).withMessage('Email must contain @').isLength({
min: 4, max: 32
});
req.check('passw... | true |
34433b985747a52c65dae8bffb8ac3642c35194b | JavaScript | ATQQ/MyNotes | /md/demo/Object/index.js | UTF-8 | 2,463 | 4.0625 | 4 | [] | no_license | // var obj = Object(1);
// console.log(obj instanceof Object);
// console.log(obj instanceof Number);
// console.log(obj === 1);//false
// var obj2 = new Object(obj);
// console.log(obj2);
// //var obj={} 等价于 var obj=new Object()
// /**
// * 判断一个值是否是对象
// * @param {Object} v
// */
// function isObject(v) {
// r... | true |
3ebc51ddfc9d3c69d0795916a5d0a46601a1ef07 | JavaScript | laura4614/geekbook-j.s | /2-programacion-dos/retoDiez.js | UTF-8 | 449 | 2.953125 | 3 | [] | no_license | 'use strict';
let edad=0,horasVividas=0;
edad=parseInt(prompt("Ingrese su edad actual en años: "));
horasVividas=edad*(365.25*24); //multi de días considerando el bisiesto por las 24horas del día por el numero de años vividos
console.log('El total aprox de horas vividas en '+edad+' años es de: '+horasVividas+' Horas');... | true |
3db1bb09fb0f1b23e8c4922d4924bf96e5eb2792 | JavaScript | ezlab/odb_gui | /static/js/level.js | UTF-8 | 1,437 | 2.671875 | 3 | [] | no_license |
$(function(){
var lock = {};
var select = $('#input-search-level');
function calcLevels(keys){
var i, item, results;
function calcNode(key){
var list = [],
src = app.getNode(key);
if (src){
if (!src.children){
src = src.parent;
}
while... | true |
bb52b9b8716eabd98f816ca3782415462f414758 | JavaScript | seunggs/isff | /public/js/all.js | UTF-8 | 3,217 | 2.625 | 3 | [] | no_license | $(document).ready(function(){
$(".signup-link").click(function(){
$("#footer_email").focus();
})
$("[id$=email]").focus(function(){
// this.parent is the containing div -> next is the names div
$(this).parent().next().show();
})
var feedback = function(div, msg, mode) {
div.html(msg);
div.removeClass("alert-inf... | true |
d4f72a98214f207db6f634439787f136b3becbec | JavaScript | ktsiegel/pokebble | /server/test.js | UTF-8 | 710 | 2.78125 | 3 | [] | no_license | function shuffle(o){ //v1.0
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
};
ws = new WebSocket("ws:jinpan.mit.edu:10915/battle")
hash = window.location.hash;
var trainer = hash.substring(1, hash.length);
var pokemon = [
{
"id": "3"... | true |
ae6fa643b30c1fdbb8e425e56e0be8740ae2e1fe | JavaScript | JMarsh99/MochaFlake | /src/flake-util.js | UTF-8 | 2,577 | 3.203125 | 3 | [
"MIT"
] | permissive | // Utility methods for use within the program
// Currently just file and dir reads
const { promisify } = require('util');
let fs = require('fs');
/**
* Promisified version of readFile which is simpler to call
* Must be awaited!
* Inspired by https://stackoverflow.com/questions/46867517/how-to-read-file-with-async-awa... | true |
1a6696ff523fd1619f87943d741a4a862acd4fde | JavaScript | MrNobad/W7D2_Currency_Converter_HW | /src/app.js | UTF-8 | 636 | 2.609375 | 3 | [] | no_license | import Vue from 'vue';
document.addEventListener('DOMContentLoaded', () => {
new Vue({
el: "#app",
data: {
rates: [],
filteredRates: null,
convertedRates: null,
enteredRates: null
},
computed: {
currencyCalculator: function() {
return this.convertedRates = (this... | true |
9013468027b7cb19183bd5d344ab768a4a56fd25 | JavaScript | drewlearns/portfolio | /speak-color/handlers.js | UTF-8 | 1,046 | 3.21875 | 3 | [] | no_license | function logWords(results){
// // return results[results.length -1][0].transcript;
};
import {isValidColor} from './colors.js'
import {start} from './speech.js'
export function handleResult({results}){
logWords(logWords(results));
const words = results[results.length -1][0].transcript;
... | true |
78ca3c471da28449ea991d96e25094cbdd34fc86 | JavaScript | mariodmpereira/freecodecamp-javascript-algorithms-and-data-structures | /resources/courses/04-debugging.mjs | UTF-8 | 1,071 | 3.203125 | 3 | [
"MIT"
] | permissive | // https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/#debugging
import {createExerciseFiles} from '../create-course-files.mjs';
const COURSE = {
name: "Debugging",
number: "04",
lessons: [
"Use the JavaScript Console to Check the Value of a Variable",
"Understand... | true |
15aa724819f879341d08a9113e7301c742610227 | JavaScript | Yura-Yaremko/JS-course | /lesson 5/js05.js | UTF-8 | 401 | 3.15625 | 3 | [] | no_license | // let res = " "
// exit: {
// while (true) {
// while (true) {
// let a = prompt("write number")
// if (a == 100) {
// break exit
// }
// res += a + " "
// }
// }
// }
// console.log(res)
// for (let i = 0; i <= 10; i++) {
// ... | true |
d8b3c000e643025d2e7edcc339ccb3ac8cc9b308 | JavaScript | yogesh2019/EdabitProblems | /Recursion/lengthOfString.js | UTF-8 | 157 | 3.515625 | 4 | [] | no_license | function length(str) {
if(str=="")
return 0;
else
return length(str.substring(1))+1;
}
//length("apple");
console.log(length(" ")); | true |
a11085e094b4b428a807000759e52e09cb4dd0c4 | JavaScript | uk-gov-mirror/DFE-Digital.eapim-developer-hub | /src/hooks/useCookie.js | UTF-8 | 777 | 2.859375 | 3 | [
"MIT"
] | permissive | const getCookie = (key) => {
const cookies = (document.cookie.split(';'))
const item = cookies.find(item => item.indexOf(key) > -1)
if (!item) return null
return item.split('=')[1]
}
const hasCookie = (key) => {
const cookies = (document.cookie.split(';'))
return !!cookies.find(item => item.indexOf(key) ... | true |
d34bb3e1a6f2b6f1e6fe2760268e63ad197c0521 | JavaScript | katekocalgary/kateko | /routes/posts.js | UTF-8 | 1,885 | 2.75 | 3 | [] | no_license | /* * * * * * * * * * * * * * * * * * *
Router middleware for post
* * * * * * * * * * * * * * * * * * */
/* (2019-11-15, Kate Ko) */
// Update: 2019-12-10
// Note : modify for deleting post
const express = require('express');
const PostRouter = express.Router();
const Posts = require('../models/posts.js');
const momen... | true |
05c77f3e929d38dff1f2063e4135ea5049fd4d70 | JavaScript | kennylam91/C0419_CaseStudy | /PHAM_VAN_LAM_C0419G1/blackjack.js | UTF-8 | 9,050 | 2.953125 | 3 | [] | no_license | const START_GAME_BTN = document.getElementById("start_game_btn");
const START_SCREEN = document.getElementById("start_screen");
const GAME_SCREEN = document.getElementById("game_screen");
const NEW_HAND_BTN = document.getElementById("new_hand_btn");
const START_DEALING_BTN = document.getElementById("start_dealing_btn")... | true |
c5416e09fe4ae44fe19797c686f40fc7e6626e6e | JavaScript | shreyashah115/ecomm-project | /firestore-config.js | UTF-8 | 21,214 | 2.625 | 3 | [] | no_license | // CONNECTION TO FIREBASE GOES HERE, WITH "db" as the firebase.firestore()
var firebaseConfig = {
apiKey: "AIzaSyB6-AAe68QiCaeB3loIORz6E6Hg3Znr7ec",
authDomain: "webstore-9da1d.firebaseapp.com",
projectId: "webstore-9da1d",
storageBucket: "webstore-9da1d.appspot.com",
messagingSenderId: "607890589045",
app... | true |
fbef26dec089ef5d2e92e783e7296e754ab4ca2a | JavaScript | hmtranae/launch-academy-challenges | /rock-paper-scissors-js/game.meets.js | UTF-8 | 3,266 | 4.4375 | 4 | [] | no_license | // IMPORTANT!!!!
// PLEASE VISIT game.meets.js for meets expectation solution
// game.exceeds.js is for exceeds expectation
// YOUR CODE GOES HERE
// Meets
// [x] A game consists of a single round.
// [x] Welcome to Rock, Paper, Scissors! should appear in the console.
// [x] The player is prompted to choose a select... | true |
e595afb077e212176ae8e8f84f89460ff856c946 | JavaScript | lindenquan/lindenquan.github.io | /Bayesian/src/Variable.es6 | UTF-8 | 192 | 2.546875 | 3 | [
"MIT"
] | permissive | class Variable {
constructor(name, domain) {
// name is a string
this.name = name
// domain is an arry containing strings
this.domain = domain.slice()
}
}
| true |
6f4f8a040a5aa18bfcc63b094ca738f61871c59e | JavaScript | Expandes/restserver | /server/models/usuario.js | UTF-8 | 1,682 | 2.984375 | 3 | [] | no_license | //Mongoose
const mongoose = require('mongoose');
//Unique Validator
const uniqueValidator = require('mongoose-unique-validator');
//Esquema
let Schema = mongoose.Schema;
//Roles válidos
let rolesValidos = {
values: ['ADMIN_ROLE', 'USER_ROLE'],
message: '{VALUE} no es un rol válido'
};
// ==============... | true |
87a1a2dac4031c6c427a56d07381ea4026ddfe7e | JavaScript | express-labs/pure-react-carousel | /src/Store/Store.jsx | UTF-8 | 2,877 | 2.59375 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import deepMerge from 'deepmerge';
import deepFreeze from 'deep-freeze';
const DEFAULT_STATE = {
masterSpinnerFinished: false,
};
const Store = class Store {
constructor(initialState) {
this.state = deepFreeze(deepMerge(DEFAULT_STATE, initialState));
this.subscriptions = [];
this.masterSpinnerSubscrip... | true |
7b89628d30724988f643fa68f354f6d7b35b6881 | JavaScript | ncaron/Launch-School | /Courses/Front-end Development/210 - Computational Thinking and JavaScript Programming/Lesson 3 - Logic and Flow Control/trimming-spaces.js | UTF-8 | 1,046 | 5.25 | 5 | [] | no_license | /*
Write a function that takes a string as an argument, and returns the string
stripped of spaces from both ends. Do not remove or alter internal spaces.
Example
trim(' abc '); // "abc"
trim('abc '); // "abc"
trim(' ab c'); // "ab c"
trim(' a b c'); // "a b c"
trim(' '); // ""
trim(''); //... | true |
7244819da959313aeeef58fac12d3cf19bbbc23c | JavaScript | Abramus/sportivity-backend | /routes/places.js | UTF-8 | 7,880 | 2.765625 | 3 | [] | no_license | var place = require('../models/place');
var event = require('../models/event');
var express = require('express');
var config = require('../config'); // get our config file
var jwt = require('jsonwebtoken'); // used to create, sign, and verify tokens
var router = express.Router();
var app = express();... | true |
662369c57cb2ffcf13e223a2cad3b74c43689644 | JavaScript | metehankurucu/data-structures-and-algorithms | /Algorithms/Search/Binary/BinarySearch.js | UTF-8 | 366 | 3.875 | 4 | [] | no_license |
//Iterative
function binarySearch(arr, x){
let left = 0, mid;
let right = arr.length - 1;
while(right >= left){
//mid index
mid = Math.floor((left + right) / 2);
if(arr[mid] == x)
return mid;
else if(arr[mid] > x)
right = mid - 1;
else
... | true |
f3dc40aa76096c829f2a381bfd4a33ebe4b94312 | JavaScript | chenhaoxian/MyRepository | /0727/shili.js | UTF-8 | 1,548 | 3.6875 | 4 | [] | no_license | (function(){
//工厂
function createPerson(name,sex,age){
var o = {};
o.name = name;
o.sex = sex;
o.age = age;
o.introduce = function(){
return "name:"+name+"sex:"+sex+"age:"+age;
}
return o;
}
// var p1 = createPerson("hyman","male",20);
// var p2 = createPerson("hyman2","male",30);
// console.log(p1.introduce(... | true |
90f6e42f7a8c0eb24c4bc70623831af427791c91 | JavaScript | transformerjnm/facebook-clone | /client/src/components/Organisms/CreateNewPost.js | UTF-8 | 2,552 | 2.515625 | 3 | [] | no_license | import { Paper, Divider, Grid, Hidden } from '@material-ui/core';
import CircleImageWithTextInput from '../Molecules/CircleImageWithTextInput';
import ActionIconButton from '../Atoms/ActionIconButton';
import VideoCallIcon from '@material-ui/icons/VideoCall';
import PhotoLibraryIcon from '@material-ui/icons/PhotoLibrar... | true |
6212531623a1f019a0a81a9d837efccb01935dd2 | JavaScript | CloudPower97/fcc-metric-imperial-converter | /controllers/convert.js | UTF-8 | 1,169 | 2.828125 | 3 | [] | no_license | const regex = /(\d+(?:.?\d+)?(?:\/\d+)?)?(.+)/
const convert = require('convert-units')
exports.convert = ({ query: { input } }, res) => {
const conversion = {
gal: 'l',
l: 'gal',
lbs: 'kg',
kg: 'lbs',
mi: 'km',
km: 'mi',
}
if (input) {
let [, initNum, initUnit] = regex.exec(input)
... | true |
40de1b60f68d2bd3453a032a9d7fc16d20f69eae | JavaScript | chang-ke/dva-native-cli | /utils/commander.js | UTF-8 | 1,595 | 3.078125 | 3 | [
"MIT"
] | permissive | const Commander = function () {
this.argvs = [];
this.commands = [];
this.callback = [];
this.options = [];
this.actions = [];
this.isCatch = false;
this.catchCallback = () => { };
};
Commander.prototype.option = function (option, cb) {
this.options.push(option);
this.callback.push(cb);
return this... | true |
141ba6c953d6e779e26c5e2eb07ea946cb3b33b7 | JavaScript | Arun4kumar/ecommerce | /frontend/src/reducers/cartReducer.js | UTF-8 | 1,756 | 2.6875 | 3 | [] | no_license | export const cartReducer = (
state = {
cartItems: [],
shippingAddress: {},
paymentMethod: "",
loading: false,
error: null,
},
action
) => {
switch (action.type) {
case "CART_ADD_REQUEST":
return { ...state, loading: true };
case "CART_ADD_SUCCESS":
const recieved = action... | true |
26ed85a556a475acdeee31a2b4a356b621a3d1b9 | JavaScript | programerpemula01/jsAn | /five/js/latihan4.js | UTF-8 | 1,707 | 3.234375 | 3 | [] | no_license | /* 2. Tampilkan list Movies dan
memberikan list warna pada tiap tiap barisnya .*/
/*
Struktur HTML:
<h5>Top Mo<strong>vies</strong></h5>
<ul id="items" class="list-group"></ul>
*/
// ======== Point 10
// Berikut ini ada object moviesnya:
let obj = {
movies : [
{title:'Zootopia', releaseDate:2016},
{title... | true |
5a24eaf0555594506bc7a0e8d0062f386e9cf2a8 | JavaScript | wor101-ls-javascript/JS210 | /flow_control/pattern_generation.js | UTF-8 | 1,532 | 4.75 | 5 | [] | no_license |
/*
**Problem**
Write a function that takes a number of rows as the argument nStars
and logs a square of numbers and asterisks.
For example, if nStars is 7, log the following pattern:
**Examples / Test Cases**
generatePattern(7);
// console output
1******
12*****
123****
1234***
12345**
123456*
1234567
**Data Stru... | true |
681ee9cdffd955ba90b31754030e6c5253f1e32b | JavaScript | sadikovi/omnisearch | /lib/history.js | UTF-8 | 991 | 3.125 | 3 | [
"MIT"
] | permissive | /** @babel */
export default class History {
constructor(state) {
// current position in the buffer, can equal to the length of the buffer, in this case
// we show empty field.
this.current = 0;
// buffer of previous searches
this.buffer = [];
}
assertPosition() {
if (this.current < 0 ||... | true |
980b4cc5ba914c46e01185ab51aa6c0c3630ecdf | JavaScript | Tathoi96/my-javaproject | /Guess game,Dom/key.js | UTF-8 | 205 | 3.09375 | 3 | [] | no_license | var count=0;
document.querySelector("textarea"). addEventListener("keypress",function(event)
{
count++;
var text=event.key;
document.querySelector("p").innerHTML="You have pressed "+count;
}
) | true |
73b7c0f219fb5f0f057eb9eb3b767ebb24095f12 | JavaScript | data4society/mpro | /client/embed/Feed.js | UTF-8 | 3,150 | 2.53125 | 3 | [] | no_license | import { Component, Grid, request } from 'substance'
import concat from 'lodash/concat'
import moment from 'moment'
import Pager from './Pager'
class Feed extends Component {
constructor(...args) {
super(...args)
this.handleActions({
'loadMore': this._loadMore
})
}
didMount() {
this._load... | true |
a9f3ca22ddf26ff6fe53abd7f9790aa06d18a8db | JavaScript | ericisaprogrammer/NHTI-Web-Programming-I | /apiGame2/hand.js | UTF-8 | 3,858 | 3.171875 | 3 | [] | no_license | function Hand(newName)
{
var name = newName;
var handValue = [];
var handCode = "";
//----------------------------------initialization
displayHand();
//----------------------------------End initialization
this.name = function() { return name; };
this.handCode = function() { return handCode; ... | true |
0a30fb348ead170a496157f92b15c07f60c14c8c | JavaScript | m0nd2y/dimigo_react_project | /70_react/71_basic/src/State.js | UTF-8 | 928 | 3.265625 | 3 | [] | no_license | import React, {useState} from "react";
function State() {
// [state값, 업데이트 함수] = useState(초기값)
let [color, setColor] = useState("black");
const red = () => {
setColor( "red" ); //setter 함수를 통해 직접 변경해야됨
};
const blue = () => {
setColor( "blue" ); //setter 함수를 통해 직접 변경해야됨
};
... | true |
0558aff73b65956526c4e50dbf8e13ff13e8f2c6 | JavaScript | ZirtQuesadas/PSEUDOCODIGO | /PSEUDOCODIGO/Ejercicio 3 CÁLCULO AREA DE UN TRIÁNGULO/Problema/main.js | UTF-8 | 500 | 4.03125 | 4 | [] | no_license | var base = prompt("Dame el primer número")
var altura = prompt("Dame el segundo número")
var ba = (parseInt(base) * parseInt(altura) )
var area = (ba/2)
document.write("El área del triángulo es ")
document.write(area)//Escribe aquí tu código
//Escribe el pseudocódigo
//Inicio
//Introducir las medidas de las variabl... | true |
8cfc7c97b410e9c78cd6fd5a22f00ef0a38f4082 | JavaScript | hatchways/team-evergreen | /src/config/db-connect.js | UTF-8 | 1,059 | 2.578125 | 3 | [] | no_license | //db-connect.js
/* Created by Fil on August 25, 2019 */
const config = require("./config");
const mongoose = require("mongoose");
let dbUrl = "";
let displayUrl = "No database url loaded.";
if (process.env.NODE_ENV === "production") {
const { type, host, name, userName, pwd, options } = config["db"];
dbUrl = ... | true |
4369e09ea69c645899b831dd8dfb261d31c066a9 | JavaScript | AAI-USZ/FixJS | /input/100+/before/c6a9d9972a5bbdb1566ac124822bac2f7448a344_0_8.js | UTF-8 | 1,886 | 2.640625 | 3 | [
"MIT"
] | permissive | function mkfile(path, options, callback) {
if (!checkType([
"path", path, "string",
"options", options, "object",
], callback)) return;
var meta = {};
// Make sure the user has access to the directory and get the real path.
realpath(dirname(path), function (err, dir) {
if (err) r... | true |
4bc9975eeed428b9d84be9e4f9ea3216b72501fc | JavaScript | crashb/javascript-analyzer | /test/fixtures/resistor-color-duo/229/resistor-color-duo.js | UTF-8 | 301 | 2.75 | 3 | [
"MIT"
] | permissive | const COLORS = [
"black",
"brown",
"red",
"orange",
"yellow",
"green",
"blue",
"violet",
"grey",
"white"
];
function code(name) {
return COLORS.indexOf(name);
}
function value(bands) {
return code(bands[0]) * 10 + code(bands[1]);
}
export { value };
| true |
89656d4229073d19bc839fc3ccce374deec5e94d | JavaScript | mikejihbe/metrics | /stats/exponentially_decaying_sample.js | UTF-8 | 2,710 | 2.953125 | 3 | [
"MIT"
] | permissive | var Sample = require('./sample')
, BinaryHeap = require('../lib/binary_heap');
/*
* Take an exponentially decaying sample of size size of all values
*/
var RESCALE_THRESHOLD = 60 * 60 * 1000; // 1 hour in milliseconds
var ExponentiallyDecayingSample = module.exports = function ExponentiallyDecayingSample(size, a... | true |
14ec71189b38f4993ca110c97d9ae0fce2feceb9 | JavaScript | afraca/lrs | /localization/localizationManager.js | UTF-8 | 1,530 | 2.65625 | 3 | [] | no_license | const _ = require('lodash');
const config = require('../config');
const translations = require('./translations');
const defaultCulture = 'en';
const supportedCultures = config.supportedLanguages;
module.exports = class LocalizationManager {
constructor(userCultures) {
this.culture = this._getCultureToLoad... | true |
7b7bc493133f70a80e98c8824908538e2578674d | JavaScript | tw2159/Team-Profile-Generator | /src/template.js | UTF-8 | 4,312 | 2.578125 | 3 | [] | no_license | module.exports = team => {
const createTeam = team => {
// Create manager profile HTML markup
createManager = manager => {
return `
<li class="team-member">
<div class="card">
<div class="card-header">
<h2>${manager.getName()}</h2>
<h3>
... | true |
6365659ba48a2e22f74b71cd60ac5a63f71d4ed1 | JavaScript | manamiueda1/leetcode | /Easy/nodeDepths.js | UTF-8 | 519 | 4.1875 | 4 | [] | no_license | // Node Depths
// Write a funtion that takes in a Vinary Tree and returns the sum of its nodes' depth.
// Time: o(n) space: o(h) -> h is the height/depth of the Binary Tree
function nodeDepths(root, depth = 0) {
if (root === null) {
return 0;
}
return (
depth + nodeDepths(root.left, depth + 1) + nodeDep... | true |
8b5cccef4189f2e51eab02dcd7ec81fa872ff55e | JavaScript | maximtop/test-assignment-dr-head | /src/promo-code.js | UTF-8 | 821 | 3.3125 | 3 | [] | no_license | const getRandomInt = (min, max) => {
const ceilMin = Math.ceil(min);
const floorMax = Math.floor(max);
return Math.floor(Math.random() * (floorMax - ceilMin)) + ceilMin;
};
const getRandomChar = (string) => {
const stringArr = string.split('');
return stringArr[getRandomInt(0, stringArr.length)];
};
const g... | true |
27c3cd749eea9aea9912ac2c4440a1814f0e41a3 | JavaScript | PhanHaHus/node_postgres | /server/controllers/members.js | UTF-8 | 1,160 | 2.6875 | 3 | [] | no_license | const members = require('../models').members;
var jwt = require('jsonwebtoken'); // used to create, sign, and verify tokens
var express = require('express');
var app = express();
module.exports = {
create(req, res) {
// create a sample user
var nick = {
username: req.body.username,
... | true |
61f01c8f7fb5fce917f1c7900cda9ebd33b7ecae | JavaScript | webondevices/geroge-ii | /services/rekognition.js | UTF-8 | 2,943 | 2.625 | 3 | [] | no_license | const AWS = require("aws-sdk");
const fs = require("fs-extra");
const config = require("../config").rekognition;
const rekognition = new AWS.Rekognition({ region: config.region });
function findPerson(imagePath) {
const bitmap = fs.readFileSync(imagePath);
return new Promise((resolve, reject) => {
rekognitio... | true |
b1c3bdf4885356115ca23451be54110c574fbaeb | JavaScript | jakepino/algo-notebook | /binary-search/easy-questions/NarcissisticNumber.js | UTF-8 | 491 | 3.71875 | 4 | [] | no_license | // Given an integer n,
// return whether it is equal to the sum of its own digits raised to the power of the number of digits.
// Example 1
// Input
// n = 153
// Output
// true
// Explanation
// 153 = 1 ** 3 + 5 ** 3 + 3 ** 3
class Solution {
solve(n) {
let arr = Array.from(n.toString())
let tot... | true |
48067acdc39029e3894dfe2d45bf1a8f1a72968b | JavaScript | twipixel/hello | /lab/3d/sphere/index.js | UTF-8 | 4,192 | 2.59375 | 3 | [] | no_license | import 'babel-polyfill';
import App from './App';
import KeyCode from '../../../src/consts/KeyCode';
(function () {
window.onload = function () {
new Main();
}
}());
class Main {
constructor() {
this.init();
this.addEvent();
}
init() {
window.app = this.app = new App();
window.parent.o... | true |
2383a4014315a64b726d88515234016381209452 | JavaScript | DonVadimon/IU5-Frontend-2021 | /lab7/js/utils/createNavBar.js | UTF-8 | 2,798 | 2.90625 | 3 | [] | no_license | import {
getWeatherByCity, getForecastByCity,
} from '../modules/weatherModule.js';
import { createCurrentWeatherBlock } from './createCurrentWeatherBlock.js';
import { createErrorBlock } from './error.js';
import { createForecastBlock } from './createForecastBlock.js';
import { changeWeatherBackground } from './chan... | true |
d76d95a644613296fd9fec0b14cae22f0df574a1 | JavaScript | perfmjs/perfmjs_old | /src/base.js | UTF-8 | 2,894 | 2.59375 | 3 | [] | no_license | /**
* 原生态js的OO框架抽象基类
* @date 2012-12-01
*/
!(function($) {
$ = $ || window;
/**
* 子类继承父类的例子,调用如:new base.xxx() 或 new xxx() 或xxx.newInstance(arg) 或用xxx.instance访问实例;
第一级子类例子:
!(function($) {
$.base("base.xxx", {
init: function(arg) {
return this;
},
end: 0
});
$.base.xxx.defaults = {
scope... | true |
9e8485ace5414de4aef2a53bcafac0ac814930c0 | JavaScript | ManjulaNarasimhan/Node-Challenges | /countNonDivisible.js | UTF-8 | 1,616 | 3.671875 | 4 | [] | no_license | function countNonDivisible(A) {
const createCounts = A => {
const counts = Array(A.length * 2 + 1).fill(0)
for (let i = 0; i < A.length; i++) {
counts[A[i]] += 1
}
return counts
}
const counts = createCounts(A)
const results = []
for (let i = 0; i < A.leng... | true |
6db410cf386764fc4a1264c04d3c51411771b228 | JavaScript | SALAH-EDDIB/javascript-mini-projects | /Form/js/script.js | UTF-8 | 1,524 | 2.96875 | 3 | [] | no_license | function animatedForm() {
const arrow = document.querySelectorAll('.fa-arrow-down')
arrow.forEach(arrow => {
arrow.addEventListener('click', () => {
const input = arrow.previousElementSibling
const parent = arrow.parentElement
const nextForm = parent.nextElementSibli... | true |
2eacb2ef7001e7ef47d7460c2d6ec01b7852b2e8 | JavaScript | KatarinaFilipovic/SvetEdukacije | /FrontEnd/Test boot 2/data_models/predavac.js | UTF-8 | 1,780 | 2.53125 | 3 | [] | no_license | import { Predmet } from './predmet.js';
export class Predavac {
constructor(id, ime, prezime, username, password, email, brtel, opis, ocenePlus, oceneMinus, adresa) {
this.id = id;
this.ime = ime;
this.prezime = prezime;
this.username = username;
this.password = password;
this.email = email;
this.brtel =... | true |
8bacb9eba5af181cc63f657c3aa8a4a14882a3be | JavaScript | lhl622/3dspace | /webapps/StuClickable/StuClickableEnterEvent.js | UTF-8 | 2,982 | 2.71875 | 3 | [] | no_license | define('DS/StuClickable/StuClickableEnterEvent', ['DS/StuCore/StuContext', 'DS/StuClickable/StuClickableEvent'], function (STU, ClickableEvent) {
'use strict';
/**
* Describe a STU.ClickableEvent triggered by a {@link STU.Actor3D}.
* It occurs when the mouse cursor enters on the clickable zone.<br/>
... | true |
12df97a3c339170338e033e26d60c15e66218ec9 | JavaScript | myrnd/Javascript-ES6 | /day1/const.js | UTF-8 | 294 | 3.875 | 4 | [] | no_license | const x = 20;
x = 30; //error const variable cannot be reassigned
const ary = [10, 20, 30];
ary.push(40); //no error
console.log(ary); //[10, 20, 30, 40]
const obj = {id: 1, name: "MyR&D"};
obj.location = "YouTube"; //no error
console.log(obj); //{id: 1, name: "MyR&D", location: "YouTube"} | true |
d7d261c6e298a52140923cc542dda696dc31d8fb | JavaScript | glennj/exercism.io | /javascript/tournament/tournament.js | UTF-8 | 2,107 | 3.59375 | 4 | [
"MIT"
] | permissive | const STATS = ['MP', 'W', 'D', 'L', 'P']; Object.freeze(STATS);
const tableRow = (name, statistics) => [
name.padEnd(30),
...statistics.map(s => String(s).padStart(2))
].join(' | ');
const header = () => tableRow('Team', STATS);
/* *********************************************************** */
class Team {... | true |
6fba1a79b81519874c4eb1a7438516a5814df9de | JavaScript | chaoticgood1/Mind-Map-BabylonJS | /src/controls/idle-controls.js | UTF-8 | 1,683 | 2.515625 | 3 | [] | no_license |
class IdleControls {
constructor(scene) {
this.scene = scene;
scene.onPointerDown = (event, pickResult) => {
if (pickResult == undefined) return;
Utils.onSelectedNode(scene, pickResult, this.selectedNodeFn);
Utils.onDragScreen(scene, pickResult, this.dragScreenFn);
}
scene.onP... | true |
e7fa55b43971f8212496ed3f2b0ec2b578a2dfd0 | JavaScript | ARWL2016/algorithms | /codewars-7/descending-order.js | UTF-8 | 184 | 3.296875 | 3 | [] | no_license | function descendingOrder(n){
const result = n.toString().split('').sort((a, b) => b-a).join('');
return Number(result);
}
let x = descendingOrder(123456789);
console.log(x);
| true |
244c0db06b8e90c0e7da1d7a3d323f8add61c2f7 | JavaScript | 1909WDFNY/TestFirst-Review-V2 | /00-pig-latin/pig-latin_Ondrea.js | UTF-8 | 561 | 3.640625 | 4 | [] | no_license | const vowelArr = ['a', 'e', 'i', 'o','u']
function changeStr (str){
let piggyArr = str.split('')
let count = 0
for (let i = 0; i < piggyArr.length; i++){
if(vowelArr.includes(piggyArr[i]) && piggyArr[i-1] !== 'q'){
let front = piggyArr.slice(0,count).join('')+'ay'
piggyArr.sp... | true |
532a497af71da59dd769ac63e3795df52fe72ccc | JavaScript | KatieGarrison15/sailboat-quiz | /js/main.js | UTF-8 | 4,646 | 2.75 | 3 | [] | no_license | $(function () {
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyBm7KVE8ZpDPNTmlVBCc1wbdmNwkONfRb0",
authDomain: "sailboat-klg.firebaseapp.com",
databaseURL: "https://sailboat-klg.firebaseio.com",
projectId: "sailboat-klg",
storageBucket: "sailboat-klg.appspot.com... | true |
c3477889780226d22e58a4f2b7cea62e86602634 | JavaScript | brittanydionigi/react-testing | /app/actions/favoriteActions.js | UTF-8 | 720 | 2.640625 | 3 | [] | no_license | // exporting these strings as variables seems redundant, but it helps
// avoid bugs related to simple typos & makes it easier to update an
// action name in a single spot rather than all over your application
export const ADD_FAVORITE = 'ADD_FAVORITE';
export const DELETE_FAVORITE = 'DELETE_FAVORITE';
export const FETC... | true |
e29df5bb950ca312351e3c105efb0ac4f7990106 | JavaScript | msm2020/quikk | /src/utils/countrystate.js | UTF-8 | 825 | 2.59375 | 3 | [] | no_license | import countrystate from "countrycitystatejson";
import memoize from "lodash/memoize";
import camelCase from "lodash/camelCase";
import upperFirst from "lodash/upperFirst";
function _getCountriesForSelect() {
const allCountries = countrystate.getCountries();
return allCountries.map((eachCountry) => ({
value: e... | true |
f4b3884da9926f6dbb3ff8aaea43ece6e64036fd | JavaScript | that-hatter/proj-euler-js | /euler031.js | UTF-8 | 345 | 3.5625 | 4 | [] | no_license | function main() {
const coins = [1, 2, 5, 10, 20, 50, 100, 200];
let ways = [1];
for (let i = 1; i <= 200; i++) ways[i] = 0;
coins.forEach(coin => {
for (let i = coin; i <= 200; i++) {
ways[i] += ways[i - coin];
}
});
return ways[200];
}
console.time("time");
console.timeLog("time", "\nAnswer... | true |
a58ad466de0061bea39e7400c0c619a109b96ca9 | JavaScript | navarathanb/reactJs7 | /Javascript Es6/8obj_destructor.js | UTF-8 | 109 | 2.921875 | 3 | [] | no_license | let emp = {name:"james",email:"james@gmail.com"};
let {name,email} = emp;
console.log(name);
console.log(email);
| true |
127850ba2c687cc0af4b7c88e359368cf7b228aa | JavaScript | AshtonHoneggar/web-apps-final | /static/rating.js | UTF-8 | 3,054 | 3.0625 | 3 | [
"MIT"
] | permissive | // Source: https://reactjs.org/docs/forms.html
// Date pulled: 11/28/2018
'use strict';
const e = React.createElement;
// handleSubmit(event) {
// alert(this.state.value);
// event.preventDefault();
// }
class Rating extends React.Component {
constructor(props) {
super(props);
this.state = ... | true |
1d157289739106194675883667ae01299629d657 | JavaScript | RubyRubenstahl/fluent-escript | /src/server/createServer.js | UTF-8 | 1,832 | 2.546875 | 3 | [] | no_license | const dgram = require("dgram");
const json5 = require("json5");
const util = require('util');
const EventEmitter = require("events").EventEmitter;
const { compileScript } = require("../lib");
const queue = require("queue");
const defaultOpts = {
hostAddress: "localhost",
listenPort: 9001,
sendAddress: "127.0.0.1"... | true |
fd683d13acefa141c45c5dd0f5d3887f805c2224 | JavaScript | mmis1000/Node-Snake | /test/tree-test.js | UTF-8 | 6,517 | 2.703125 | 3 | [] | no_license | var assert = require('chai').assert;
var MapTree = require('../lib/snake-map-tree');
var size = 64 * 64;
describe('Node', function() {
var tree;
var child;
describe('#spawn', function () {
it('should spawn a object', function () {
var tree = new MapTree.Node();
assert.typeO... | true |
469d021d54f6b91c5782a145ae596c9533fd5954 | JavaScript | iamJakeRobbins/quotient | /level-up-tutorial/apollo/imports/ui/components/QuoteList.js | UTF-8 | 1,665 | 2.796875 | 3 | [] | no_license | import React, { Component } from 'react';
import {ListGroup, ListGroupItem} from 'react-bootstrap';
import './cat.css';
export default class QuoteList extends Component {
render(){
return (
<div>
<h2>
Select one of the following Quotes to Interpret
</h2>
<ListGroup className='listgroup'>
... | true |
0d35f7ed590d5e783f052dfaa43bf121154fb47f | JavaScript | CW0149/NotebookBlog | /src/utils/api.js | UTF-8 | 449 | 2.734375 | 3 | [
"MIT"
] | permissive | const request = (url) => {
return fetch(url).then(res => res.json())
}
module.exports = {
fetchPopularRepos: (language) => {
const encodedURI = window.encodeURI(`https://api.github.com/search/repositories?q=stars:>1+language:${language}&sort=stars&order=desc&type=Repositories`)
return request(encodedURI)
.the... | true |
f273fc7e7b54ceaf98d74e507d7babf81b7af825 | JavaScript | rbrander/rbrander.github.io | /Tileset/app.js | UTF-8 | 18,779 | 2.96875 | 3 | [] | no_license | // app.js
var globals = {
canvas: undefined,
ctx: undefined,
tileImg: undefined,
tileSize: 32,
tiles: [],
map: [],
toggleTiles: true,
gridX: undefined,
gridY: undefined,
};
function clearBackground(ctx) {
// Clear the background
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, globals.canvas.width,... | true |
3071f8fe514db6c5ad82901af752c71ca9dcc9a4 | JavaScript | 2smallears/todolist-redux | /public/js/containter/todoList.js | UTF-8 | 1,116 | 2.59375 | 3 | [] | no_license | import React from 'react'
import {connect} from 'react-redux'
const TodoList = React.createClass({
changeState(index){
this.props.changeState(index);
},
onDelete(index){
this.props.onDelete(index);
},
render: function () {
const todo = this.props.todos.map((todo, index)=> {
... | true |
48eb3479d3b2ce9c918e92eace0fbeb7a98e607f | JavaScript | marcmajcher/dumbformvalues | /index.js | UTF-8 | 389 | 3.109375 | 3 | [] | no_license | 'use strict';
/* eslint-env browser */
function setResultValue(value) {
const result = document.getElementById('resultValue');
result.textContent = value;
}
function submitForm(event) {
event.preventDefault();
setResultValue(event.target.myValue.value);
}
function clickForm(event) {
event.preven... | true |
766c10eb5fecf07f08bb2536911598848bfaf6c3 | JavaScript | DonnaIB/cli | /map.js | UTF-8 | 1,515 | 2.921875 | 3 | [] | no_license | function initMap() {
const myLatLng = { lat: 53.31952608924311, lng: -6.2276343192623775 };
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 12,
center: myLatLng,
});
const myMarks = [
{"lat": 53.298750804089785, "lng": -6.178747830803757, "name": "HQ", "info": "This is our... | true |
66c8fa7db140958c4e48108195bdf82ba12a7764 | JavaScript | Sam-2019/COVID19 | /src/pages/Country/CountryStats.js | UTF-8 | 2,066 | 2.75 | 3 | [] | no_license | import React from "react";
import View from "./View";
import Spinner from "../Spinner";
import Search from './Search'
const isSearched = (searchTerm) => (item) =>
!searchTerm || item.country.toLowerCase().includes(searchTerm.toLowerCase());
class CountryStats extends React.Component {
intervalID;
state = {
... | true |
d0380b0f64518dcb311546744c584b81269086b2 | JavaScript | FrontEndProduct/Typescript | /Arrowfunction.js | UTF-8 | 443 | 3.375 | 3 | [] | no_license | var manufacturers = [{ "id": "Samsung", "price": 15000 }, { "id": "Microsoft", "price": 20000 },
{ "id": "Apple", "price": 40000 }, { "id": "Micromax", "price": 10000 }];
var test;
function myFunction() {
test = manufacturers.filter(function (manufacturer) { return manufacturer.price >= 20000; });
}
myFun... | true |
0b656991fe6e97a23528c8abf669bf0a6ecb0541 | JavaScript | knlju/calculator-theme-picker | /script.js | UTF-8 | 3,118 | 3.25 | 3 | [] | no_license | (function () {
let firstNum = 0, secondNum = 0, operation = "", bResetNum = false
let isDotActive = false
let floatMultiplier = 1
const result = document.querySelector(".result")
const controls = document.querySelectorAll("[class*='control-']")
controls.forEach(c => {
const textValue = c... | true |
399979f0a1868ef7a09dadfb7f5e926d22c6ae0c | JavaScript | CodingSamples-Kingsland-Z2B/Lab-Q2-2021 | /Module_2/Lab2/Arrays/06.condenseArray.js | UTF-8 | 416 | 3.671875 | 4 | [
"MIT"
] | permissive | function main(arrayOfNums) {
while (arrayOfNums.length > 1) {
let condensed = [];
for (let i = 0; i < arrayOfNums.length - 1; i++) {
//use this
condensed[i] = arrayOfNums[i] + arrayOfNums[i + 1];
// or this below
//condensed.push(Number(arrayOfNums[i]) + Number(arrayOfNums[i+1]));
}
arrayOfNums = c... | true |
04dbca8f03763b2ff0ac634915bab2449d20336f | JavaScript | overview/overview-pdf-viewer | /web/note_store.js | UTF-8 | 10,208 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | /* Copyright 2017 Overview Services Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... | true |
81b0b32e649be4d5d5db71a6d04636e208e278f3 | JavaScript | jeanniedavis/csthw2 | /js/myjs.js | UTF-8 | 1,743 | 3.203125 | 3 | [] | no_license | $(document).ready(function() {
fillColor("white",0);
$("#play").on("click", function(){
$("#gameFdbck").html("");
randomBoard();
})
});
var answer;
function fillBoard(color) {
var counter = 0;
$("#gameboard").html("");
for (var i = 0; i < 3; i++) {
va... | true |
706677defee826daee0c9ab91b9d5dc3af628795 | JavaScript | NISHIY-EKSDEE/lab4_full | /frontend/src/components/Map.js | UTF-8 | 4,286 | 2.59375 | 3 | [] | no_license | import * as React from "react";
import {addPoint} from "../js/actions";
import { connect } from "react-redux";
import $ from "jquery";
class Map extends React.Component{
componentDidMount() {
this.canvas = this.refs.canvas;
this.drawMap();
}
componentDidUpdate(prevProps, prevState, snapsh... | true |
cbc495b267971723013733885b1317d34a6ec08f | JavaScript | eramirez117/full_stack_app_with_react_and_a_rest_api_p10 | /client/src/Components/UpdateCourse.js | UTF-8 | 6,961 | 3.296875 | 3 | [] | no_license | //this component will have it's own state
import React, { Component } from 'react';
import axios from "axios";
/*This component provides the "Update Course" screen by rendering a form
that allows a user to update one of their existing courses.
The component also renders an "Update Course" button that when clicked
... | true |
37825e406ac5bbd34e9523a8cf5c26b5cc88923b | JavaScript | FloZone/carte_campus_m2 | /online/data_dir/www/openlayer/routing/graph.js | UTF-8 | 7,866 | 2.796875 | 3 | [] | no_license | var Graph,
__hasProp = {}.hasOwnProperty;
Graph = (function() {
function Graph() {
//Change projection of each node coord
for(id in routingGraphJSON._nodes){
var nodeCoord = [routingGraphJSON._nodes[id]._coord.x, routingGraphJSON._nodes[id]._coord.y];
routingGraphJSON._nodes[id]._coord = ol.proj.transform(n... | true |
6c18bf610264db891d9567f39d0fc1ac11b7a32d | JavaScript | PyLawrence/Javascript-Projects | /Project1_expressions_alert/JS/main.js | UTF-8 | 684 | 3.40625 | 3 | [] | no_license | //#region variable declarations
var documentText = "This text won't break, because I added: \"\\\"<br>";
var alertText = "ALERT: HELLO, WORLD!<br>";
var concat = documentText + " " + alertText;
var kid = "James", dad = "Mark", mom = "Janet";
// changes font color of the family member strings
var kid = kid.fontcolor(... | true |