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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8f5e839c00159f6d2b50de2b4357e1cee29da9ed | JavaScript | cingzion/MernKit | /nodekit/useA.js | UTF-8 | 1,705 | 3.546875 | 4 | [] | no_license | let r = require('./a');
console.log(r);
// commonjs 原理, require 时同步的,不是一异步的
/*
let r = (function() {
module.exports = 'hello';
return module.exports;
})(module, exports, require, __dirname, __filename);
*/
// commonjs 规范:三种模块
// 这种方式叫:自定义模块、文件模块 / 第三方模块 / 内置模块和核心模块
// 使用内置模块
/**
*... | true |
8358d4a41c7d0746616a8fa64c985c51cc0c86e3 | JavaScript | edmondtam1/javascript-small-problems | /js_dom_and_async/lessons/combined_approach/guess_word/javascripts/game.js | UTF-8 | 3,007 | 2.96875 | 3 | [] | no_license | var $message = $("#message"),
$tree = $("#tree"),
$letters = $("#spaces"),
$guesses = $("#guesses"),
$replay = $("#replay"),
$apples = $("#apples"),
$body = $("body"),
game;
var randomWord = function() {
var words = ["abacus", "quotient", "octothorpe", "proselytize", "stipend"];
return function() {
... | true |
929c95e42934ac595e27d937ae509975c2a980e2 | JavaScript | sandeephexa/ModalCssJS | /main.js | UTF-8 | 589 | 3.0625 | 3 | [] | no_license | // get elements
var modal = document.getElementById('simpleModal');
var modalBtn = document.getElementById('btnModal');
var closeBtn = document.getElementsByClassName('closeBtn')[0];
// add event listener
modalBtn.addEventListener('click',openModal);
closeBtn.addEventListener('click',closeModal);
// listen outside c... | true |
5e81d1dfa84aa8f58a8139219f1ebaaa285d65f7 | JavaScript | johns-hub/node-sample | /01.node/02.module.js | UTF-8 | 651 | 3.75 | 4 | [] | no_license | /*
模块化
- 在Node中,一个js文件就是一个模块
- 在Node中,每一个js文件中js代码都是独立运行在一个函数中
而不是全局作用域,所以一个模块的中的变量和函数在其他模块中无法访问
*/
console.log("我是一个模块,我是02.module.js");
var x = 10;
var y = 20;
/*
我们可以通过 exports 来向外部暴露变量和方法
只需要将需要暴露给外部的变量和方法设置为exports的属性即可
*/
// 向外部暴露属性和方法
exports.x = "我是02.module.js中的x";... | true |
fa0af7911855f0b9f193c96f89d22cb4a1714a88 | JavaScript | YongamaFayo/first_terminal_test | /allFromTown.js | UTF-8 | 314 | 2.765625 | 3 | [] | no_license | module.exports = function (regs, townString) {
var list = regs.split(",")
var results = []
for (var i = 0; i < list.length; i++) {
var trimmed = list[i].trim();
if (trimmed.startsWith(townString)) {
results.push(trimmed)
}
}
return results.length
}
| true |
c7950bdbfe1d70dff50bd6503868f099644599fc | JavaScript | tssoft/abstract-calendar | /abstract-calendar.js | UTF-8 | 3,427 | 3.21875 | 3 | [
"MIT"
] | permissive | /**
* AbstractCalendarJS
*
* @license MIT
* @author TS Soft
* @version 1.0
*/
(function (factory) {
"use strict";
// Module definition
if (typeof define === 'function' && define.amd) {
define([], factory); // AMD
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(); /... | true |
4d23a3d89c405a7fe7bc0add258a1a2a06b8ff37 | JavaScript | jbbanabale/MERN_Stack_MCIT_Batch_2021 | /Testing/JEST/React with JEST Testing/react-with-rest-testing/src/App.test.js | UTF-8 | 1,717 | 2.6875 | 3 | [] | no_license | import App from './App';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import Enzyme, { shallow } from 'enzyme';
Enzyme.configure({adapter:new Adapter()})
describe("React Testing",()=> {
it("Simple Test Render Message Testing",()=> {
let obj = shallow(<App/>); // load the App module in Enzyme ... | true |
74b3ef9781a3f788cc192969d8da7a6dcbcb5e6a | JavaScript | akriot/tiktok_live_stats | /index.js | UTF-8 | 1,930 | 2.90625 | 3 | [] | no_license | // ########################
// Tracker options
// ########################
const trackVideo = false;
const trackProfile = true;
const profileName = '@Adsnipers';
const videoID = '6892220263971179777'
const tiktok = require('tiktok-app-api');
const chalk = require('chalk');
let tiktokApp;
async function waitForTiktok... | true |
f34559996a5dce9e62187db74b7a11c94b4199a3 | JavaScript | vaseto27/DiceGame-Homework | /service.js | UTF-8 | 1,875 | 3.40625 | 3 | [] | no_license | var game = (function(){
// Player.nextId = 0;
// function Player(){
// this.id = ++Player.nextId;
// this.score = 0;
// this.currentScore = 0;
// }
function Game(player){
this.players = [];
this.winner = '';
var player1 = {
id : 1,
... | true |
616c03de697f54fc3ec7ba7bc8750d7ec1f6fd35 | JavaScript | guaracyalima/jasmine-fundamentals | /spec/andcallThroughSpec.js | UTF-8 | 620 | 3 | 3 | [
"MIT"
] | permissive | describe('andcallThroughSpec', () => {
let Calculadora = {
somar: (a, b) => { return a+b },
dividir: (x, y) => { return x/y }
}
beforeEach(() => {
spyOn(Calculadora, "somar").and.callThrough();
spyOn(Calculadora, "dividir")
})
it('deve somar dois numeros', () => {
expect(Calculadora.som... | true |
f1d29b61dc3eb67e2bb900c5ae7d894956da7179 | JavaScript | markrdecello/JavaScript-Review-Notes | /Javascript/ExerciseProblems/binarySearch.js | UTF-8 | 923 | 4.21875 | 4 | [] | no_license | const binarySearch = (arr, x) => {
let low = 0;
let high = arr.length - 1;
while (low <= high) {
let mid = Math.floor((low + high) / 2);
/**
* Check if x is equal to arr[mid]
* if true, then number is found
*/
if (arr[mid] == x) {
... | true |
40f8a124c30211752624e793ed0e6e003ac4fe62 | JavaScript | kodebuff/udemy-webdev-bootcamp | /S11/S11-L130-array-pset/array-pset.js | UTF-8 | 1,267 | 4.40625 | 4 | [] | no_license | // 1. printReverse()
function printReverse(arrs) {
for (var i = arrs.length - 1; i >= 0; i--) {
console.log(arrs[i]);
}
}
// 2. isUniform()
// //VERSION 1
// function isUniform(arrs) {
// //store first array to a variable
// var compareElement = arrs[0];
// for (var i = 1; i < arrs.length; i++) {
/... | true |
ffe3390deaa8dc5dc400ee149c8ba0efa5bbd7ac | JavaScript | eakrum/datadog-exercise | /apps/example-api/index.js | UTF-8 | 5,534 | 2.625 | 3 | [] | no_license | const tracer = require('dd-trace').init();
const { Client } = require('pg');
const Express = require('express');
const cors = require('cors')
/**
* @let result @type {Array}
* @summary get the data from DB and shows it
*/
let result = [];
/**
* @constructor client
* @type {Client}
* @summary make and object t... | true |
b914b8f5ab09082ae18d16161e94579b4d4e3074 | JavaScript | peondg/solitaire-games | /src/shared/deckObject.js | UTF-8 | 1,581 | 3.8125 | 4 | [] | no_license | import cardObject from "./cardObject";
// Suits
const suits = ["spades", "clubs", "hearts", "diamonds"];
// Ranks
const ranks = [
"ace",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"ten",
"jack",
"queen",
"king",
];
// shuffleDeck function
export const shuffleDeck = (de... | true |
1634751ea25677854487aff5cce3c4c2e8033c1c | JavaScript | sgyles/p5js-template | /sketch.js | UTF-8 | 3,589 | 3.140625 | 3 | [] | no_license | var lincoln;
function preload(){
lincoln = loadImage("AbrahamLincoln.jpg");
}
function setup(){
createCanvas(lincoln.width, lincoln.height);
}
function draw() {
background(0);
image(lincoln, 0, 0);
loadPixels();
for (var row = 0; row < height; row++){
for (var col = 0; col < width; col++){
var startingInd... | true |
454e1d13f1b2d12a8f1b46b11cec5f53978369f4 | JavaScript | Moziz123/DepressionApp | /public/js/script.js | UTF-8 | 3,407 | 2.609375 | 3 | [
"MIT"
] | permissive |
$(function(){
$("#username_error").hide();
$("#password_error").hide();
$("#password_confirmation_error").hide();
var error_username = false;
var error_password = false;
var error_password_confirmation = false;
$("#username").focusout(function(){
check_username();
});
$("#pass... | true |
8c75911e3230ef9a09cf6328457249ae9e93a879 | JavaScript | efeng0414/Nobul-Edward | /src/assets/ext/pdf_viewer/lib/html5/external/touchr.js | UTF-8 | 16,646 | 2.671875 | 3 | [
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | (function(window) {
var IE_10 = !!window.navigator.msPointerEnabled,
// Check below can mark as IE11+ also other browsers which implements pointer events in future
// that is not issue, because touch capability is tested in IF statement bellow.
IE_11_PLUS = !!window.navigator.pointerEnabled;
// Only poi... | true |
f983968fb86476ed8ecc0af789b496ff2cddf6c0 | JavaScript | hibenca/Tip-Calculator | /app.js | UTF-8 | 625 | 3.46875 | 3 | [] | no_license |
function calculator() {
let billAmount = document.getElementById('billAmount').value;
let people = document.getElementById('people').value;
if (billAmount <= 0) {
alert("Please fill out the amount");
} else {
document.getElementById('results1').innerHTML = ('$' + (billAmount * .1 / p... | true |
61b30b44d2528a083e7547cf480d59db95f30718 | JavaScript | mechaphysis/threejs-sketches | /src/main.js | UTF-8 | 3,632 | 3.4375 | 3 | [] | no_license | /**
* Required objects when working in 3D: scene, camera, renderer
*/
function init() {
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(
45, //field of view
window.innerWidth / window.innerHeight, // aspect ratio
1, // near clipping plane (nothing is visible beyond)
1000 ... | true |
57b0e3e9578b6418f65144b650be463380c46112 | JavaScript | dannygallant/InteractiveFizzBuzz | /js/app.js | UTF-8 | 1,248 | 3.734375 | 4 | [] | no_license | $(document).ready(function(){
var maxValue = prompt('Enter a number between 20 and 1000 for the upper limit of FizzBuzz');
testInput(maxValue);
console.log(maxValue); // Used for testing, but left active. Not necessary.
function testInput() {
maxValue = +maxValue; // Convert user entry into a number.
if (Number... | true |
93b168223bcb6115d8c8e9772e4337848cd2a66f | JavaScript | Wanderniesing/WincAcademy | /week2/Dag3/Dag3/arrowfunction.js | UTF-8 | 530 | 4.0625 | 4 | [] | no_license | // functie naar arrow functie
// A
const ikRockArrowFunctions = function () {
console.log("Joe, ik rock de arrow funtions!");
};
let ikRockArrowFunctions = () => ("Joe, ik rock de arrow funtions!")
// B
const fivePlusSeven = function () {
return 5 + 7
};
let fivePlusSeven = () => (5 + 7);
// ... | true |
0818ba0d28ad4ab6c7863df374f12845538f9b09 | JavaScript | A-Marzouk/resume-manager | /resources/assets/js/admin.js | UTF-8 | 11,745 | 2.515625 | 3 | [
"MIT"
] | permissive |
// submit form to delete multiple users / clients / conversations
let toBeDeletedUsers = [] ;
let toBeDeletedClients = [] ;
let toBeDeletedConversations = [] ;
let toBeDeletedBookings = [] ;
let toBeDeletedOwners = [] ;
let toBeDeletedJobs = [] ;
let toBeDeletedData = {} ;
$('[id*="selectedUser"],[id*="selectedClien... | true |
d9c74ecae0284ac120ae189d9faf1ced5a07c0bd | JavaScript | thienvoj/hackerrank | /bit-manipulation/maximizing-xor.js | UTF-8 | 221 | 3.390625 | 3 | [] | no_license | // https://www.hackerrank.com/challenges/maximizing-xor
function maxXor(l, r) {
let max = 0;
for (let i = l; i <= r; i++)
for (let j = i; j <= r; j++)
max = Math.max(max, i ^ j);
return max;
} | true |
6e1971d9d8a04b5b7402f7f481b11a145b0daf5a | JavaScript | Gilisinai/userPage-API-Project-Student | /main.js | UTF-8 | 597 | 2.6875 | 3 | [] | no_license | // Create instances of your classes
// Create the loadData and renderData functions - these should use the relevant instance
let user = new APIManager
let renderer = new Renderer
$("#load").click(function () {
user.loadPageData()
})
$("#display").click(function () {
renderer.render(user.data)
})
$("#save").... | true |
8307a59cfdb47d0a3fb63d705c24fd47cf84087c | JavaScript | OxCom/constraint-validator | /src/Constraints/Bic.js | UTF-8 | 3,605 | 2.734375 | 3 | [
"MIT"
] | permissive | import AbstractConstraint from './AbstractConstraint';
import {isString, trim} from '../Utils/functions';
import list from '../Resources/countries';
const MESSAGE_INVALID = 'This is not a valid Business Identifier Code (BIC).';
const MESSAGE_WITH_IBAN = 'This Business Identifier Code (BIC) is not ass... | true |
fca8cde8b0ed325fff5ce7abd5b0e310a91e93b3 | JavaScript | web-explorer/jingdong-app-hybrid | /src/store.js | UTF-8 | 2,138 | 2.75 | 3 | [] | no_license | import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
/*
* vuex作用:
* 1、vuex就是在vue中创建全局变量的一个东西。
* 2、并且我们可以通过一些方法,来改变这些全局变量的值。
* */
/*
* Store:
* 就是new Vuex.Store({})里面的对象,用到的vuex所有核心概念都是在store里面的。
* 在vue的组件中,我们可以直接通过this.$store = Store对象。
* this.$store.state = "state: {}",
*
* State:
* vuex中的数据源,所有通过vuex声... | true |
21d36859f281972366377c1f4ceda15441fcd539 | JavaScript | heinlinaung/freeCodeCamp-algorithm-tutorials | /basic-algorithm-scripting.js | UTF-8 | 4,226 | 3.828125 | 4 | [] | no_license | // Factorialize the number
function factorialize(num) {
var result=1;
if (num === 0 || num === 1)
return 1;
while (1 < num) {
result = result * num;
num--;
}
return result;
}
factorialize(5);
// --- BEST ---
function factorial(n) {
if (n === 0) {
return 1;
}
// This is it! Recursion!!
... | true |
23faf6ea5850e36772500c4498147ff223492b0c | JavaScript | WithoutATowel/GoogleDO | /main.js | UTF-8 | 4,766 | 2.515625 | 3 | [
"MIT"
] | permissive | var tasks = {};
var taskDue = "";
var ldap = "brettspencer";
var requestURL = "https://script.google.com/macros/s/djihwerd98ejdeijded/exec?ldap="
var fakeTasks = {
"1410709882" : {
"task_name" : "Eat pizza",
"due" : "today"
},
"1410913315" : {
"task_name" : "Take out trash",
"due" : "today"
},
"1410509882"... | true |
0a34dd7a0191a7e1ed32f83bc098b20ca9bb1065 | JavaScript | damien-hl/jotto | /server/test/app.test.js | UTF-8 | 668 | 2.546875 | 3 | [] | no_license | const request = require("supertest");
const createApp = require("../app.js");
let fastify;
describe("Test server", () => {
beforeEach(async () => {
fastify = createApp();
await fastify.ready();
global.agent = request.agent(fastify.server);
});
afterEach(async () => {
await fastify.close();
})... | true |
ad924a89c3003cbf17dd84b984416e1b060479a2 | JavaScript | carloscorti/FDT-dashboard | /lib/client/utils/dataTableAdapter.js | UTF-8 | 534 | 3.046875 | 3 | [] | no_license | /**
* Function dataTableAdapter: adapts data format to correct format required to use in Table component
*
* @param {Array} data Json object containing data to display
*
* @returns {Array} json object with data correctly formated
*/
const dataTableAdapter = (data) => {
return data.map((element) => {
const... | true |
0b417ab4869d96ea8a17f4e9c05732f4a2a689b3 | JavaScript | meatbags/valentines-day | /src/ui/alert.js | UTF-8 | 1,131 | 2.9375 | 3 | [] | no_license | /** Alert */
import CreateElement from '../util/create_element';
class Alert {
constructor(params) {
this.msg = params.msg;
this.x = params.position.x;
this.y = params.position.y;
this.keepAlive = params.keepAlive === undefined ? false : params.keepAlive;
this.render();
}
remove() {
thi... | true |
09efea38f12038ff7dc627f323b5883e2d1e528e | JavaScript | psalmody/databridge | /bin/missing-keys.js | UTF-8 | 671 | 3.59375 | 4 | [
"MIT"
] | permissive | /**
* Checks object for missing keys and returns
* any that are missing or false if no keys missing
*/
module.exports = function missingKeys(obj, arr) {
//if not an object - return
if (typeof(obj) !== 'object') throw new Error('missing-keys: First parameter must be an object.');
//array required
if (typeof(a... | true |
45100816ee565982a7d121c17265ed4c6950f924 | JavaScript | lourencovitor/api_appSenac | /src/controllers/UserCodeController.js | UTF-8 | 1,665 | 2.53125 | 3 | [] | no_license | const User = require('../models/User');
const UpdatePass = require('../models/UpdatePassword');
const md5 = require('crypto-md5');
module.exports = {
async store(req, res){
const {email, password, code} = req.body;
try{
const validateEmail = await User.findOne({
... | true |
84b481d1a0279978e4564fa05995a63b22eebba4 | JavaScript | amarp86/enterprise-wc | /app/ids-tag/example.js | UTF-8 | 185 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | // Add an event listener to test clickable links
const tag = document.querySelector('#ids-clickable-tag');
tag?.addEventListener('click', (e) => {
console.info('Click Fired', e);
});
| true |
6f6df24eb769fcbe1532fefac1a613938356a340 | JavaScript | emiljohansson/clock-in-out | /lib/report.js | UTF-8 | 2,888 | 2.640625 | 3 | [
"MIT"
] | permissive | 'use strict';
const fs = require('fs');
const loadJsonFile = require('load-json-file');
const Promise = require('pinkie-promise');
const createFilePath = require('./create-file-path');
const validTimes = require('./valid-times');
const today = require('./todays-date');
const basePath = require('./week-path');
functio... | true |
56350d2d0f78d311a7b0302457c18006c3dc1597 | JavaScript | benberryallwood-bjss/js-bootcamp-2021 | /session-13/challenges/findLowestIndex/findLowestIndex.js | UTF-8 | 117 | 2.90625 | 3 | [] | no_license | const findLowestIndex = (arr) => arr.indexOf(Math.min(...arr));
console.log(findLowestIndex([99, 98, 97, 96, 98]));
| true |
66d730e3b5700d31adfe1022a0817fd2fcf57e4e | JavaScript | darioaplicano/rslp | /codigo/rslp_backend/rslp-REST/controllers/contenido.controller.js | UTF-8 | 4,161 | 2.953125 | 3 | [] | no_license | const Contenido = require('../models/contenido.model.js');
//CRUD:
//Create:
// Create and write a new content to the database
exports.create = (req, res) => {
// Validate request
if(!req.body.titule) {
return res.status(400).send({
message: "El campo del título está vacío."
});
... | true |
c9b8ec56a72dfb5408280cfa02681dca37334984 | JavaScript | matneyka/hw5-backend | /src/main/webapp/js/app.js | UTF-8 | 10,977 | 2.734375 | 3 | [] | no_license | window.onload = function () {
loadLogin();
$('#toLogin').on('click',loadLogin);
$('#toRegister').on('click',loadRegister);
$('#toLogout').on('click',logout);
}
// Logging In
function loadLogin() {
// console.log('in loadLogin()');
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if(x... | true |
9659cf479cec25db6af153daddc455a1acb6b89b | JavaScript | Jeydolen/immunator3000 | /src/shared/utility.js | UTF-8 | 2,127 | 2.78125 | 3 | [] | no_license | // ASKIP FO FAIR UN NAMESPASS
const DEBUG = false;
const UNIT_TEST = false;
const V2 = (x,y) => {return {x:x,y:y}};
const TILE_SIZE = 30;
const VP_SIZE = V2(1200,900);
const CARDINAL_POINTS = ['N', 'E', 'S', 'W','NE','NW','SE','SW'];
const ASSET_SIZE =
{
"gun" : V2(55,55),
"Ab" : V2(7,8),... | true |
6206715abed9e6c92cee3c6fd68acaf0e7325c86 | JavaScript | BeckTimothy/Advent-of-Code | /2019/12-06-19/challenge-1/script.js | UTF-8 | 24,899 | 2.875 | 3 | [] | no_license | /**
* This is challenge 1 of 2019-12-06 of Advent of Code's 25-day challenge
* See the readme for an explanation
*
* @author Timothy Beck <Dev@TimothyBeck.com>
*/
function orbitCalc(arr) {
let target = "COM";
let satellites = [];
let planetList = [];
let satelliteList = [];
let endpoints = [];
let currentPl... | true |
1407a7c372f68f30857ce87a0d5cd31f630c4ec5 | JavaScript | Board-Games-Workshop/world-transit-solar | /tests/App/public/public/map.js | UTF-8 | 914 | 2.84375 | 3 | [] | no_license | window.addEventListener("message", function(event) {
window.removeEventListener("message", function() {});
var iframe = document.getElementsByTagName("iframe")[0];
var type = event.data.type;
iframe.contentWindow.GLOBALS.return_value = true;
});
// PostMessage Wrapper for External Environment
w... | true |
bd0a8e33b3fcc7a519d469ca2d62d780d8dcf74f | JavaScript | Suhailahnfsella/Javascript | /JS3/javascript/js/shoppingcart.js | UTF-8 | 1,617 | 2.859375 | 3 | [] | no_license | let tblmenu = [
{
idmenu: 1,
idkategori: 1,
menu: "Apel Merah",
gambar: "apel.jpg",
harga: 3000,
},
{
idmenu: 2,
idkategori: 1,
menu: "Pisang Raja",
gambar: "pisang.jpg",
harga: 5000,
},
{
idmenu: 3,
idkategori: 2,
menu: "Nasi Goreng",
gambar: "nasigoren... | true |
fdbd018ce1ae3ace9513dab39c5e4cbe79af81f8 | JavaScript | eatyourabstractions/m3-3-react--state | /src/components/App.js | UTF-8 | 4,113 | 2.640625 | 3 | [] | no_license | import React from "react";
import styled from "styled-components";
import Header from "./Header";
import Button from "./Button";
import Deadman from "./DeadMan";
import DeadLetters from "./DeadLetters";
import TheWord from "./TheWord";
import Keyboard from "./Keyboard";
//import GameOverModal from "./GameOverModal";
i... | true |
c40b080d8fcb205649779a446b6c4134ed1d8150 | JavaScript | Dostoy320/lodash-examples | /uniq.js | UTF-8 | 480 | 3.421875 | 3 | [] | no_license | var _ = require('lodash');
//Super simple example:
var bunchOfNumbers = [2, 4, 2, 56, 3, 4, 34, 56];
var uniqueNumbers = _.uniq(bunchOfNumbers);
console.log(uniqueNumbers);
// Comparing a property of an object:
var sandwiches = [
{ 'type': 'submarine', 'length': 12},
{ 'type': 'burger', 'length': 5},
{ 'ty... | true |
b7059a535d0b5131a545a3a4fc0ab76c6e547735 | JavaScript | VladKalachev/game_demo2 | /Selim Arsever - jQuery Game Development Essentials - 2013/chapter 10/soundWebAudio.js | UTF-8 | 1,013 | 3.3125 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | // a sound object
sound = function(){
this.preloaded = false;
// Preloads the sound
this.preload = function(url){
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.responseType = 'arraybuffer';
// Decode asynchronously
var that = this;
request.onload = function() {
sound... | true |
1bc2cfc330d4892812fa02e42d68ec374e520b39 | JavaScript | kaps001/fusionexport-node-client | /src/ExportManager.js | UTF-8 | 4,342 | 2.609375 | 3 | [] | no_license | const path = require("path");
const fs = require("fs-extra");
const _ = require("lodash");
const AdmZip = require("adm-zip");
const tmp = require("tmp");
const { URL } = require("url");
const fetch = require("node-fetch");
const FormData = require("form-data");
const { EventEmitter } = require("events");
const config =... | true |
c975489e6e4481957347aea2a7fb9b683fcf559b | JavaScript | marcelojrhonorio/sweet-sweetbonus | /public/assets/seguro-auto/js/formValidationBR.js | UTF-8 | 22,750 | 3.296875 | 3 | [] | no_license | /*
Form Validation
Method
// objForm - reference to form object
// 'formResultDiv' - div id to present the error mesages
// show_alert - shows error mesages in alert message instead of div mode
validateFormTemplate( objForm, divErrorId, show_alert )
Attribute Description:
validate = "not_... | true |
a53a7268dcb8984e590b01b39e5a59781b692b7e | JavaScript | wwperry94/hooks | /src/Components/People.jsx | UTF-8 | 1,190 | 2.609375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import { Link } from "react-router-dom";
import { spinner } from './utilities.jsx'
const People = () => {
const [dataArr, setdataArr] = useState([]);
const [loading, setLoading] = useState(false);
const getData = async () => {
await setLoading(tru... | true |
9502b7023bb82aa6c4cf640480a994d9744ba15e | JavaScript | Arcidev/Minesweeper | /src/assets/js/minesweeper.js | UTF-8 | 5,264 | 3.1875 | 3 | [
"MIT"
] | permissive | function createMinefield(rows, columns, mines) {
var minefield = {
rows: [],
rowsCount: rows,
columnsCount: columns,
gameWon: null
};
for(var i = 0; i < rows; i++) {
var row = {
spots: []
};
for(var j = 0; j < columns; j++) {
... | true |
a77edd38ebdf779f2d8b6ac6a75a35b6d430e3c6 | JavaScript | Nikil-Singh/Seddit | /frontend/src/userPages.js | UTF-8 | 7,472 | 2.921875 | 3 | [] | no_license | // Written by Nikil Singh (z5209322)
// Imports scripts
import genFeed from './feed.js'
// Creates the required links and modal to display user pages.
function genPages(command, item) {
if (command == "generate") {
// Creates the modal to view users page.
createUserModal();
} else if (command ... | true |
55e054924ef4a1b1253c8f63c069750c3eff6c03 | JavaScript | ipetrov22/schooly-v2 | /server/src/helpers/userValidators.js | UTF-8 | 834 | 2.75 | 3 | [
"MIT"
] | permissive | const emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
const email = (email) => {
if (!email.match(emailRegex)) {
return 'Invalid email.';
}
};
const usernameRegex = /^[a-z0-9._-]{3,20}$... | true |
6b99c24b7338a83bedf9e869134300a8d5100271 | JavaScript | PhilD203/NYT-Real-News-Scraper | /public/app.js | UTF-8 | 2,931 | 3.078125 | 3 | [] | no_license | // onClick for /scrape
//AJAX request to /scrape endpoint
//submit a Second AJAX request to articles endpoint
//append articles to page
$(document).ready(function () {
$(document).on("click", "#scrapeButton", function () {
$.ajax({
method: "GET",
url: "/scrape",
succes... | true |
7107cec714dff166cdd8f99f4026336f50e6edb8 | JavaScript | n0nb1narydev/Random-Quote-Generator | /js/script.js | UTF-8 | 5,327 | 3.3125 | 3 | [] | no_license | /******************************************
Treehouse FSJS Techdegree:
project 1 - A Random Quote Generator
******************************************/
// For assistance:
// Check the "Project Resources" section of the project instructions
// Reach out in your Slack community - https://treehouse-fsjs-102.slack.co... | true |
28cb21b81f192320a1f5ec7dd6b5d3098261164a | JavaScript | danilo-uea/SPD-2020-1 | /Front-end/src/pages/main/index.js | UTF-8 | 2,115 | 2.65625 | 3 | [
"MIT"
] | permissive | import React, { Component } from "react";
import api from "../../services/api";
import { Button, Card } from 'react-bootstrap';
import './styles.css';
import {data_hora} from '../../services/formatos';
export default class Main extends Component {
state = {
perguntas: [],
perguntasInfo: {},
... | true |
9326326d29cfcc3511d76c68304861ae34295bc2 | JavaScript | afrosamasenpai/afrosamasenpai.github.io | /wip/laced-jackal/js/helpers/select.js | UTF-8 | 182 | 2.515625 | 3 | [] | no_license | const select = (selector, parent = document) => {
let foundEl = [...parent.querySelectorAll(selector)]
return (foundEl.length === 1) ? foundEl[0] : foundEl
}
export default select | true |
96f5623cab6adae610cb3a47103103ea733159e5 | JavaScript | gibsonhan/leetcode | /util/test.js | UTF-8 | 395 | 2.90625 | 3 | [] | no_license | let arr = [-2, 1, -3, 4, -1, 2, 1, -5, 4];
let combination = [];
let max = Number.NEGATIVE_INFINITY;
let num = 0;
for (let i = 0; i < arr.length; i++) {
for (let j = i + 1; i < arr.length; j++) {
let lastIndex = combination.length - 1;
prev = combination[lastIndex];
combination.push(prev + arr[j]);
... | true |
0f89f65920b909111d6de104415351311e08ecf7 | JavaScript | loui7/js-challenges | /07_binarySearch.js | UTF-8 | 1,213 | 4.125 | 4 | [] | no_license | /*
Write a method which will act as a binary search which will find the
position and the actual number of steps required to find the position.
When the array has an even number of values the midpoint index will be rounded up.
Example:
binaryArray = [1,5,8,12,20,21,35]
searchValue = 8
In this case the inde... | true |
816bfcfb8d2e7bdf03cfbb90219a05f1d983ebbb | JavaScript | GabrielCarneiroDEV/desafio-backend-modulo-02-sistema-bancario-CUBOS | /src/controladores/comprovantes.js | UTF-8 | 1,873 | 2.6875 | 3 | [] | no_license | const { contas, saques, depositos, transferencias } = require("../bancodedados");
//SALDO
function saldo(req, res){
if(!req.query.senha || !req.query.numero_conta){
res.status(404);
res.json({erro: "informe a senha e numero da conta!"});
return;
}
const conta = contas.find(x =>... | true |
b1bbad5f0688ab556c1f50edc96413f1d2e0b84c | JavaScript | thiagoos16/skylab-js | /es/main_examples.js | UTF-8 | 3,786 | 4.25 | 4 | [] | no_license | class List {
constructor() {
this.todos = [];
}
add(data) {
this.todos.push(data);
console.log(this.todos);
}
}
class TodoList extends List {
constructor() {
super();
this.usuario = 'thiago';
}
showUser() {
console.log(this.usuario);
}
... | true |
eedd614a31550295ae681dbb7d0f4203d494e9f1 | JavaScript | cesarverlini/GymCI | /assets/js/planes/new_plan.js | UTF-8 | 3,258 | 2.6875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | $(document).ready(function() {
$('#titulos').hide();
var id = $('#id_plan').val();
if (id) { load_plan(id); }
});
var plans = [];
var base_url = $('#base_url').val();
$('#add_service').on('click', function() {
service_id = $('#service').val();
if (service_id == "") {
Swal.fire({
... | true |
1170cd92f6c650be8ccd6a9794598ae38d6c337a | JavaScript | baixiaoji/demos | /function/bind/bind.js | UTF-8 | 463 | 2.921875 | 3 | [] | no_license | const slice = Array.prototype.slice;
function _bind(asThis) {
const fn = this;
if (typeof fn !== 'function') {
return Error('must need function type to call')
}
const args = slice.apply(arguments, 1);
const newFn = function () {
return fn.apply(this instanceof newFn ? this : asThis, args.concat(sli... | true |
66e0f0566f786169eb6e83e40e73ac17ad3e739b | JavaScript | sdeli/learning-curve | /node-js-tutorial-basic/node-core-tut/utility/testing.js | UTF-8 | 413 | 2.859375 | 3 | [] | no_license |
function getQueryObj(queryStr) {
queryStr = decodeURIComponent(queryStr);
queryStrArr = queryStr.split('&');
return queryStrArr.reduce((accumulator, currValue, index) => {
let keyValueArr = currValue.split('=');
accumulator[keyValueArr[0]] = keyValueArr[1];
return accumulator;
... | true |
4c8318646207ef745777a1396be1ec57f7091443 | JavaScript | patricklealrocha/estudo-javascript | /treinamentos/condicoes/exe001/compara.js | UTF-8 | 1,894 | 3.75 | 4 | [
"MIT"
] | permissive | function verificar() {
var letra = window.document.getElementById('letra')
var res = window.document.querySelector('div#resultado')
//window.alert(`A letra digitada foi ${letra.value}`)
if(letra.value.length > 1 || letra.value == '' || letra.value == Number(letra.value))
{
window.alert(... | true |
646399eb05664b1ae6d896aceb75adf77c7750eb | JavaScript | mehrimo/JS-warmups | /chai-mocha-test-example.js | UTF-8 | 521 | 2.734375 | 3 | [] | no_license | 'use strict';
const code = require('../01032017.js');
const expect = require('chai').expect; //chai is the assertion library
describe("countVowels", function() {
it("accepts only one argument", () => {
expect(code.countVowels("Hello", "There")).to.equal("I only accept 1 arg");
});
it("must include one argumen... | true |
70782b2be3c22214749d227b8087b1fc8ff5e3f2 | JavaScript | kutibu/E.T | /sum.test.js | UTF-8 | 199 | 2.796875 | 3 | [] | no_license | const sum = require("./sum");
test("adds 1 + 2 to equal 3", () => {
expect(sum.sum(1, 2)).toBe(3);
});
test("adds 1 + 2 + 3 to equal 6", () => {
expect(sum.sume(1, 2, 3)).toBe(6);
});
| true |
ca01994fe67e3a6202809725bae890c020a678fc | JavaScript | jc9292/testdb2 | /sources/jembe.js | UTF-8 | 30,839 | 3.78125 | 4 | [] | no_license | /*
http://www.JSON.org/json2.js
2011-10-19
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS... | true |
3069c57720e9ccbd8ab27f8a0bc048fb021e49bd | JavaScript | LukeH1993/Hangerman | /js/main.js | UTF-8 | 4,811 | 3.171875 | 3 | [] | no_license | $ (function() {
// Variables
var words = ['chicken-nuggets', 'apple', 'creme-brulee', 'pizza', 'melon',
'cheeseburger', 'salad', 'pasta', 'chocolate', 'strawberries', 'lasagna', 'curry',
'cheesy-nachos', 'donut'];
var characters = null;
var incorrect = 0;
var correct = [];
var gameScore = 10;
var time = nul... | true |
ad75d2cb4ab2e905ba5bd1ae51607a67f443dc82 | JavaScript | nohgnim/node-course-mongodb | /server/server.js | UTF-8 | 4,200 | 2.578125 | 3 | [] | no_license | require('./config/config')
const express = require('express')
const bodyParser = require('body-parser')
const {ObjectID} = require('mongodb')
const _ = require('lodash')
const bcrypt = require('bcryptjs')
let {mongoose} = require('./db/mongoose')
let {Todo} = require('./models/todo')
let {User} = require('./models/use... | true |
70f58a3a695db9491f1c20655e2b4cd63604b096 | JavaScript | Dewang2356/dewangportfolio | /src/components/Typeit.js | UTF-8 | 752 | 3.046875 | 3 | [] | no_license | import Typed from "typed.js";
import { useEffect, useRef } from "react";
export default function App() {
// Create Ref element.
const el = useRef(null);
useEffect(() => {
const typed = new Typed(el.current, {
strings: ["Full Stack Developer", "Freelancer", "Front Developer","Web Developer"]... | true |
0021490b8e02144cba9d1d518de9248d9db4d93f | JavaScript | athompsonScottLogic/ci-cd-practical | /src/Counter.js | UTF-8 | 636 | 2.90625 | 3 | [] | no_license | import React, { Component } from 'react';
class Counter extends Component {
constructor(props) {
super(props);
this.state = { count: 0 };
this.handleIncrementClick = this.handleIncrementClick.bind(this);
}
handleIncrementClick() {
this.setState(state => ({ count: state.count + 1 }));
}
rend... | true |
c254020398cf876d2e4b1d9c8fa4e86f3b5df6dd | JavaScript | puncoviy/CodeWars-7-kyu-Soluitions-part-2 | /One Line Task: Making Pizza.js | UTF-8 | 1,638 | 4.1875 | 4 | [
"MIT"
] | permissive | /*
Description:
Task
Fix the code to pass all the tests. Unfortunately, you can only modify ONE line of code :(
Rules
Usually, the changes you make are limited to one line. Please don't complain that you can't write your own code, because this is a bugfix kata. Also, don't complain that the initial code is too messy. ... | true |
4abf513f71ce10c9e65e91aaad3d78ab11801d11 | JavaScript | zhangjunx/EducationManager | /views/systemManagement/js/integralStatistics.js | UTF-8 | 3,012 | 2.5625 | 3 | [] | no_license | getYearList();
layui.use(["form","table"],function(){
var $ = layui.$,
form = layui.form,
table = layui.table;
//监听搜索
form.on('submit(LAY-user-front-search)', function(data){
var field = data.field;
var startDate="";
var endDate="";
var year=$("#yearID").val();
if(field.term=="上学期... | true |
7f30accab5a2195f0cc7d73eecf2141e6cbc1dc5 | JavaScript | maelfardwn/testifabula | /src/soal/Tujuh_sha256.js | UTF-8 | 1,069 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react'
import { sha256, sha224 } from 'js-sha256';
export default class Tujuh_sha256 extends Component {
constructor() {
super();
this.state = {
input :'',
resultHash:''
};
this.handleChange = this.handleChange.bind(this);
... | true |
5759d8d373c63b18154072bb87527f01e830871f | JavaScript | Gybelle/IMDbDataVisualisation | /Code/scripts/Genre_MenuGenreFilter.js | UTF-8 | 2,292 | 3.125 | 3 | [] | no_license | /*
* @author: Michelle Gybels
*/
var genreFilter;
function setGenreFilterMenu() {
genreFilter = [];
$("#menu-toggle").click(function (e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
$("#allCheckbox").prop('checked', true);
//Functionality for genre checkboxes... | true |
fc201072384b6a53fdfd4f9df381dbe2eadf2cb0 | JavaScript | jamigibbs/javascript-problems | /eloquent-javascript/05/everything.js | UTF-8 | 626 | 4.21875 | 4 | [] | no_license | function every(array, test) {
return array.every(function(val){
return test(val)
});
}
function everyAlt(array, test) {
var count = 0;
for(var i = 0; i < array.length; i++){
if(test(array[i])){
count += 1;
}
}
return count == array.length ? true : false;
}
console.log(every([1, 3, 5], n... | true |
4e5fbcc6e5065ebf1d2d40b2727756fb601b6679 | JavaScript | EJohnF/part-1-task-3 | /index.js | UTF-8 | 5,455 | 2.671875 | 3 | [] | no_license | 'use strict';
const express = require('express');
const fs = require('fs');
const MyTransform = require('./MyTransform');
const app = express();
const PORT = process.env.PORT || 4000;
app.listen(PORT, function () {
console.log(`App is listen on ${PORT}`);
});
// log start time of middlewares
app.use((req, res, ... | true |
be1169f1fb7fbedcf4e1f7892a07fb4231aae677 | JavaScript | coarchive/legacy | /sandpile/model.js | UTF-8 | 5,535 | 3.109375 | 3 | [] | no_license | import { no } from "./util.js";
import { Op, Point } from "./structures.js";
/**
* @property {Number} width
* @property {Number} height
* @property {Number} size
* @property {Number} overflow
*/
const config = {
width: 0|0,
height: 0|0,
size: 0|0,
overflow: 0|0,
}
/** @type {Uint8ClampedArray} */
var sandb... | true |
b3b74be92f257376d2559da41c41328940d86b2d | JavaScript | pporche87/core-algorithms | /src/fizzBuzz.js | UTF-8 | 399 | 3.296875 | 3 | [
"MIT"
] | permissive | const fizzBuzz = () => {
const fizzBuzzArray = [];
for (let i = 1; i < 101; i += 1) {
if (i % 3 === 0 && i % 5 === 0) {
fizzBuzzArray.push('FizzBuzz');
} else if (i % 3 === 0) {
fizzBuzzArray.push('Fizz');
} else if (i % 5 === 0) {
fizzBuzzArray.push('Buzz');
} else {
fizzBuz... | true |
5aaac52281f86c4483c9aacadbc67a4dbd93c047 | JavaScript | wyminc/Data-Structures-Algorithm | /Bubble-Sort/bubbleSort.js | UTF-8 | 787 | 3.515625 | 4 | [] | no_license | module.exports = function bubbleSort(arr) {
for (var i = 0; i < arr.length; i++) {
//It is a double for loop because even though we swap every j-1 and j, its only in comparison in that very momment.
//i.e. if the lowest number was at the end of the array and there was no nested for loop, the lowest number wou... | true |
111b21929d9b86a82af0fcd9b512562a9b64bbc4 | JavaScript | PoweRGbg/SoftUni | /Advanced/04. JS-Advanced-DOM-Introduction-Exercise-Resources-New/04. Search in List/search.js | UTF-8 | 591 | 3.4375 | 3 | [] | no_license | function search() {
let towns = document.getElementById('towns').getElementsByTagName("li");
const searchingFor = document.getElementById('searchText').value;
let matches = 0;
for (const element of towns) {
if (element.innerText.includes(searchingFor)) {
element.style.fontWeight = 'bold';
... | true |
730e4dbc53976cb46ce0aa448bfa662fd342e1bd | JavaScript | myk245/fewpjs-removing-altering-and-inserting-html-lab-nyc-web-010620 | /index.js | UTF-8 | 418 | 3.765625 | 4 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // remove the DOM node 'main#main':
let main = document.getElementById("main")
main.remove()
// add a 'newHeader' variable that points to node 'h1#victory'
// with "YOUR-NAME is the champion" inside
// add an h1 with an ID of "victory", where the inner HTML is the above-mentioned
let newHeader = document.createElement... | true |
36ea61121c5e4430624f7e87c2aa96a6bb7caaa9 | JavaScript | mwegman/react-mentions | /gh-pages/views/examples/AsyncHashtags.js | UTF-8 | 1,349 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | import React from 'react'
import { merge } from 'lodash'
import { MentionsInput, Mention } from '../../../src'
import { provideExampleValue } from './higher-order'
import defaultStyle from './defaultStyle'
import defaultMentionStyle from './defaultMentionStyle'
function getHashtags(query, callback) {
const getInd... | true |
6e1093e554ea73c3516bf2b0894fb654d440840c | JavaScript | scealux/Scrimba-Javascriptmas | /5 - Reverse A String/main.js | UTF-8 | 563 | 3.796875 | 4 | [] | no_license | function reverseAString(str) {
return str.split("").reverse().join("")
//return String.fromCharCode( ...Array.from( Array(str.length), (el, i)=> str.charCodeAt( (str.length-1)-i )))
//Recursive
//return (str === '') ? '' : reverseAString(str.substr(1)) + str.charAt(0)
}
//Test Suite
describe... | true |
60e431d5ab3183a6e3c1fdb926bc59dc2d4b0e4d | JavaScript | endrin/multiline-tag | /test/coffee_multiline_tests.js | UTF-8 | 1,417 | 2.609375 | 3 | [
"WTFPL"
] | permissive | var expect = require('chai').expect;
var Multiline = require('../index').Multiline;
/* jshint esnext:true */
describe("Multiline tag tests", function () {
it("Should clean simple aligned strings", function () {
var example = Multiline`one
two`;
expect(example).to.be.equal("one t... | true |
0519ea75572a02cfcdc673af0adc995bd7cf85f3 | JavaScript | ChrisH40/cohort3 | /src/03-objects/scripts/cities-api-functions.test.js | UTF-8 | 4,519 | 2.578125 | 3 | [] | no_license | import { Community } from './cities.js';
import syncFunctions from './cities-api-functions.js';
global.fetch = require('node-fetch');
const url = 'http://localhost:5000/';
test('test dataSync on pageload working', async () => {
const test_community = new Community("Test Community");
const test_cities_list ... | true |
a0a2580ec2bd9f00df97f2a5cb4e985799576bee | JavaScript | MorgueStrikesBack/MorgueStrikesBack | /deadstate.js | UTF-8 | 757 | 2.84375 | 3 | [] | no_license |
var DeadState = function()
{
this.prototype = BaseState;
}
DeadState.prototype.load = function()
{
}
DeadState.prototype.unload = function()
{
}
DeadState.prototype.update = function(dt)
{
if( keyboard.isKeyDown( keyboard.KEY_E ) == true )
{
sfxBegin.play();
stateManager.switchState( new GameState() );
... | true |
1c5be00f0767d02f4f2b49d81d727a421317fc83 | JavaScript | abdallhali/quiver | /app/utils/parseMemo.js | UTF-8 | 481 | 3.046875 | 3 | [
"MIT"
] | permissive | import hex from 'hex-string';
const parseMemo = (memoHex: string): string | null => {
if (!memoHex || memoHex.length < 2) return null;
// First, check if this is a memo (first byte is less than 'f6' (246))
if (parseInt(memoHex.substr(0, 2), 16) >= 246) return null;
// Else, parse as Hex string
const textDe... | true |
a864ebb1f310cc7b9f464ffd621ee0562d53bfa9 | JavaScript | kasperisager/doem | /lib/parents.js | UTF-8 | 559 | 3.328125 | 3 | [
"MIT"
] | permissive | import {parent} from './parent';
/**
* Get all the parents of an element.
*
* @example
* <div>
* <p>Lorem <b>ipsum</b></p>
* </div>
* @example
* const element = find(document, 'b');
* parents(element);
* // => [<p>...</p>, <div>...</div>]
*
* @param {Element} element The element whose parents to get.
* ... | true |
de0a5ec2d69180d34078b40377455fe34c68c8e5 | JavaScript | munnysri/content-cka-apps | /random-crashing-web-server/server.js | UTF-8 | 510 | 2.78125 | 3 | [] | no_license | const http = require('http');
var crashed = false;
const requestListener = function (req, res) {
if (!crashed) {
res.writeHead(200);
res.end('App is working!');
} else {
res.writeHead(500);
res.end('Internal server error.');
}
}
const server = http.createServer(requestListener);
server.listen(8... | true |
9230ef85faf6d5352fb52118c4c0f0a304e7c4ba | JavaScript | fpservant/semanlink | /semanlink-lod-webapp/src/main/webapp/scripts/rdfparsing/tabulator/based-on-tabulator-0.8-2007-02-01T16-43Z/rdf/match.js | UTF-8 | 5,114 | 3.234375 | 3 | [
"W3C"
] | permissive | // Matching a statement against a formula
//
//
// W3C open source licence 2005.
//
// We retpresent a set as an associative array whose value for
// each member is set to true.
/* Not used, bogus. See identity.js for the ones really used.
RDFFormula.prototype.statementsMatching = function(s,p,o,w) {
var results =... | true |
3ccdc78a6d29c9eee8164cfe83417bcb5a922884 | JavaScript | ElCammel/ProjetTypeScript | /src/Classes/Battle.js | UTF-8 | 928 | 2.71875 | 3 | [] | no_license | "use strict";
exports.__esModule = true;
var Battle = /** @class */ (function () {
function Battle() {
}
Battle.prototype.whichPokemonHaveTheInitiative = function (firstPokemon, secondPokemon) {
if (firstPokemon.stats.speed === secondPokemon.stats.speed) {
return (Math.floor(Math.random(... | true |
2cfe0f820472bd3c1db37f4b6d025986c75dfa09 | JavaScript | BLipsett/Daily-Planner | /script.js | UTF-8 | 3,216 | 3.125 | 3 | [] | no_license | //$(document).ready(function () {
console.log("ready!");
var currentDate = moment().format("MMM Do YY");
$("#currentDay").text(currentDate);
console.log(currentDate);
let curDate = moment().clone();
let updateInterval;
var hourArr = [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19];
function loadPlanner() {
cl... | true |
c7c1346fc21d424f54f7723e63f0902413ff69a2 | JavaScript | adrianadames/React-Insta-Clone | /instagram/src/App.js | UTF-8 | 3,837 | 2.875 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import dummyData from './dummy-data';
import PostsPage from './components/PostContainer/PostsPage';
// import Authenticate from './components/Authentication/Authenticate';
class App extends React.Component {
constructor() {
super();
this.state = ... | true |
73b0ec7d5bf876f4c18bde70ee416d6a58aa68f3 | JavaScript | panda1920/NodePrac | /app1/notes.js | UTF-8 | 1,986 | 3.375 | 3 | [] | no_license | const fs = require("fs");
const chalk = require("chalk");
const FILENAME = "notes.json";
function addNote(title, body) {
const notes = loadNotes();
// do not allow duplicate title
if (notes.some(note => note.title === title)) {
console.log(chalk.red(`Duplicate note of title: ${title} found!`));
... | true |
9b6e44217194f8ae973b99df3f389441d960032d | JavaScript | DFLovingWM/leetcode-solving | /biweekly-contest/biweekly-contest-30/1/naive.js | UTF-8 | 469 | 3.25 | 3 | [] | no_license | /**
* 字符串处理
*/
var reformatDate = function(date) {
const [d, m, y] = date.split(' ');
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
const monthMapping = {};
for (const [i, v] of months.entries()) {
monthMapping[v] = padding(i + 1);
}
return [
y... | true |
4dce6c7f0f982eb41fe474092d6a45bb6886a397 | JavaScript | nagcloudlab/ui-batch | /Stage-3/2-HTML5-APIs/5-webworker/index.js | UTF-8 | 388 | 2.890625 | 3 | [] | no_license |
document.getElementById('big-computation')
.addEventListener('click',e=>{
const worker=new Worker('./big-computation.js')
worker.onmessage=message=>{
document.getElementById('result-span').innerText=message.data.value;
}
})
document.getElementById('uname')
.addEventListener('keyup',function(e)... | true |
b3d8bbf1bfdfaf8d5f9da9470ffd04611f7ca700 | JavaScript | tcbutler320/JPigLatin | /index.js | UTF-8 | 496 | 3.3125 | 3 | [] | no_license | function encode(input,output) {
var string = document.getElementById(input).value;
var words = string.split(" ");
var answer = "";
var temp = "";
for (var i = 0; i < words.length; i += 1) {
temp = words[i].slice(1);
if (typeof temp === 'undefined' || typeof words[i][0] === 'undefined') {
... | true |
df2931f40ea2241b750d6aa53f6d232f1cf1a296 | JavaScript | greyli/helloflask | /demos/assets/static/ckeditor/plugins/filebrowser/plugin.js | UTF-8 | 21,615 | 2.65625 | 3 | [
"MIT",
"LGPL-2.1-or-later",
"LGPL-2.1-only",
"OFL-1.1",
"BSD-3-Clause",
"MPL-1.1",
"GPL-2.0-only",
"GPL-2.0-or-later",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /**
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/**
* @fileOverview The "filebrowser" plugin that adds support for file uploads and
* browsing.
*
* When a file is upload... | true |
f9d7447b1adf4fba37519e61070c3e17d6e273ff | JavaScript | Vishal643/ds-question | /unit-3-async/week-4/day-1/order_process.js | UTF-8 | 1,113 | 3.203125 | 3 | [] | no_license | function runProgram(input) {
input = input.trim().split('\n');
let num_of_input = input.shift();
let arr1 = input[0].trim().split(' ').map(Number);
let arr2 = input[1].trim().split(' ').map(Number);
let queue = [];
for (let i = 0; i < arr1.length; i++) {
queue.push(arr1[i]);
}
let correctOrder = 0;
let cha... | true |
0de21d20cc7e49d5ce6e50279d8788b582db6370 | JavaScript | juzi5230/pwa-test | /src/utils/mCall.js | UTF-8 | 4,256 | 2.671875 | 3 | [] | no_license | /**
* 校信提供的统一的方法
*/
let mCall = window.mCall
let hasMCall = !!mCall
export default {
/**
* 判断是否支持mCall校信方法
*/
hasMCall () {
return hasMCall
},
/**
* 监听物理键盘返回按钮, 并阻止返回,只能监听一个
* @param {function} fn - 回调函数
*/
setLeftButtonListener (fn) {
if (!hasMCall || !mCall.setLeftButtonListener) ... | true |