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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8fc7824e87a23d76e71ee67072b0206439086294 | JavaScript | K-AppDevClub/ehamaloud | /src/services/CalcScore.js | UTF-8 | 1,141 | 2.921875 | 3 | [
"MIT"
] | permissive | function each(xs, fn){ for(var i = 0; i < xs.length; i++) fn(xs[i], i); }
export default{
calc(preSpectrums, spectrums){
var current_score = 0;
each(spectrums, (s,i)=>{
current_score += Math.pow(s - (preSpectrums[i] || 0), 2) / 100;
});
return current_score;
},
calc2(preSpectrums, spectru... | true |
bd8ea154305dc4362e0fd2e9f9f4ef892adb49d9 | JavaScript | randjana/WebFundamentals | /Javascript/reward.js | UTF-8 | 206 | 3.4375 | 3 | [] | no_license | //Function to return reward
function returnReward(days){
var totSum = 0;
for (var i = 0;i < days;i++){
totSum = totSum + Math.pow(2,i) * 0.01;
}
return totSum;
}
returnReward(30);
| true |
641bbd5c2a7b1bc5e273878f21d88e85638c290c | JavaScript | zsm-Web/bookstore | /js/contact.js | UTF-8 | 1,806 | 3.3125 | 3 | [] | no_license | //让姓名文本框获得焦点。
document.getElementById("name").focus();
var form = document.getElementById('contact');
form.addEventListener('submit', function (event) {
if (!form.checkValidity()) {
event.preventDefault();
return;
} else {
let name = document.getElementById("name").value;
... | true |
1b2d33ffbbd3724c10bbdb9e584a16ac9333f7f7 | JavaScript | LiveAlone/nodejs | /doc/util/debuglog.js | UTF-8 | 579 | 2.609375 | 3 | [] | no_license | const util = require('util');
const debuglog = util.debuglog('foo');
//console.debug("console debug info");
// console.info("console info info");
// console.warn("console warn info");
// console.error("console error info");
// console.log("console logger info");
// debug mode start 设置对应的环境变量, output Title
// 可以自定义 de... | true |
815f5ddcf35eeaf684d63575ff44f580b2787f95 | JavaScript | dhanyasv/recipebook | /server/routes/recipes.js | UTF-8 | 1,781 | 2.59375 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const Recipe = require('../models/Recipe');
//GET ALL RECIPES
router.get('/',async (req,res) => {
try {
const recipes = await Recipe.find();
res.json(recipes);
} catch (err) {
res.json({message:err})
}
});
//GET A ... | true |
0a9fa48f2360a1fcda9408c2ad819b9e681af2d0 | JavaScript | nurulizzafarhana/JLINE-005 | /js/script.js | UTF-8 | 349 | 2.5625 | 3 | [] | no_license | //Logo pop up
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 680 || document.documentElement.scrollTop > 680) {
document.getElementById("logo").style.fontSize = "50px";
} else {
document.getElementById("logo").style.fo... | true |
9f3f5a529f1fc0b15b3bdebee2ea52b8fadc6254 | JavaScript | gdd-shobhit/Project2HTML | /project3/theGame/js/keys.js | UTF-8 | 360 | 3.28125 | 3 | [] | no_license | // this is the "key daemon" that we poll every frame
const keys = [];
window.onkeyup = (e) => {
keys[e.keyCode] = false;
e.preventDefault();
};
window.onkeydown = (e)=>{
keys[e.keyCode] = true;
// checking for other keys - ex. 'p' and 'P' for pausing
var char = String.fromCharCode(e.keyCode);
if (char == "p" ... | true |
bd36955882e442d499809603cf3ee2b2a0a8dc9d | JavaScript | lucasmartins96/FCC-JSAlgorithms-DataStructures-Projects | /roman-numeral-converter/romanNumeralConverter.js | UTF-8 | 719 | 3.203125 | 3 | [] | no_license | function convertToRoman(num) {
const romansNumerals = {
'I': 1,
'IV': 4,
'V': 5,
'IX': 9,
'X': 10,
'XL': 40,
'L': 50,
'XC': 90,
'C': 100,
'CD': 400,
'D': 500,
'CM': 900,
'M': 1000
}
const romansNumeralsKeys = Object.keys(romansNumerals);
let romanNumeralString... | true |
c011536328e509da86037660d3a24b5d59cc1f5d | JavaScript | sluckywhh/ChargeClientActiveX_Signed | /webpages/mobile_gz_cecunet/mobile_gz_cecunet_js/mobile_gz_cecunet_reversal.js | UTF-8 | 4,568 | 2.515625 | 3 | [] | no_license | function Reversal_PassParameter() {
// ------ DEBUG INFO BEGIN ------
//If the debug flag is set "ON", the log will be wroten.
//After we finished the debug process, we should remove the lines.
//ChargeClientActiveX1.InputParameterDebugFlag="DEBUG_ON";
//ChargeClientActiveX1.InputParameterDebugFlag="DEBUG_OFF";
... | true |
184ce5fb69e6cfed671557cc69b9fdad4777ebd2 | JavaScript | mansibhadoria/OnlineHotelReservationSystem | /OHRS_Frontend/src/services/GuestService.js | UTF-8 | 1,038 | 2.515625 | 3 | [] | no_license | import axios from 'axios';
const GUEST_API_BASE_URL = "http://localhost:8080/hotel-reservation/guests"
class GuestService {
registerGuest(guest) {
return axios.post(GUEST_API_BASE_URL + "/" + "/register", guest);
}
loginGuest(guest) {
return axios.post(GUEST_API_BA... | true |
9b24392ac3dec1e9a7a0580c83553e020dd3b1e6 | JavaScript | betinaivanova/ITTalents | /JS_Fundamentals/Homework_02/Task_10.js | UTF-8 | 408 | 3.90625 | 4 | [] | no_license | var n = Number(4);
if(n === 2) {
console.log("is prime");
} else if(n === 1 || n % 2 === 0) {
console.log("is not prime.");
} else {
var isPrime = true;
for(var numbers = 3; numbers <= n/2; numbers+=2) {
if(n % numbers === 0 ) {
isPrime = false;
}
}
if(isPrime) {
... | true |
cef540bd18457ea8754a0277dff795126b6f1d75 | JavaScript | rtagashira/algorithms | /leetcode/uniqueMorseCodeWords.js | UTF-8 | 1,357 | 4.0625 | 4 | [] | no_license | // International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on.
// For convenience, the full table for the 26 letters of the English alphabet is given below:
// [".-","-...","-.-.","-..... | true |
629b1719ffe5b264d612d554824f906524aba22d | JavaScript | Dreessy/javascript-exercises | /calculator/calculator.js | UTF-8 | 666 | 3.5 | 4 | [] | no_license | function add (n1,n2) {
return n1 + n2;
}
function subtract (n1,n2) {
return n1 - n2;
}
function sum (numbers) {
let sum = 0;
numbers.forEach(result => {
sum += result;
});
return sum;
}
function multiply (numbers) {
let mult = 1;
numbers.forEach(result => {
mult *= result;
})
return mult;
}
function... | true |
a4fd96c755af176d98a969e99216d78a3ad01328 | JavaScript | Mattc33/JavaScriptSnippets | /src/Algorithms/Sorts/BubbleSort/bubbleSort.js | UTF-8 | 496 | 3.890625 | 4 | [] | no_license | const arr = [2,3,1]
const bubbleSort = (array) => {
let i, j, lim;
lim = array.length;
while(lim--) {
for(i = 0, j = 1; i < lim; ++i, ++j) {
if ( array[i] > array[j] ) {
temp = array[i];
console.log(temp);
array[i] = array[j];
... | true |
923371d62c8fe007b6f9d7505140d2025967ca51 | JavaScript | MR26-UA/front-end-pro-2019-september | /lections/lection_10_OOP/materials/oop.js | UTF-8 | 644 | 3.640625 | 4 | [] | no_license | function Parent() {}
Parent.prototype.m1 = function(){
console.log('m1');
}
function Child() {}
Child.prototype = Object.create(Parent.prototype);
Child.prototype.m3 = function(){
console.log('m3');
}
var p = new Child();
console.log(p);
// -----------------------------------------------
// class Parent... | true |
56bada6454a2b89fb4a38b0d808e70c7ddfac4bc | JavaScript | ddurden11/react-testing | /src/Movies/__tests__/MovieDetail.test.js | UTF-8 | 2,493 | 2.984375 | 3 | [] | no_license | import React from "react";
import {
render,
cleanup,
fireEvent,
waitForElement,
} from "react-testing-library";
import MovieDetail from "../MovieDetail";
import { POSTER_PATH } from "../Movie";
//mock fetch method of window global using jest-fetch-mock package
global.fetch = require("jest-fetch-mock");
// cl... | true |
950e3fba5de956f9da52e6234d95cf73b4ccda6a | JavaScript | usuariojm21/sepa | /view/js/class.principal.js | UTF-8 | 9,141 | 2.953125 | 3 | [] | no_license |
/*class Principal{
/*bloquear_elementos(state,arrayElement){
if (state > 0) {
for (var i = 0; i < arrayElement.length; i++) {
arrayElement[i].removeAttribute("disabled","")
arrayElement[i].removeAttribute("readonly","")
}
}else{
for (var i = 0; i < arrayElement.length; i++) {
arrayElement[i]... | true |
cdda0c1fbaae2c24cad4a29e6c58839d2c17c0bc | JavaScript | SupportClass/lfg-sounds | /extension/sounds.js | UTF-8 | 1,238 | 3 | 3 | [
"MIT"
] | permissive | 'use strict';
const DEFAULT_VOLUME = 30;
module.exports = function (nodecg) {
// Create defaults array
const soundDefaults = nodecg.bundleConfig.soundNames.map(soundName => {
return {
name: soundName,
volume: DEFAULT_VOLUME,
file: null
};
});
// Instantiate replicant with defaults object, which will... | true |
6ebbfe585696980db5e18fa87662698f4040b05d | JavaScript | abouolia/Fahembot | /tests/multiton_test.js | UTF-8 | 1,367 | 2.6875 | 3 | [] | no_license | const Multiton = require('../fahem/multiton');
const assert = require('chai').assert;
describe('Multiton', () =>{
describe('add', () => {
it('Should add class instance to collection.', () => {
let multiton = new Multiton();
class Foo{}
multiton.add(new Fo... | true |
29018e3f6e70c14bce7647ea5c582e415ac19149 | JavaScript | jbrown25/code-presentation-tool | /src/app.js | UTF-8 | 2,360 | 2.8125 | 3 | [
"MIT"
] | permissive | import React, {Component} from 'react';
import Loader from './components/loader';
import Slide from './components/slide';
import NextButton from './components/next_button';
import PreviousButton from './components/previous_button';
import 'styles/highlight.css';
import 'styles/index.scss';
import axios from 'axios';
... | true |
21a6c3ac06c4cf8ebfb1a0102fd8b791d4c95fd7 | JavaScript | kengz/kengz.github.io | /app/scripts/github.js | UTF-8 | 3,162 | 2.71875 | 3 | [
"Apache-2.0",
"CC-BY-4.0",
"LicenseRef-scancode-other-permissive",
"MIT"
] | permissive | /*!
*
* Web Starter Kit
* Copyright 2015 Google Inc. All rights reserved.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
... | true |
8ee1508d6232b5d21d73ef3b00679ed6a1bb1abc | JavaScript | hannadrehman/sample-projects | /Project Management/src/App/Routes/Login/utility.js | UTF-8 | 1,373 | 3.203125 | 3 | [] | no_license | /**
* this module will have all pure functions that are used in Login Component.
* all complex logic that dosent belog in the controller should be kept in this file
* in the form of functions. all api call functions must be written here
*/
import { ApiStore } from '../../services';
/**
* @function loginAction
* @... | true |
b0e4ff3b9343a1fd491dad91c104f54abeb79808 | JavaScript | edumorlom/Library-Database-Final | /newItem.js | UTF-8 | 1,819 | 2.609375 | 3 | [] | no_license | function getParamsLink() {
params = '?'
params += 'bookCode=' + document.getElementById('bookCode').value
params += '&title=' + document.getElementById('bookTitle').value
params += '&authorFirst=' + document.getElementById('authorFirst').value
params += '&authorLast=' + document.getElementById('auth... | true |
8d0ee92376e767077120407aac007df1ee1854d3 | JavaScript | Louya/eztransfer | /js/app.js | UTF-8 | 2,135 | 2.65625 | 3 | [
"MIT"
] | permissive | //Récupération des l'url
let url = window.location.pathname;
//Test de la page en cours
if (url === '/home') {
//vérification de la page upload
const icone = document.querySelector("#icone");
const nom = document.querySelector("#nom");
const emailExpediteur = document.querySelector("#emailExpediteur")... | true |
01f8669fb425a5d1a31a2ce64f938926737b38ce | JavaScript | toni-mo/nodewpg | /js/index33.js | UTF-8 | 620 | 4.21875 | 4 | [] | no_license | // -- Program Company Users --
// Defining variables
let userCount, menCount, womenCount, displayUserCount;
// Defining functions
displayUserCount = function(userCount, userGender = "User"){
userCountMessage = `${userGender} count ${userCount}`;
console.log(userCountMessage);
};
// Program body
userCount = 10... | true |
2f6f334ad4badc1f0676ed04db9742ae9a920063 | JavaScript | Allen-Chen-setfree/React_App_Test_by_NUnit_Cypress | /ui/tests/integration/testRandomSqaurePage.js | UTF-8 | 1,388 | 2.828125 | 3 | [] | no_license |
describe('Test Random Square Page', () => {
const pageName = "random-square";
it('visit and verify Random Square page', () => {
cy.visit('http://localhost:3000').get('a[href=' + pageName + ']').click()
cy.url().should('include', '/' + pageName)
cy.get('a[href="home"]').contains('Home')
... | true |
6139ce297278860bf97c7302d8262ece5b708a3f | JavaScript | matthewquercia/AlgoPractice | /1710MaximumUnitsTruck.js | UTF-8 | 768 | 3.75 | 4 | [] | no_license | /**
* @param {number[][]} boxTypes
* @param {number} truckSize
* @return {number}
*/
var maximumUnits = function (boxTypes, truckSize) {
boxTypes = boxTypes.sort((a, b) => { return b[1] - a[1] });
let units = 0;
for (let i = 0; i < boxTypes.length; i++) {
if (truckSize > 0) {
if (bo... | true |
582de6b6247cd2986f05f92fb16fd07515087fea | JavaScript | TamirIzhak/JS-Simon-Game | /game.js | UTF-8 | 3,072 | 3.609375 | 4 | [] | no_license | //Variables decalartions
var colorArray = ["red", "blue", "yellow", "green"];
var blueAudio = new Audio("sounds/blue.mp3");
var yellowAudio = new Audio("sounds/yellow.mp3");
var redAudio = new Audio("sounds/red.mp3");
var greenAudio = new Audio("sounds/green.mp3");
var wrongAudio = new Audio("sounds/wrong.mp3");
... | true |
1c79adf3f7e49ece9a98b7be8291311c92474f77 | JavaScript | SebDev777/HikariBot | /commands/ping.js | UTF-8 | 273 | 2.53125 | 3 | [] | no_license | exports.run = async (bot, message, args) => {
let random = Math.floor(Math.random() * 100)
if(random < 20){
message.channel.send(`**:confounded: Ups i lost!**`)
} else {
message.channel.send(`Pong!`)
}
}
exports.help = {
name: 'ping'
} | true |
4f56cb38f3404b3af300d09a6903f08dd052dd8b | JavaScript | ioannidis/jQueryPluginPatterns | /prevent-multiple-simple-plugin-structure.js | UTF-8 | 1,035 | 2.78125 | 3 | [] | no_license | (function($, window, document, undefined) {
// Choose your plugin name and the default data
var pluginName = "myNewPlugin",
defaults = {
key: "value"
};
function NewPlugin( element, options) {
this._defaults = defaults;
this._pluginName = pluginName;
... | true |
d8b5e8c52c8daded134820f0d883ec3f6b7cd176 | JavaScript | kasumisk/node-siteExample | /schema/User/UserSchema.js | UTF-8 | 1,793 | 2.71875 | 3 | [] | no_license | var mongoose = require('mongoose');
var bcrypt = require("bcrypt-nodejs");
var SALT_WORK_FACTOR = 10;
var UserSchema = new mongoose.Schema({
email:String,
name:String,
password:String,
meta:{
createAt:{
type:Date,
default:Date.now()
},
updateAt:{
... | true |
64b2bedf90da67b40680b4d7ff9951b0c9b4dee1 | JavaScript | vicesalles/m06 | /DAW_M06_T1_VicencSalles/loginPassword.js | UTF-8 | 296 | 3.15625 | 3 | [] | no_license | var user = prompt('Introdueix el teu nom d\'usuari');
var pass = prompt('Introdueix la teva contrassenya');
//Ara comprovem si l'usuari ha introduit 'daw' i '123'
if (user === 'daw' && pass === '123') {
alert('Benvingut');
} else {
alert('Les dades introduïdes són incorrectes');
} | true |
3eb3e89560c75b71cf5608a29dc1c3c3df936b2f | JavaScript | elshadagayev/Psychic-Game | /script.js | UTF-8 | 1,324 | 3.984375 | 4 | [] | no_license | var letters = ['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'];
var compGuess = letters[Math.floor(Math.random()*letters.length)];
var guessesLimit = 9;
var guessesLeftNum = guessesLimit;
var guessesArr = [];
var winsCount = 0;
var losesCount = 0;
startGame()... | true |
1fe1c14c4f787812d4e4d9706c93de20f971b91b | JavaScript | fmcauley/InvisibleHand | /tests/testSuiteSample.js | UTF-8 | 582 | 2.796875 | 3 | [] | no_license | "use strict";
/* Import invisible hand library,
* a fixture for some placeholder data
* and finally a screen which models a single screen in our app
*/
#import "../invisibleHand.js"
#import "../fixtures/UserTestData.js"
#import "../screens/SampleScreen.js"
/* Test our screens by tapping, swiping, or entering data... | true |
15a4c9a69d12e0d3e9cb1d5665c0570939f8e561 | JavaScript | LucasBolela/programacao-computadores | /Lista 2/exe3.js | UTF-8 | 2,090 | 3.625 | 4 | [] | no_license | function boss(){
let opcao = Number(prompt(`Digite [1] Cadastrar \n [2] Media Idade \n [3] Maior Idade \n [4] Quantidade mulheres \n [5] Percentual \n [6] Sair`)),
habitantes = [];
cadastro(habitantes)
do{
switch (opcao) {
case 1:
cadastro(habitantes)
break;
case 2:
conso... | true |
579346d7e9e866e33f062a9b779febcc734e65a9 | JavaScript | ncannata-dev/WebScrapingMadeEasy | /index.js | UTF-8 | 743 | 2.78125 | 3 | [] | no_license | const axios = require("axios");
const cheerio = require("cheerio");
const express = require("express");
const PORT = 8000;
const URL = "https://www.repubblica.it/"; // <-- insert you url
const app = express();
axios(URL)
.then((response) => {
const html = response.data;
const $ = cheerio.load(html);
let... | true |
793b607db22d7fd3960ce35fee8987bdfaabb537 | JavaScript | ameliap101/ameliap101.github.io | /multi coloured grid/sketch.js | UTF-8 | 943 | 3.625 | 4 | [
"Unlicense"
] | permissive | // Multi Coloured Grid
// Amelia Pilon
// Febuary 27th, 2020
let gridSpacing = 30;
function setup() {
createCanvas(windowWidth, windowHeight);
windowResized();
rectGrid();
}
function windowResized() { // resets the screen
resizeCanvas(windowWidth, windowHeight);
}
function mouseClicked() {
windowResized... | true |
91f539bff9857e779ee03fe01cbc1d93bdc3e407 | JavaScript | steffenlarson/checkpoint7 | /checkpoint7.client/src/services/NoteService.js | UTF-8 | 820 | 2.609375 | 3 | [] | no_license | import { AppState } from '../AppState'
// import { logger } from '../utils/Logger'
import { api } from './AxiosService'
class NoteService {
async getNotes(bugId) {
const res = await api.get('api/bugs/' + bugId + '/notes')
AppState.notes = res.data
// logger.log('this should be the notes for the indv bug'... | true |
f34bfabf5485d89797406dc6404fa172bfe6d544 | JavaScript | felps85/vilaalpha | /js/script.js | UTF-8 | 2,178 | 2.8125 | 3 | [] | no_license | $(document).ready(function(e) {
$('.fireworks').click(function(e){
window.location = $('*').attr('href');
});
});
// Google maps
function initMap() {
var markerArray = [];
// Instantiate a directions service.
var directionsService = new google.maps.DirectionsService;
// Create a map and ce... | true |
2a8c123b1cde778e6e0ae9de3a6b0e38ad9c192f | JavaScript | ANASDAVOODTK/World_Water_Project | /Project_Documents/static/app.js | UTF-8 | 14,184 | 3.125 | 3 | [] | no_license | // Code for Chart is Wrapped Inside a Function That Automatically Resizes the Chart
function makeResponsive() {
// If SVG Area is not Empty When Browser Loads, Remove & Replace with a Resized Version of Chart
var svgArea = d3.select("body").select("svg");
// Clear SVG is Not Empty
if (!svgArea.empty()... | true |
0137c3e382f9b71e578b428ba8a5741a21ad0db4 | JavaScript | shpsyte/urlshortener | /src/client/public/controllers/Short.js | UTF-8 | 2,008 | 2.734375 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
class ShortController {
constructor () {
this._url = 'https://appshorturl.herokuapp.com/'
this._urlServices = new UrlServices()
// this._postView = new PostView()
this._element = document.querySelector('.result')
this._spanEl = docu... | true |
7ce555c9b2f0f0e7d3b18dce9a829b5bf41580f0 | JavaScript | nculp/Hackathon-1---Parody-Project | /main.js | UTF-8 | 3,560 | 2.5625 | 3 | [] | no_license | var global_result;
var new_url;
var youtube_id_no;
function build_query_string(search_info) {
query_string_new = ("key=" + search_info["key"] + "&" + "q=" + search_info["q"] + "&" + "part=" + search_info["part"] + "&" + "maxResults=" + search_info["maxResults"]);
return query_string_new;
}
function google... | true |
14a3be9f016ba74a98ddcb0c2e458c12cac14584 | JavaScript | mngrateacher/PAP-projeto | /app.js | UTF-8 | 1,248 | 2.625 | 3 | [] | no_license | var express = require('express');
var app = new express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var nicknames = [];
app.get('/', function(req, res){
res.sendFile(__dirname + '/public/index.html');
});
app.use(express.static(__dirname + "/public" ))
io.on('connection', fu... | true |
a6bfd8d1030a614e702f83f13ee74eedcd74846f | JavaScript | hsahrij/PROMOQUBE | /js/validation.js | UTF-8 | 3,460 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | var tooltipLeft, tooltipTop;
function removeTooltip(){
$('.tipsy').remove();
}
function addTooltip(elm, msg, pos){
removeTooltip();
tooltipLeft = elm.offset().left;
tooltipTop = elm.offset().top;
$('body').append('<div class="tipsy"><div class="tipsy-arrow tipsy-arrow-s"></div><div class="tipsy-inne... | true |
cee7d4b73536bd12bfcdd44665b67252d1bbbe89 | JavaScript | michamoro/Javascript | /05Classes/classes.js | UTF-8 | 1,644 | 4 | 4 | [] | no_license | // strict mode always
class Ejemplo {
constructor(nombre, genero) {
this.nombre = nombre;
this.genero = genero;
}
}
// anonymous
let anonimus = class {
constructor(nombre, genero) {
this.nombre = nombre;
this.genero = genero;
}
}
// defined methods - Get and Set
class f... | true |
6f2c402781349cc1f954ea418f35da18a8eb5e1a | JavaScript | taibaaljanabi/assignments | /review/app.js | UTF-8 | 124 | 2.953125 | 3 | [] | no_license |
const animals = ['dog', 'cat', 'mouse']
const Newanimals = ['bird', 'elephant',...animals, 'snake']
console.log(Newanimals) | true |
ac17b6b1b8c4ac722c4cfd4cd8d1e29b730b5db9 | JavaScript | mchogo/login-mypage | /logout_confirm.js | UTF-8 | 375 | 2.625 | 3 | [] | no_license | function confirmLogout(){
if(window.confirm('ログアウトしてよろしいですか?')){ // ログアウト時確認ダイアログを表示
alert ("ログアウトしました。");
location.href="log_out.php"
} else{ // 「キャンセル」時の処理
return false; // 処理を中止
}
} | true |
622c205f0d7a50037b66c891cc2b07fb9ab550c3 | JavaScript | yuraslivka/js | /18/js/common.js | UTF-8 | 3,422 | 3.109375 | 3 | [] | no_license | window.onload = function (){
document.getElementById('result').onclick = getResult;
function getResult(){
var menu = document.getElementsByClassName('menu');
var cost = 0;
var kkal = 0;
for (var i=0; i<menu.length; i++){
if (menu[i].checked){
cost += parseFloat(menu[i].getAttribute('d... | true |
23f65137a5a44dc1d668249ce6e1642ccd72842f | JavaScript | AndrewSLentz/JS-challenges4 | /src/index.js | UTF-8 | 4,291 | 4.53125 | 5 | [] | no_license | /**
* PART 0
*
* Define a function max() that takes two numbers as arguments
* and returns the largest of them. Use the if-then-else construct available in Javascript.
*/
function max(a, b) {
if (typeof(a) === 'number' && typeof(b) === 'number') {
return Math.max(a, b);
} else if (typeof(a) === 'number' &... | true |
2a526513d9896ef3e406014680daf92aa4135879 | JavaScript | Nwafor-Onyebuchi/tracker-api | /controllers/transactions.js | UTF-8 | 4,323 | 2.671875 | 3 | [] | no_license | const Transaction = require('../models/Transactions')
const ErrorResponse = require ('../utils/errorResponse')
// @desc Create a transaction
// @route POST /api/v1/user-transactions
// @access Private
exports.createTransaction = async (req, res, next) =>{
try {
req.body.user = req.user.id
... | true |
608420a49e7334de60e051778d681de5d1a121c8 | JavaScript | LearnModernDev/Gruximillian.github.io | /08_most_frequent_array_item/script.js | UTF-8 | 1,935 | 3.5 | 4 | [] | no_license | $(document).ready(function() {
function getArray(input) {
var array = $(input).val().split(','); // Split string on comma
array = array.map(function(current, index, array) {
if (current.trim() === '') {
return current; // If item is only whitespace, then return untrimm... | true |
9db092f58a98d414ba445748d32f09bd67279adf | JavaScript | S0NN1/polinetwork.github.io | /res/js/dark_mode/javas_it.js | UTF-8 | 1,105 | 2.921875 | 3 | [] | permissive | /*
var debugInput = document.querySelector("input");
function updateDebugState() {
document.body.classList.toggle('debug-on', debugInput.checked);
}
debugInput.addEventListener("click", updateDebugState);
updateDebugState();
*/
const toggleSwitch = document.querySelector('.theme-switch input[type="che... | true |
df317728cea6683cd60aaa44cc0dbb2d967e121d | JavaScript | blancabgz/DWEC | /T3/WS3/puzzle.js | UTF-8 | 3,170 | 3.21875 | 3 | [] | no_license |
var nfilas = prompt("Introduce el numero de filas");
var ncolumnas = prompt("Introduce el numero de columnas");
var tablero = [];
var blanco = [];
var rellena=0;
class puzzle{
constructor(filas,columnas){
this.filas = filas;
this.columnas = columnas;
this.tablero = [];
this.blanco = [];
this.crearTablero... | true |
f5c30ed48bc0b79e267a8ef21dbcd1febb596815 | JavaScript | geekdmm0xff/Block-Breaker | /scene/main/block.js | UTF-8 | 563 | 2.828125 | 3 | [
"MIT"
] | permissive | var Block = function (position, game) {
log('game:', game)
var p = position
var o = game.imageByName('block')
o.x = p.x
o.y = p.y
o.alive = true
o.life = p.life || 1
o.kill = function () {
o.life--
if (o.life == 0) {
o.alive = false
}
}
o.c... | true |
96e2a8479669b1668143baf9e62f5b68fdfe1b28 | JavaScript | visualizacao-ufpe/spotifyvis | /Projeto/src/spotify_requests_artist_genre.js | UTF-8 | 2,236 | 2.71875 | 3 | [] | no_license | var request = require('request'); // "request" library
var jsonfile = require('jsonfile') // "jsonfile" library
jsonfile.spaces = 2; // setting JSON file identation
var readJsonPath = "./Projeto/json/Artists_Links.json" // setting JSON load file path
var writeJsonPath = "./Projeto/json/Artists_Links.json" // setting JS... | true |
ffb665568bf1af37ca9698f5a72ff98f9006fdc0 | JavaScript | tuesday-freya/ohm-calculator | /src/components/color-code.jsx | UTF-8 | 2,842 | 2.625 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
import bg from '../images/checkered10.png';
class ColorCode extends Component {
constructor(props){
super(props);
// Initialize the codes active state.
this.state = {
active: props.active
}
this.onClick = this.onClick... | true |
c05955926a22fb0344f823b5e1e91cdeb4b82580 | JavaScript | danipar7777/prueba_inditex | /src/reducers/products.reducer.js | UTF-8 | 1,145 | 2.546875 | 3 | [] | no_license | // Core
import { combineReducers } from 'redux';
// Contants
import { ON_PRODUCT_LIST_SUCCESS, ON_PRODUCT_DETAIL_SUCCESS, ON_PRODUCT_CART_SUCCESS } from '../constants/products.reducer.constants';
const list = (state = { data: [], expiresAt: new Date() }, { type, payload }) => {
switch (type) {
case ON_PRODUCT_LI... | true |
470fa1a948f9775e8b6a133af1a2b53892ebcbdf | JavaScript | zepheira/viewshare | /freemix/static/dataset/js/transaction.js | UTF-8 | 1,897 | 2.953125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-secret-labs-2011",
"CC-BY-2.5",
"MIT",
"Apache-2.0",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | (function($) {
var Transaction;
/**
* Represents a DataSourceTransaction
* @constructor
* @param {string} options.profileURL - The freemix/dataprofile/ URL
* @param {string} options.statusURL - The status URL for the transaction
*/
Transaction = function(options) {
this.profileURL = options.p... | true |
fdb506e6c412a3caa62e1b543df29423435c1cd5 | JavaScript | HBherer/Jeu-de-memoire | /script.js | UTF-8 | 7,678 | 2.765625 | 3 | [] | no_license | "use strict"
$(document).ready(validation());
let cartesTournees = []
let pairesTrouvees = 0
let pairesATrouvees;
let btnValidate = document.getElementById("valider")
btnValidate.addEventListener("click", validation)
/**
* Sert à faire afficher un message de fin de partie au joueur si le temps est écouler et efface... | true |
1b23f3c1bf8a30169e76fcaf6b617d940c974d67 | JavaScript | ProjectRogueOne/tpp-reference-server | /app/authorization.js | UTF-8 | 919 | 2.578125 | 3 | [
"MIT"
] | permissive | const { session } = require('./session');
const authorization = process.env.AUTHORIZATION;
/**
* @description Only return the authorization if there is a valid session
* @param sid
* @returns {*}
*/
const getAuthFromSession = (candidate, callback) => {
session.getId((err, sid) => {
if (sid === candidate) {
... | true |
29cb6fd75df59393b29f62392df814ec9245119a | JavaScript | 200202iqbal/BookshelfApp | /js/dom.js | UTF-8 | 5,006 | 3.46875 | 3 | [] | no_license | const UNCOMPLETED_LIST_BOOK_ID = "uncomplete-read";
const COMPLETED_LIST_BOOK_ID = "complete-read";
const BOOK_ID = "bookId"
function addBookList(){
const uncompletedBOOKList = document.getElementById(UNCOMPLETED_LIST_BOOK_ID);
const completedBOOKList = document.getElementById(COMPLETED_LIST_BOOK_ID);
cons... | true |
227af472fa91dce682e577e690ba0b72666fc0e0 | JavaScript | F1lus/jpskills | /sockets/users/AdminManager.js | UTF-8 | 1,575 | 2.609375 | 3 | [] | no_license | const DbConnect = require("../../model/DbConnect")
function dateFormat(rawDate) {
let date = new Date(rawDate)
month = '' + (date.getMonth() + 1)
day = '' + date.getDate()
year = date.getFullYear()
if (month.length < 2) {
month = '0' + month
}
if (day.length < 2) {
day = '... | true |
152af6648ff44908ea4f4353ee10d6e5c4eefa75 | JavaScript | vhamet/Codewars | /index.js | UTF-8 | 535 | 3.15625 | 3 | [] | no_license | import { sort, transpose } from './utils';
const sequence = '123456789';
const toOrderedString = arr => sort(arr).join('');
const lineIsSequence = line => toOrderedString(line) === sequence;
const subMatrixes = array => array.map((l, i) => l.map((n, j) => array[Math.floor(i / 3) * 3 + Math.floor(j / 3)][Math.floor(i... | true |
9cc8c6e663fab7050d0270a3051f7c569dd731bb | JavaScript | SergioZulueta/DAW | /DAW2/DWEC/Reto1/Practica1/Ejercicio18.js | UTF-8 | 136 | 2.859375 | 3 | [] | no_license | //18 Soluciuona los errores
var a, b;
a = prompt("Escribe la base:");
b = prompt("Escribe la altura:");
alert("Area= " + (a * b / 2));
| true |
c7c4f02153ec5b402204b8e0f4af3967ca0de9cb | JavaScript | irfanpra/wt2016s3 | /MoreThanConsumers/spirala3/validacija.js | UTF-8 | 2,159 | 3.515625 | 4 | [] | no_license | /* provjerava da li u imenu ima brojeva, nije mi palo ništa drugo na pamet */
function regex(name)
{
var pattern = /[^0-9]/;
return pattern.test(name);
}
function validateName()
{
var name = document.forms["formica"]["firstName"].value;
if(regex(name)==false)
{
document.forms["... | true |
fbfd74707380dff0071fbd5190cd3364f4e88b54 | JavaScript | RyanChoukri/Music-WebApp-React | /server/controllers/authentication.js | UTF-8 | 2,047 | 2.59375 | 3 | [] | no_license | const jwt = require('jsonwebtoken'),
crypto = require('crypto'),
User = require('../models/user'),
config = require('../config/main');
function generateToken(user) {
return jwt.sign(user, config.secret, {
expiresIn: 10080 // in seconds
});
}
function setUserInfo(request) {
return {
_id... | true |
28948f67e9f5294e861c25d127057bcd050718a7 | JavaScript | Nima155/FSO-Part10 | /src/utils/helpers.js | UTF-8 | 91 | 2.75 | 3 | [] | no_license | export const thousander = (e) => {
return +e > 1000 ? (+e / 1e3).toFixed(1) + "K" : e;
};
| true |
99fc5f46125f0b955e2bf08366308786a1fe8dc5 | JavaScript | YiTaChen/node-practice | /learning_code/01/02-load_file.js | UTF-8 | 1,701 | 3.828125 | 4 | [] | no_license |
/* 讀取文件
瀏覽器中的JavaScript 是沒有文件操作的能力
but Node 中的JavaScript 具有文件操作的能力
fs 是 file-system 的縮寫,文件系統的意思
如果想要在Node 中進行文件相關的功能操作,就必須引入fs 這個核心模塊
在fs 這個核心模塊中,提供了所有的文件操作相關的API
例如: fs.readFile 就是用來讀取文件的
*/
// 1. 首先使用 require 方法加載 fs 核心模塊
var fs = require('fs')
// 2. 讀取文件
// 第一個參數為文件路徑
// 第二個參數是一個回調函數
/*
成功
data 數據
... | true |
33c92e3739ea0766ddb62be751db0e391e6889a4 | JavaScript | future4code/Thomas-Arantes | /Semana 7/labenusers/src/components/FormPage/FormPage.js | UTF-8 | 2,175 | 2.640625 | 3 | [] | no_license | import React from 'react' ;
import axios from 'axios';
import styled from "styled-components";
const FormPageContainer = styled.div`
display: flex;
justify-content: center;
margin-top: 10px;
margin-bottom: 10px;
`
const InputContainer = styled.div`
display: flex;
width: 650px;
heigh... | true |
0221d173996a3c517436b50016e36464f761035c | JavaScript | TimAConner/NSS-Single-Page-Applications-Sandwich-Maker | /js/sandwichView.js | UTF-8 | 1,006 | 3.28125 | 3 | [] | no_license | "use strict";
module.exports.createDropDown = (ingredientsArray) => {
let output = document.getElementById("ingredients");
for(let prop in ingredientsArray){
let ingredients = ingredientsArray[prop].getTypes();
let labelDOM = document.createElement("label");
let labelText = docume... | true |
52c6db77b5c5c992256f02ecc8f5f23f37e28df6 | JavaScript | runjak/simpleChess | /src/utils/field.js | UTF-8 | 1,596 | 2.875 | 3 | [
"MIT"
] | permissive | // @flow
import type { Figure } from './figures';
import type { Color } from './colors';
export type Column = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h';
export type FieldIndex = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
export type Row = FieldIndex;
export type Position = {
column: Column,
row: Row,
};
export type Fields... | true |
83f98f33baa67d743d67be3697567bb209736202 | JavaScript | smilga/analyzer | /web/store/websites.js | UTF-8 | 1,617 | 2.578125 | 3 | [] | no_license | import Website from '@/models/Website';
export const state = () => ({
list: [],
total: 0,
queued: 0,
timeouted: 0
});
export const actions = {
fetch(ctx, { filters = null, pagination }) {
const q = `?f=${filters}&p=${pagination.page}&l=${pagination.limit}&q=${pagination.search}`;
r... | true |
0b61730cd2b520c74ec15cf042a0e2985c9575f7 | JavaScript | QUT-Motorsport/QUTMS_ComponentStore | /component/table.js | UTF-8 | 2,099 | 2.578125 | 3 | [] | no_license | /** The Table component is used to display the components (result of the search as well as in the check out) */
import React from 'react';
import Typography from '@material-ui/core/Typography';
import Cookies from 'universal-cookie';
import Popup from './component_popup'
const { v1: uuidv1 } = require('uuid');
export... | true |
6ae34316ab4c4875c6d98d669e53afe34a2db3eb | JavaScript | quantum93/Week2Thursday | /Desktop/Week2Tursday/animalWiki/js/scripts.js | UTF-8 | 516 | 2.921875 | 3 | [] | no_license | $(document).ready(function() {
$("#formOne").submit(function(event) {
var pet = $("input#yourpet").val();
if (pet === "cat") {
$('.cat').toggle();
$('.dog').hide();
$('.bird').hide();
} else if (pet === "dog") {
$('.dog').toggle();
$('.cat').hide();
$('.bird').hide();
... | true |
92fdb48848e6d93ebe3438dec636acc2e19c492d | JavaScript | littlegustv/oldsite | /games/space/scenes/mainmenu.js | UTF-8 | 10,205 | 2.65625 | 3 | [] | no_license | // name: 'salvage'
var player;
var other;
var debug;
var onscreen; // hacky! this will be a function shortly!
function notFriendly (callback) {
return function (object, other) {
if (other.family == object.family) return false;
else if (!other.family || !object.family) return false;
return callback.call(this,... | true |
86eecc75e7c03f26b9c3e8c526af57d45c0fd9fb | JavaScript | 1Fungi99/BootCamp | /10.3-The Power of Packages/20-CommandSort/Unsolved/commandSortUnsolved.js | UTF-8 | 757 | 3.921875 | 4 | [] | no_license | // Quick warm-up activity
// Create an application that takes in a series of numbers then sorts them.
// Feel encouraged to use Stack or Google to find the "sort" code.
// ===========================================================================================
num1=parseFloat(process.argv[2]);
num2=parseFloat(proces... | true |
e4ab09818a181aa6eff0c0df67fb70bc75a97f47 | JavaScript | dramaTangent/MoonLight | /scripts/charts.js | UTF-8 | 574 | 3.140625 | 3 | [] | no_license | function Charts(className,index){
this.className=className;
this.chartIndex=index;
this.chartObjects=document.getElementsByClassName(this.className)[this.chartIndex];
this.valueChart=childNodesToArray(this.chartObjects.childNodes);
this.setChartValue=function(){
for(var i=0;i<this.valueChart... | true |
a596b992c03bac7cad749747b23ee81164e8bda9 | JavaScript | kamenyanakiev/SoftUni-Programming-Basics | /08-If-Else-Exercises/03-SpeedInfo.js | UTF-8 | 783 | 3.65625 | 4 | [] | no_license | function speedInfo(input) {
let speed = input[0];
if (speed <= 10){
console.log('slow');
} else if (speed > 10 && speed <= 50){
console.log('average');
} else if (speed > 50 && speed <= 150){
console.log('fast');
} else if (speed > 150 && speed <= 1000){
console.log('ultra fast');
} else{
... | true |
1441c59eb6255d31d562f16c6b8507563fc4bd13 | JavaScript | RevanthNagarajan/ShortURL | /Web/src/Models/createForm.js | UTF-8 | 986 | 3.265625 | 3 | [
"MIT"
] | permissive | export class URL {
constructor (title,description,url) {
this.title = title ? title : "";
this.description = description ? description : "";
this.url = url ? url : "";
this.titleValidation = "";
this.urlValidation = "";
}
validate() {
if(this.title.length) {
... | true |
b4333835edd8bdcf56e211452ecd9d910a38cea5 | JavaScript | karenpeng/leetCode | /linked_list/convert_sorted_list_to_binary_tree.js | UTF-8 | 1,034 | 3.71875 | 4 | [] | no_license | /**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {ListNode} head
* @return {TreeNode}
... | true |
bcd5a685c637b3c978debda7fd2d2e7a959384e1 | JavaScript | zoeyikemoto/rpt06-data-structures-Debalina-Zoey | /sprint-two/spec/binarySearchTreeSpec.js | UTF-8 | 2,717 | 3.65625 | 4 | [] | no_license | describe('binarySearchTree', function() {
var binarySearchTree;
beforeEach(function() {
binarySearchTree = BinarySearchTree(5);
});
it('should have methods named "insert", "contains", and "depthFirstLog', function() {
expect(binarySearchTree.insert).to.be.a('function');
expect(binarySearchTree.con... | true |
22e17be033cc1575b20b742f67cf52bd1f43d8ef | JavaScript | benjaminpettus/core-algorithms | /src/isPalindrome.js | UTF-8 | 401 | 3.09375 | 3 | [
"MIT"
] | permissive | export default function isPalindrome(string){
if(typeof string != 'string' ){
return 'input not a string'
}
const noSpecialChar = string.replace(/[.,\/#!$%\^&\*;:{}=\-_`~()]/g,"").toLowerCase()
const noSpaces = noSpecialChar.replace(/\s/g, '')
const splitter = noSpaces.split('')
const reverse = splitter... | true |
e7f26a535336f223fabb313aed86b8c149f5f8cb | JavaScript | eirikt/default-webapp-heroku | /client/scripts/connection-count.jsx | UTF-8 | 1,723 | 2.5625 | 3 | [
"MIT"
] | permissive | /* global window, console, setTimeout */
/* eslint-disable no-console */
/* eslint-disable no-extra-parens */
/* eslint complexity: [1, 1] */
/* eslint newline-after-var: 1 */
import React from 'react';
export default React.createClass({
render: function() {
console.log('React :: ConnectionCount compone... | true |
45832a47995c6778c0d9d3545520fa120a81a215 | JavaScript | ronmaple/code-dump | /nodeserver/asyncIO.js | UTF-8 | 389 | 3.21875 | 3 | [] | no_license | /*
Read files given as argument on terminal, and return # of new lines
asynchronously
*/
const fs = require('fs');
let filePath = process.argv[2];
let bufferObj = fs.readFile(filePath, (err, data) => {
if (err) throw err;
else {
let bufferStr = data.toString();
let bufferStrSplit = bufferStr... | true |
fe1586826ceb810639f49e470a5c4bbcef187885 | JavaScript | h2atecnologia/paroflow | /dist/chart.js | UTF-8 | 18,598 | 2.5625 | 3 | [
"MIT"
] | permissive | import { drag } from 'd3-drag'
import { path } from 'd3-path'
import { event, select } from 'd3-selection'
const getTextLength = text => {
let len = 0
let i = 0
while (i < text.length) {
if (text.charCodeAt(i) > 127 || text.charCodeAt(i) === 94) {
len += 2
} else {
len++
}
i++
}
re... | true |
abdd094c7fd049a35c090d28d1ac24bb776134df | JavaScript | skeskinen/js-shooter | /modules/shooter/utils.js | UTF-8 | 4,261 | 3.1875 | 3 | [] | no_license | /*
* Lots of stuff that does't fit naturally into other modules.
* For example server time handling and small helper functions.
*/
define(["dojo/_base/array"], function(arrayUtil){
var time_offset = 0;
var time_results = [];
/*
* Calculates standard deviation of all latency samples taken.
* U... | true |
31b4b3e8002fa3d90b4d4c35c326e05071c90a40 | JavaScript | ernestocmou/Ethereum_blogchain | /app/javascript/components/TokenShow.js | UTF-8 | 3,073 | 2.515625 | 3 | [] | no_license | import React from 'react';
import { Link } from 'react-router';
import CommentsContainer from '../containers/CommentsContainer'
import CommentForm from '../containers/CommentForm'
class TokenShow extends React.Component {
constructor(props){
super(props)
this.state = {
tokenInfo: {},
comments: []... | true |
88316ab8aa53098fd5d40e9fbe81911a996760c7 | JavaScript | arangodb/arangodb | /3rdParty/V8/v7.9.317/test/intl/date-format/related-year.js | UTF-8 | 599 | 2.53125 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"BSL-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcre",
"Bison-exception-2.2",
"LicenseRef-scancode... | permissive | // Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-intl-other-calendars
// Test it will output relatedYear and yearName
let df = new Intl.DateTimeFormat("zh-u-ca-chinese", {year: "nu... | true |
e9baad342b8713abc7fa75f84ae5e1cfd162d800 | JavaScript | bondiano/memebattle_frontend | /src/components/controls/RadioComponent.js | UTF-8 | 1,446 | 2.765625 | 3 | [] | no_license | import React, {Component} from 'react';
import PropTypes from 'prop-types';
class RadioComponent extends Component {
constructor(props) {
super(props);
this.state = {
value: props.value
};
}
/**
* Sets the value of the switch to the state on click
*
* @p... | true |
94caf76c1802164965f593b8234422aa696b31ba | JavaScript | sathyapriyaa-sketch/Hacktoberfest-Repo-Checker | /public/js/input.js | UTF-8 | 1,032 | 2.734375 | 3 | [] | no_license | const customInput = document.querySelector(".custom-search-input");
const lastSearched = document.querySelector(".last-searched");
const listItem = document.querySelectorAll(".list-group-item");
const listGroup = document.querySelector(".list-group");
customInput.addEventListener("focusin", () => {
lastSearched.style... | true |
725f9ce5bb72a508febf53132b28c980fc8dc08e | JavaScript | wesdu/Gin | /script.js | UTF-8 | 2,906 | 2.515625 | 3 | [] | no_license | var path= require("fs");
var fs= require("fs");
var path= require("path");
var mime= require("./util/fu.js").mime;
var ruleHash= [];
var hostHash= [];
function addRule(ruleData) {
removeRule(ruleData);
ruleHash.push(ruleData);
}
function removeRule(ruleData) {
for(var i=0;i<ruleHash.length;i++) {
if(ruleHash[i].... | true |
649a774e7859dccf7ef9aeac1acac587a1d82b06 | JavaScript | alexcaulfield/essentials-frontend | /app.js | UTF-8 | 2,985 | 2.75 | 3 | [] | no_license | var spotifyApi;
function getAuth() {
$.get("http://localhost:5000/", function(data) {
authorization_window = window.open(
data,
'_blank'
);
});
}
function createPlaylist() {
var artistName = document.getElementById('artist').value;
var playlistName = document.getElem... | true |
858e4353607dc8a71bdf569c00011be2b2b43d0a | JavaScript | SlobodanStojkovic/login-form | /src/Components/Login/Login.jsx | UTF-8 | 1,674 | 2.984375 | 3 | [] | no_license | import { useState } from "react";
import "./Login.css";
export const Login = () => {
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
const [warning, setWarning] = useState("");
const hasNumber = (myString) => {
return /\d/.test(myString);
}
... | true |
1de7e5027288a00cabaeaa47d6b290103d06c849 | JavaScript | eliseevaa/web-app-coursework | /inm316/exercises/week-4/week-4-exercise-1.js | UTF-8 | 274 | 3.34375 | 3 | [] | no_license | function enthuse(card) {
return "I like the card " + card;
}
var mercurySentence = enthuse("Mercury");
console.log(mercurySentence);
var earthSentence = enthuse("Earth");
console.log(earthSentence);
var saturnSentence = enthuse("Saturn");
console.log(saturnSentence); | true |
4ce82646e1752d94dc7b5ee472473d47d1a247e5 | JavaScript | alvemollah/country-league | /src/Component/Home/Home.js | UTF-8 | 607 | 2.609375 | 3 | [] | no_license | import React, { useEffect } from 'react';
import { useState } from 'react';
import CountryDetail from '../CountryDetail/CountryDetail';
const Home = () => {
const [country, setCountry] = useState([]);
useEffect(() => {
const url = "https://restcountries.eu/rest/v2/all";
fetch(url)
.th... | true |
dcace27452047af4d7a19d1c47fd407fc4d81dd6 | JavaScript | Paparoni/LustBot | /main.js | UTF-8 | 3,360 | 2.75 | 3 | [] | no_license | const Discord = require("discord.js");
const Lust = new Discord.Client({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });
const PREFIX = '+';
const editJsonFile = require("edit-json-file");
Lust.login('')
Lust.on('ready', () => {
Lust.user.setActivity('・𝐿𝑢𝑠𝑡・', { type: 'WATCHING' })
.then(prese... | true |
8b3e85ea3bada438a111afd273bf018e77656caf | JavaScript | morozd/floor13 | /src/engine/ticker.js | UTF-8 | 694 | 2.75 | 3 | [
"MIT"
] | permissive | function Ticker() {
// Private variables
var requestID = 0;
// Methods variables
var time, update;
__mixin(this, {
/**
* Start the game loop.
*
* @param {Function} callback
*/
r: function run(callback) {
// Stop previous tick
requestID && this.s();
time = +new... | true |
d49bf7fce9086668435b4a26c8d2bf2890ba7fb1 | JavaScript | AndyRace/scoreboard | /src/ScoreboardWebServer/ScoreboardWebServer/web/microcontroller.js | UTF-8 | 4,880 | 2.625 | 3 | [
"MIT"
] | permissive | const cRestfulServiceURL = "/api/";
// POST
const cTestApiUri = cRestfulServiceURL + "test";
// POST, {text: <text to display>}
const cTextApiUri = cRestfulServiceURL + "text";
// GET/PUT, {key: <score group>, value: <score>}
const cValueApiUri = cRestfulServiceURL + "value";
function api(fnUri) {
var self = t... | true |
6bddf731e7c83d2c268fd293c8e147884f424181 | JavaScript | PacktPublishing/Learn-Python-Programming-Second-Edition | /Chapter03/ch3/switch.js | UTF-8 | 317 | 3 | 3 | [
"MIT"
] | permissive | switch (day_number) {
case 1:
case 2:
case 3:
case 4:
case 5:
day = "Weekday";
break;
case 6:
day = "Saturday";
break;
case 0:
day = "Sunday";
break;
default:
day = "";
alert(day_number + ' is not a valid day number.')
}
| true |
44ee33ed7d67af14a519e56f0e3d1b45979f1157 | JavaScript | AGjozev/To-Do-Application | /scripts/models/project.js | UTF-8 | 868 | 2.59375 | 3 | [] | no_license | /**
* Created by AGjozev on 5/24/2016.
*/
/* creating new project */
function Folder(folderName) {
var me = {};
var id = 'todoapp'+JSON.stringify((new Date()).getTime());
console.log(id);
var name = folderName;
var position = localStorage.length + 1;
me.todos = [];
me.getId = function ... | true |