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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d6ec0eda4d43d07f94f7ff80680671230609236a | JavaScript | robnit/hello-http | /test/app-test.js | UTF-8 | 2,408 | 2.703125 | 3 | [] | no_license | const chai = require('chai');
const http = require('http');
const chaiHttp = require('chai-http');
chai.use(chaiHttp);
const assert = chai.assert;
const app = require('../lib/app');
//starts a server and makes it so request object talks to server that got started
// const request = chai.request(app);
describe('http m... | true |
9082a060d882d0bf3711b1d9ca78c7e3321890d9 | JavaScript | MidnightCitizen/RedLion | /app.js | UTF-8 | 2,475 | 2.703125 | 3 | [] | no_license | const { GoogleSpreadsheet } = require('google-spreadsheet');
require('dotenv').config();
const sleep = require('./lib/sleep');
const retrieveDataFromReddit = require('./functions/retrieveDataFromReddit');
const getDataFromGoogleSheet = require('./functions/getDataFromGoogleSheet');
const deleteRows = require('./functi... | true |
64ba45825db39811b3bb2fed498b01ecd5df16d6 | JavaScript | MaxLacasseG/speech-recognition | /src/classes/GameManager.js | UTF-8 | 679 | 3.140625 | 3 | [] | no_license | export class GameManager {
constructor(colorsArray, messages) {
this.points = 0;
this.colorsArray = colorsArray;
this.messages = messages;
this.container = "";
}
SetContainer = container => {
this.container = container;
};
StartGame = () => {
console... | true |
6865e171be7c95a9435c5f91f54f832d8647469a | JavaScript | jusselman/logicOfEspress | /controllers/rebootCtrl.js | UTF-8 | 1,390 | 2.640625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const reboot = require('../data/reboot')
// index //
router.get('/', (req, res) => {
return res.status(401).send("suck it");
});
// show //
router.get('/:id', (req, res) => {
if (!reboot[req.params.id]) return res.status(400).send('That\'s ... | true |
2299675dcce58a52ef98bd59a365ee35fdc96de7 | JavaScript | mzvonar/modular-redux-form | /src/utils/reducerUtils.js | UTF-8 | 1,618 | 2.875 | 3 | [
"MIT"
] | permissive | function createFilteredReducer(reducerFunction, reducerPredicate) {
return (state, action) => {
const isInitializationCall = state === undefined;
const shouldRunWrappedReducer = reducerPredicate(action) || isInitializationCall;
return shouldRunWrappedReducer ? reducerFunction(state, action) ... | true |
cb8bd29b9bdae3fd16c98d4375bbbdc5b71b96ff | JavaScript | jvillasante/ReActive | /api/routes/docs/projects.js | UTF-8 | 4,655 | 2.578125 | 3 | [] | no_license | /**
* @api {get} /projects/ Get all projects
* @apiVersion 1.0.0
* @apiPermission user
* @apiName GetAllProjects
* @apiGroup Projects
*
* @apiSuccess {Array[]} projects List of projects related to the current user according to the permissions defined, not the user who creates the project.
* @apiSuccess {String}... | true |
7dd3ff4fc0ad94afdbb80efbe9551740c66947af | JavaScript | hamidraza1/analogeClock | /script.js | UTF-8 | 639 | 3.609375 | 4 | [] | no_license | setInterval(clock, 1000);
const secondHand = document.querySelector("[data-second]");
const minutesHand = document.querySelector("[data-minute]");
const hourHand = document.querySelector("[data-hour]");
function clock() {
const currentDate = new Date();
let secondsRatio = currentDate.getSeconds() / 60;
let minu... | true |
e1da90ec26e72fb3fe54066fc57cb98fcf8beb41 | JavaScript | KrishnaRajan18/broken-app | /broken-app/app.js | UTF-8 | 997 | 2.640625 | 3 | [] | no_license | const express = require("express");
const axios = require("axios");
const ExpressError = require("./expressError");
const app = express();
app.use(express.json());
app.get('/hello',(req,res)=>{
return res.send("hello everyone")
})
app.post('/', async function(req, res, next) {
try{
const devList= req.body.dev... | true |
1217f1b86d8d8f8b6659f4467040d360e7cfe54f | JavaScript | z0le12/ZoranoviotRepoZitory | /FRONTend/javaScript/Procedural programing/totally-different.js | UTF-8 | 1,936 | 4.59375 | 5 | [] | no_license | // Write a function that accepts two numbers N and X.
// Find the closest number bigger than N that is TOTALLY DIFFERENT than the number X.
// A number is TOTALLY DIFFERENT from another:
// if every digit in the first number is different than every digit of the second number.
// You are not permitted to use arrays o... | true |
b21df2a22eb4666c434aa9ee548031e3776fa890 | JavaScript | duyvu0302/VueJs | /src/store/module/user.js | UTF-8 | 2,262 | 2.515625 | 3 | [] | no_license | import axios from "axios";
const baseUrl = "http://localhost:3000/listUser";
// eslint-disable-next-line no-unused-vars
const sleep = (time) => new Promise((resolve, _reject) => setTimeout(resolve, time))
const userModules = {
state: {
isLoad: true,
user: [],
isAuth:false,
},
gett... | true |
45e1641d9c3c5e739a42e6349970032f5a79b784 | JavaScript | moriartp/moriartp.github.io | /projects/ms1exercise/sketch.js | UTF-8 | 646 | 3 | 3 | [] | no_license | var data;
function preload() {
var url = 'https://raw.githubusercontent.com/dariusk/corpora/master/data/colors/crayola.json';
data = loadJSON(url);
}
function setup() {
createCanvas(windowWidth,windowHeight*20);
}
console.log('data');
function draw() {
background(0);
textSize(20);
fill(222);
for (var i ... | true |
a73de72cd9cf8003ff49ec139ea1519e01032391 | JavaScript | TheGhost501/first-repo | /JS Advanced/Syntax, Functions, Expr/Exercise/03samenumbers.js | UTF-8 | 404 | 3.640625 | 4 | [] | no_license | function same(number) {
let text = number.toString();
let end = text.length;
let sameNum = Number(text[0]);
let areSame = true;
let sum = sameNum;
for (let i = 1; i < end; i++) {
let curNum = Number(text[i]);
if (sameNum !== curNum) {
areSame = false;
}
... | true |
296005f8ae0e206d7b3dde000ca92719d4967449 | JavaScript | CardinalXDA/CardinalXDA.github.io | /solutions.js | UTF-8 | 3,062 | 2.640625 | 3 | [] | no_license | function query(collection, select, filter) {
var massLib = [].slice.call(arguments);
var finalArray = arguments[0];
for (i = 1; i < massLib.length; i++) {
if (massLib[i].name == 'filterIn') {
finalArray = massLib[i].action(finalArray);
}
}
for (i = 1; i < massLib.lengt... | true |
7db88d6710ad7c3573f130bf23e4eef5167de1be | JavaScript | Jantho1990/redux-demo | /app/redux-example.jsx | UTF-8 | 1,103 | 2.875 | 3 | [] | no_license | const redux = require('redux')
console.log('Starting redux example')
let actions = require('./actions/index')
console.log(actions)
let store = require('./store/configureStore').configure()
console.log(store)
// Subscribe to changes
let unsubscribe = store.subscribe(() => {
let state = store.getState()
console.... | true |
2b137400270343d7ed69541c8188206c888871a4 | JavaScript | DNundy/DesignPatterns | /8.单例模式/demo1.js | UTF-8 | 505 | 2.703125 | 3 | [] | no_license | /*
* @Author: Administrator
* @Date: 2017-11-26 14:40:40
* @Last Modified by: Administrator
* @Last Modified time: 2017-11-26 16:17:18
*/
var Method = (function (){
/* 定义的静态变量 */
var conf = {
MAX_NUM = 10,
MIN_NUM = 1
};
/* 返回一个取值器 */
return {
get : function(name){
retur... | true |
4814c88a2f8d88919c43511c4a8f2f153c376783 | JavaScript | theradius1/Harmonic-Animation | /sketch.js | UTF-8 | 754 | 3.21875 | 3 | [] | no_license | var periodOne = 200.0;
var periodTwo = 130.0;
var pointCount = 0;
var angle = 10.0;
var amplitude = 140;
let inc = 0.05;
function setup() {
createCanvas(400, 400);
}
function draw() {
if(pointCount > 10000){
noLoop();
}
noFill();
strokeWeight(1);
stroke(10);
translate(width/2, height/2);
beginS... | true |
df13d48db26cec6e993bb326d966705d6c7dc90e | JavaScript | shughes1992/neighbors | /client/src/store/reducers/loginReducer.js | UTF-8 | 912 | 2.5625 | 3 | [] | no_license | import * as actionTypes from '../actions/loginActions'
const initialState = {
username: '',
userId: '',
password: '',
location: '',
lat: '',
lng: '',
loggedIn: false
}
const reducer = (state = initialState, action) => {
switch (action.type) {
case actionTypes.UPDATE_USERNAME:
return {
... | true |
249dd7c766a662a8ec11659be49c79cae964afc5 | JavaScript | IlyaMatv/Homework_JS_Basic-level | /Homework_JS_Basic-level/lesson 5/task 1/main.js | UTF-8 | 298 | 3.359375 | 3 | [] | no_license | function isThatPalindrome(str) {
str = prompt('Введите палиндром');
var strLen = str.length,
strReverse = str.split('').reverse().join('');
if (strReverse == str) {
return true;
} else {
return false;
}
}
test = alert(isThatPalindrome()); | true |
6d7a1fe9e475bd25e16c3d6fde424a3b9af0b4c5 | JavaScript | Lucaskitteridge/string-calulator | /test/string-calculator-test.js | UTF-8 | 2,391 | 3.5 | 4 | [] | no_license | const chai = require('chai');
const assert = chai.assert;
const stringCalculator = require('../string-calculator.js');
describe("String Calculator", function() {
it("Should return 8", function() {
const expectedOutput = 8
const input = "1,2,5"
assert.strictEqual(stringCalculator(input), expectedOutpu... | true |
834a5e97ab4dc6244bdbf8e3a7283e84e59392c2 | JavaScript | HamzaAlsarakbi/NoteVault | /src/global_assets/js/libraries/window.js | UTF-8 | 1,749 | 2.6875 | 3 | [
"MIT"
] | permissive | class Window {
constructor(id, title, icon) {
// create overlay
this.overlay = addElement('overlay', {id: id + '-overlay' }, '', el.app);
// create window
this.window = addElement('div', { class: 'popup window', id: id + '-window' }, '', this.overlay);
// create titlebar
this.titleba... | true |
4c1897f171a17c232a8d5e91bf335c292a9bb1c0 | JavaScript | Code-Institute-Submissions/CI-MS3 | /static/js/contact.js | UTF-8 | 1,152 | 2.921875 | 3 | [] | no_license | import {
showLoadingButton,
displayError,
displaySuccess
} from "./utils.js";
const contactForm = document.querySelector('form');
const formMessage = contactForm.querySelector('p')
contactForm.addEventListener("submit", (e) => {
e.preventDefault();
sendContact(e);
});
async function sendContact(e) {
co... | true |
2c1dc7374aedf5db27e84c7c5b3bb96ddc989e0b | JavaScript | chenl93/test | /1-js/object/Object.create.js | UTF-8 | 240 | 3.375 | 3 | [] | no_license | var Animal = {
type: "Invertebrates",
displayType: function () {
console.log(this.type);
}
}
var animal1 = Object.create(Animal);
animal1.displayType();
var fish = Object.create(Animal);
fish.type = "Fishes";
fish.displayType(); | true |
61987be05b97654271a9514dbde46164cfd4c9e5 | JavaScript | jussijartamo/docs-editor | /dist/getDOMSelectionNode.js | UTF-8 | 461 | 2.609375 | 3 | [
"MIT"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function getDOMSelectionNode() {
var selection = window.getSelection();
if (!selection || selection.rangeCount !== 1) {
return null;
}
var range = selection.getRangeAt(0);
var node = range.commonAncestorContainer;
if (node &... | true |
477e74cac39a537bb5c67439c4415db00553cf7d | JavaScript | chentaos/Node-JS-Tutorial1 | /7-mind-grenade.js | UTF-8 | 143 | 3.25 | 3 | [] | no_license | const num1 = 10;
const num2 = 5;
function addition() {
console.log(`The sum is ${num1 + num2}`);
}
addition();
module.exports = addition;
| true |
34c2694bff49903633ee63d71730c86984ad8ea3 | JavaScript | TheCollinslake/IM2490_Assignment-4_Collins | /code.js | UTF-8 | 3,853 | 3.15625 | 3 | [] | no_license |
document.addEventListener("DOMContentLoaded", function()
{console.log("Initializing the video player.");
startVideoPlayer();
}, false);
function startVideoPlayer() {
videoPlayer= document.getElementById("video");
videoPlayer.controls = false;
console.log("Video element's controls... | true |
6f159026359cb4108570d127ac82a9c32a241ace | JavaScript | CihanErenler/vaalikone | /src/main/webapp/js/compare.js | UTF-8 | 3,294 | 3.09375 | 3 | [] | no_license |
const candidateAnswers = document.querySelectorAll(".compare-candidate-answer");
const btnContainer = document.querySelector(".compare-btn-container");
const yourAnswer = document.querySelector(".your-answer");
const questionList = document.querySelector(".question-list");
function getAllData() {
return new Promise... | true |
66874aa53f7a3bc9918fe66088ade6f79cc4504c | JavaScript | WickedyWick/DiscordBot | /index.js | UTF-8 | 1,109 | 2.5625 | 3 | [] | no_license | const Discord = require('discord.js');
const client = new Discord.Client();
var cron = require('node-cron');
require('dotenv').config({path: __dirname + '/.env'})
try{
let list;
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
list = client.guilds.cache.get(String(process.env.SERV... | true |
2551f18911174ed921722360c75037b1df018cc4 | JavaScript | anasahmed700/frontend-web-PIAICQ1 | /JavaScript/scripts/23string_segments.js | UTF-8 | 1,668 | 3.625 | 4 | [] | no_license | var text = "in World War II germany lost badly!";
for (var i = 0; i < text.length; i++) {
if (text.slice(i, i + 12) === "World War II") {
text = text.slice(0, i) + "the Second World War" + text.slice(i + 12);
console.log(text);
}
}
// another easy way to find index
var mytext = "in ... | true |
a9b3f5cca89fcf5ac81e1184cd4b35ad87762d41 | JavaScript | Sudan20215/password_generator | /script.js | UTF-8 | 2,923 | 3.78125 | 4 | [] | no_license | // Assignment Code
// program started
let generatepasswordBtn = document.querySelector("#generate");
// All the element are defined
let onlyupperCase= ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
let onlylowerCase = ["a","b","c","d","e","f","g","h","i","j","k... | true |
88104c5d8ec0ec7e4c7eaead2140ac1053d67547 | JavaScript | PenghaiZhang/openEQUELLA | /Source/Plugins/Core/com.equella.reporting/resources/web/js/reporting.js | UTF-8 | 868 | 2.515625 | 3 | [
"Apache-2.0",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"EPL-1.0",
"LGPL-2.0-or-later",
"Classpath-exception-2.0",
"LicenseRef-scancode-jdom",
"ICU",
"Apache-1.1",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"GPL-1.0-or-later",
"CPL-1.0",
"C... | permissive | function printReport(id)
{
var printFn = document.createElement('script');
printFn.type = 'text/javascript';
printFn.text = printPage;
var iframe = document.frames ? document.frames[id] : document
.getElementById(id);
if (iframe)
{
var ifWin = iframe.contentWindow || iframe;
iframe.focus();
ifWin.docume... | true |
2740e539716606d531e02970571f23d33df73f06 | JavaScript | targee/EWS-Calendar | /getHoliday.js | UTF-8 | 484 | 2.515625 | 3 | [
"MIT"
] | permissive | //http://data.ntpc.gov.tw/api/v1/rest/datastore/382000000A-000077-002
const url = 'http://data.ntpc.gov.tw/api/v1/rest/datastore/382000000A-000077-002';
const request = require('request');
const fs = require('fs');
function getHoliday() {
request(url, function (error, response, body) {
if(error == null){
... | true |
f5adde9509e4cc87f9227d91162e6d93f8581d02 | JavaScript | Afroid/project2 | /controllers/sportsRadarController.js | UTF-8 | 5,958 | 2.640625 | 3 | [] | no_license | // Dependencies
// =============================================================
// Requiring our models
var express = require('express');
var app = express.Router();
var request = require("request");
var rp = require("request-promise");
try{
var dataTimer, homeTimer, awayTimer;
app.get("/sports", function(req, res)... | true |
36f8f8308425413f9f87fb0d24c36201d5041b67 | JavaScript | kuetedonald/NodeJS-Backend-Ecommerce-App | /src/models/bookmark.js | UTF-8 | 3,032 | 2.671875 | 3 | [] | no_license | const dbConnection = require("../../config/database.js");
const executeQueryInsertSelectUpdate= require("./index.js").executeQueryInsertSelectUpdate;
const Store = require('./store.js');
const Bookmark = function(bookmark){
this.storeId=bookmark.storeId;
this.userId=bookmark.userId
}
Bookmark.createBookmarkPa... | true |
511d00eaeda478293ead6c836cdd2f21dfa2a6be | JavaScript | WinstonMarvel/meta-tag-copy-helper | /handler.js | UTF-8 | 1,374 | 3.15625 | 3 | [] | no_license | (function(){
var selection = window.getSelection();
var range = document.createRange();
document.addEventListener("keypress", (event)=>{
var key = event.key;
if((event.key=="t" || event.key=="T") && event.shiftKey){
var titleTag = document.querySelector("title").innerText;
copyText(titleTag);
}
if((ev... | true |
e0e33a790e3ecac8a325fd525423d46a851dbb11 | JavaScript | afasihi/pokemon-wiki | /src/Components/pages/HomePage.js | UTF-8 | 1,771 | 2.515625 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { fetchData } from "../../redux/actions/pokemonActions";
import Alert from "../layouts/Alert";
import Spinner from "../layouts/Spinner";
import Pokemon from "../shared/Pokemon";
const HomePage = () => {
... | true |
d6f584ac5173d426c5c0f76df93801c8a3112e3f | JavaScript | jonathanlurie/pixpipejs | /src/filter/FourierImageFilters.js | UTF-8 | 2,911 | 2.921875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
* Author Armin Taheri - https://github.com/ArminTaheri
* License MIT
* Link https://github.com/Pixpipe/pixpipejs
* Lab MCIN - Montreal Neurological Institute
*/
import ndarray from 'ndarray';
import zeros from 'zeros';
import ft from 'ndarray-fft';
import { Filter } from '../core/Filter';
import ... | true |
61d4513c7ea99cf6d1c34caa34d29928d9bb85fc | JavaScript | TimeRemnant9/cryptocurrency-ICO | /test/DappToken.js | UTF-8 | 5,866 | 2.859375 | 3 | [] | no_license | // smart contract data is immutable
// if bug is found you need to deploya new contract
var DappToken = artifacts.require("DappToken.sol");
contract('DappToken',function(accounts){
it('initialized contract will correct values', function(){
return DappToken.deployed().then(function(instance){
tokenInstance=insta... | true |
52739025b2efece5dbbc2518cb0e0a1f0e41b747 | JavaScript | thetylerwolf/tylernwolf.com | /v2/js/party_calendar.js | UTF-8 | 1,831 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | var gallery = d3.select('#gallery-right .gallery-inner');
var calendarWrap = gallery.append('div').attr('class','calendar-wrap');
var now = new Date();
var year = undefined || now.getYear() + 1900;
var dayColors = ['#258ace','#b80f74','#57bc3c','#372885','#f85921','#0b95b9','#f5db0a']
var daysInMonth = function(mo... | true |
31e7ad047c40e0a2c284898cbb71ce0e4231a217 | JavaScript | Jukoss/lection6 | /scripts.js | UTF-8 | 499 | 3.640625 | 4 | [] | no_license | const timeMachine = {
name: 'DeLorean',
horsepower: 200,
timeTravel: true,
maxSpeed: 160,
age: 36
}
// for (let key in timeMachine) {
// if (typeof timeMachine[key] === 'number') {
// timeMachine[key] = timeMachine[key] * 2;
// }
// }
// console.log(timeMachine);
function objectToArray(obj) {
con... | true |
a46d8a4827c7adba401a800a1339fd10ad058597 | JavaScript | cyrusssschen/react-memo | /src/actions/memo.js | UTF-8 | 1,381 | 2.578125 | 3 | [] | no_license | import moment from 'moment';
import { getStorage } from '../utils/storage';
import { ADD_MEMO, DELETE_MEMO, SHOW_MEMO, SHOW_LAYER, SHOW_EDITOR } from '../constants';
let memoId;
let memosArr2;
let memosArr = JSON.parse(getStorage('memos'));
if (memosArr instanceof Array && memosArr.length !== 0) {
if (memosArr.leng... | true |
262d8fc6cf2f2e052d5bf67ad7b9f65e13627613 | JavaScript | yash-learner/lco-js | /03Intermediate/11ObjectsPartTwo.js | UTF-8 | 812 | 3.265625 | 3 | [] | no_license | var user = {
firstName : "Yaswanth",
lastName : "Bethu",
role : "Admin",
loginCount : 23,
faceBookSignedIn : true,
courseList : [],
buyCourse : function (courseName) {
this.courseList.push(courseName);
},
getCourseCount : function () {
return `${this.firstName... | true |
11fe2645b9e6b528f905eefab57a1af0b2daa012 | JavaScript | edele/goeat | /resources/assets/scripts/modules/form.event/views/view.js | UTF-8 | 3,276 | 2.546875 | 3 | [] | no_license | 'use strict'
import app from 'core/app'
import template from '../templates/template.hbs'
import moment from 'moment'
import binder from 'utilities/binder'
import _ from 'underscore'
const roundTo = (num, to) => {
return Math.ceil(num / to) * to
}
export default app.ItemView.extend({
template: template,
... | true |
40a1064063404c6d13d112c16322b5cebf18eefb | JavaScript | cloneforyou/content-review-lookup | /dist/sonako-back-up/Wikia.js | UTF-8 | 11,447 | 2.578125 | 3 | [
"CC-BY-4.0"
] | permissive | // Outside variables
var railgunDefaultMode = 0; // default mode to enter upon pageload
// Inside variables
var railgunMode;
if (wgNamespaceNumber != undefined) {
addOnloadHook(launchRailgun);
}
/* function launchRailgun -------------------------------------------------- */
/* Starts up Railgun upon page load, p... | true |
b895a84e1392df1d840b18337f85c081af03c771 | JavaScript | bobholt/LinAlg | /tests/lib/matrix.js | UTF-8 | 1,266 | 2.8125 | 3 | [
"MIT"
] | permissive | "use strict"
const assert = require('assert');
const M = require('../../lib/matrix');
const V = require('../../lib/vector');
const A = new M([1, 2],
[3, 4]);
function isDiagonal(i, j) {
return Number(i === j);
}
assert.deepStrictEqual(M.shape(A), new V(2, 2));
assert.deepStrictEqual(A.shape(), new... | true |
8a8e88bd01906196a33caba7a327fa732e653dd2 | JavaScript | vish198910/MedIdForm | /src/Form.js | UTF-8 | 5,519 | 2.703125 | 3 | [] | no_license | import React, { useState } from 'react';
import firebase from "./Firestore";
import Dropdown from 'react-dropdown';
import 'react-dropdown/style.css';
import DatePicker from 'react-date-picker';
import "./index.css"
import Autosuggest from 'react-autosuggest';
//list of allergies
const allergies = [
{
alle... | true |
d87d5784503cd1c72b86f803a3832bef884a67f5 | JavaScript | amlali/node-shooping | /helper/fetch.js | UTF-8 | 258 | 2.796875 | 3 | [] | no_license | module.exports.fetchList=function(list){
var tempList=[];
(list).forEach(element => {
var elem={
name:element.name,
amount:element.amount
}
tempList.push(elem);
});
return tempList;
} | true |
cdecc2aaf9629138b0e208564781c19202a73074 | JavaScript | MastersAcademy/js-course-2018 | /homeworks/roman.plynko_RPVanarx/homework_5/country.js | UTF-8 | 1,052 | 3.078125 | 3 | [
"MIT"
] | permissive | const countryCodes = require('./CountryCodes.json');
let allPeople = 0;
const allCountries = [];
const MIN_PERCENT_VALUE = 0.5;
const otherCountries = { country: 'Other', percentValue: 0, population: 0 };
const otherMass = [];
allPeople = countryCodes.reduce((sum, { Population }) => sum + parseInt(Population.replace(... | true |
d0f46b256189595c91c47391bd7f007195038669 | JavaScript | explooosion/AON-UI-React-Dva | /src/api/UnrealAPI.js | UTF-8 | 2,115 | 2.59375 | 3 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | export default class UnrealAPI {
constructor(dispatch) {
// models actions
// this.actions = actions // this is for hyperapp framework
this.dispatch = dispatch
if (!this.isValid()) return
// testing
// this.debug('Hello AON')
ue.interface.setFPS = this.setFPS.bind(this)
ue.interfa... | true |
beaf6ef61251400f046e5880e2d32af1004a8cdc | JavaScript | T3Piti/AbTestTask | /WebApplication1/wwwroot/js/index.jsx | UTF-8 | 5,829 | 2.625 | 3 | [] | no_license | var usersData = [];
const tableStyle = {
fontFamily: "Ubuntu",
fontStyle: "normal",
fontWeight: "normal",
fontSize: "14px",
lineHeight: "16px",
color: "#5D6D97",
width: "770px",
height: "48px",
left: "50%",
textAlign: "center"
};
const thStyle = {
padding: "5px"
};
const td... | true |
af7724dc9ff560de46759bb017fc9d18825787a9 | JavaScript | cph-at129/JS-MEAN-Exercises | /Period2_finetuned/P2_A.js | UTF-8 | 13,042 | 2.6875 | 3 | [] | no_license | //=========================================================================================================
//---------- Why would you consider a Scripting Language as JavaScript as your Backend Platform. ----
/* NodeJS is faster on the server, than anyone has expected. Faster than Java or other options;
when ... | true |
71b35a42b855a40c411af9551159e32c6cba224f | JavaScript | vishwaksaran/Api_Sample | /src/App.js | UTF-8 | 631 | 2.796875 | 3 | [] | no_license |
import './App.css';
import {useEffect, useState} from 'react';
import axios from "axios";
function App() {
const [state, setstate] = useState("")
const user =async()=>{
try{
const data = await axios.get('https://randomuser.me/api/');
console.log(data);
console.log(data.data.results[0])
setstate(... | true |
a7ec8cb888ffed9ed06f99abec43f309cf48b379 | JavaScript | Jim-Heftypants/newChess.com | /frontend/components/games/game_board/game_board_container.jsx | UTF-8 | 6,385 | 2.625 | 3 | [] | no_license | import Board from './game_board';
import React from 'react';
import * as Utils from './utils';
import findAiMove from './chess_ai';
class Game extends React.Component {
constructor(props) {
super(props);
const board = new Utils.Board();
this.state = { board: board };
this.restartGam... | true |
4eb6799f144c2512cdac824516447d3b493c5d82 | JavaScript | shechoruiz/javascript-moderno | /Curso JS Moderno/21-Fechas/js/01-app.js | UTF-8 | 451 | 3.84375 | 4 | [
"MIT"
] | permissive | // EL objeto Date
const diaHoy = new Date()
let valor
valor = diaHoy
valor = diaHoy.getFullYear() // Trae el valor del año actual
valor = diaHoy.getMonth() // Trae el valor del mes actual
valor = diaHoy.getMinutes() // Trae el valor de los minutos actuales
valor = diaHoy.getHours() // Trae el valor de la hora actua... | true |
c2676f52076c9464e76706733b683daa500275a7 | JavaScript | aryanpariyarofficial/angular | /Day 1/JAVASCTIPT/challange2.js | UTF-8 | 465 | 4.03125 | 4 | [] | no_license | // WAP to swap a value of two numbers with third temp var and without temp var
// With Temp Variable.
var a = 5;
var b = 10;
var temp;
console.log("Before Swap");
console.log("a : " + a);
console.log("b : " + b);
temp = a;
a = b;
b = temp;
console.log("After Swap With Temp");
console.log("a : " + a);
console.log("... | true |
2dd516aadd6bc0f57dfd2a76483e9386f9009c58 | JavaScript | JamesPF/react-weather | /example-arrow-functions.js | UTF-8 | 778 | 4.34375 | 4 | [] | no_license | var names = ['James', 'Mike', 'Kim', 'Yadi'];
//
// names.forEach(function (name) {
// console.log('forEach', name);
// });
//
// names.forEach((name) => {
// console.log('arrow', name);
// });
//
// names.forEach((name) => console.log('arrow 2', name));
//
// var returnMe = (name) => name + '!';
// console.log(re... | true |
a859ecaf23f9b2c167f65a763bb5acbb2cf2b076 | JavaScript | tirin2411/FormLogin | /kiemtra.js | UTF-8 | 452 | 2.65625 | 3 | [] | no_license | function validate() {
var u = document.getElementById("username").value;
var p = document.getElementById("password").value;
if(u== "") {
alert("Vui lòng nhập tên đăng nhập!");
return false;
}
if(p == "") {
alert("Vui lòng nhập mật khẩu!");
return false;
}
... | true |
47b0d5f8663e802b6c1b30c0bc2c0346be419fdb | JavaScript | Md-Imam-Hasan/Pioneer-Bank | /main.js | UTF-8 | 1,469 | 3.234375 | 3 | [] | no_license | // Login event handler
const loginBtn = document.getElementById("login");
loginBtn.addEventListener("click", function () {
const loginArea = document.getElementById("login-area");
loginArea.style.display = "none";
const transactionArea = document.getElementById("transaction-area");
transactionArea.style.display... | true |
80bd17a1492ac50ea44c3a4b431aefa6722f0129 | JavaScript | rei-gun/kfbootcamp | /src/day2/compareObjects.js | UTF-8 | 946 | 3.46875 | 3 | [] | no_license | function compareObjects(obj1, obj2) {
let numOfKeys = Object.keys(obj1).length !== Object.keys(obj2).length ? false : true;
if (!numOfKeys) return false;
let keys1 = Object.keys(obj1);
let keys2 = Object.keys(obj2);
console.log(keys1.sort(), keys2.sort());
if (keys1.sort().equals(keys2.sort())) {
retu... | true |
c955c9322f3d10c5f6cf2fb779c51e25e1f68e1b | JavaScript | BedrickijV/JavaScript | /homework 11/homework 11.js | UTF-8 | 1,028 | 4.34375 | 4 | [] | no_license | //Task 1
function filterArr(n, i, arr) {
return n > 0;
}
var arr = [-1, 0, 2, 34, -2];
arr.filter(filterArr);
//Task 2
function findArr (n, i, arr) {
return n > 0;
}
var arr = [-1, 0, 2, 34, -2];
arr.find(findArr);
//Task 3
function isPalindrome(str) {
return str.toLowerCase() == str.toLowerCase().spl... | true |
704c7d7a7d26a782360a9d512f52e87ca3aa3aae | JavaScript | anne-mainguy/Projet_symfony | /public/js/order.js | UTF-8 | 682 | 2.78125 | 3 | [] | no_license | //récupérer l'url et la mettre en href des lien arrow + 1 ou 2 en fonction de l'ordre
let urlCurrent = window.location.pathname;
let urlPropre = urlCurrent.split('/');
let offsetOrder;
for(let i = 0; i < urlPropre.length; i++){
if(!isNaN(urlPropre[i] )){
offsetOrder = i;
... | true |
fe3186dc369ba917837580381214ed2db6d82ab8 | JavaScript | dzakyinsan/frontend | /src/components/content.jsx | UTF-8 | 893 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
class Content extends Component {
state = {};
renderStnk = () => {
var jsx = this.props.stnk1.map((val, index) => {
//this.props.stnk1== ini menunjuk ke stnk1 di App.js
//(stnk1 ini tampungan dari stnk didalam objek state )
return (
<... | true |
c1961346c72f54b5d6657214e347fc5acbde8489 | JavaScript | cod3art/me-dev-template | /src/util/fetch.js | UTF-8 | 1,586 | 2.59375 | 3 | [
"MIT"
] | permissive | /**
* @Description: 统一请求方法
* @Author: Zhang Hang
* @Date: 2019-06-10 18:06:46
*/
import Axios from "axios";
import store from "@/store/store";
import qs from "qs"; // node-modules 中的 querystring 模块
// 创建一个 axios 实例,并添加默认配置
const axiosInstance = Axios.create({
baseURL: process.env.BASE_API, // base_url,'https://s... | true |
5f230b72b43cf1aa4e82c8482c212444301c572e | JavaScript | joshwrn/Full-Stack-Open-2021 | /part7/bloglist-front-extended/src/reducers/loginReducer.js | UTF-8 | 193 | 2.5625 | 3 | [] | no_license | export const loginReducer = (state = false, action) => {
console.log(action);
switch (action.type) {
case 'logged in':
return action.user;
default:
return false;
}
};
| true |
916e615dc58b435fb5b882382f72266d87d2580c | JavaScript | FFace32/facebook-mass-message | /public/index.js | UTF-8 | 11,437 | 2.578125 | 3 | [
"MIT"
] | permissive | "use strict";
var messageID = -1;
function get( url, data, success, dataType ) {
if ( typeof data === "function" )
{
dataType = success;
success = data;
data = {};
}
data.message_id = messageID;
$.get( url, data, success, dataType );
}
function post( url, data, success ) ... | true |
5af6666a3cce712291c8f3e183c9a95b6d8f60a6 | JavaScript | JonathanC13/AirWebsite_exercise | /js/load_pageInfo.js | UTF-8 | 14,751 | 2.625 | 3 | [] | no_license | window.onload = function load_pageInfo(){
load_bannerInfo();
load_inventoryInfo();
// Listener for text input (id="inputBlur") and dropbox (id="dropboxAutoPop")
setInputBox_FocusBlur();
}
function setInputBox_FocusBlur(){
var id_inTextBox = "inputBlur"
var elem_inText = document.getElementById(id_inText... | true |
91473ee73edd0cf988fc4575e98af83a9fb2d393 | JavaScript | jehincastic/NoFrameWorkApi | /lib/handlers.js | UTF-8 | 1,890 | 2.96875 | 3 | [] | no_license | /*
* Request handlers
*
*/
// Dependencies
// Define the handlers
const handlers = {};
// Users handler
handlers.users = (data, callBack) => {
const acceptableMethods = ['post', 'get', 'put', 'delete'];
if (acceptableMethods.indexOf(data.method) > -1) {
handlers._users[data.method](data, callBack);
} else {
... | true |
4234ee1909c4b0c0b305949a8ae8364b0dc692ef | JavaScript | Webprogr/email-services | /test/emailprovider.test.js | UTF-8 | 1,126 | 2.578125 | 3 | [] | no_license | let expect = require('chai').expect;
let emailProvider = require('../components/providers/emailprovider');
let email = new emailProvider();
describe('email validation', function() {
context('email address validator', function() {
it('Check valid addresses succeed', function() {
expect(email.validEmail("ali... | true |
9c482cabfbb2640dc6428c65d402679ede7feaf4 | JavaScript | satyasaibhushan/p5.js-sound | /test/tests/p5.Noise.js | UTF-8 | 1,421 | 2.625 | 3 | [
"MIT"
] | permissive | const expect = chai.expect;
describe('p5.Noise', function () {
it('can be created and disposed', function () {
let noise = new p5.Noise();
expect(noise).to.not.have.property('f');
expect(noise).to.not.have.property('oscillator');
expect(noise).to.have.property('buffer');
expect(noise.started).to.... | true |
7e65f6ab39d8fabd97034eac377c7b43c70be0d5 | JavaScript | richarddowdy/react-box-color-app | /src/BoxForm.js | UTF-8 | 1,267 | 2.671875 | 3 | [] | no_license | import React, { useState } from 'react';
function BoxForm({ addBox }) {
const INITIAL_STATE = { height: 0, width: 0, color: "" };
const [formData, setFormData] = useState(INITIAL_STATE);
const handleSubmit = evt => {
evt.preventDefault();
addBox(formData);
setFormData(INITIAL_STATE);
};
const ... | true |
09ba955cb780843fe4caa2c30db2474c9d209ce9 | JavaScript | ksenia-fe/js-course | /live-coding/objects/objects3.js | UTF-8 | 1,911 | 3.71875 | 4 | [] | no_license | // ------------------------ 21-12-2020 ---------------------
const customers = {
'customer-id-1': {
name: 'William',
age: 54,
},
'customer-id-2': {
name: 'Tom',
age: 17,
},
'customer-id-3': {
name: 'Andrey',
age: 100,
},
};
// input: obj
// output: array(of objects)
// 1 copy obj ... | true |
a3a8a9b5a30dc6e82c8b4ecb8acfdb038745c79f | JavaScript | xiaohanihan/react_book | /src/react_redux/Reducer.js | UTF-8 | 364 | 2.671875 | 3 | [] | no_license | import { INCREMENT, DECREMENT } from "./ActionTypes";
const reducer = (state, action) => {
const { type, caption } = action;
switch (type)
{
case INCREMENT:
return {...state, [caption]: state[caption] + 1};;
case DECREMENT:
return {...state, [caption]: state[caption] - 1};
default:
... | true |
9a50b532fb2642eca34b82cfdfcbb36fb3602f5e | JavaScript | lilong7676/Peter- | /chunchao/src/index.js | UTF-8 | 2,598 | 2.859375 | 3 | [] | no_license | import './route'
/**
*
* @param {string} entry
* @param {function} activeRule
*/
const Apps = []; //子应用队列
export function registryApp(entry, activeRule) {
Apps.push({
entry: entry,
activeRule: activeRule,
});
}
async function loadApp() {
const shouldMountApp = Apps.filter(shouldBeActive);
const Ap... | true |
d11d33a0507116a87a3255e786a39ca1bff621ba | JavaScript | Lenarin/fitness_app | /Stores/Models/Exercise.js | UTF-8 | 594 | 2.8125 | 3 | [] | no_license | import { observable, action } from 'mobx';
class Exercise {
@observable
Image = '';
@observable
Title = '';
@observable
Text = '';
@observable
Completed = false;
@observable
TimeToDo = '';
@observable
Repeats = 10;
constructor(title, image, text, timeToDo, repe... | true |
04d6c4997febe8912a497a013932a9ae025a4d24 | JavaScript | Edgar101010/cragravorum | /Programming3/public/script.js | UTF-8 | 6,007 | 3.0625 | 3 | [] | no_license |
function RandInt(min, max) {
var z = Math.floor(Math.random() * (max - min + 1)) + min;
return z;
}
var matrix = [];
var n = 20;
var m = 20;
for (var i = 0; i <= n; ++i) {
matrix[i] = [];
}
for (var y = 0; y <= n; y++) {
for (var x = 0; x <= m; x++) {
matrix[y][x] = 0;
}
}
var tokos1 = 100... | true |
953e91bbcde795f96b9329b77f5acd00c7a4dc40 | JavaScript | magast-io/screeps | /room.manager.js | UTF-8 | 2,298 | 2.703125 | 3 | [] | no_license | class RoomManager {
static exec(room) {
const UPDATE_EVERY = 10;
let memory = room.memory;
let needsUpdate;
if (memory.needsUpdateAt != undefined) {
needsUpdate = memory.needsUpdateAt < Game.time;
} else {
needsUpdate = true;
memory.needsUpdateAt = 0;
}
if (needsUpdate) ... | true |
ada62f4ce06a0b20139fd1f5ef1dbd774fa2b01a | JavaScript | MUSHA170/HAHR-2021 | /v1/itens.js | UTF-8 | 1,231 | 3.515625 | 4 | [] | no_license | var add_input = document.getElementById("add_input");
var lista = document.getElementById("lista");
function add() {
var elem = add_input.value;
console.log(elem);
if (elem == '') {
console.log("vazio");
} else {
console.log("ok");
var item = document.createElement('li... | true |
8b279079942754da82b0d726e8765f23f420bb8a | JavaScript | gidema/osmlayers3 | /externs/jstree.js | UTF-8 | 604 | 2.53125 | 3 | [] | no_license | /**
* @fileoverview Externs for jstree
*
* Note that some functions use different return types depending on the number
* of parameters passed in. In these cases, you may need to annotate the type
* of the result in your code, so the JSCompiler understands which type you're
* expecting. For example:
* <code>va... | true |
05cad93f0f6c82ffc398b618db1c2f8466cf90c4 | JavaScript | KayO-GH/robofriends | /src/actions.js | UTF-8 | 769 | 2.6875 | 3 | [] | no_license | import {
CHANGE_SEARCHFIELD,
REQUEST_ROBOTS_PENDING,
REQUEST_ROBOTS_SUCCESS,
REQUEST_ROBOTS_FAILED
} from './constants';
export const setSearchFieldAction = (text) => ({
type: CHANGE_SEARCHFIELD,
payload: text
});
export const fetchRobotsAction = () => (dispatch) => {//things like this are wh... | true |
b67ec225a4628b5d686c7604d97eaa764061bafe | JavaScript | igareck99/LastChance | /static/js/script.js | UTF-8 | 684 | 2.953125 | 3 | [] | no_license | window.addEventListener('DOMContentLoaded', () =>{
let form = document.querySelector('form'),
submit = document.getElementById('submit'),
login = document.getElementById('login');
submit.addEventListener('click', (event) =>{
event.preventDefault();
let check = checkLogin();
... | true |
4c3dee3d98d4950a7b58d3408c501b90c4e46ed1 | JavaScript | Sahan105/foodKaa | /js/dishes.js | UTF-8 | 2,790 | 3.015625 | 3 | [] | no_license | const btns = document.querySelectorAll('.btn');
const storeProducts = document.querySelectorAll('.store-product');
for (i = 0; i < btns.length; i++) {
btns[i].addEventListener('click', (e) => {
e.preventDefault()
const filter = e.target.dataset.filter;
console.log(filter);
... | true |
99a42ab4cf8dbca7be6a296af6f2f5760f2f5ae1 | JavaScript | LawrenceHua1/Bootcamp4 | /src/components/ViewBuilding.js | UTF-8 | 1,397 | 2.703125 | 3 | [] | no_license | import React from 'react';
class ViewBuilding extends React.Component {
render(){
const {data, id} = this.props;
const buildingData = data.filter(directory => {return directory.id === id})[0]
let out = '';
if(buildingData){
out =
<div>
<tr>
<row>
<b>
Name: <t></t>
</b>
{... | true |
561c30543d3fcae74213f12851c65208d9a3dfbc | JavaScript | Angelinodc71/Ejersisios-Rusben | /004-duck.js | UTF-8 | 476 | 3.125 | 3 | [] | no_license |
var track = document.getElementById("track");
var playButton = document.getElementById("btn-play");
var pauseButton = document.getElementById("btn-pause");
var stopButton = document.getElementById("btn-stop");
playButton.addEventListener("dblclick", play);
pauseButton.addEventListener("click", pause);
stopButton.addE... | true |
9dc244a482f6f2eb745a4f8a5ea6ab93efb79f70 | JavaScript | eveninglily/hslpicker | /hsvpicker.js | UTF-8 | 14,152 | 3.5 | 4 | [
"MIT"
] | permissive | 'use strict';
/** HSV Color Picker */
class HSVPicker {
/**
* Constructs a HSVPicker and appends it to #parentId
* @param {String} id The id of the HSVPicker canvas
* @param {String} parentId The id of the parent element
* @param {Number} radius The radius of the picker
* @param {Function}... | true |
f7e10d8fd17f77770336cafd73f36641c57b4223 | JavaScript | BS-Howard/BS-Howard.github.io | /HW-Pokemon/app.js | UTF-8 | 3,150 | 3.046875 | 3 | [] | no_license | const loadAllBtn = document.querySelector("#loadAll");
const removeAllBtn = document.querySelector("#removeAll");
const plusOneBtn = document.querySelector("#plusOne");
const removeOneBtn = document.querySelector("#removeOne");
const timerBtn = document.querySelector("#timer");
const stopTimerBtn = document.querySelect... | true |
3920c7e8de85106ab456d456de436d358ffc1dac | JavaScript | MitchellDill/moonar | /client/components/app.jsx | UTF-8 | 5,934 | 2.578125 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import Moon from "./moon.jsx";
import Mercury from "./mercury.jsx";
import Modal from "./modal.jsx";
import styles from "../style/main.less";
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
date: new Date(),
... | true |
49591f66c996809cb1011711669a09eade93a7b8 | JavaScript | jslone/sald | /sald/Tilemap.js | UTF-8 | 2,265 | 3.078125 | 3 | [] | no_license | var Tilemap = function(srcJson){
this.load(srcJson);
}
Tilemap.prototype.width = 0
Tilemap.prototype.height = 0
Tilemap.prototype.tilesize = 8
Tilemap.prototype.tilecount = 0
Tilemap.prototype.tiles = []
Tilemap.prototype.img = null
Tilemap.prototype.getTilesByTag = function(tag){
var ret = [];
for (var r = 0; r <... | true |
f782140799e56f683d7b55fbf415173bc55ca33f | JavaScript | janaratolonbaeva/itattractor-hw66 | /src/containers/Countries/Countries.js | UTF-8 | 2,184 | 2.5625 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import Country from "../../components/Country/Country";
import ListCountry from "../../components/ListCountry/ListCountry";
import axiosCountries from "../../axoisCountries";
import withLoader from "../../hoc/withLoader/withLoader";
import './Countries.css';
const C... | true |
2969b0355c1d4cf75345affff1eb312907f99e1c | JavaScript | fison67/tuyapi | /lib/message-parser.js | UTF-8 | 5,049 | 2.9375 | 3 | [
"MIT"
] | permissive | const debug = require('debug')('TuyAPI:MessageParser');
/**
* Class for decoding and encoding payloads.
* @class
* @private
*/
function MessageParser() {
this._parsed = false;
this._buff = Buffer.alloc(0);
this._payloadSize = undefined;
this._data = undefined;
this._leftOver = undefined;
this._commandByte ... | true |
ebb877e16bf81eabdbd639e89ca677305ba31290 | JavaScript | jburgoon1/effect-and-ref | /src/Draw.js | UTF-8 | 956 | 2.859375 | 3 | [] | no_license | import React, {useState, useRef, useEffect} from 'react'
import axios from "axios"
const Draw = () =>{
const [card, setCard]=useState()
const [deck, setDeck]=useState()
const deckId = useRef('')
const remaining = useRef(52)
const button = useRef()
useEffect(()=>{
async function getDeck(){
const newDeck = aw... | true |
77e4117fd11f3df4b6964baf218c9cc5d7ee3cc8 | JavaScript | kadonomaro/filmsovet | /src/api/LocalStorage.js | UTF-8 | 330 | 2.859375 | 3 | [] | no_license | export class LocalStorage {
constructor(name) {
this.name = name;
}
load() {
if (!localStorage.getItem(this.name)) {
return [];
}
return JSON.parse(localStorage.getItem(this.name));
}
save(data) {
localStorage.setItem(this.name, JSON.stringify(data));
}
clear() {
localStorage.removeItem(this.na... | true |
6e3734f02472f8c3f8050cfbf0326ff37f52c52d | JavaScript | hexiaoah/hexiao | /static-hercules/src/base/interception.js | UTF-8 | 4,730 | 2.546875 | 3 | [] | no_license | import axios from 'axios'
import {
GW
} from '@2dfire/gw-params'
import catchError from './catchError'
const {
getCookie
} = require("./utils/AppUtil")
const {
warning: warningDialog
} = require("./components/dialogs/events")
const Promise = require("promise")
import {
API_BASE_URL,
ENV,
GATEWAY... | true |
021d66315b36c61c73551b7e845b4925b4bd5628 | JavaScript | ktan114/Sprint-Challenge-Node-Express | /server.js | UTF-8 | 3,391 | 2.640625 | 3 | [] | no_license | // Bring in modules
const express = require('express');
const actionDb = require('./data/helpers/actionModel');
const projectDb = require('./data/helpers/projectModel');
const cors = require('cors');
// Initialize server
const server = express();
// Add middleware
server.use(express.json());
server.use(cors())
// GE... | true |
6d88b47cf6f8ce51cfbe05927b386ad01401b8d7 | JavaScript | cciccia/forum | /styles/maftigers/template/viewtopic.js | UTF-8 | 4,316 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | function quote (post_id, username, forum){
var append= "./posting.php?mode=";
if (storeQuote (post_id, username, "")){
append += "select&f=" + forum + "&p=" + post_id;
}
else{
append += "quote&f=" + forum + "&p=" + post_id;
}
window.location = append;
}
//checks for quote by selection, if use... | true |
d8ca4f98de9f618bc46d27e71e97b7af7e47268e | JavaScript | sing1302/functions_exercise | /functions.js | UTF-8 | 4,826 | 3.984375 | 4 | [] | no_license | /**
Parwinder singh
17 June 2020
**/
// This function returns a random number between (and including both) minimum and maximum
function getRandomInteger (minimum, maximum) {
minimum = Math.ceil(minimum) // minimum is inclusive
maximum = Math.floor(maximum + 1) // maximum is exclusive so we add one
return Math... | true |
18218876390e4bc152ecdeb55f88b1e8eac59a02 | JavaScript | siddharthanarang/dataStructureAndAlgorithms | /slidingWindowPattern/minSubArrayLen.js | UTF-8 | 1,585 | 4.96875 | 5 | [] | no_license | // Write a function called minSubArrayLen which accepts two parameters - an array of positive integers and a positive
// integer.
//
// This function should return the minimal length of a contiguous subarray of which the sum is greater than or equal t
// o the integer passed to the function. If there isn't one, return ... | true |
a2c266d78d1e232b78240c7ef6833b36fff4b5b7 | JavaScript | jarod-rossini/runtrack3 | /jour01/job09/script.js | UTF-8 | 605 | 3.421875 | 3 | [] | no_license | function tri(numbers, order)
{
let a = 0;
var desc = new Array;
while(a < numbers.length){
let nb = 0;
for(let i = 0; i < numbers.length; i++){
if(numbers[i] > nb){
nb = numbers[i];
}
}
desc[a] = nb;
let index = numb... | true |
a4e2f6764e37f117e5fbfefe9c4e9c1cade3510a | JavaScript | loverxp/Codewars | /JavaScript/src/MergedStringChecker.tidy.js | UTF-8 | 1,471 | 3.453125 | 3 | [] | no_license | // https://www.codewars.com/kata/54c9fcad28ec4c6e680011aa/solutions/javascript
function isMerge(s, part1, part2) {
console.log("isMerge");
console.log({ s });
console.log({ part1 });
console.log({ part2 });
console.log();
if (s.length == 0) {
return s1.length == 0 && s2.length == 0;
... | true |
19026ff114347f22be55e687d9f1eca2b45078f7 | JavaScript | adclleva/App-Academy-Bootcamp-Prep | /Assessments_Lleva/arvin_lleva_A5/problems/1_highest_score.js | UTF-8 | 1,996 | 4.0625 | 4 | [] | no_license | /*******************************************************************************
Write a function highestScore(students) that takes in an array of student objects
as a parameter. It should return a string that corresponds to the student with
the highest score. The string should contain that student's initials
concatena... | true |
6dce0822808c1cc2bff532d5b1315d67a1f499e8 | JavaScript | simonyanli/mongodb_playground | /server/test/server.test.js | UTF-8 | 2,234 | 2.671875 | 3 | [] | no_license |
const {app} = require('./../app');
const {Todo} = require('./../models/todo');
const request = require('supertest');
const {ObjectId} = require('mongodb');
const todos = [{
_id: new ObjectId(),
text:'First test todo'
},{
_id: new ObjectId(),
text:'Second test todo'
}]
beforeEach(async ()=>{
awa... | true |
e9b499fdf1097f36f1513ee0c618221aae8baa97 | JavaScript | fanksin/react-tilemap | /src/components/Terrain/Grass/index.js | UTF-8 | 675 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import getRandomInt from '../../../helpers/getRandomInt';
import variants from './variants';
import './index.scss';
export default class Grass extends Component {
constructor(props) {
super(props);
this.props = props;
this.variants = variants;
}
getRandomVari... | true |