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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
660d0bb92a4d469e99fd8dcbdd6bf9a3efcc6e33 | JavaScript | lingfly/note | /前端/js/test.js | UTF-8 | 415 | 3.171875 | 3 | [] | no_license | var html = document.getElementsByTagName("html")[0]
console.log(html);
console.log(html.nodeType == Node.ELEMENT_NODE);
console.log(html.nodeType == Node.DOCUMENT_NODE);
console.log("name: "+html.nodeName+", type: "+html.nodeType+", value: "+html.nodeValue);
var nlist = html.childNodes;
console.log(nlist);
console.l... | true |
2fb9d1b78dc0ae2ad7fc7db526737b9ac8bd9f3a | JavaScript | LordKriegan/team3j | /public/assets/js/admin/news.js | UTF-8 | 1,985 | 2.84375 | 3 | [] | no_license | window.onload = function () {
axios
.get("/api/news")
.then(function (response) {
var newsFeed = response.data;
console.log(newsFeed);
for (var i = 0; i < newsFeed.length; i++) {
var newDiv = $("<div>");
var newP = $("<p>");
... | true |
4f441984cea818e54b93c04896fa16fc6b3c8d05 | JavaScript | peerhenry/reactable | /src/flux/stores/CommentStore.js | UTF-8 | 726 | 2.5625 | 3 | [] | no_license | import { EventEmitter } from "events";
import commentsDispatcher from "dispatchers/CommentsDispatcher"
class CommentStore extends EventEmitter{
constructor(){
super();
}
// Actions
handleAction(action){
switch(action.type){
case "ACTIVATE_COMMENT_FRAME":
this.activateCommentFrame();
... | true |
cb9786300cc39d90788a0a1215d23e5d77a1b0aa | JavaScript | JhullRondon/Cuaderno-de-notas | /javascript/fundamentos/clase5.js | UTF-8 | 777 | 4.46875 | 4 | [] | no_license |
function printAge(persona) {
console.log(`${persona.nombre} ${persona.apellido} tiene ${persona.edad} años`)
}
// para invocar en una funcion solo ciertos atributos de un objeto usamos la siguiente definicion
function printAge2({ nombre }) {
console.log(`${nombre} es lo mejor!`)
}
/*para declarar var... | true |
fb8d91c57d3a5729c71c185ae4d8f817df41ade3 | JavaScript | Patabu2/d3_bar_chart_energy | /js/main.js | UTF-8 | 7,984 | 2.828125 | 3 | [
"MIT"
] | permissive | /*
Horizontal bar chart
*/
var svgHeight = 500,
svgWidth = 960;
var margin = {
left:150,
right:10,
top:50,
bottom:100
};
// Define width and height of the cahrt
var height = svgHeight - margin["top"] - margin["bottom"],
width = svgWidth - margin["right"] - margin["left"];
var svg = d3.selec... | true |
57fb2d325ee2075fe18f2a7d2f285cb79ed14ab8 | JavaScript | emveleva/Programming-Basics-JS | /Exam - 2 - April 2019/2easterParty.js | UTF-8 | 865 | 3.359375 | 3 | [] | no_license | function solve(input){
let guestCount = Number(input.shift());
let couvertPerPerson = Number(input.shift());
let budget = Number(input.shift());
if(guestCount >= 10 && guestCount <= 15) {
couvertPerPerson = couvertPerPerson - couvertPerPerson*0.15;
} else if (guestCount > 15 && guestCount <... | true |
01bb70e6950f17d1477fce8317244ec4b24f1c8e | JavaScript | icely450050766/blog | /like-koa2/index.js | UTF-8 | 1,809 | 2.59375 | 3 | [] | no_license | const http = require('http')
// 组合中间件
function compose(middlewareList) {
return function (ctx) {
// 中间件调用
function dispatch(i) {
const fn = middlewareList[i]
try {
// 每个中间件是一个async函数,返回的是一个promise
return Promise.resolve(
... | true |
53f4489afdf7d9bb5b4703607b79475abef9bc0a | JavaScript | SebastianSutkowski/to_do_react | /src/content/AddTask.js | UTF-8 | 2,048 | 2.828125 | 3 | [] | no_license | import React, { Component } from 'react';
class AddTask extends Component {
state = {
task: "",
accepted: false,
date: `${(new Date()).getFullYear()}-${(((new Date()).getMonth() + 1) > 9 ? ((new Date()).getMonth() + 1) : ("0" + ((new Date()).getMonth() + 1)))}-${(new Date()).getDate()}`
}
han... | true |
ef1b8f9a00468261cccba89224b0d98fe60849c0 | JavaScript | IsuruMaduranga/SupplyChainManagementSystem-Semester4 | /middleware/auth.js | UTF-8 | 403 | 2.515625 | 3 | [] | no_license | const jwt = require('jsonwebtoken');
function auth(req,res,next){
const token = req.header('x-auth-token');
if(!token) return res.status(401).send('Access denied. No token provided!');
try{
const payload = jwt.verify(token,'privateKey');
req.user = payload;
next();
}catch(e)... | true |
7127e2e662c7c265c81420b799a9f1d32937d901 | JavaScript | gyula-ny/see-all-tabs | /App/App.js | UTF-8 | 16,715 | 2.6875 | 3 | [] | no_license | import {
INCOGNITO_IMAGE,
MUTED_SPEAKER,
SPEAKER,
ARROW_DOWN,
ARROW_UP,
ENTER_KEY,
ARROW_LEFT,
ARROW_RIGHT,
CLOSE_BUTTON
} from './consts.js';
const App = {
currentWindowId: null,
windowCounter: 0,
listOfTabs: [],
highlightedTab: -1,
isInFilterMode: false,
filteredResultsLengt... | true |
a6e50de659c58df413697383f74825595d2898b2 | JavaScript | MonMaramba/JavaScript-Algorithms-and-Data-Structures | /SortingAlgorithms/bubbleSort/bubbleSortComparator.js | UTF-8 | 1,227 | 4.59375 | 5 | [] | no_license | // BUBBLE SORT COMPARATOR
// Implement a function called bubbleSort. Given an array, bubbleSort will sort the values in the array. The function takes 2 parameters: an array and an optional comparator function.
// The comparator function is a callback that will take two values from the array to be compared. The function... | true |
d7aea38df1b8dfe94b3c2f963112ef2368ec7195 | JavaScript | KawayAlpaka/lession | /nodejs/stream/copy.js | UTF-8 | 1,388 | 2.84375 | 3 | [] | no_license | var fs = require('fs')
var path = require('path')
// 开始监控内存
var memeye = require('memeye')
memeye();
// 将拷贝操作封装到一个函数中
function copy() {
var fileName1 = path.resolve(__dirname, 'data/data.txt');
var fileName2 = path.resolve(__dirname, 'data/data-bak.txt')
// 这里自行补充上文的拷贝代码
// // 测试一,使用 readFile 和 writeFile 编写的拷... | true |
6bdcafbb346b02520413328982ddfb153091cffd | JavaScript | ziakhan124/nm_fullstack_project | /utils/validate_title.js | UTF-8 | 927 | 3.453125 | 3 | [
"MIT"
] | permissive | 'use strict';
/* ============================ PUBLIC METHODS ============================= */
/** Validate movie titles
* A valid title should
* 1. Be a string
* 2. Consist of at least 1 alphanumeric character
* 3. Optionally contain single spaces between words
* 4. Optionally contain surrounding do... | true |
b065ceed0e10b98e4185f7b815715885036b8de4 | JavaScript | Amr-rgb/grow_landing-page | /js/main.js | UTF-8 | 214 | 2.515625 | 3 | [] | no_license | const nav = document.getElementById('nav')
const menuBtn = document.getElementById('menuBtn')
menuBtn.addEventListener('click', () => {
nav.classList.toggle('close-nav')
nav.classList.toggle('open-nav')
}) | true |
c13a036f918ef711f61555f84bdea2d7373f3400 | JavaScript | ozanm/GOLrev_5_JS | /Timer.js | UTF-8 | 281 | 2.921875 | 3 | [] | no_license | class Timer {
constructor(tempTotalTime) {
this.totalTime = tempTotalTime;
this.startTime = 0;
}
start() {
this.startTime = millis();
}
isFinished() {
return millis() - this.startTime > this.totalTime;
}
setTime(t) {
this.totalTime = t;
}
}
| true |
10241b61a529c79efd3f14ddd2f5ff981a616b18 | JavaScript | WebAhead7/dr-workout-app | /src/pages/Workout.js | UTF-8 | 2,572 | 2.609375 | 3 | [] | no_license | import React from "react";
import { useParams } from "react-router-dom";
import { getWorkouts } from "../utils/getData";
import "./styles/workouts.css";
import CricyleCounter from "../components/CircyleCounter";
function Workout() {
const [workouts, setWorkouts] = React.useState(null);
const [workoutIndex, setWork... | true |
a818c4553f323ef4a311177b74ec6f1b557277bc | JavaScript | kikupiku/to-do-list | /src/task.js | UTF-8 | 225 | 2.609375 | 3 | [] | no_license | //to determine the functionality of creating tasks
let taskFactory = (title, description, deadline, urgency) => {
urgency = Number(urgency);
return { title, description, deadline, urgency };
};
export { taskFactory };
| true |
75734fd0897ab4f4ef56603069ec48e4836e8a16 | JavaScript | SouVangLee/PracticeProblems | /9_15_2021/reverseWordsInString.js | UTF-8 | 386 | 3.515625 | 4 | [] | no_license | function reverseWordsInString(string) {
let chars = string.split('');
let result = [];
let currentStr = "";
for (let i = 0; i < chars.length; i++) {
if (chars[i] !== " ") {
currentStr += chars[i];
} else {
if (currentStr !== "") result.unshift(currentStr);
currentStr = "";
result.unshift(chars[i]);... | true |
5d68a470411f577ff8b5315d9645948ae0e5179e | JavaScript | zzhuangqian/ReactDianShang | /src/util/mm.jsx | UTF-8 | 1,919 | 2.734375 | 3 | [] | no_license | export default class MUtil{
request(params){
return new Promise((resolve,reject) =>{
$.ajax({
type:params.type || 'get',
url:params.url|| '',
dataType:params.dataType|| 'json',
data:params.data || null,
success:res => {
if(0... | true |
9385f917cd2004fc75fa1f7b1eae772325f80391 | JavaScript | ldunbar/tic-tac-toe | /tic-tac-toe.js | UTF-8 | 3,440 | 4.125 | 4 | [] | no_license | /**
* Logic to play Tic-Tac-Toe
*/
var whoIsNext = 'X' // "X" always starts
var turnNbr = 0 // No one has taken a turn yet
var winningPlayer = '' // No winner yet
// Set the possible winning positions. The arrays contain the element
// IDs for the player's moves that represent a winning position.... | true |
72d6365f95e7fab817591a03edf92a31f98b1fb7 | JavaScript | ChristopherALee/MERN-stack-practice | /net-ninja-nodejs/stream.js | UTF-8 | 544 | 2.796875 | 3 | [] | no_license | const http = require("http");
const fs = require("fs");
// will send chunk package numbers
const myReadStream = fs.createReadStream(`${__dirname}/readMe.txt`);
const myWriteStream = fs.createWriteStream(`${__dirname}/writeMe.txt`);
// will send chunks with actual file contents
// const myReadStream = fs.createReadStr... | true |
ae4a16c662233ba227616af43b975808528ac840 | JavaScript | fr33r/reactbook | /chapter_5/chapter-5-react-app/src/components/Ingredient.js | UTF-8 | 447 | 2.515625 | 3 | [] | no_license | import React from 'react'
/*
* The Ingredient component is responsible for representing a single
* ingredient within a recipe.
*/
class Ingredient extends React.Component {
render () {
let { amount, measurement, name } = this.props;
return (
<li>
<span className="amount">{amount}</span>
<span classN... | true |
d4fba109f171b0525a949f6eba4043729ce9b6a1 | JavaScript | fire888/forest | /src/Space/Ui.js | UTF-8 | 1,675 | 2.71875 | 3 | [
"Beerware"
] | permissive |
var messages = {
'1': 'Привет, бродяга.',
'2': 'Заблудился в лесу? Мож встретится кто, покажет дорогу.',
'3': 'Кажется кто-то идет.',
'4': 'Опасный зверь - КОЛОБОК.',
'5': '- Предлагаю сыграть в игру. У меня есть фото моих друзей.',
'6': '- Ну что ж, до встречи...',
}
export default function ... | true |
974f3a32a6937714f7b52ade361b802cf5946255 | JavaScript | ljack/apimoon | /apimoon/private/left-code.js | UTF-8 | 404 | 2.625 | 3 | [] | no_license | let customerID = httpRequest.param.id;
var query = `
query getCustomerInfo { customer( id: "customerID" ) {
id
name
}
} `;
graphql(schema, query).then(result => {
//send response back to the HTTP caller
// some additional mapping from result -> result can be made here. E.g. when the caller expects certa... | true |
6309115950c1fb616368f262157d148e2355bf9d | JavaScript | Link-s-Lights/grace-shopper | /server/db/models/orderProducts.js | UTF-8 | 1,580 | 2.6875 | 3 | [
"MIT"
] | permissive | const Sequelize = require('sequelize')
const db = require('../db')
const Product = require('./products')
const {convertToDollars, convertToPennies} = require('./utility')
const OrderProduct = db.define('orderProduct', {
qty: {
type: Sequelize.INTEGER,
defaultValue: 1
},
subtotal: {
type: Sequelize.IN... | true |
e25e66eec1a8aec8a6a3d9f475c6c28eadf9404d | JavaScript | jhorback/AppJs | /AppJs.UI/Scripts/bbext/binders/templateBinder.js | UTF-8 | 3,560 | 2.625 | 3 | [] | no_license |
// viewRenderer
// creates a view with the viewFactory
// allows for the model properties on the view to
// be a callback or a promise or a callback that returns a promise
// waits for the promise then calls render on the view.
module("bbext").register("viewRenderer",
["viewFactory", "$",
function (viewFactory,... | true |
cd5758130c53d8b8a302a07630e4859f3ae7cde8 | JavaScript | TunaFregno/Shopping-Cart | /src/store/index.js | UTF-8 | 799 | 2.515625 | 3 | [] | no_license |
import { createStore } from 'redux';
//import { combineReducers } from 'redux';
const initialState = {
title: 'Loding...',
token: '',
cart: []
}
/* const rootReducer = combineReducers({
}) */
const reducer = (state=initialState, action) => {
console.log('hello im in reducer');
const newSt... | true |
c733851247730d92f4eca550730450c4108c989c | JavaScript | BoburbekBaxrombekov/Exam-4 | /script.js | UTF-8 | 4,079 | 3.140625 | 3 | [] | no_license | const userList = document.getElementById("listUsers")
const postList = document.getElementById("listPosts")
const commentList = document.getElementById("listComments")
const TEMPLATE__USER = document.getElementById("temUser").content
const TEMPLATE__POST = document.getElementById("temPost").content
const TEMPLATE__COM... | true |
4346feaceb7b1f1163544b65bcc1fe8a527d54a2 | JavaScript | probees/web_audio_dsp | /Study/web-audio-samples-gh-pages/audio-worklet/src/noisegate-audio-worklet.js | UTF-8 | 7,940 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | true |
d37b0d717f9734b1b992b9a8afa05f2c9a047ac7 | JavaScript | mariamjesus/sintaxisJavaScript | /SINTAXIS_UNIT3/js/ejer7fechas.js | UTF-8 | 305 | 2.875 | 3 | [] | no_license | function navidad(){
// fecha actual
var fechaActual= new Date();
//fecha navidad
var fechaNav= new Date(2019,11,25);
var dias=fechaNav -fechaActual;// resto las fechas
dias=dias/(1000*60*60*24); //pasar a dias
document.write("faltan " + Math.ceil(dias) + " para navidad!!");
}//end function
navidad();
| true |
504f7483790a57c2a33ac24480fe7ada6db04ba5 | JavaScript | helenmedrano/react-template | /core/services/api_service.js | UTF-8 | 1,751 | 2.765625 | 3 | [
"MIT"
] | permissive | import url from 'url'
/**
* ApiService contains all functions used to make requests to the backend. It also
* contains helper functions that are used to help make web requests less verbose
*/
class ApiService {
getJson(endpoint, json = {}) {
return this.requestJson('GET', endpoint, { query: json })
}
pos... | true |
d32585b74752bdacf09b61cd155f0631851d6e04 | JavaScript | shelleydogra/totallypolishednailsalon | /js/generic_script.js | UTF-8 | 286 | 2.921875 | 3 | [] | no_license | (function(){
'use strict';
document.addEventListener('DOMContentLoaded', function() {
var cy = document.getElementById('current-year');
var date = new Date();
var year = date.getFullYear()
cy.innerHTML = year;
});
})(); | true |
605dd9d89e62c01ac660df27b831c946e1a5e717 | JavaScript | Johnhong9527/Data-Structures-and-Algorithms | /introductionToJavaScript/conditionalStatements.js | UTF-8 | 360 | 3.890625 | 4 | [] | no_license | /*条件语句*/
/*if...else*/
/*三元操作符*/
let num = 2;
console.log((num == 1) ? num-- : num++) // 2
/*switch*/
let month = 5;
switch (month) {
case 1:
console.log(1);
break;
case 2 :
console.log(2);
break;
case 3:
console.log(3);
break;
case 4:
console.log(4);
break;
case 5:
consol... | true |
7a5fbffc2a7a299becee2b1f10e0c0fb619dcbe1 | JavaScript | sleshJdev/fullcontact | /src/main/webapp/js/letters-script.js | UTF-8 | 1,286 | 3.0625 | 3 | [] | no_license | var selectAllContactsButton = null;
window.onload = function() {
selectAllContactsButton = document.getElementById("select-all");
selectAllContactsButton.setAttribute("onclick", "selectAllListener(true);");
document.getElementById("delete-emails-form").setAttribute("onsubmit", "return deleteLettersListener();");
... | true |
27412a327b5ea22e6e6ee2d016f57054b8433aed | JavaScript | ARKielley/js-basics-online-shopping-lab-bootcamp-prep-000 | /index.js | UTF-8 | 1,595 | 3.484375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | var cart = [];
function getCart() {
return cart;
}
function setCart(c) {
cart = c;
return cart;
}
function randomPrice() {
let int = Math.floor(Math.random() * 100);
return int;
}
function addToCart(item) {
let rand = randomPrice();
let name = {itemName: item};
let price = {itemPrice: rand};
let ex... | true |
08b26da9ab6c3968f02c197e0753172cc7bf025d | JavaScript | dominuskernel/school-environment | /scripts/recordatory.js | UTF-8 | 889 | 3.453125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
$(document).ready(function(){
var name = "Lydia";
var surname = "Garcia";
var age = "28";
var countries = ['Spain', 'I... | true |
d4e733eb54ad2c6a137d4c3cfb22bbf807ebfcf4 | JavaScript | C0de4TheWin/BAMAZON-APP | /bamazonCustomer.js | UTF-8 | 1,885 | 2.890625 | 3 | [] | no_license | var mysql = require("mysql");
//tried to integrate a new package
//var cTable = require('console.table');
var inquirer = require("inquirer");
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "root",
password: "password",
database: "bamazon_db"
});
connection.conne... | true |
58bec766753e31d2a91b5f629a68471e0539633a | JavaScript | pouretrebelle/overlap.show | /src/utils/numberUtils.js | UTF-8 | 442 | 3.109375 | 3 | [] | no_license | export const randomMax = (max) => (
Math.random()*max
);
export const randomMinMax = (min, max) => (
min+Math.random()*(max-min)
);
export const randomZerodInt = (max) => (
Math.floor(Math.random()*max)
);
export const getOneOf = (list) => (
list[randomZerodInt(list.length)]
);
export const clamp = (val, mi... | true |
89e3c9e8959198780af59ccb3f46c17fe18a97ce | JavaScript | tcsehv/jquery-password-requirement-checker | /src/js/jquery.password-requirements-checker.js | UTF-8 | 6,379 | 2.53125 | 3 | [
"MIT"
] | permissive | (function ($, window, document, undefined) {
"use strict";
// Create the defaults once
var pluginName = "passwordRequirements",
defaults = {
minAmounts: {
"upperCase": 1,
"lowerCase": 1,
"numbers": 1,
"specialChars": 1
... | true |
2ead05bb6b2b6e18238db1154176f85c2c3ff2f9 | JavaScript | tskittles/PetesMemoryPalace | /client/components/ImageView.jsx | UTF-8 | 1,263 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react'
import { render } from 'react-dom'
// import { Link } from 'react-router-dom'
import NodeListAPI from '../NodeList'
import NodeDescription from './NodeDescription'
class ImageView extends Component {
// Note to self: this will probably be a param off of the "PalaceList" route :... | true |
5235e52a52b2dc4fadaaf11dac7743c195eddea2 | JavaScript | VitaliiMelnychukDev/vanilla-javascript | /es-2015 and higher/objects.js | UTF-8 | 933 | 3.828125 | 4 | [
"MIT"
] | permissive | //Object.setPrototypeOf(obj, proto) - you can set prototype of objecin es6.
let car = {
make: "Honda"
};
let details = {
model: "Civic",
fuel: "gas"
};
Object.assign(car, details);
console.log(car); //{ make: 'Honda', model: 'Civic', fuel: 'gas' }
let make = "BMW", model = "X6";
let BMWCar = {
make... | true |
6ed6b98168b9ed3faf63d2e23d93d69fbae2fbb6 | JavaScript | Felichz/ecommerce-jap | /js/register.js | UTF-8 | 2,261 | 2.8125 | 3 | [] | no_license | const domElements = {
form: 'form.signin',
submitButton: 'button[type="submit"]',
emailInput: 'input[name="email"]',
pwdInput: 'input[name="password"]',
errorElement: '#error-element',
loader: '.loader',
inputs: 'input[]',
};
const errorMessages = {
'auth/invalid-email': 'Email inválido... | true |
55c78677e6dc1da2d5c07d3b032266051ced4120 | JavaScript | rdmagm062699/node_js_primes | /src/primeFactors.js | UTF-8 | 414 | 3.015625 | 3 | [] | no_license |
module.exports = {
generate: function(number) {
primes = []
prime = 2
while (prime < number)
{
while (number % prime == 0)
{
primes.push(prime)
number = number / prime
}
prime++
}
... | true |
842e36b0460c89ec20602af49e73fb32ac9c1495 | JavaScript | VuagnouxBenjamin/cafe.com-cda20229 | /public/assets/js/prod_list.js | UTF-8 | 372 | 2.515625 | 3 | [] | no_license | function showSidebar() {
document.querySelector("#prod-filter-container").style.left = "0px";
}
function hideSidebar() {
document.querySelector("#prod-filter-container").style.left = "-200vw";
}
document.querySelector(".show-filter-btn").addEventListener("click", showSidebar);
document.querySelector("#prod-f... | true |
ee29fa57b503936c9a78ed4619432b7fccd170e2 | JavaScript | dev-coco/Facebook-Script | /Auto-Scroll/Auto-Scroll.js | UTF-8 | 236 | 2.546875 | 3 | [
"MIT"
] | permissive | if (enbledscroll == '1') {
var enbledscroll = 0;
clearInterval(autoscroll);
} else {
var enbledscroll = 1;
var autoscroll = setInterval(function() {
window.scrollTo(0, document.body.scrollHeight)
}, 1000);
}
| true |
6e8957cf16500967922e959c48cc144dbf8475dd | JavaScript | oeblaauw/bachelor2015 | /js/editor.js | UTF-8 | 26,371 | 3.09375 | 3 | [] | no_license | /**
*
* @type fabric.Canvas
* @description Javascript code for the editor
* @author Oeyvind Blaauw & Frederik Borgersen
* @copy Oeyvind Blaauw & Frederik Borgersen - 2015
* @version 1.0
*/
//Declaring and initializing variables
//Canvas objects
var canvas = new fabric.Canvas('canvas', {selection: false, width... | true |
caef986e8c861d87e002589b297d2b914081b7b9 | JavaScript | olga028383/375607-keksobooking | /js/utils.js | UTF-8 | 2,474 | 3.15625 | 3 | [] | no_license | 'use strict';
(function () {
var getRandomInteger = function (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
var createMarkupFragment = function (dataCard, createElements) {
var documentFragment = document.createDocumentFragment();
var i;
var mapLength;
if (Array.is... | true |
f388aa35af3047f141770e8d1bd7be4b0e9227eb | JavaScript | geonwoomun/AlgorithmStudy | /leetcode/singleNonDuplicate.js | UTF-8 | 215 | 2.71875 | 3 | [] | no_license | var singleNonDuplicate = function (nums) {
let check = {};
nums.forEach((value) => {
check[value] = check[value] ? check[value] + 1 : 1;
});
return Object.keys(check).find((key) => check[key] === 1);
};
| true |
6d6fda5d59f1cf4cb65afdb13526197b8c9e0f12 | JavaScript | AnthonyQuinn/Year4Project | /js/D3_functions.js | UTF-8 | 16,512 | 2.953125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
function createBarChart(dataReturn, elementId) {
if (typeof elementId === "undefined") {
/**var container = document.getElementById("g... | true |
7ba94ad9c138be29d6d59bdbc6be94552dcfd496 | JavaScript | pratikdevdas/herokutestrepo | /mongo.js | UTF-8 | 1,068 | 2.671875 | 3 | [] | no_license | const mongoose = require('mongoose')
if (process.argv.length < 3) {
console.log('Please provide the password as an argument: node mongo.js <password>')
process.exit(1)
}
const password = process.argv[2]
const url =
'mongodb://fullstackopen:heystepbro@cluster0-shard-00-00.suius.mongodb.net:27017,cluster0-shard-... | true |
a4929e701e393f32cabc42267ad5e3248cd129ab | JavaScript | Janickvw/quantiful-coding-challenge | /src/components/objectives/Objectives.jsx | UTF-8 | 3,567 | 2.65625 | 3 | [] | no_license | import React from "react";
import {
makeStyles,
Typography,
Card,
CardContent,
List,
ListItem,
Link,
} from "@material-ui/core";
import AssignmentIcon from "@material-ui/icons/Assignment";
const EMAIL = "careers@quantiful.co.nz";
const useStyles = makeStyles({
card: {
height:... | true |
3b1819345487bb59b772137ff68e7f047b8976f6 | JavaScript | prayaganeethu/Eloquent_javaScript_Exercises | /chapter6/setter.js | UTF-8 | 291 | 2.890625 | 3 | [] | no_license | let geekSkool = {
names: [],
get showMembers () {
return this.names
}
}
let expr = 'addMember'
Object.defineProperty(geekSkool, [expr], {set: function (name) { this.names.push(name) }})
// delete geekSkool.addMember
geekSkool.addMember = 'Neethu'
console.log(geekSkool.names)
| true |
4ec353bf7dbba09532e7f4c21e74fa5ef63c2c88 | JavaScript | ram-yerra/Apps | /Student Cookbook-1/assets/www/lib/touch/src/platform/test/jasmine/lib/jasmine-extensions/panels/SpecDomSandbox.js | UTF-8 | 770 | 2.546875 | 3 | [] | no_license | /**
* Renders spec dom sandbox tool.
* @param {Jasmine.spec} spec The spec.
* @param {HTMLElement} panelsEl The HTMLElement which encapsulate the tools panels.
*/
jasmine.panel.SpecDomSandbox = function(config) {
this.sandBox = config.sandboxes[config.spec.id];
if (this.sandBox) {
this.el = this.ren... | true |
ebcbc43feca4f9974cb72af0f71b9e572cd22793 | JavaScript | TBoshoven/pin-to-tray | /webextension/background/native.js | UTF-8 | 1,574 | 2.78125 | 3 | [] | no_license | const native = (() => {
const base = {
nativePort: null,
// Called automatically when the first command is sent
connect: () => {
if (base.nativePort) {
// Already connected; ignore.
return;
}
base.nativePort = browser.runti... | true |
a339b7181bb2907724ee88c06e58f399b576a645 | JavaScript | matry/demo | /src/useCanvas.js | UTF-8 | 6,227 | 2.703125 | 3 | [] | no_license | import { useState, useRef, useEffect } from 'react'
const executeCanvasCommand = (ctx, command) => {
if (command.properties) {
Object.entries(command.properties).forEach(([key, value]) => {
ctx[key] = value
})
}
command.actions.forEach((action) => {
if (action.params !== null) {
ctx[acti... | true |
17359d7b2bce37ded214ba35e26397b8d89a278e | JavaScript | OksanaBakl/js---module2 | /src/18.js | UTF-8 | 228 | 3.453125 | 3 | [] | no_license | function calculateTotal(number) {
let Total = 0;
for (let i = 0; i <= number; i += 1) {
Total += i;
}
return Total;
}
console.log(calculateTotal(5));
console.log(calculateTotal(3));
console.log(calculateTotal(1));
| true |
b5e6461995aff343d7c2c9ec0b65bae6941927d4 | JavaScript | Diaa-Ghonim/React | /src/App/features/auth/components/SignUp/index2.js | UTF-8 | 8,054 | 2.65625 | 3 | [] | no_license |
import React, { useState } from 'react'
import Style from './style.module.scss';
import SvgValidateWarn from '../SvgValidateWarn';
export default function SignUp() {
const [state, setState] = useState({
fullname: '',
email: '',
password: '',
dateOfBirth: {
day: '',
month: '',
... | true |
8bc9821fababb6403aafbe9628c1ae180f715046 | JavaScript | AriShaked/arisPlayer | /main.js | UTF-8 | 19,079 | 2.609375 | 3 | [] | no_license | $(document).ready(function () {
var allAlbumsData;
hidePlayer();
getAllAlbums();
///////////////////////////////////searchBox ( on keyup ---> search for match ) ///////////////////////////////
$('#searchBox').keyup(function () {
searchAlbum();
});
///////////////... | true |
c59a4b75924c626b55c2c193f302a846a8578f24 | JavaScript | bbekhit/AutoComplete-React | /client/src/components/layout/BooksSearch.js | UTF-8 | 1,947 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react'
import {connect} from "react-redux"
import InputField from '../common/InputField';
import {getBooks} from "../../actions/bookActions"
import Books from './Books';
import NoResults from './NoResults';
class BooksSearch extends Component {
state = {
searchText:"",
visi... | true |
ac3332b200ef45a043be8eb10a16f150062ae393 | JavaScript | CUDEN-CLAS/lil_shrugger | /src/js/github.js | UTF-8 | 5,204 | 3.03125 | 3 | [] | no_license | /**
* @file
* Contains functionality for interacting with the GitHub API.
*/
let currentURL = '';
let myInit = initializeHeaders();
// This function returns the data based on the current page.
let foo = function (pageLink = null) {
// Use paging link if it exists.
// The paging link contains the endpoint and qu... | true |
22a5254667528f841bece3202e7ac48598c35ab1 | JavaScript | rmallols/uxit | /client/js/services/availableAppsService.js | UTF-8 | 2,651 | 2.671875 | 3 | [] | no_license | (function () {
'use strict';
COMPONENTS.factory('availableAppsService', ['$rootScope', 'crudService', 'constantsService',
function ($rootScope, crudService, constantsService) {
var availableApps, categories = [];
/**
* Loads the available apps from the repository
*
... | true |
968e280a6ffab09195b297d47bca7d5c6a5a394a | JavaScript | FHBielefeld-IFM-WS1718-SWEng1/WebAPI | /server/routes/todolist.js | UTF-8 | 1,615 | 2.515625 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const util = require('../helper/utilities');
router.post('/', (req, res, next) => {
req.models.Todolistitem.create({
user_id: req.body.user_id,
party_id: req.body.party_id,
text: req.body.text,
status: req.body.st... | true |
45f7fc7733d3a35ef0b872ecb7dfdf2eed55d36e | JavaScript | MooseTheCoder/SimpleNix4Win | /cat/cat.js | UTF-8 | 1,337 | 3.09375 | 3 | [] | no_license | const fs = require('fs');
const LBRegex = /\r\n|\r|\n/;
module.exports = async function(){
let FileContents = '';
const argv = require('yargs')
.usage('Usage:\n cat [OPTION]... [FILE]...')
.option('show-ends', {
alias:'E',
type:'boolean',
description: 'display $ at end of each line'
})
.option('number', {
... | true |
49a10f9c517b637bee637bcae7fd581c5c3651c7 | JavaScript | goodalls/complete-me | /tests/Trie-test.js | UTF-8 | 3,407 | 3 | 3 | [] | no_license | import { expect } from 'chai';
import Trie from '../lib/Trie';
describe('TRIE', () => {
let trie;
beforeEach(() => {
trie = new Trie();
});
it('should be a thing', () => {
expect(trie).to.exist;
});
describe('INSERT', () => {
it('should add "pizza" as letters into the trie', () => {
t... | true |
b46aec63aa145668cbeb2d23f291079f1fd675ed | JavaScript | titashneogi/node-server-template | /app/controllers/homeController.js | UTF-8 | 944 | 2.78125 | 3 | [] | no_license | var controller = require('./controller');
/**
Support for the hello-world route
*/
function hello(req, res, next) {
var temp = req.params.test;
controller.sendNext(req, res, next, undefined, {hello:temp})
}
/**
Support for the simple status response route
*/
function status(req, res, next) {
console.l... | true |
b14ca097679e9de6e7386912dc97921ab4ed3ce0 | JavaScript | ReenaSingh07/test | /index.js | UTF-8 | 1,972 | 3.3125 | 3 | [] | no_license | let todo =["At vero eos accusamus et iusto odio dignissimos","Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laud"];
let done =["dh asdhf shd adsh hasdads","Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laud"];
function eventfn(incomingIndex... | true |
3d9792a30c6370c5f9655802be81d0a1b4c6ee64 | JavaScript | jnhndrk01/RoboDoc-ODS-Project | /backend/routes/request/request.js | UTF-8 | 15,628 | 2.53125 | 3 | [] | no_license | // path mit dem er aufgerufen wurde: /api/request
var express = require("express");
var router = express.Router();
const diagnoses = require("../endpoints").csvData;
const DiagnosisModel = require("./DiagnosisModel");
var User = require("../user/UserModel");
const Patient = require("../patients/PatientModel");
const Re... | true |
8c8821e65dd5cd8491116ac0cd48ab5e6acfb0a6 | JavaScript | waterfoul/Lantern-Hoard | /browser/reducers/auth.js | UTF-8 | 872 | 2.71875 | 3 | [
"ISC"
] | permissive | import axios from 'axios';
//actions
export const AUTHENTICATED = 'AUTHENTICATED';
//reducer
export const auth = (state = null, action) => {
switch (action.type) {
case AUTHENTICATED:
return action.user;
default:
return state;
}
};
//action creators
export const authenticated = (user) => ({
type: AUTHEN... | true |
2322558bc2b1aac80aa87dab1a06e5edeb29b6f6 | JavaScript | rcrestey/42_Camagru | /camagru/common/js/main.js | UTF-8 | 725 | 2.65625 | 3 | [] | no_license | function form_action(form_id)
{
// get form with given id
form = document.getElementById(form_id);
// get action form
action = form.getAttribute('action');
// get controller and action
controller = action.split('.')[0];
method = action.split('.')[1];
// generate good url
url = '/controllers/' +... | true |
505ab4e78c3f3a656bff56ffdee25af28c90e7d3 | JavaScript | avocadoboi/bjornsundin.com | /projects/euclidean-algorithm/script.js | UTF-8 | 1,187 | 3.296875 | 3 | [] | no_license | let input_numerator = document.getElementById("input_numerator");
let input_denominator = document.getElementById("input_denominator");
let text_greatestCommonDenominator = document.getElementById("text_greatestCommonDenominator");
let text_simplifiedFraction = document.getElementById("text_simplifiedFraction");
funct... | true |
3f7ad01b5b30db9ddbdc5e2792cb3a7b9d075d2d | JavaScript | Loretapiap/EJERCICIOS-TIPOS-DE-DATOS-VARIABLES-Y-OPERADORES | /Ejercicios tipos de datos, variables y operadores/Ejercicio10- Formato determinante/Problema/main.js | UTF-8 | 348 | 3.578125 | 4 | [] | no_license | var a11 = prompt("Ingrese 'a11' de su matrix");
var a12 = prompt("Ingrese 'a12' de su matrix");
var a21 = prompt("Ingrese 'a21' de su matrix");
var a22 = prompt("Ingrese 'a22' de su matrix");
var resultado = parseInt(a11) * parseInt(a22) - parseInt(a12) * parseInt(a21)
document.write(a11 + " " + a12 + "<br>");
docume... | true |
efad0f2b17df26e1264862bef2a2b6d2cb744a00 | JavaScript | rmelendez94/PLProject3 | /Problem 3 Java Rework/person_tester.js | UTF-8 | 7,262 | 3.15625 | 3 | [] | no_license | var person = function() {
var person = function() {
var data = {
firstName: "",
sFirstName: function (n) {
data[firstName] = n
},
lastName: "",
sLastName: function (n) {
data[lastName] = n
},
... | true |
d4ec47c1562c2492d15d4ea2063d9857c240065a | JavaScript | HackYourFuture/JavaScript3_examples | /src/week1/4-errors/app.js | UTF-8 | 926 | 3.40625 | 3 | [] | no_license | /*
Define a constant for the base url.
Add error handling using a node-style callback.
Handle:
1. HTTP errors
2. Network errors
Create an Error object to report errors
*/
'use strict';
{
const API_BASE_URL = 'http://api.nobelprize.org/v1';
function fetchJSON(url, cb) {
const xhr = new XMLHttpRequ... | true |
59dae4fa44c9caed42e92b303c1fdd669c82d62f | JavaScript | salsahan/TechnicalAssigmentJSDasar | /latihan js/functionno4.js | UTF-8 | 1,453 | 3.96875 | 4 | [] | no_license |
/// Soal - 04
/// Buatlah sebuah fungsi yang mana nanti akan mengembalikan HURUF PERTAMA YANG TIDAK KEMBAR
/// Spesifikasi
/// - apabila inputan berupa kata yang dipisah, maka kembalikan "kata tidak boleh dipisah"
/// - apabila inputan tidak memiliki karakter yang tidak kembar, maka kembalikan string kosong ""
... | true |
4bcbc390ca11abd7fd73049aab6f31583b8ce3c7 | JavaScript | RoAlencar/CursoGDP-Node.js | /Seção 3 - Fundamentos do Express.js/index.js | UTF-8 | 1,075 | 3.09375 | 3 | [] | no_license | const express = require("express"); // Importanto o express
const app = express(); //Iniciando o express
app.get("/",function(req,res){ //Em toda a rota criado, deverá ter alguma resposta.
res.send("<h1>Bem vindo ao meu site</h1>") //Não é possivel enviar mais de uma resposta.
});
app.get("/blog/:artigo?",fun... | true |
1493861090a58c1a5a225620d4b207e100645583 | JavaScript | EricJobin/The-Nile-List | /theNileList.js | UTF-8 | 3,744 | 3.296875 | 3 | [] | no_license | //---------------------- Global Variables --------------------------
var mysql = require("mysql");
var inquirer = require("inquirer");
var connection = mysql.createConnection({
host: "localhost",
port: 3306,
user: "newuser",
password: "r00tr00t",
database: "nilelistdb"
});
//---------------------- Do Program ... | true |
1b4d4c18c6923341d52a9e93a1acf74f68955f60 | JavaScript | jhe01/cigcms | /assets/app/frontdesk.js | UTF-8 | 1,270 | 2.890625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | var generateTeeTimeDisplayBody = () => {
var startTime = moment("5:30 AM", "HH:mm").format("x");
var endTime = moment("16:00 PM", "HH:mm").format("x");
var tBody = $("<tbody></tbody>");
var counter = 0;
do {
var xTime = moment(startTime, "x").format("HH:mm A");
var row = $(
"<tr id='teetime_" +
startTi... | true |
50f9e952fde8b35e5de0499e0a6e7529a2a67d91 | JavaScript | teamgood/AntGame | /src/view/Menu.js | UTF-8 | 2,728 | 2.71875 | 3 | [] | no_license | var LogicalGroup = LogicalGroup || function () {};
(function () {
var events = [
{
// any button which takes the user to the root of the main menu
name: "goto_root",
binder: function (callback) {
$(".ag-btn-root").click(callback);
}
},
{
// any button which takes the user to the single match setup sc... | true |
0d5f539239a574d95033158e8653466cc992bee7 | JavaScript | dlfinis/yt-api-alfa | /main-get-info.js | UTF-8 | 1,639 | 2.765625 | 3 | [] | no_license | var request = require('superagent');
let getYoutubeVideoData = async (youtubeVideoId) => {
const response = await request
.get('https://www.googleapis.com/youtube/v3/videos')
.query({id: youtubeVideoId})
.query({key: process.env.YOUTUBE_API_KEY || "change-me-with-a-valid-youtube-key-if-you-need-me"}) //u... | true |
d58bd0766c8973a9a4c28a594d55b21805eaf36f | JavaScript | michaelwhite72/Oauth2-test | /src/authorization.js | UTF-8 | 4,317 | 2.765625 | 3 | [] | no_license | //import axios from 'axios';
"use strict";
const axios = require('axios');
const qs = require('qs');
class Authorization {
constructor(client_id, client_secret, token_url, auth_url, callback_url) {
this.client = process.env.CLIENT_ID_B2C || client_id;
this.secret = process.env.CLIENT_SECRET_B2C ||... | true |
4a4ef3d3fff1cea98fd7d45003820e999cacd3e7 | JavaScript | minichloe/reacto | /bigO/wordBreak.js | UTF-8 | 1,472 | 3.921875 | 4 | [] | no_license | // Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.
// Half solution using trie but does not account for words within words
// function wordBreak(s, wordDict) {
// const trie = {... | true |
d4ed73af61521a8d16add2fd771cfad4e7b67d68 | JavaScript | nmlane/my_site | /js/customVideo.js | UTF-8 | 3,075 | 2.828125 | 3 | [
"MIT"
] | permissive | const body = document.querySelector('body');
const player = document.querySelector('.player');
const video = player.querySelector('.viewer');
const progress = player.querySelector('.progress');
const progressBar = player.querySelector('.progress__filled');
const toggle = player.querySelector('.toggle');
const skipButto... | true |
45770efa135958e3a049203753da15a16cace845 | JavaScript | vulgarkittenstudios/raidenjs | /graphics/display.js | UTF-8 | 3,914 | 2.984375 | 3 | [] | no_license | import resources from './resources';
import loop from '../core/loop';
const defaultContainerID = 'container';
const defaultCanvasID = "screen";
export default class {
constructor(options) {
// Canvas Access
this.canvas;
this.ctx;
// Cache the width and height of this instance
this.width = 0;
... | true |
913e2371beb20d232ae190f03de14a134902582c | JavaScript | BryamVicente/react-state-self-assessment-091420 | /src/Statement.js | UTF-8 | 891 | 2.796875 | 3 | [] | no_license | import React from 'react'
class Statement extends React.Component {
state = {
clickedState: this.props.noStatement,
clickedImg: this.props.noImage
}
displayStatement = () => {
if (this.state.clickedStatement=== this.props.noStatement){
this.setState({clickedStatement... | true |
e8d653840901aeb0c0d48636284656281c5f01a2 | JavaScript | balindrarayamajhi/ModernJSFromBegining | /MouseEvents/app.js | UTF-8 | 1,491 | 3.28125 | 3 | [] | no_license | const clearBtn=document.querySelector('.clear-tasks');
const card= document.querySelector('.card');
const heading =document.querySelector('h5');
//1 click
//clearBtn.addEventListener('click',runEvent);
//2 double click
//clearBtn.addEventListener('dblclick',runEvent);
//3 mousedown
//clearBtn.addEventListener('mou... | true |
2e3e788804d59e3c813c2cb7869473691fa8dcf4 | JavaScript | hoanganh25991/node-js-callback-hell | /index-without-wait.js | UTF-8 | 671 | 2.71875 | 3 | [] | no_license | const LOOP_FOR = 10;
let count = 0;
let em = {
listeners: [],
add(l){
this.listeners.push(l);
},
fire(event){
let listenersOnEvent = this.listeners.filter(l => {return l.event == event;});
listenersOnEvent.forEach(l => {l.exec();});
}
};
let fs = require('fs');
em.add({
event: 'finished',
exec(){
// ... | true |
4c728128622383181a67edda60b4eddb895a4020 | JavaScript | Roshan13046/Modern-javaScript-ES6- | /14.2.Restparameters.js | UTF-8 | 1,748 | 4.09375 | 4 | [] | no_license | //ES5
function printAll(x,y){
// console.log(x);
// console.log(y);
console.log(arguments);
}
printAll(1,2);
//to return arguments
function printAll2(){
var tempArr=[];
for(var i=0;i<arguments.length;i++){
tempArr.push(arguments[i]);
}
return tempArr;
}
c... | true |
d087d220aaf90146a792d2065d955f0e3d748e83 | JavaScript | gschmottlach-xse/node-fiber-test | /fibertest.js | UTF-8 | 4,120 | 3.171875 | 3 | [] | no_license | 'use strict';
//
// Set to "true" to employ a workaround using Bluebird.js Promise
// and setImmediate() instead of process.nextTick().
//
var workaround = false;
//
// Set to 'true' to call the generateData() function via a
// Node.js C++ addon.
//
var callAddon = true;
const synccore = require('bindings')('synccor... | true |
65bfa619405af3da966468a0550c7c0e243da1d2 | JavaScript | slimwang/AltTrim | /background.js | UTF-8 | 627 | 2.625 | 3 | [] | no_license | chrome.commands.onCommand.addListener(function (command) {
let t = document.createElement("textarea");
document.body.appendChild(t);
t.focus();
document.execCommand("paste");
let clipboardText = t.value;
trimedText = clipboardText.replace(/[\n\r]+/g, ' ');
t.innerHTML = trimedText;
docum... | true |
ce99dde952ec9cb1183d848575bbb586096b0359 | JavaScript | TeamTaterTots/backchannel-client | /www/js/places.js | UTF-8 | 1,012 | 2.859375 | 3 | [] | no_license | function getLocation(successCallback, errorCallback) {
if ("geolocation" in navigator) {
var timeoutVal = 10 * 1000 * 1000;
navigator.geolocation.getCurrentPosition(
successCallback,
errorCallback, {
enableHighAccuracy: true,
timeout: timeoutVa... | true |
54f56c72de14653c84367e97ebf86fffecedfbed | JavaScript | NivIvri/Meme-Generator | /main.js | UTF-8 | 5,512 | 3.078125 | 3 | [] | no_license | 'use strict'
var gElCanvas;
var gCtx;
function onInit() {
//RENDER GALLERY AND KEY WORDS
renderKeywords()
gElCanvas = document.querySelector('canvas')
gCtx = gElCanvas.getContext('2d')
document.querySelector('.image-gallery').innerHTML = getStrGalleryImgs()
resizeCanvas()
creategMeme(gEl... | true |
8e28e539ea42c15a139a988386d63746ed85546c | JavaScript | JonMorales22/CrowdControlled | /public/Chords/Notes.js | UTF-8 | 2,297 | 2.921875 | 3 | [] | no_license | class NotesUtility {
ChordTypes = {
Major: 'Major',
Minor: 'Minor',
Diminished: 'Diminished'
}
MidiToFrequency = {
60: 261.63,
62: 293.66,
64: 329.63,
65: 349.23,
67: 392.00,
69: 440.00,
71: 493.88,
72: 523.25,
74: 587.32,
76: 659.25,
77: 698.45,
79:... | true |
9503c423be048f6865697fa78ecb9eacf5831412 | JavaScript | vinntreus/frost | /lib/event-builder.js | UTF-8 | 674 | 2.625 | 3 | [
"MIT"
] | permissive | var _ = require('lodash');
module.exports = function eventBuilder(eventData){
var event = newEvent(eventData);
function newEvent(eventData){
return _.cloneDeep(eventData);
}
function validate(){
if(!event.name){ throw 'event name cannot be empty'; }
if(!event.key){ throw 'event key cannot b... | true |
25b291c6ede521c5cc8878c180a1c4a320249d8a | JavaScript | rafaelrph/champ | /js/scorers.js | UTF-8 | 271 | 2.515625 | 3 | [] | no_license | //GLOBAL VARS
var controller = new Controller();
var model = new Model();
//GETTING DATA
controller.getResults().then(results => {
let finishedMatches = model.getFinishedMatches(results)
controller.showScorers(model.calculateGoalsScorers(finishedMatches));
});
| true |
1e5c6f811a3845e92886901040640e4a919f7eea | JavaScript | sherryYYX/dom-1 | /src/dom-1.js | UTF-8 | 1,126 | 3.328125 | 3 | [] | no_license | window.dom = {
create(string) {
const container = document.createElement('template')
container.innerHTML = string.trim()
return container.content.firstChild;
},
find(selector,scope){
return (scope||document).querySelectorAll(selector)
},
style(node,name,value){
... | true |
48637b275794931b3bc9a13fda3783f100eacaef | JavaScript | QPC-database/FluidFramework | /experimental/PropertyDDS/packages/property-common/src/error_objects/http_error.js | UTF-8 | 2,643 | 2.640625 | 3 | [
"MIT",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-gutenberg-2020"
] | permissive | /*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
(function() {
var FlaggedError = require('./flagged_error');
/**
* Class extending Error with HTTP-specific error information like statusCode and statusMessage
* @param {string} title The ... | true |
61c24197f8cbe67c19b91d90b597e780cd5cb4a1 | JavaScript | gallant4473/docs | /src/docs/container/LazyLoadBodyExample/index.js | UTF-8 | 4,336 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react'
import { withRouter, Link } from 'react-router-dom'
import axios from 'axios'
import { LazyLoadOnBody } from 'reusable-react-components'
import { lazybodyConst } from '../../constants'
const Loader = () => (
<div style={{
display: 'flex', alignItems: 'center', justifyCont... | true |
63fb7d0e5282cdbc0f5202565e01fea9e87154d0 | JavaScript | FernandoBasso/programming-how-to | /codewars/javascript/fundamentals/e03b-even-or-odd.js | UTF-8 | 249 | 3.96875 | 4 | [] | no_license | //
// https://www.codewars.com/kata/53da3dbb4a5168369a0000fe/solutions/javascript
//
const l = console.log.bind(console);
function evenOrOdd(n) {
return n & 1 === 1 ? 'Odd' : 'Even';
}
l(evenOrOdd(3));
// → Odd
l(evenOrOdd(4));
// → Even
| true |
e1ec5f7f3d4ee38a0b426a7e04e0ea57c24e3dcc | JavaScript | e3cd/es6 | /8-asynchronous-JS/starter/script.js | UTF-8 | 1,148 | 2.625 | 3 | [] | no_license | //setTimeout is in the web api which includes HTTP requests for AJAX GEOLOCATION LOCALSTORAGE ETC, it is in the javascript run time but not in the javascript engine.
//The timer will keep running for 2s asynchronously so that our code ca neep running without being blocked. When setimeout is called the timer is created... | true |
1a533f5dfed12e1d2b55447d48332f95b09ce3a2 | JavaScript | pchampin/tracingyou | /sharedworker.js | UTF-8 | 4,657 | 2.640625 | 3 | [] | no_license | /**
* Created by pa on 06/04/16.
*/
"use strict";
var scriptUrl = new Error().stack.match(/(https?:\/\/.+):\d+:\d+/)[1];
var port = null;
console.log("shared worker started", scriptUrl);
onconnect = function(evt) {
port = evt.ports[0];
port.addEventListener('message', function(evt) {
var msg = evt.... | true |