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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
c67eaac9ad654dcafbc1f0e98031eeb954fc27a2 | JavaScript | mateoroldos/etch-a-sketch | /scripts.JS | UTF-8 | 2,370 | 3.671875 | 4 | [] | no_license | // Global Variables
let numberOfDivs = 2000
let perfectRoot
// Find next perfect square
const nearest_sq = n => Math.pow(Math.ceil(Math.sqrt(n)), 2);
// Create default grid
perfectRoot = nearest_sq (numberOfDivs);
makeGrid (perfectRoot);
mouseHover ();
// When number of plays changed remake the grid
const btn = docu... | true |
7f6878266d1ea9f2f0bf00a6e68d8587bf28bf99 | JavaScript | Ksz-K/rock-scissors-paper | /js/script.js | UTF-8 | 11,015 | 3.015625 | 3 | [] | no_license | "use strict";
(function() {
var params = {};
var {
playNumber = 1,
draw,
drawn,
drawnID = "",
drawID = "",
sequanceOfDrawn = [1],
sequanceOfResult = [],
manPoints = 0,
iaPoints = 0,
manWon = 0,
iaWon = 0,
deuce = 0,
manWonSeries = 0,
iaWonSeries = 0,
deuc... | true |
3740ad85e6de93e24d0bec6bb30d9c9e7bfd134d | JavaScript | BryantTruong/Free-Code-Camp | /Boo Who.js | UTF-8 | 137 | 2.984375 | 3 | [] | no_license | function booWho(bool) {
if (bool===true||bool===false||bool===null){
return true;
}else {
return false;
}
}
booWho(false);
| true |
ac85804d3612be45a9d20cdff8a7d7cbf1982453 | JavaScript | silviousai96/js-es6-icons | /js/script.js | UTF-8 | 2,514 | 2.984375 | 3 | [] | no_license | const icons = [
{
name: 'cat',
prefix: 'fa-',
type: 'animal',
family: 'fas'
},
{
name: 'crow',
prefix: 'fa-',
type: 'animal',
family: 'fas'
},
{
name: 'dog',
prefix: 'fa-',
type: 'animal',
family: 'fas'
},
{
name: 'dove',
prefix: 'fa-',
type: 'animal',
family: 'fas'
},
{
name:... | true |
3998c26f0c76d253b03b0b1330e66213e1b75e50 | JavaScript | gefinity/redwarrior | /src/engine/scene.js | UTF-8 | 5,234 | 2.75 | 3 | [] | no_license | import invariant from 'invariant';
import _ from 'lodash';
import Lifecycle from './lifecycle';
class Scene extends Lifecycle {
constructor (systems) {
super();
this.systems = systems;
this.entities = [];
}
// entities can be nested, this walks entire hierarchy f... | true |
49eb7e64d8405d6439b3434201f9258b8842b9d9 | JavaScript | philipwisner/lab-jquery-ten-seconds-math-game | /starter-code/js/tenSecondsMath.js | UTF-8 | 1,852 | 4.1875 | 4 | [] | no_license | // Use this file to write the logic of your game, the needed attrs and functions
var TenSecondsMathGame = function(operation, limit) {
this.operation = operation;
this.limit = limit;
this.answer = 0;
this.question = "";
this.questionCount = 0;
this.timer = 0;
};
// Returns a random integer bet... | true |
cf298ee9d2d1e17ee160ee52d0870642fde4b49c | JavaScript | cira0100/T9 | /src/main/resources/static/js/register.js | UTF-8 | 11,815 | 2.5625 | 3 | [] | no_license | function promeniFormu(Id){
if(Id==1)
{
document.getElementById("RadnikForma").style.display = "none";
document.getElementById("PoslodavacForma").style.display = "block";
document.getElementById("DugmeZaRegistraciju").setAttribute("onClick","javascript: Registruj(1);");
}else if(Id==2... | true |
f0c3a4d7b291a64c70c9e04d0fdd4b34ca93a0d3 | JavaScript | Abenezerm/team-profile-generator | /src/generateHtml.js | UTF-8 | 4,068 | 2.640625 | 3 | [] | no_license | const fs = require('fs');
let members = []
function generateManager(name, id, email, role, room){
const managerCard =
`<div id='team-membercard'>
<div id="card-title">
<h2 id="name">${name}</h2>
<h2 id="role"><svg xmlns="http://www.w3.org/2000/svg" width="30" height="45... | true |
8fab47b8392111a482c9248d7fab43b1621b27e7 | JavaScript | cckmit/front-side | /src/utils/string-to-date.js | UTF-8 | 171 | 2.796875 | 3 | [
"MIT"
] | permissive | String.prototype.toDate = function() {
var lists = this.split('-')
var date = new Date(parseInt(lists[0]), parseInt(lists[1]) - 1, parseInt(lists[2]))
return date
}
| true |
6ae706dda834c30c994dfcfd7e283c4e90b8f1d4 | JavaScript | Leetrin/Hillel_homework | /lesson2_calculator_nearestMultiple/calculator/js/script.js | UTF-8 | 1,115 | 4.375 | 4 | [] | no_license | "use strict";
function calculator() {
const firstAnswer = prompt("What is a first number?", "");
const secondAnswer = prompt("What is a second number?", "");
const operatorAnswer = prompt("What do you do with this numbers? Enter +, -, * ,/ ,**", "");
if (operatorAnswer !== "+" && operatorAnswer !== "-" && op... | true |
106d51af3a6e5dbd762a1d23232670463b7dfb36 | JavaScript | KhaldAttya/Cafe-Townsend | /pages/employee_page.js | UTF-8 | 2,985 | 2.734375 | 3 | [] | no_license | var employee_page = function () {
var createEmployeeButton = element(by.id('bAdd'));
var editEmployeeButton = element(by.id('bEdit'));
var addEmployeeButton = element(by.buttonText('Add'));
var firstNameField = element(by.model('selectedEmployee.firstName'));
var lastNameField = element(by.model('selectedEmployee.las... | true |
9625a7ec0ca95624f57e7641ae18d78685780a59 | JavaScript | Dieg0Code/jamstck_example | /src/js/vibe.js | UTF-8 | 320 | 3.0625 | 3 | [] | no_license | // almacén de buenas vibras
const vibes = [
"...tu puedes!!",
"...confío en ti!!",
"...con fe nomas!!",
"...sin miedo al éxito!!",
];
// choose a random vibe
var vibe = vibes[Math.floor(Math.random() * Math.floor(vibes.length))];
// display a good vibe
document.querySelector(".vibe").append(vibe); | true |
f0adc94c015f52a919a7662245207ef146894be6 | JavaScript | JackOddy/prawf | /assert.js | UTF-8 | 358 | 2.578125 | 3 | [] | no_license | var chalk = require('chalk')
function assert() {
}
assert.isTrue = function(testTitle, assertionToCheck) {
if (!assertionToCheck) {
console.log(chalk.red(' ' + '👎 ' + testTitle + ' ❌'));
return false
} else {
console.log(chalk.green(' ' + '🍓 ' + testTitle + ' ✅'))
return true
}... | true |
055d9cc44f0a061a2955eeb1377cd74ee976c948 | JavaScript | georgec12104531/codingChallenges | /longestCommonPrefix.js | UTF-8 | 1,191 | 4.21875 | 4 | [] | no_license |
// Plan:
// - Keep track of a longestPrefix
// - Loop through the input
// - Loop through string at index 0
// - if all strings contain the current letter then add it to the longestPrefix
// - else break
// - return longestPrefix
// Input: ["flower","flow","flight"]
// Output: "fl"
const longestCommonPrefi... | true |
4e6e147d821cc5d158e1b4ee7e5ca6ae11543e8c | JavaScript | flyeagleyuan/vue-cli-yuanfx | /src/utils/assist.js | UTF-8 | 2,601 | 2.984375 | 3 | [
"MIT"
] | permissive | /**
* 向上查找离得最近的指定name的Vue组件对象
* @param context 当前上下文
* @param componentName 组件名
* @return {Vue}
*/
export function findComponentUpward(context, componentName) {
let parent = context.$parent,
name = parent.$options.name;
while (parent && (!name || name !== componentName)) {
parent = parent.$parent;
... | true |
98bb75fc9a42ef82c8ed72443576b6fde3809c27 | JavaScript | EmiBarat/EjerciciosJavaScript | /EjDOM/EjMultiplicador.js | UTF-8 | 408 | 3.453125 | 3 | [] | no_license | window.onload = function(){
let factor1 = document.getElementById('factor1');
let factor2 = document.getElementById('factor2');
let botonCalcular = document.getElementById('botonCalcular');
let resultado = document.getElementById('resultado');
botonCalcular.onclick = function multiplicar(){
... | true |
7e8db8c5c664af055da0e4a30dfe6a08a5e55aa1 | JavaScript | wojciechlasak/helpers | /svgtopath/paths.js | UTF-8 | 1,567 | 2.96875 | 3 | [
"MIT"
] | permissive | function convert() {
const input = $('#input').val();
let svg = input;
svg = svg.replace(/ {2,}/g, ' ');
svg = svg.replace(/>( |\r|\n)+/g, '>\r\n');
// polyline, polygon
svg = svg.replace(
/points="([0-9-., ]*)"/g,
(match, p1) => {
let first = true;
let s = p1.replace(/([0-9-.]+), ?([0-... | true |
3b3b5971865f7c0cc2d1d26d5ab249d48c7d0d81 | JavaScript | stringparser/practice | /node-school/stream-adventure/combiner.js | UTF-8 | 919 | 2.546875 | 3 | [] | no_license | 'use strict';
var zlib = require('zlib');
var split = require('split');
var through = require('through2');
var combiner = require('stream-combiner');
module.exports = function(){
var genre = {};
var current;
function write(data, enc, next){
if(!data.length){ return next(); }
var json = JSON.parse(dat... | true |
25dee1eaa3d442e7c253e3fd0fd1b751dcb267cb | JavaScript | riccardocadoni/quarantine-games | /src/components/AccGame.js | UTF-8 | 13,523 | 2.8125 | 3 | [] | no_license | import React, { useState, useEffect, useContext } from "react";
import firebase from "../firebase";
import { GameContext } from "../App";
import { Grid, TextField, Button } from "@material-ui/core";
import ResultTable from "./ResultTable";
export default function AccGame() {
const Game = useContext(GameContext);
c... | true |
998a92c6464b564fe3acd983a788bd32f7755d11 | JavaScript | MagentaReds/week-18-scrapped-Handlebars-Cheerio | /routes/routes.js | UTF-8 | 4,400 | 2.71875 | 3 | [] | no_license | var express = require("express");
var router = express.Router();
var mongoose = require("mongoose");
var request = require("request");
var cheerio = require("cheerio");
var Note = require("../models/Note.js");
var Article = require("../models/Article.js");
var SavedArticle = require("../models/SavedArticle.js");
//G... | true |
706e0e78304c70b5f3814fdaa86498c435c546c6 | JavaScript | LocalAnastasia/hw2 | /src/components/item_screen/ItemScreen.js | UTF-8 | 3,269 | 2.703125 | 3 | [] | no_license | import React, { Component } from 'react'
import PropTypes from 'prop-types';
export class ItemScreen extends Component {
state = {
key: this.props.todoItem.getKey(),
description: this.props.todoItem.getDescription(),
assigned_to: this.props.todoItem.getAssignedTo(),
due_date: this.p... | true |
62b1c9f7fa2307b32a593f7a15510854034f6cda | JavaScript | CarlosIUSalazar/Carlos | /Week 1/Week1 Class2/Warm Up/script.js | UTF-8 | 801 | 4.625 | 5 | [] | no_license | 'use strict'
// Please don't delete the 'use strict' line above
//1 You will use a new JavaScript operator for this: typeof. You can learn more about this operator here.
const variableString = "I am a string";
console.log(typeof variableString); // should print "string"
const variableNumber = 123;
console.log(typeof... | true |
816581c2202081b7fe6c8291e7d5d65924e1a0dd | JavaScript | ranadeeb92/JavaScript_Advanced_Problems | /jest-testing/car.test.js | UTF-8 | 2,321 | 2.9375 | 3 | [] | no_license | const car = require('./car');
const Car = require('./car');
// describe('The car class' , () => {
// test('has four wheels', ()=> {
// let car = new Car();
// expect(car.wheels).toBe(4);
// });
// xtest("bad wheels", ()=> {
// let car = new Car();
// expect(car.wheels).toBe(3);
// });
// tes... | true |
184c50ce8c0753434048cfb142132e62beedf407 | JavaScript | 1hsun/react_ref | /todoapp_complex/src/reducers/items.js | UTF-8 | 863 | 2.796875 | 3 | [] | no_license | //@flow
import { ADD_ITEM, DEL_ITEM, UPDATE_ITEM, INIT_ITEMS } from '../constants/actionTypes';
import type { Item } from '../definitions/TodoTypeDefinition';
export default function items(state: Array<Item> = [], action: Object) {
switch (action.type) {
case ADD_ITEM:
return [action.payload, ...state]
... | true |
21800ede5207ec67a5df48105a86e3b54c6b093e | JavaScript | xbdljq/resume-webpack | /src/index.js | UTF-8 | 258 | 3.125 | 3 | [] | no_license | import sass from './style.scss'
let a = "这里用的是let而不是var"
setTimeout(() => {
var temp = document.querySelector('.test2')
temp.innerHTML = a
}, 100)
let fn = () => console.log('fn = () => console.log(),这是个箭头函数')
fn() | true |
0375a2ee7229e7a74f7c685e7d08ef010ab37f2a | JavaScript | ben-bourdin451/kata | /misc/inArray/ex.js | UTF-8 | 96 | 2.578125 | 3 | [] | no_license | function inArray(a1, a2) {
return a1.filter(e => a2.contains(e));
}
module.exports = inArray;
| true |
cb548f7b96829889f9c76cfbc143e4217c021f14 | JavaScript | clarityhub/react-redux-clarity | /src/Request.js | UTF-8 | 2,795 | 2.640625 | 3 | [
"MIT"
] | permissive | import {
LOADING,
FAILURE,
SUCCESS,
} from './constants/request';
import { DONE } from './constants/status';
/*
* This class does not take care of throttling requests.
*
* If you would like your requests throttled, use
* the loader component
*/
export default (xhr) => class ClarityRequest {
constructor({... | true |
56a9587f40d9d44311287e05cdfc2fe43aabc10d | JavaScript | nityasankar7/Project-34 | /sketch.js | UTF-8 | 1,457 | 2.78125 | 3 | [] | no_license | const Engine = Matter.Engine;
const World= Matter.World;
const Bodies = Matter.Bodies;
const Constraint = Matter.Constraint;
const Mouse =Matter.Mouse;
var bob1,bob2,bob3,bob4,bob5;
var sling2,sling3,sling4,sling5,sling6;
function setup(){
var canvas = createCanvas(windowWidth/2,windowHeight/1.5);
... | true |
dd08fd6e07a747c8e2f6bb4ecfe5f30da8b8d8e6 | JavaScript | anaseightsee/exo-site-emporium | /public/js/main.js | UTF-8 | 4,932 | 2.859375 | 3 | [] | no_license |
const nav = document.getElementById('navigation');
const navTop = nav.offsetTop;
// THEME CHANGE START
let logo = document.getElementById('logo');
let activeNavbar = document.getElementsByClassName('active')[0];
let header = document.getElementsByTagName('header')[0];
let blckBtn = document.getElementsByClassName('da... | true |
e7b72ff33eee3765ea6f37de49800bec0a57bb0e | JavaScript | cjbrock/js-object-oriented-front-end-030220 | /js/models/post.js | UTF-8 | 836 | 2.984375 | 3 | [] | no_license | class Post{
static all = []
constructor({id, title, author, content, likes}){
this.id = id
this.title = title
this.author = author
this.content = content
this.likes = likes
Post.all.push(this)
}
// create our html elements to display the post
postHTML(){
return (`
<div class=... | true |
ff41c4be67dad815055e5a036273c611517c7c2d | JavaScript | Elodie-F18/TP_HTML_CSS_JS | /moduleJS/TP19/js/script.js | UTF-8 | 290 | 3.15625 | 3 | [] | no_license | function calculerSommeDiagonal(matrice) {
let sommeDiagonal1 =0;
let sommeDiagonal2 =0;
for(let i=0;i<matrice.length;i++) {
sommeDiagonal1 += matrice[i][i]
sommeDiagonal2 += matrice[i][matrice.length - i - 1]
}
return sommeDiagonal1 + sommeDiagonal2
}
| true |
7efddc730541da8ef43ea2d4d009fed587ee4107 | JavaScript | brettsam/azure-webjobs-sdk-templates | /Templates/ServiceBusQueueTrigger-NodeJS/index.js | UTF-8 | 513 | 2.515625 | 3 | [] | no_license | module.exports = function(context, myQueueItem) {
context.log('Node.js ServiceBus queue trigger function processed message', myQueueItem);
var OutPutQueueItem = null;
if (myQueueItem.count < 1) {
// write a message back to the queue that this function is triggered on
// ensuring that we on... | true |
8b77c193da79c5f83e4c250b92a8bf3ff95ddc9d | JavaScript | somyaranjan26/TradeByte | /routes/api/transaction.js | UTF-8 | 5,133 | 2.75 | 3 | [
"MIT"
] | permissive | // Cart Routes
//jshint esversion:8
const express = require("express");
const router = express.Router();
const { ensureAuth } = require("../../middleware/auth");
const User = require("../../models/User");
const Transaction = require("../../models/Transaction");
const getPrice = require("../../helpers/getPrice");
// ... | true |
9151293a3bc59ec03621e389064dab2d1e2d948c | JavaScript | milancxe/AgroSocialNetwork | /packages/posts/server/controllers/postControllerServer.js | UTF-8 | 4,662 | 2.5625 | 3 | [] | no_license | 'use strict';
var mongoose = require('mongoose');
var PostModel = mongoose.model('PostModel');
var PostVoteModel = mongoose.model('PostVoteModel');
var postUtils= require('./postUtilsServer.js');
var fs = require('fs');
var _ = require('lodash');
exports.post = function (req, res, next,id) {
PostModel.findOne({ _id:... | true |
85aeabd80efebdb66c22501bdf712b4cfe83a0ef | JavaScript | novacrazy/bluebird-co | /benchmark/src/iterables.js | UTF-8 | 1,593 | 2.609375 | 3 | [
"MIT"
] | permissive | /**
* Created by Aaron on 7/17/2015.
*/
import Promise from 'bluebird';
import BluebirdCo from '../../';
function makeSet( length ) {
let res = new Array( length );
let i = -1;
while( ++i < length ) {
res[i] = i;
}
return new Set( res );
}
suite( 'very short iterables (Set of 2 elemen... | true |
419dfccda36b7ab320d20cc55da9d38e333e4f3a | JavaScript | itstoreall/goit-react-hw-09-phonebook | /src/redux/contacts/contact-operations.js | UTF-8 | 1,397 | 2.71875 | 3 | [] | no_license | import axios from 'axios';
import { contactsActions } from '../contacts';
/**
* Операция это функция, вызванная в компоненте,
* которая возвращает другую функцию, в которой
* выполняются асинх запросы по паттерну:
* Request > Success > Error
*/
// GET
export const GET = () => async (dispatch) => {
dispatch(con... | true |
463ab77a241a3e4fcea5fca130fac1f20be263b7 | JavaScript | Majroch/bubble | /server.js | UTF-8 | 4,922 | 2.625 | 3 | [] | no_license | #!/usr/bin/env node
let WebSocketServer = require("ws").Server;
let wss = new WebSocketServer({
port: 8001,
});
let messages_stack = [];
let client_id = 0;
setInterval(() => {
console.log(messages_stack);
}, 1000);
function loggedIn(ws) {
ws.whoami = ws.whoami.replace("Guest", "Listener");
ws.send("L... | true |
f95518bfda1f147436d5f31405edfbf389f235e1 | JavaScript | MohammadWajhiUddin/GENERIC-APIS | /api/user_add_deleted_update_find_apis/user_detailed_working.service.js | UTF-8 | 2,700 | 2.625 | 3 | [] | no_license |
// requiring database details which are described inside config file, and storing that details inside pool variable
const pool = require("../../config/database");
//module.exports will export every callback or functions which we described within this
module.exports={
//creating user
CREATE_USER:(data,callB... | true |
e8ac93aeaec11c825cd13dda078dd59c6832e1dc | JavaScript | RanganathDevaramani/fundo | /client/src/redux/reducers/campaign.js | UTF-8 | 361 | 2.53125 | 3 | [] | no_license | const campaignInitialState = []
const campaignReducer = (state = campaignInitialState, action) => {
switch(action.type){
case 'ADD_CAMPAIGN' :
return [...state, ...action.payload ]
case 'GET_CAMPAIGN':
return [...action.payload]
default :
return [...state... | true |
bc31af6b0bb805dce3be0aa4d326a3f57c827639 | JavaScript | 15980829676/dd | /marketing/wheel/wheel.js | UTF-8 | 3,859 | 2.59375 | 3 | [] | no_license |
/**
* @param {Number} areaNumber 奖品数量
* @param {Number} speed 转动速度
* @param {Number} awardNumer 中奖索引从0开始
* @param {Number} mode 1是指针旋转,2为转盘旋转
* @param {Number} singleAngle // 每片扇形的角度
*/
Page({
data: {
integral: '2555',//用户积分
deg:0,
areaNumber:'',
... | true |
3f633ee21a9eb3b7a6c29a6dfc72b624aceceea5 | JavaScript | michaelamancio89/User-Managment-System | /models/User.js | UTF-8 | 3,382 | 3.390625 | 3 | [] | no_license | //Nome de classe inicia em maiúscula
//qualquer método desta classe consegue acessar seus atributos
class User{
constructor(id, name, gender, birth, country, email, password, photo, admin){
//quando há _ subentendesse que são propriedades privadas, não é uma regra: é convenção
this._id = id;
... | true |
460967236aaa9df97a95e587ca62afee66efead5 | JavaScript | yasherarafath/nodemvc | /server/controllers/product.controller.js | UTF-8 | 768 | 2.703125 | 3 | [] | no_license | const Product = require('../models/product.model');
//Simple version, without validation or sanitation
exports.test = function (req, res) {
res.send('Greetings from the Test controller!');
};
exports.hello = function (req, res) {
res.send('Greetings from the Hello controller!');
};
exports.product_create = f... | true |
3bb57b4067e628b2fbc0e43436bd151928245c78 | JavaScript | zebrox5/Java | /Jquery/index.js | UTF-8 | 2,578 | 3.9375 | 4 | [] | no_license | /*
$(document).ready(function () {
//making sure the jQuery loaded
//otherwise add the library to the end of the body
$("h1").css("color", "red"); //changing the css (property, value)
});
// document.querySelectorAll("button");
$("button")
//we can get the current values also
console.log($("h... | true |
d05bb18870b6c1eeee8a15cca28c3d9f83591226 | JavaScript | elhadjialiouthiam/EL-HADJI-ALIOU-THIAM | /MINI_PROJET QuizzSA/insjour.js | UTF-8 | 1,457 | 2.75 | 3 | [] | no_license | var loadFile = function(event) {
var output = document.getElementById('output');
output.src = URL.createObjectURL(event.target.files[0]);
output.onload = function() {
URL.revokeObjectURL(output.src) // free memory
}
};
let prenom = document.querySelector("#prenom");
let prenominf = d... | true |
d65b59ed9d8d7e3de9f0e53cf8154896b85bfc0b | JavaScript | ocapuozzo/musaicbox | /src/models/Group.js | UTF-8 | 4,249 | 2.59375 | 3 | [
"MIT"
] | permissive | /*
* Copyright (c) 2019. Olivier Capuozzo
* This file is part of the musaicbox project
*
* (c) Olivier Capuozzo <olivier.capuozzo@gmail.com>
*
* For the full copyright and license information, please view the README.md file of this project.
*
*/
import MusaicPcsOperation from "./MusaicPcsOperation";
import ... | true |
0a2161325aefb88fdf8ca73720413d345194feb9 | JavaScript | TimMikeladze/ya-react-redux-form | /src/FormRegistry.js | UTF-8 | 762 | 2.5625 | 3 | [
"MIT"
] | permissive | const FORM_REGISTRY_KEY = Symbol.for('yaFormRegistry');
const globalSymbols = Object.getOwnPropertySymbols(global);
const hasSymbol = globalSymbols.indexOf(FORM_REGISTRY_KEY) > -1;
if (!hasSymbol) {
global[FORM_REGISTRY_KEY] = {
handlers: {},
add(name, handler) {
this.handlers[name] = handler;
},
... | true |
a5652ea500b246a7d559ec54f8c81a799300a4c9 | JavaScript | ravi4all/JS_WE_Nov | /02-EventsAndObjects/FormValidations/validations.js | UTF-8 | 2,061 | 3.09375 | 3 | [] | no_license | window.addEventListener("load", init);
var userName;
var userMail;
var userPwd;
var confPwd;
function init(){
userName = document.getElementById("box_1");
userMail = document.getElementById("box_2");
userPwd = document.getElementById("box_3");
confPwd = document.getElementById("box_4");
... | true |
a12cf388813f23c8aa4b7272934cf4ff6ecdde34 | JavaScript | ioanachi/PlayThemes | /themePr/src/js/script.js | UTF-8 | 494 | 2.734375 | 3 | [] | no_license | // creating the $ variable from jquery
var $ = require("jquery");
// when document finished loading
$(document).ready(function() {
// jquery code on load here
//
// $('body').click(function(){
// $(this).css('background','red');
// });
//
//
// var b = $('body');
// function ce_sa_faca(){
// $(... | true |
0b19fb7f7a590527bc05d1689539a8331bbf20ce | JavaScript | mo3athBaioud/bluestome | /magnolia-core/src/main/resources/mgnl-resources/js-classes/mgnl/util/URLUtil.js | UTF-8 | 2,466 | 2.6875 | 3 | [] | no_license | /**
*
* Magnolia and its source-code is licensed under the LGPL.
* You may copy, adapt, and redistribute this file for commercial or non-commercial use.
* When copying, adapting, or redistributing this document in keeping with the guidelines above,
* you are required to provide proper attribution to obinary.
... | true |
50f364eab6aba1314b5be1c753690b5f073a98e5 | JavaScript | zarahz/account-management | /src/services/UpdateUserService.js | UTF-8 | 960 | 2.75 | 3 | [
"MIT"
] | permissive | // @flow
import ServiceConstants from '../constants/ServiceConstants';
import type { UserModel } from '../models/UserModel';
export default class UpdateUserService {
/**
* the api will receive a token for a changed user. if the user could be updated, a token is returned,
* otherwise an error message
* @pa... | true |
4bb9b5226066d00b27126acb1212d57a2eee5640 | JavaScript | mdlawrenceusa/et710_instructor | /MakeAnInteractiveWebsite/debugged.js | UTF-8 | 451 | 2.5625 | 3 | [] | no_license | //Correct Sample
var main = function() {
$(".dropdown-toggle").click(function() {
$(".dropdown-menu").toggle();
});
};
$(document).ready(main);
//To Be Debugged
var main = function() {
(".dropdown-toggle").click( {
(".dropdown-menu").toggle();
});
};
(document).ready(main);
//Debugged Code
var main ... | true |
2292b35574a027215f44e4db16d90f48344f24f9 | JavaScript | cosminstaicu/antheia | /src/Antheia/Scripts/JavaScript/message.js | UTF-8 | 2,627 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | /**
* Displays a message to the user. It will be displayed as a toast type popup
* on the bottom right side of the page (if no image is provided) or as a
* full screen text (if an image is provided)
* @param {String} message the text to be displayed
* @param {String} imageUrl (optional) url to an image if a f... | true |
b5c912d0d2698211795945d3aced1f3d62f8069b | JavaScript | mrkalpak/FMS_CPP | /js/index.js | UTF-8 | 634 | 2.65625 | 3 | [] | no_license | //For Sidenav
const openNav = () => {
document.getElementById('sidebar-container').style.width = "350px";
document.getElementById('close_btn').style.display = "block";
}
const closeNav = () => {
document.getElementById('sidebar-container').style.width = "0";
document.getElementById('close_btn').style.d... | true |
53cdcc69c50426f5911b01570f1575646c70deed | JavaScript | bruna-capistrano/chrome-extensions | /3 - collect id data from user/extension 3/options.js | UTF-8 | 586 | 2.84375 | 3 | [] | no_license | let button = document.getElementById('save_button');
button.addEventListener('click', function() {
var userToken = document.getElementById('user_token').value;
chrome.storage.local.get(["userToken"], function(result) {
if(userToken) {
chrome.storage.local.set({"userToken": userToken}, function() {
... | true |
54b23e391e825e6f36c842261d6d81f348cead6f | JavaScript | durganmcbroom/durganmcbroom.github.io | /frontend/src/static/js/Pong.js | UTF-8 | 4,725 | 3.46875 | 3 | [] | no_license | let context;
let ballClass;
let canvas;
let player1;
let player2;
let gameRunning = false;
export function startPong() {
canvas = document.getElementById("gameCanvas");
context = canvas.getContext("2d");
startRound();
update();
}
window.addEventListener("keydown", function(event) {
if (event.keyCod... | true |
949726113d73538873650b09fbf21a93722dbeb8 | JavaScript | ohkamanda/FreeCodeCamp | /Object Oriented and Functional Programming/05 - Waypoint.js | UTF-8 | 1,326 | 4.9375 | 5 | [
"MIT"
] | permissive | /*
Waypoint: Make Object Properties Private
Objects have their own attributes, called properties, and their own functions, called methods.
In the previous challenges, we used the this keyword to reference public properties of the current object.
***
We can also create private properties and private methods, which ar... | true |
52feb6a26936b3974c035a4ea8acd2ad81157168 | JavaScript | Anton2102/code.me | /NodeJs/15_Роутинг на файлах/1 задача/index.js | UTF-8 | 946 | 2.90625 | 3 | [] | no_license | // Пусть у нас есть какой-то файл с HTML страницей (с доктайпом, тегами head, body и тп). Разверните NodeJS сервер, который при обращении к любому URL будет отдавать эту HTML страницу.
'use strcit'
const fs = require('fs');
const http = require('http');
http.createServer( (request, response) => {
// console.log(req... | true |
2ee3189adf23a77f8323127742bcdaa3683fb52e | JavaScript | anaibol/client | /www/js/services/reverse-geocode.js | UTF-8 | 2,154 | 2.515625 | 3 | [] | no_license | app.factory('ReverseGeocode', function($window, $http, $ionicPlatform) {
// https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&location_type=ROOFTOP&result_type=street_address&key=API_KEY
// return {
// getAddress: function(lat, lng) {
// return $http.get('https://maps.googleap... | true |
6598ddb05ecdee3a527d375ccf88e10e25d7e000 | JavaScript | iiolavoii/SAP-Bulletin-Board | /sap.m.tutorial.testing.01/webapp/model/formatter.js | UTF-8 | 622 | 2.65625 | 3 | [] | no_license | sap.ui.define([], function () {
"use strict";
return {
/**
* Rounds the number unit value to 2 digits
*
* @public
* @param {string} sValue the number string to be rounded
* @returns {string} sValue with 2 digits rounded
*/
numberUnit: function (sValue) {
if (!sValue) {
return "";
}
... | true |
8b743653bb0ecb9b17e43c1efb8f8f1f179c07d9 | JavaScript | ddanailova/JavaScript-Fundamentals | /05_Functions Exs/07_TreasureLocator.js | UTF-8 | 1,274 | 3.546875 | 4 | [] | no_license | function findTreasure(input) {
let tonga = {bottX: 0, bottY: 8, topX: 2, topY: 6, name: "Tonga"};
let cook = {bottX: 4, bottY: 8, topX: 9, topY: 7, name: "Cook"};
let samoa = {bottX:5, bottY:6, topX:7, topY:3, name:"Samoa"};
let tuvalu = {bottX:1, bottY:3, topX:3, topY:1, name:"Tuvalu"};
let tokelau... | true |
54326a9d90fceef41505d941b66a5acefde92eed | JavaScript | Zwerd/react-native-projects | /LearningApp/Components/LearningComponent.js | UTF-8 | 14,025 | 2.65625 | 3 | [] | no_license | import React, { Component } from 'react'
import { AppRegistry, Text, Image, View, StyleSheet, TextInput, Button, Alert, TouchableOpacity, TouchableNativeFeedback, TouchableWithoutFeedback,TouchableHighlight, Platform,
ScrollView, FlatList, SectionList} from 'react-native'
export class HelloWorldApp extends Component {... | true |
2711c97191bf5d7b60570d0adbc80ed5f4c4f25b | JavaScript | williamlhelton/williamlhelton.github.io | /vetdata/main.js | UTF-8 | 3,664 | 3.265625 | 3 | [] | no_license | // Slideshow #1
// Variables for slideshow
var i = 0;
var time = 3000;
var runSlide;
// Variables for HTML elements
var bragHeader = document.getElementById("brag-header");
var bragText = document.getElementById("brag-text");
// Variables for box selectors
var boxID = document.getElementById("slideshow-buttons");
var... | true |
2d56b36427ede6bdf95fab693c7187392547916b | JavaScript | Bhalut/holbertonschool-higher_level_programming | /0x12-javascript-warm_up/10-factorial.js | UTF-8 | 252 | 3.6875 | 4 | [] | no_license | #!/usr/bin/node
// Computes and prints a factorial
const num = parseInt(process.argv.slice(2, 3)[0]);
function factorial (value) {
if (!value) {
return ('1');
} else {
return value * factorial(value - 1);
}
}
console.log(factorial(num));
| true |
418fc7e3bfe7ae4795114fcfc46a96e55666d1c9 | JavaScript | SFDC-Tools/Bolt | /src/bolt.js | UTF-8 | 8,711 | 2.765625 | 3 | [
"MIT"
] | permissive | window.Bolt = (function(R, $A){
return function(c, details){
/**
* [log checks for message and logs message to console]
* @author Rob Bruhn, rbruhn@gobyinc.com
* @date 2017-03-27T13:26:46-0600
* @param {[type]} message [message to be logged]
... | true |
f534917d5e5d91136612f5f4791b4dcf28739f22 | JavaScript | theohewett/Codecademy-Tasks | /Lodash/_.js | UTF-8 | 1,642 | 3.078125 | 3 | [] | no_license | const _ = {
clamp(num, lower, upper) {
var temp = Math.max(num, lower);
return Math.min(temp, upper);
},
inRange(num, start, end) {
if (end === undefined) {
end = start;
start = 0;
}
if (start > end) {
let temp = end;
end = start;
start = temp;
}
return ... | true |
939a09cb2bd0df612d8a3bc57f7de3aeb0a059f4 | JavaScript | AlexDM0/IPE | /simulator/js/agents/actuatorProxy.js | UTF-8 | 1,257 | 2.671875 | 3 | [] | no_license | /**
* This interacts with the actuator agent. The actuator can send messages into the mesh.
*
* @param id
* @constructor
*/
function ActuatorProxy(id) {
// execute super constructor
eve.Agent.call(this, id);
// extend the agent with RPC functionality
this.rpc = this.loadModule('rpc', this.rpcFunctions, {t... | true |
22f3f932fe67a5409a63a9d47b4fb068004fa775 | JavaScript | charizarrd/gcode-viewer-demo | /layer.js | UTF-8 | 509 | 2.828125 | 3 | [] | no_license | function Layer() {
this.extrusionPointIndexRanges = [];
this.travelPointIndexRanges = [];
this.height = -1;
};
Layer.prototype.addRangeStart = function(index, extrude) {
var range;
if (extrude)
range = this.extrusionPointIndexRanges;
else
range = this.travelPointIndexRanges;
range.push(index);
};
Layer.... | true |
8c016b15f9ae8011db5ef031ce8d4cf24b39935e | JavaScript | harryby1149/News-Scraper | /public/logic.js | UTF-8 | 830 | 2.640625 | 3 | [] | no_license | console.log("here's a page")
$(document).ready(function () {
console.log("page is loaded")
$("#scrape").on("click", function (event) {
event.preventDefault();
$.get("/scrape").then(function () {
console.log("scrape complete");
location.reload();
})
});
$(... | true |
0f7bf8f30d14c870593e1d0adef51341ce518af6 | JavaScript | kasperskei/test-work | /src/models/Product.js | UTF-8 | 400 | 2.65625 | 3 | [] | no_license |
/**
* @typedef {Object} Product
* @property {number} id
* @property {string} name
* @property {number} groupId
* @property {number} count
* @property {Object} price
*/
export default class Product {
constructor({
id,
name,
groupId,
count,
price,
}) {
this.id = id
this.name = name... | true |
ac899f710ee091a0813ab7d99485d5ad48386ec5 | JavaScript | ethicalapparel/ethiCAL-member-website | /client/src/Auth.js | UTF-8 | 859 | 2.515625 | 3 | [
"MIT"
] | permissive | import axios from 'axios';
const auth = {
authenticated: false,
knowAuth: false,
updateAuthentication(cb) {
axios.get('auth/authenticated')
.then((res) => {
this.authenticated = res.data.authenticated;
if (this.authenticated) {
this.username = res.data.name,
... | true |
dcf0a2f651bf8dfa50736129c662a493991d5ac3 | JavaScript | jamiepreston/genderGuesser | /test/testGenderGuesser.js | UTF-8 | 4,592 | 3.140625 | 3 | [] | no_license | const { genderise, constructQueryString, guessTitle } = require('../src/genderGuesser');
const { assert } = require('chai');
const nock = require('nock');
const nockMaleResponse = [{'name':'Thomas', 'gender':'male'}];
const nockFemaleResponse = [{'name':'Lily', 'gender':'female'}];
const nockLocalisedResponse = [{'nam... | true |
2fa86d41c29e5cdb1ecdbb85b05524b341fd6dd4 | JavaScript | MollyJeanB/PromptRobot | /server.js | UTF-8 | 789 | 2.609375 | 3 | [] | no_license | const express = require("express");
const app = express();
const axios = require("axios");
app.use(express.static("public"));
app.get("/words", (req, res) => {
const url = "https://wordsapiv1.p.mashape.com/words/";
const partOfSpeech = req.query.partOfSpeech;
axios({
method: "get",
url: url,
headers... | true |
fda5039f4f24a37e35045838ae1e622ad9e197ba | JavaScript | Preciousomonze/alc-book-meal | /server/models/order.model.js | UTF-8 | 476 | 2.6875 | 3 | [] | no_license | /* set date format and stuff */
const date = new Date();
const month = `${date.getMonth() + 1}`;
const today = `${date.getDate()}-${month.padStart}-${date.getFullYear()}`;// get DD-MM-YYYY
class Orders {
constructor() {
this.id = null;
this.customerId = null;
this.meal = [];
this.total = null;
t... | true |
71e0c531d794f927e6033ed936ebbd2147b06af4 | JavaScript | gthmb/solomon-bane | /tests/testfiles/utils.tests.js | UTF-8 | 3,096 | 2.9375 | 3 | [] | no_license | module("Utils Tests");
QUnit.test("Utils.bind", function( assert ) {
var foo = {
bar: true
}
function unbound(){
assert.notOk(this == foo);
}
var bound = Utils.bind(foo, function(){
assert.ok(this == foo);
});
unbound();
bound();
});
QUnit.test("Utils addClass/removeClass", function( assert ) {
var ... | true |
fc9cdf3bc0b328ed1875043f3b961d7958c69821 | JavaScript | feihonghui/meipet | /static/js/page/log/v1.js | UTF-8 | 1,197 | 2.6875 | 3 | [] | no_license | (function($){
$(function(){
var mobile = $('#mobile'),
password = $('#password'),
doLog = $('#do-log'),
message = $('#message'),
loginForm = $('.login-form'),
fromUrl = decodeURI(Meipet.urlTool.paramsToJSON()['from']);
if(fromUrl === 'undefined'){
fromUrl = '/';
}
var mobileRex = /^1[3|4|5|... | true |
0be00fa88614a006edcf3e58c6f1ea4577543588 | JavaScript | PabloChanivet/Solidity | /zombieFront.js | UTF-8 | 2,103 | 3.421875 | 3 | [] | no_license | // Así es como accederiamos a nuestro contrato:
var abi = /* abi generado por el compilador */
var ZombieFactoryContract = web3.eth.contract(abi)
var contractAddress = /* nuestra dirección del contrato en Ethereum después de implementarlo */
var ZombieFactory = ZombieFactoryContract.at(contractAddress)
// `ZombieFactor... | true |
6e7a25faf4b84b67692dc7cc7af634971673b4b2 | JavaScript | WillMonty/WillMonty.github.io | /330/projects/game/js/loader.js | UTF-8 | 2,904 | 2.53125 | 3 | [] | no_license | import { startManager, gameLoop } from './manager.js';
export { app };
WebFont.load({
custom: {
families: ['Edmunds'],
urls: ['./font/fonts.css']
}
});
let app = new PIXI.Application({
width: 256,
height: 256,
antialias: true,
transparent: false,
resolution: 1
});
app.rend... | true |
f34ab8a7d2083c81be21714530cf639f0b249041 | JavaScript | judeGibbons/jobs-feed-refactor | /js/jobsFeedModule.Objects.js | UTF-8 | 3,520 | 2.921875 | 3 | [] | no_license | var jobsFeedModule = jobsFeedModule || {};
jobsFeedModule.Objects = function () {
this.displayfeed = function(result) {
var newXmlObjectsArray = [];
if (!result.error) {
var items = result.xmlDocument.getElementsByTagName('item');
//set up objects based on xml items
function xmlObject(title,link,... | true |
4ae9bd46ca276c355254f7750a20544cc978ac9d | JavaScript | millernj/note-taker | /routes/api.js | UTF-8 | 514 | 2.515625 | 3 | [
"MIT"
] | permissive | const { Router } = require('express');
const notes = require('../db/db.json');
const router = Router();
router.get('/notes', (req, res) => {
res.json(notes);
})
router.post('/notes', (req, res) => {
const { body } = req;
body.id = notes.length + 1;
notes.push(body);
res.send(true);
})
router.de... | true |
db77925d3b7e2f102455fec97295120e8661c38e | JavaScript | kikilohioo/e-mercado | /js/login.js | UTF-8 | 896 | 2.953125 | 3 | [] | no_license | let USERS_URL = "https://kikilohioo.github.io/e-mercado/users.json";
let mistorage = window.localStorage;
/* INICIO DE SESION CON GOOGLE */
function onSignIn(googleUser){
var profile = googleUser.getBasicProfile();
mistorage.setItem('username', profile.getName());
window.location.href = "inicio.html";
}
... | true |
119b7c4265f618e3a1e5b5ef4504c16cfe9d7e3f | JavaScript | Nsudeep/dhis2-chrome | /src/test/unit/js/app/transformers/to.tree.spec.js | UTF-8 | 2,685 | 2.78125 | 3 | [] | no_license | define(["toTree"], function(toTree) {
describe("to tree", function() {
var getOrgUnit, expectedOrgUnitTree, allOrgUnits, child1, child2;
beforeEach(function() {
getOrgUnit = function(id, name, level, parent) {
return {
'id': id,
'n... | true |
80f5ab7fa9ef195e6ba9ef31e76a7adffe2fc6e9 | JavaScript | Skydaw/Montecaos | /www/src/components/admin/Modifarticle.jsx | UTF-8 | 3,740 | 2.53125 | 3 | [] | no_license | import React, { useState, useEffect, useContext } from 'react'
import { useRouteMatch} from 'react-router-dom'
import axios from 'axios'
import { UserContext } from '../../js/UserContext'
const url = "http://localhost:5000/api/blog"
const Modifarticle = () => {
const[title,setTitle]=useState("")
const[bod... | true |
ddbb065d9da489c45c2f294d2114d21b1b8fb035 | JavaScript | walzer85/ACA311-Final-Project-Try2 | /friends-with-bands/client/src/components/MusicianList.js | UTF-8 | 1,088 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import MusicianListContainer from '../containers/MusicianListContainer';
class MusicianList extends Component {
constructor(props) {
super(props);
}
componentWillMount() {
this.props.musiciansLoaded
}
// reading ab... | true |
10004213418a141b761b36cc770e045ffc3121dd | JavaScript | andthengoto10/Free-Robin-Hood | /js/index.js | UTF-8 | 165 | 2.515625 | 3 | [] | no_license | function myFunction() {
var robinField = document.getElementById("robinField");
var robin = document.getElementById("robin");
robin.appendChild(robinField);
}
| true |
73c80e62f8157b3fc55cdfa5477c35ea303a2ba2 | JavaScript | Zahidsqldba07/programming-challenge-solution-in-js | /leetcode/algorithms/667-beautiful-arrangement-ii.js | UTF-8 | 379 | 3.234375 | 3 | [] | no_license | /*
LeetCode > Beautiful Arrangement II
Tags: array
*/
/**
* @param {number} n
* @param {number} k
* @return {number[]}
*/
var constructArray = function (n, k) {
const res = [];
let from = 1;
let to = k + 1;
while (from <= to) {
res.push(from++);
from <= to && res.push(to--);
}
for (let i = k ... | true |
946d28a636cd3f696f62b761e6347bc75b86ed46 | JavaScript | Badjeck/javaaAAAAAA | /cour5/DOM/script.js | UTF-8 | 1,756 | 3.59375 | 4 | [] | no_license | 'use strict';
/* // Utilisez les méthodes text, html, val, attr pour travailler avec le HTML suivant.
const h1text = $('h1').text();
console.log('h1text', h1text);
// Récupérez et logguez dans la console le contenu du titre de la page.
$('h1').text('My page title');
const articleHTML = $("#js-article").html... | true |
94b2f34d79fb7ce057f914bdf64539c3c3304a80 | JavaScript | lucy-3/photoGram | /validation/post.js | UTF-8 | 600 | 2.78125 | 3 | [] | no_license | const Validator = require("validator");
const isEmpty = require("./isEmpty");
module.exports = function validatePostInput(data) {
let errors = {};
//Check if user uploaded photo - may need to keep commented until we know how to upload photos
if (!Validator.isLength(data.caption, { max: 300 })) {
errors.ca... | true |
653a433434eaea86ef3cc2b6f2fe65265140e9e8 | JavaScript | RenatoMAlves/AnimaSom-Game | /.history/animaSom/js/play_20170531210933.js | UTF-8 | 1,181 | 2.515625 | 3 | [
"MIT"
] | permissive | var playState = {
create: function(){
var background = game.add.sprite(0, 0, 'cidade');
background.width = 1300;
background.height = 650;
graphics = game.add.graphics(0, 0);
groupCidade = game.add.group();
var x = 100;
for (var i = 0; i < 3; i++){
... | true |
92da8dddb68bed4a52cd4668b647dec685511cc5 | JavaScript | emuren/sfwars | /[content][dota_addons][sfwars]/panorama/scripts/custom_game/sfwars_scoreboard.js | UTF-8 | 694 | 2.578125 | 3 | [] | no_license | "use strict";
function UpdateTimer( data )
{
var timerValue = Game.GetDOTATime(false,false);
var sec = Math.floor( timerValue % 60 );
var min = Math.floor( timerValue / 60 );
var timerText = "";
if ( min < 10 )
{
timerText += "0";
}
timerText += min;
timerText += ":";
if ( sec < 10 )
{
timerText += "0"... | true |
1570790d1c6f0caea60f14e6f5f4d9420c194726 | JavaScript | ntenhue/NovaCal | /monthView/js/AskGoogle.js | UTF-8 | 1,096 | 2.546875 | 3 | [] | no_license |
function AskGoogle(calendarModel) {
this.calendarsList = function() {
this.request = gapi.client.calendar.calendarList.list();
this.request.execute(function(resp) {
console.log("received calendars list:", resp);
calendarModel.addCalendars(resp.items);
});
}
this.calendarsEventsList = function(c... | true |
8df1c058e571d8e136b69b5aab951704f0372e6a | JavaScript | ryansims265/trainScheduler | /script.js | UTF-8 | 4,100 | 3.484375 | 3 | [] | no_license | //First console log just to test that the JS file is linked correctly
console.log("Waiting for Submission");
//Set up a timer to display the current time to the user and update every second
setInterval(function(){
var currentTime = moment().format("HH:MM A");
$("#currentTime").html("Current Time: " + currentTime... | true |
fcd9d42c984ece8918b5bc561124209e7ab354e2 | JavaScript | BarinovVV/JS5 | /Lesson_15/js/scriptlesson.js | UTF-8 | 2,149 | 3.578125 | 4 | [] | no_license | window.addEventListener('DOMContentLoaded', function() {
'use strict';
let lesson = document.querySelector('h2'),
title = document.querySelector('title'),
myBody = document.querySelector('body');
lesson.textContent = 'Домашнее задание Урок № 15';
title.textContent = 'Lesson 15';
le... | true |
91b0e25703f849f3d0ef0210cd59c614fd06b871 | JavaScript | limeandcoconut/rubricjs | /test/entity-manager-tests.js | UTF-8 | 19,161 | 2.765625 | 3 | [
"MIT"
] | permissive | /* eslint-env mocha, es6 */
const EntityManager = require('../dist/entity-manager.js')
const expect = require('chai').expect
const auid = require('alphastring')
function createComponentClass() {
let componentName = auid()
let propertyName = auid()
/* eslint-disable max-len, no-new-func */
return Funct... | true |
53360b9e142940d38fba8ec259faaf1cc441bcc7 | JavaScript | animateJoke/javascript | /mock.js学习demo/Mock.js | UTF-8 | 2,096 | 2.828125 | 3 | [] | no_license | require(["config"],function(){
require(["mock"],function(Mock){
//模拟自定义对象
var data = Mock.mock({
"list|2-3":23,
"name|1":"@cname",
"age|1-88":100
})
console.log(JSON.stringify(data,null,4));
//模拟ajax请求
var data1 = Mock.mock("http://... | true |
909e3e81cb78fd563ddba4f8798123ad846598c1 | JavaScript | gormanucharyan/Intro_to_CS_Saro_HW2 | /task3_4.js | UTF-8 | 233 | 3.71875 | 4 | [] | no_license | let x1 = 4;
let y1 = 5;
let x2 = 16;
let y2 = 8;
let distance = Math.sqrt((x1-x2)**2 + (y1 -y2)**2);
console.log("The length of the line from "+ "( "+ x1 + "," + y1 + " ) " + " to " + "( "+ x2 + "," + y2 + " ) " + " is " + distance); | true |
f991badf7ff2c377169ada3c0bcf28bf2d8ef353 | JavaScript | dowookims/WebDev | /Part 3. node.js/Quest 12. AJAX/skeleton/client/notepad.js | UTF-8 | 5,505 | 3.078125 | 3 | [
"MIT"
] | permissive | class Notepad {
/* TODO: 그 외에 또 어떤 클래스와 메소드가 정의되어야 할까요? */
constructor(){
this.tabs = [];
this.currentTab = null;
this._prepareDOM();
this._customEventHandler();
this.serverUrl = 'http://127.0.0.1:8080'
}
_prepareDOM(){
const app = document.getElementById('app');
const iconDiv = document.querySelecto... | true |
c5ac1848d86efedec74c8755c94c1b0aaeb301f8 | JavaScript | bigyank/ant-smasher | /javascript/main.js | UTF-8 | 1,754 | 3.546875 | 4 | [] | no_license | /**
* SEE contants.js for particle values
* SEE canvas.js for canvas properties
* SEE Particle.js for Particle Class
* SEE Utility.js for utility functions
* SEE collision.js for collision detection and direction change
*/
// particle container
let particles = [];
let score = 0;
// create particles with given v... | true |
68126a68eaed5fddc593ca1cb9061c83512ec5eb | JavaScript | mani-rsg/Redux-template-generator-React | /generators/reactWithRedux.js | UTF-8 | 3,292 | 2.640625 | 3 | [] | no_license | const fs = require('fs');
const fsPromises = require('fs/promises');
const ora = require('ora');
const chalk = require('chalk');
const { SRC_ARR, ACTION_ARR, REDUCER_ARR } = require('./templates/reduxTemplates');
const { createApp } = require('./utils/helper');
const createTemplate = (path, filesArr, spinnerText) => {... | true |
a56fcedd135b8c491eb9c551e3c5705017bc561b | JavaScript | InkPi/rpgGame | /src/app.js | UTF-8 | 9,206 | 2.96875 | 3 | [] | no_license | /*
All Images are borrowed from the internet. I do not own any of them.
*/
$(document).ready(() => {
const $landing = $('.landing'); // put in var to save memory
const $fighting = $('.fighting');
const $mapEx = $('.mapEx');
$landing.show();
$fighting.hide();
$mapEx.hide();
$('#buttonS').on('click', ... | true |
8d5029890aa867476f6594c76cee85f936cd38c8 | JavaScript | dominictarr/pull-throttle | /test/index.js | UTF-8 | 1,368 | 2.71875 | 3 | [
"MIT"
] | permissive |
var tape = require('tape')
var pull = require('pull-stream')
var Throttle = require('../')
function Time () {
var ts = 0
return function (abort, cb) {
if(abort) return cb(abort)
var _ts = Date.now()
if(_ts != ts)
cb(null, ts = _ts)
else
setTimeout(function () {
cb(null, ts = Da... | true |