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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1afe880b24302dcb29666afd7efe10f761e7605d | JavaScript | ratan612/outcom-backend | /api/updateUser.js | UTF-8 | 1,982 | 2.765625 | 3 | [
"MIT"
] | permissive | import { success, failure } from "./libs/response-lib";
const Joi = require('@hapi/joi');
const dao = require('./dao/dao')
export async function main(event, context, callback) {
console.log('Executing updateUser')
if (!event.body) {
return failure({ status: false, message: 'POST data expected' });
}
// Va... | true |
43027b11a8bfd0e76d7ef5dc6f1b9228bff22de7 | JavaScript | carolferreiradev/aulas-particulares | /src/models/Base.js | UTF-8 | 1,424 | 2.65625 | 3 | [] | no_license | const db = require('../config/db')
const Base = {
init({ table }) {
if (!table) throw new Error('Invalid params')
this.table = table
return this
},
async create(fields) {
try {
let camposDaTabela = []
dadosASeremInseridosNaTabela = []
Object.keys(fields).map(key => {
c... | true |
41c44a5126d0186ac9d4850bf6588facbe04dbbd | JavaScript | glennerik/myip.info | /src/components/ShowMetric/reducer.js | UTF-8 | 512 | 2.703125 | 3 | [
"MIT"
] | permissive | export const defaultState = {
metricValue: "",
failedMessage: "",
isLoading: true,
}
export default (state, action) => {
switch (action.type) {
case "SET_METRIC_VALUE": {
const metricValue = action.payload
return { ...state, isLoading: false, failedMessage: "", metricValue }
}
case "SE... | true |
cd0b25673763b67ed63f563a46deb8148234aff0 | JavaScript | curriculum-advantage/cocos2d-html5-boilerplate | /frameworks/cocos2d-html5/extensions/cocostudio/trigger/ObjectFactory.js | UTF-8 | 3,065 | 2.53125 | 3 | [
"MIT"
] | permissive | /****************************************************************************
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation... | true |
7a9a3c6b850418e1a4f0fe366a52586a68d9bfcb | JavaScript | jherdman/ember-cli-trackjs | /tests/unit/utils/error-handler-test.js | UTF-8 | 1,011 | 2.578125 | 3 | [
"MIT"
] | permissive | import ErrorHandler from '../../../utils/error-handler';
import { module, test } from 'qunit';
function collapseWhitespace(text) {
return text.trim().replace(/\s{1,}/g, ' ');
}
let trackJs = {
track(err) {
this._errors.push(err);
},
reset() {
this._errors = [];
},
getError(n) {
return this._... | true |
81034d2c1a334a09131a7ab31183555ee27e77f5 | JavaScript | sarahwertz/sepal | /modules/gui/frontend/src/components/users/views/list.js | UTF-8 | 3,707 | 2.53125 | 3 | [
"MIT"
] | permissive | /**
* @author Mino Togna
*/
var EventBus = require( '../../event/event-bus' )
var Events = require( '../../event/events' )
var ListSort = require( './list-sort' )
var Container = null
var usersList = null
var rowHeader = null
var rowUser = null
var selectedUser = null
var init = function ( container ) {
se... | true |
da1ce79d96c02b0394c91f9988d76842dd373afd | JavaScript | zbc/JSPractice | /src/Emitter.js | UTF-8 | 519 | 2.96875 | 3 | [] | no_license | class Emitter {
constructor() {
this.events = {};
}
on(eventName, cb) {
if (!this.events[eventName]) {
this.events[eventName] = [];
}
this.events[eventName].push(cb);
}
emit(eventName, data) {
if (!this.events[eventName]) {
return;
}
this.events[eventName].forEach(f => f(data));
}
removeListe... | true |
33e7d4ce88ab92d3e6ae2b05b91b311fde872e75 | JavaScript | skrish87/RandomStuffs | /UI Samples/script.js | UTF-8 | 1,761 | 3.109375 | 3 | [] | no_license | // JavaScript Document
var numberOfRows=30; // This number will be changed to control the number of rows
var activeTabId = "tab-1";
var constructTrRow = function(index) {
var bgColor1 = "#FFFFFF";
var bgColor2 = "#F4F4F4";
var bgColor = (index%2 == 0) ? bgColor2: bgColor1;
var trRowString = '<tr bgcol... | true |
89703798de9f6813fec71b8600091bf0543ecb7a | JavaScript | leighquince/checkcheckburnjs | /test/poker_move.js | UTF-8 | 690 | 2.734375 | 3 | [] | no_license | describe('Poker Move', function() {
var PokerMove = require('../poker_bot/poker/poker_move').PokerMove;
it('should be a function', function() {
PokerMove.should.be.a('function');
});
it('should take a name, action and amount', function() {
var pokerMove = new PokerMove("player1", "raise... | true |
2dddad06da0daabbd80358dd48d69611429b0376 | JavaScript | iwebexpert/corp-rostelecom-1 | /sml/lesson5/basket/basket.js | UTF-8 | 3,822 | 3.6875 | 4 | [] | no_license | /**
* Домашнее задание #5
* @author Сорванов Михаил Леонидович [CorpRostelecom-1]
*/
/**
2. Сделать генерацию корзины динамической: верстка корзины не должна находиться в HTML-
структуре. Там должен быть только div, в который будет вставляться корзина, сгенерированная на
базе JS:
a. Пустая корзина до... | true |
16736b119ebf64aa423ae539726d9e04518ecdf6 | JavaScript | xujinglian/feimu | /js/main.js | UTF-8 | 1,459 | 2.734375 | 3 | [
"MIT"
] | permissive | function $(id){
return typeof id==='string'?document.getElementById(id):id;
}
/***
鼠标滑过介绍和演示菜单的时候发生内容切换脚本
***/
window.onload=function(){
//获取鼠标滑过或点击的标签和要切换内容的元素
var feimutitles=$('qiehuantitle').getElementsByTagName('li'),
feimudivs=$('qiehuancontent').getElementsByTagName('div');
alert(feimutitles.length);
if... | true |
b1d6d66adee51ee3ddddb32a41cb35bbca766ffa | JavaScript | Estellanini/JavaScript-Principle-Demo | /JavaScript-Advance/Lexical-Environments.js | UTF-8 | 498 | 3.828125 | 4 | [
"Apache-2.0"
] | permissive | //词法分析1:
//结果:输出2
/*function foo() {
console.log( a );
}
function bar() {
var a = 3;
foo();
}
var a = 2;
bar();*/
/*//词法分析2:
//结果:输出10
var foo = 1;
function bar() {
if (!foo) {
var foo = 10;
}
console.log(foo);
}
bar();*/
/*
//结果undefined
console.log(foo)
var foo='foo';
//结果报错
cons... | true |
8a6aeb3efdf290ff2ab256a4d84329317b1c7914 | JavaScript | frankmarmier/cohort-286 | /module-1/week-2/day-5/RQA/script.js | UTF-8 | 1,012 | 3.484375 | 3 | [] | no_license | const list = document.getElementById("list");
const btn = document.getElementById("btn");
const li = document.createElement("li");
// btn.onclick = () => {
// const li = document.createElement("li");
// li.textContent = "Liste item";
// li.onclick = function () {
// console.log("i am being clicked");
// }... | true |
8cfc82149665546ed1e52403f7f454fd65158640 | JavaScript | evansst/news_api | /inactive_seeds/userSeeds.js | UTF-8 | 534 | 2.546875 | 3 | [] | no_license | const User = require('./models/User')
const faker = require('faker')
const bcrypt = require('bcrypt')
async function doSeeds() {
for(let i = 1; i < 120; i++) {
const randomCard = faker.helpers.contextualCard()
const password = faker.internet.password()
const hash = bcrypt.hashSync(password, 12)
awai... | true |
c2bd66fa8dd4e740f41d4619565cb363daeb04c1 | JavaScript | Platane/js13k-2017 | /game/src/generateMazeObject.js | UTF-8 | 14,070 | 3.03125 | 3 | [] | no_license | // floor mat
const floor = new THREE.MeshLambertMaterial()
{
const canvas = document.createElement('canvas')
canvas.width = 16 * 32
canvas.height = 1
const ctx = canvas.getContext('2d')
for (let i = 16; i--; ) {
ctx.beginPath()
ctx.rect(i * 32, 0, 32, 1)
const h =... | true |
4702bb480d9b0ba82d96ee3df4d7d7295839d806 | JavaScript | donaldshen/log-viewer | /src/utils/index.js | UTF-8 | 1,422 | 3.15625 | 3 | [
"MIT"
] | permissive | const ENCODED_NEWLINE = /\r{0,1}\n/
const START_CONTROL = /\x1b\[((3[0-7])|(90)){0,1}(;{0,1}[134]){0,1}m/g
const END_CONTROL = /\x1b\[0m/g
const ERASE_IN_LINE_FLAG = /\x1b\[[0-2]{0,1}K/
const POPULAR_PRIVATE_SEQUENCES = /\x1b\[\?25[hl]/g
// RegExp reference:
// http://jafrog.com/2013/11/23/colors-in-terminal.html
// h... | true |
35c0888587c5a581de790728ecee12d6976aa00d | JavaScript | kevinbarabash/equal-loudness | /fourier/fourier.js | UTF-8 | 848 | 3.59375 | 4 | [] | no_license | const dft = (x) => {
const N = x.length;
const X = [];
for (let k = 0; k < N; k++) {
let re = 0;
let im = 0;
for (let n = 0; n < N; n++) {
const t = -2 * Math.PI * k * n / N;
re += x[n] * Math.cos(t);
im += x[n] * Math.sin(t);
}
... | true |
477cea5f65354d677f2f0762d47ba948dbd6129f | JavaScript | Git9243031/Easy-Travel-MERN | /front/src/utils/getMin.js | UTF-8 | 99 | 2.640625 | 3 | [] | no_license | export const getMin = (items, value) => {
return Math.min(...items.map(item => item[value]));
};
| true |
610a4e68810ac0621a628f77866d075fe9efc65f | JavaScript | parryjos1/sei35-homework | /warmups/week2/day03_scrabble/js/main.js | UTF-8 | 1,759 | 4.125 | 4 | [] | no_license |
const scrabbleImproved = {
letterScores: {
'a': 1, 'e': 1, 'i': 1, 'o': 1,
'u': 1, 'l': 1, 'n': 1, 'r': 1,
's': 1, 't': 1, 'd': 2, 'g': 2,
'b': 3, 'c': 3, 'm': 3, 'p': 3,
'f': 4, 'h': 4, 'v': 4, 'w': 4,
'y': 4, 'k': 5, 'j': 8, 'x': 8,
'q': 10, 'z': 10
},... | true |
2510ac7117c6fdaa2afd3889e3a64057f7c56731 | JavaScript | JohnnyMoonlight/Worker-Threads | /js/js.js | UTF-8 | 905 | 2.59375 | 3 | [] | no_license | var divLoadingIcon;
$(function() {
divLoadingIcon = document.getElementById("loader");
});
let worker = new Worker("/js/worker.js");
var requestedAnimationFrame;
let starttime = null;
var i = 0;
function animateLoadingIcon() {
rotateCount = (new Date().getTime() - starttime) / 3;
if (rotateC... | true |
400ef0d85fd588def211547d4ea260bbcbf00bde | JavaScript | BowieEno69/Moonphase | /sketch.js | UTF-8 | 2,174 | 2.9375 | 3 | [] | no_license | let moons = [];
let frames = 0;
function setup() {
createCanvas(500,880)
frameRate(14);
for (let i = 0; i < 28; i++){
if(i < 10){
moons[i] = loadImage("assets/moons_0"+i+"_delay-0.11s.jpg");
}else{
moons[i] = loadImage("assets/moons_"+i+"_delay-0.11s.jpg");
}
}
// moons[0] = loadIm... | true |
b48ba17c0afc4cef431a49a774e432e8f9437f68 | JavaScript | lambdabaa/roshambo | /src/play.js | UTF-8 | 2,425 | 3.078125 | 3 | [] | no_license | // @flow
const calculateScore = require('./calculateScore');
const debug = console.log.bind(console, '[play]');
const leaderboard = require('./leaderboard');
const perceptron = require('./perceptron');
const state = require('./state');
const sum = require('lodash/sum');
const rock = perceptron('rock');
const paper = ... | true |
7e62215a220315f6f0f00b1ba3dacd5aab2c55c0 | JavaScript | Farcem11/ReactApp | /src/reducers.js | UTF-8 | 960 | 2.765625 | 3 | [] | no_license | import
{
ADD_TASK,
REMOVE_TASK,
LOAD_TASKS,
SET_TASK,
FILTER_TASKS
} from './constants/ActionTypes'
const initialStateTask = {
Title : '',
Responsable : '',
Description : '',
Priority : 'Low'
}
const filterTasksText = (filterTasksText = "", action) =>
{
if(action.type === FILT... | true |
3503e15d3ddcde2e20e1b0ce622adffcc7e439cb | JavaScript | idris-maps/idris-csv | /lib/convertToJson.js | UTF-8 | 241 | 2.78125 | 3 | [] | no_license | module.exports = function(array) {
var head = array[0]
var d = []
for(i=1;i<array.length;i++) {
var line = array[i]
var jsonLine = {}
for(j=0;j<line.length;j++) {
jsonLine[head[j]] = line[j]
}
d.push(jsonLine)
}
return d
}
| true |
0328a0edc03e73a24d1c2f66a391e3eb6987e631 | JavaScript | dianligegege/study | /基础/index.js | UTF-8 | 194 | 3.125 | 3 | [] | no_license |
// return num = 100 时 返回值时100不是num
var obj1 = {};
obj1[obj1['first'] = 1] = 'first';
console.log(obj1);
console.log(obj1['first'] = 2); // 2
let a1 = '';
console.log(a1 = 9); // 9 | true |
0e322d5f2aa7651c623746dbd56cd5fd4ec88cf8 | JavaScript | caballerof/codingInterviewAlgorithms | /exercises/interview_problem/reverseStringSym.js | UTF-8 | 2,215 | 4.0625 | 4 | [] | no_license | /**
* Given a string, reverse it but don't change the symbols
* position only change the literal characters.
*
* Example.
* str = 'abc$df' => 'fdc$ba'
* str = 'ab.c$dfg' => 'gf.d$cba'
* str = 'ab,c$f#' => 'c,b$a#'
* str = 'Ab,c,de!$' => 'ed,c,bA!$'
*
* Note: Strings in JS are immutable
*/
/**
* C... | true |
12539032cda4b534f563c8b08efa24ef3f8937ef | JavaScript | vmorishima/vmorishima | /prog109/lectures/jsforms.js | UTF-8 | 688 | 4 | 4 | [] | no_license | //var userInput = prompt("Enter a number between 0 and 6");
function getNameWeek(userInput, greeting) {
//SWITCH statement
console.log(greeting);
var myMessage;
switch (userInput) {
case "2":
myMessage = "Monday";
break;
case "3":
myMessage = "Tuesday";
break;
case "4":
... | true |
f90b3099be07213c521b1dad0bf7e76eac2fa044 | JavaScript | yoddidahsyat/DWF19PFK3_WaysBucks_API | /src/controllers/product.js | UTF-8 | 4,322 | 2.546875 | 3 | [] | no_license | const { Product } = require('../../models/');
const statusSuccess = "SUCCESS";
const statusFailed = "FAILED";
const messageSuccess = (type) => { return `Product successfully ${type}` }
const messageSuccessSingle = (id, type) => { return `Product with id: ${id} successfully ${type}` }
const messageFailedSingle = (id) =... | true |
e98eafa80a59594126b00bf8d31c2100c4b12e25 | JavaScript | niveditasonker/JSPrograms | /JSCodeProject/findMaxDepthOfATree.js | UTF-8 | 699 | 3.625 | 4 | [] | no_license | function TreeNode(val) {
this.val = val;
this.left = this.right = null;
}
var maxDepth = function(root) {
if(root == null){
return 0;
}
var left = maxDepth(root.left);
var right = maxDepth(root.right);
var maxLen = Math.max(left,right);
return maxLen + 1;
};
var n1 = n... | true |
4618d004021c7b7ce97b304db2cc196ad3f38187 | JavaScript | TrevorN1126/express-sequelize-rest-api-server | /server/user/user.controller.js | UTF-8 | 4,210 | 2.765625 | 3 | [
"MIT"
] | permissive | /**
* Controller for the user component
* @module User Controller
*/
const httpStatus = require('http-status');
const APIError = require('../helpers/APIError');
const UserService = require('./user.service');
/**
* Create new user
* @property {string} req.body.username - The username of user.
* @property {string} r... | true |
a6aaf05db252190b236f06c240a5992f19e6a574 | JavaScript | yandaxin/Vue | /references/formvalidation/index.js | UTF-8 | 980 | 2.59375 | 3 | [] | no_license | window.onload=function(){
Vue.component('item', {
template:'#item-template',
props:{
show1:Boolean,
show2:Boolean,
show3:Boolean
},
methods:{
isNum(num){
// this.show1 = !show;
var reg = new RegExp("^[0-9]*$");
if(!reg.test(num)){
this.show1 = true;
}... | true |
c84a3bdcf91ff1b0ebbebe7670f5ec12298587de | JavaScript | yodaos-project/rt-node | /deps/jerryscript/tests/jerry/es2015/typedArray-find-index.js | UTF-8 | 3,058 | 2.96875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] | permissive | // Copyright JS Foundation and other contributors, http://js.foundation
//
// 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 r... | true |
ebf3d8c72ed20360c1cac024bc327d759c1d1246 | JavaScript | ruanitto/duolingo-style-linux-skills-game | /backend/functions/answerquestion.js | UTF-8 | 894 | 2.625 | 3 | [] | no_license | 'use strict';
const QuestionTester = require('../modules/questiontester');
module.exports.answerquestion = (event, context, callback) => {
let response = {
statusCode: 200,
headers: {
"Access-Control-Allow-Origin": "*"
}
};
let question = "";
/**
* When runni... | true |
02848126186b3c3d08e6dd616545e77063d638c3 | JavaScript | bgoonz/UsefulResourceRepo2.0 | /MY_REPOS/web-dev-notes-resource-site/2-content/Data-Structures/DS-ALGO-OFFICIAL/CONTAINER/DS-n-Algos/Trees/bfs-vs-dfs/DepthFirstSearch.js | UTF-8 | 1,445 | 4.1875 | 4 | [
"MIT"
] | permissive | /*
* Author: Surendra Kumar
* DFS Algorithm implementation in JavaScript
* DFS Algorithm for traversing or searching graph data structures.
*/
function traverseDFS (root) {
const stack = [root]
const res = []
while (stack.length) {
const curr = stack.pop()
res.push(curr.key)
if (curr.right) {
... | true |
04e53a3ec95c847a821ff5442aa8f522df210184 | JavaScript | elhardoum/node-nonce | /index.js | UTF-8 | 4,376 | 2.53125 | 3 | [] | no_license | 'use strict';
const crypto = require('crypto');
module.exports = {
// ref response
res: null,
// ref request
req: null,
// default config
DEFAULT_CONFIG: {
cookie_path: '/',
CSRF_ttl: 86400, // 1 day
CSRF_token_name: 'CSRF',
nonce_default_ttl: 1800, // 3... | true |
9e3955b21744753f3f9ad1a657de159842365d2f | JavaScript | mohibuslc/recap1 | /src/App.js | UTF-8 | 2,364 | 2.875 | 3 | [] | no_license | import React from 'react';
import './App.css';
import {useState} from 'react';
function App(){
const info =['KALAM','TINA','FRIDA','MONI','NILU'];
return(
<div style={{textAlign:"center"}}>
<MovieCounter></MovieCounter>
{
... | true |
5b8f476619fbffcd664dcf98329026c1ac242323 | JavaScript | prasad145/React.js | /Practice/Passing_Props.jsx | UTF-8 | 836 | 3.359375 | 3 | [] | no_license | {/* Pass Props to a Stateless Functional Component
passing information from parent component ot child component as props
*/}
{/*stateless functional component means it can only recieve the data and render it*/}
const CurrentDate = (props) => {
return (
<div>
{ /* props will have Date() Obje... | true |
923ac976c0b63b6b622ae4ee564bea3023f9eb6d | JavaScript | tabinGlitchHub/Project-FindStuff | /client/myreact/src/components/CartBasket.js | UTF-8 | 1,760 | 2.78125 | 3 | [] | no_license | import React, { useContext, useEffect, useState } from "react";
import cartApi from "../apis/cartApi";
import { ProductsContext } from "../context/ProductsContext";
function CartBasket() {
const { cartList, setCartList, totalAmount, setTotalAmount } = useContext(
ProductsContext
);
let tempAmount = 0;
let list =... | true |
2696600b5f1dacdeebf8ee6a1f144b07fd697e71 | JavaScript | sober1128/web-learning | /算法/数学运算/字符/06_字符串相乘.js | UTF-8 | 648 | 3.515625 | 4 | [] | no_license | // 时间复杂度 O(n^2)
const multiply = (num1, num2) => {
if(num1 === '0' || num2 === '0') return '0';
const len1 = num1.length;
const len2 = num2.length;
const pos = new Array(len1+len2).fill(0);
for(let i = len1-1; i >= 0; i--) {
const n1 = +num1[i]; // 转成数字
for(let j = len2-1; j >= 0; j--) {
con... | true |
9b49afa59c960ff8e03f82fd191582c2ac103155 | JavaScript | durban24k/BookingAppointment_USSD | /config/db_config.js | UTF-8 | 570 | 2.546875 | 3 | [] | no_license | const mysql=require('mysql');
require('dotenv').config();
// Database Connection
const db=mysql.createConnection({
host : process.env.DB_HOST,
user : process.env.DB_USER,
password : process.env.DB_PASSWORD,
database : process.env.DB,
debug:false,
multipleStatements : true
});
db.connect(... | true |
78e683f566c5246121b7a66548df727b6cf45a19 | JavaScript | kevin3033/chess_server | /server.js | UTF-8 | 21,189 | 2.671875 | 3 | [] | no_license | //imports
const express = require('express')
const app = express()
const server = require('http').Server(app)
const io = require('socket.io')(server)
const path = require('path')
const { Chess } = require('chess.js')
//ports
const port = process.env.PORT || 3000
app.use(express.static('public'))
//rota GET /
app.get(... | true |
7c42a690eab798db8c8db3e4285631d561758fae | JavaScript | AliDizzz/memory-game | /main2.js | UTF-8 | 2,026 | 3.828125 | 4 | [] | no_license | console.log("coucou");
var puissance4 = [];
var nbColonne = 7;
var nbLigne = 6;
var joueur1car = "x";
var joueur2car = "o";
puissance4 = initialiserTableauVide(nbLigne, nbColonne, 0);
afficherPuissance4(puissance4, joueur1car, joueur2car);
puissance4[3][3] = 1;
puissance4[4][4] = 2;
afficherPuissance4(puissance4, jou... | true |
922f6b1f48ce59f0eeeaf95af623326ae914da26 | JavaScript | BubbleM/InterviewTopic | /JS/practice5.js | UTF-8 | 159 | 3.109375 | 3 | [] | no_license | function formatStr(str) {
let arr = str.split('-');
return arr.reverse().join('&');
}
let str = 'abcd-ef-ghi';
console.log(formatStr(str)); // ghi&ef&abcd | true |
0aeecb60118ff771beec2424387405e23b7893e6 | JavaScript | Vitaminvp/JS-code | /codewars/src/script7.js | UTF-8 | 5,053 | 3.5625 | 4 | [] | no_license |
function chooseBestSum(distance, number, ls) {
const arr = [...ls];
let max = null;
const reducer = (element = [], index = 0) => {
// console.log("element", element);
if(element.length === number) {
// console.log("element", element);
const summ = element.reduce((su... | true |
ef7a42022f9cc617ed60e13ff6bf78dc429f7c66 | JavaScript | manumorante/at-break.js | /at-break.js | UTF-8 | 1,326 | 2.84375 | 3 | [] | no_license | /**
* At-Break
* Manu Morante
* 21/05/2014
*/
function breakpoint(){
// Media Query Horizontal Breakpoints Values (mobile first)
var hor_xs = 480, // Xtra Small
hor_sm = 768, // Small
hor_md = 992, // Medium
hor_lg = 1200, // Large
// Vertical Proportional Breakpoints
ratio = 9... | true |
1871de6465c9d4aa3a897196d5bd392eb7f18f64 | JavaScript | qinfuji/generator-webpack-react | /generators/app/templates/app/scripts/actions/index.js | UTF-8 | 369 | 2.53125 | 3 | [
"MIT"
] | permissive | import * as ActonTypes from '../constants/ActionTypes';
function listPerson(persons) {
return {
type: ActonTypes.PERSON_LIST,
persons
};
}
export function loadPerson(persons) {
return (dispatch) => {
setTimeout(() => {
const persons = [{
id: 1,
name: '李四'
}];
dispat... | true |
0ac92f6099ebfc22236da731e88e4ffcd3d61688 | JavaScript | AlexH893/Restaurant-Inventory | /script.js | UTF-8 | 722 | 2.953125 | 3 | [] | no_license |
$(document).ready(function(){
$("#submit").click(function(){
var Item_Num = $("#Item_Num").val();
var Item_Description = $("#Item_Description").val();
var Used = $("#Used").val();
var Quantity = $("#Quantity").val();
// Returns successful data submission message when the entered information is stored in database.
var ... | true |
1f9f5cc7101a257a8a5c792b8f1a8769503e888d | JavaScript | prabutdr/CodeCompeteJS | /LeetCode/30-day-april-2020/02-happy-number.js | UTF-8 | 427 | 3.859375 | 4 | [] | no_license | /**
* @param {number} n
* @return {boolean}
*/
var isHappy = function(n) {
let set = new Set();
while (n !== 1) {
set.add(n);
n = sumOfDigitSquare(n);
if (set.has(n)) return false;
}
return true;
};
/**
* @param {number} n
* @return {number}
*/
var sumOfDigitSquare =
n => String(n).split("... | true |
57f3b7bf31fb3254e409e4ac6b834fd0c840b58c | JavaScript | BhavaniDandu/oopcrash-course | /5_object_create.js | UTF-8 | 543 | 3.828125 | 4 | [] | no_license | //object
const bookProtos={
getSummary:function() {
return `${this.title} was written by ${this.author} in ${this.year}`;
},
getAge:function() {
const years=new Date().getFullYear-this.year;
return `${this.title} is ${years} years old`;
}
}
//create object
//const book1 =Object.create(bookProtos);
//b... | true |
cf1df312991384b62e6c51ccc0f57e51545bb0c8 | JavaScript | ndricimrr/carcompanion-website | /frontend/src/services/QuestionService.js | UTF-8 | 3,482 | 2.71875 | 3 | [
"MIT"
] | permissive | "use strict";
import HttpService from "./HttpService";
export default class QuestionService {
constructor() {}
static baseURL() {
return "http://localhost:3000/questions";
}
static getQuestions() {
return new Promise((resolve, reject) => {
HttpService.get(
this.baseURL(),
funct... | true |
5fa5b4f607568b9b72e0a8c15368f648c8e7bade | JavaScript | techtronics/set | /scripts/junk/set.js | UTF-8 | 2,169 | 3.640625 | 4 | [] | no_license | function Card(color, number, shape, fill) {
this.color = color;
this.number = number;
this.shape = shape;
this.fill = fill;
this.name = this.color.substring(0,1) + this.number + this.shape.substring(0,1) + this.fill.substring(0,1);
}
var getAllCards = function(colors, numbers, shapes, fills) {
var cards = [];
... | true |
19a7ff262608823f7c5abc03fcae98280a132b15 | JavaScript | LegendGamer27/Bro-Time-Server | /server/commands/customcolor.js | UTF-8 | 5,616 | 2.96875 | 3 | [] | no_license | async function awaitReply(message, question, limit = 60000){
const filter = m => m.author.id === message.author.id;
await message.reply(question);
try {
const collected = await message.channel.awaitMessages(filter, { max: 1, time: limit, errors: ["time"] });
return collected.first().content;
} catch (error) {
... | true |
3559fe977bbba5bd1eea5e7f79cf3c35d17ab7d1 | JavaScript | afterloe/node.js | /day_3/promise4.js | UTF-8 | 705 | 3.453125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | /**
* Generator 推导式 管理Promise流程
*
* 异步编程对node来说太重要了,在Ecmascript6 之前的异步编程方式为 回调函数、事件监听、发布/订阅、Promise
* 现在新的Ecmascript添加了Generator的协程,使用Generator推导式来管理Promise流程
*/
function getFoo(){
return Promise.resolve("foo");
};
let g = function* (){
try{
let foo = yield getFoo();
console.log(foo);
}catch(err){
consol... | true |
20a5d2b7b7e40ce8ca64525c8b84e4c4d0e436e0 | JavaScript | yhengkang/asteroids | /game.js | UTF-8 | 3,554 | 3.171875 | 3 | [] | no_license | (function (root) {
var Asteroids = root.Asteroids = (root.Asteroids || {});
var Game = Asteroids.Game = function(ctx) {
this.ctx = ctx;
this.asteroids = [];
this.bullets = [];
this.ship = new Asteroids.Ship([Game.DIM_X/2,Game.DIM_Y/2], [0,0],
Asteroids.Ship.RADIU... | true |
935f62e675f2da33685804460f858963ea57e050 | JavaScript | tomohikoseven/dayjs_sample | /src/Parse/test_milliseconds.js | UTF-8 | 207 | 3.046875 | 3 | [] | no_license | const dayjs = require('dayjs');
let date = dayjs(0);
console.log( date.toDate() );
// => 1970-01-01T00:00:00.000Z
let date1 = dayjs(1);
console.log( date1.toDate() );
// => 1970-01-01T00:00:00.001Z | true |
5a4d43f096a69b61127a03b33aa83b8e4ab16896 | JavaScript | ItsManishShaw/project-coinone | /src/constants/MinuteToHour.js | UTF-8 | 314 | 2.59375 | 3 | [] | no_license | const timeConvert=(n)=> {
var num = n;
var hours = (num / 60);
var rhours = Math.floor(hours);
var minutes = (hours - rhours) * 60;
var rminutes = Math.round(minutes);
return (rhours>0 ? (rhours + " h "):'') +(((rminutes>0)||(!rhours&&rminutes===0))?(rminutes+'m'):" ");
}
export default timeConvert; | true |
9d1dca0c85781fcbf2d0c0226a1e48ca73e02b6c | JavaScript | milislavski/Telerik-Academy-Season-2016-2017 | /JavaScript-Fundamentals/05. Conditional Statements/04. Sort3Numbers.js | UTF-8 | 2,267 | 4.40625 | 4 | [] | no_license | // Sort 3 real values in descending order.
// Use nested if statements.
// Note: Don’t use arrays and the built-in sorting functionality.
// a b c result
// 5 1 2 5 2 1
// -2 -2 1 1 -2 -2
// -2 4 3 4 3 -2
// 0 -2.5 5 5 0 -2.5
// -1.1 -0.5 -0.1 -0.1 -0.5 -1.1
function sortNumbers... | true |
77973396f9a9f16da5c6361ab5d257a7830e9e7a | JavaScript | tmantock/react-js | /middleware/src/middlewares/async.js | UTF-8 | 504 | 2.828125 | 3 | [] | no_license | export default function ({ dispatch }) {
return next => action => {
//if action does not have a payload or a then property then send to the next middleware
if(!action.payload || !action.payload.then){
return next(action);
}
//Make sure the Promise resolves
action.payload.then(function(respon... | true |
786c57b8c1c24723b4b302b3e434d7350dd09c11 | JavaScript | msdlisper/react-mobile-seed | /seed/commander-line/git-npm.js | UTF-8 | 5,963 | 2.515625 | 3 | [] | no_license | /**
* @file 共享公用库的脚本
* @author zhangpeng
*/
const command = process.argv[2];
const argv1 = process.argv[3];
const sp = require('shell-promise');
const fs = require('fs');
const config = require('config');
const utils = require('utils');
const versionPath = config.path.befe + 'version.json';
const _ = require('lodas... | true |
e71d1fbb28c13ae6157ce99384605c2551acd66a | JavaScript | colmo0912/js-snack-es6 | /script.js | UTF-8 | 1,900 | 3.6875 | 4 | [] | no_license | //esercizio uno
//creo un array con 5 oggetti bici
const gruppoBici = [
{nome: "bici1" , peso: 30},
{nome: "bici2" , peso: 33},
{nome: "bici2" , peso: 28},
{nome: "bici3" , peso: 31},
{nome: "bici4" , peso: 27},
]
console.log(gruppoBici)
//creo un ciclo for per recuperare
//poi aggiungo i ... | true |
6494f02963743523d9c8c8df98f0a93317032a4e | JavaScript | heyarne/dogs-life | /index.js | UTF-8 | 3,779 | 2.734375 | 3 | [] | no_license | require('dotenv').load()
const { PORT, MONGODB_URL } = process.env
// Set up our database connection and model
const mongoose = require('mongoose')
mongoose.Promise = global.Promise
mongoose.connect(MONGODB_URL, _ => console.log(`Mongoose connected to ${MONGODB_URL}`))
const Puppy = mongoose.model('Puppy', {
// hu... | true |
a7a74ae42055d1f30c5a22ed6a7d0f55335f872a | JavaScript | sschmeier/rna2drawer2 | /src/forms/annotate/bases/character/CharacterField.test.js | UTF-8 | 1,009 | 3.0625 | 3 | [
"MIT"
] | permissive | import { CharacterField } from './CharacterField';
let initialValue = 'E';
let onInput = jest.fn();
let onValidInput = jest.fn();
let onInvalidInput = jest.fn();
let set = jest.fn();
let f = CharacterField({
initialValue: initialValue,
onInput: onInput,
onValidInput: onValidInput,
onInvalidInput: onInvalidInpu... | true |
a72b986a22aecffa873a7edd087bd714dff114b1 | JavaScript | wurde/treasure-hunt | /client/src/helpers/earnNewPowers.js | UTF-8 | 614 | 3.03125 | 3 | [
"MIT"
] | permissive | /**
* Dependencies
*/
import travelTo from './travelTo';
import pray from './pray';
/**
* Define helper
*/
async function earnNewPowers() {
/**
* Pray at Linh's Shrine.
*/
await travelTo(461);
console.log("Pray at Linh's Shrine.");
await pray();
/**
* Pray at The Peak of Mt. Holloway.
*/
... | true |
9ca5e7d48a6b87367458e744125bc5161330085b | JavaScript | VitorTheodoro1/CursoWebMorderno | /fundamentos/usandoVarEmLoop2.js | UTF-8 | 169 | 2.96875 | 3 | [] | no_license | const funcs =[]
for(var i =0;i<10;i++){
funcs.push(function(){
console.log(i)
})
}
//function em for o var nao funcioan direito
funcs[2]()
funcs[8]() | true |
c8ba49504aa1f2e8ab1f717050e7b934b8ab9e43 | JavaScript | eklitzke/e | /js/event_listener.js | UTF-8 | 1,933 | 3.078125 | 3 | [] | no_license | // Copyright 2012, Evan Klitzke <evan@eklitzke.org>
//
// An implementation of the event listener interface.
var addListener = function (callbacks, name, callback) {
callbacks[name] = callbacks[name] || [];
callbacks[name].push(callback);
};
var removeListener = function (callbacks, name, callback) {
if (name i... | true |
98bb561673603fb834d19b45be1e377e6d27af08 | JavaScript | CristianZ12/music_reproductor_cjzr_mern_stack_1 | /src/app/Components/Music/Users.jsx | UTF-8 | 3,786 | 2.6875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { toast } from 'react-toastify';
import jwtDecode from 'jwt-decode';
const Users = () => {
const initialValuesUser = {
_id: '',
firstName: '',
lastName: '',
username: '',
email: '',
... | true |
95d61e90b40d8c9837c6b62eb94e2ddd50b2d520 | JavaScript | DEV6hub/HTML5-Course-Files | /HTML5April2016/Demos/Unit07-Canvas/scripts/05-path-fill.js | UTF-8 | 278 | 2.734375 | 3 | [] | no_license | function drawPath() {
var canvas = document.getElementById("my-canvas");
if (canvas.getContext) {
context = canvas.getContext("2d");
context.beginPath();
context.moveTo(50, 50);
context.lineTo(100, 100);
context.lineTo(100, 50);
context.fill();
}
} | true |
af8b893dfd4d68759e42e065dae26ce1bccd6d4d | JavaScript | abreo/PaperDuck | /src/fn.crop.js | UTF-8 | 1,206 | 2.796875 | 3 | [
"MIT"
] | permissive | (function(PaperDuck) {
PaperDuck.fn.crop = function(offsetX, offsetY, sizeX, sizeY) {
offsetX = parseInt(offsetX);
offsetY = parseInt(offsetY);
sizeX = parseInt(sizeX);
sizeY = parseInt(sizeY);
var currSizeX = this.getWidth();
var currSizeY = this.getHeight();
if (isNaN(offsetX)) {
offsetX ... | true |
aa233a529b87a161a5533e5b61a2569a1c1ae2a2 | JavaScript | Nirmal707/dredd-example | /swagger/hooks.js | UTF-8 | 2,250 | 2.625 | 3 | [
"MIT"
] | permissive |
const hooks = require('hooks');
const {MongoClient} = require('mongodb');
let db;
// Fixtures
const gist = {
'_id': '42',
'created_at': new Date().toISOString(),
'description': 'Gist description...',
'content': 'String content...',
}
const star = {
'gist_id': '42',
'starred': true,
}
// Setup databa... | true |
39a2554ec44d3106903d92554acaeb62e8e91d8f | JavaScript | TorHathaway1/pokemonBattle | /src/common/pokemonFunctions.js | UTF-8 | 5,228 | 3.03125 | 3 | [] | no_license | import axios from "axios";
export const initializePokemonForBattle = async (pokemon) => {
const speciesData = await getSpeciesDataForPokemon(pokemon);
pokemon.species = await insertGrowthRateToSpeciesData(speciesData);
pokemon.level = await calculatePokemonLevel(pokemon);
pokemon.moves = await getMovesForPokem... | true |
7119cda127e89a25c45ab3e78c9c13fe2d41dcbd | JavaScript | maciejk77/node-refresher | /modules/app.js | UTF-8 | 171 | 2.5625 | 3 | [] | no_license | var hello = require('./hello.js');
var bye = require('./goodbye.js');
hello();
bye.goodbye();
// Calling goodbye method in one line
// require('./goodbye.js').goodbye(); | true |
036822d4c9c08703d94c3b3ab9ab2403e525a3e6 | JavaScript | AndyGuoX/JavaScript-case | /EasyDatePicker/easy-date-picker.js | UTF-8 | 56,507 | 2.6875 | 3 | [] | no_license | /**
* @name easy-date-picer
* @description 日期选择插件
* @date 2020-07-30
* @author andyguo
*/
/**
* 工具函数集合 created by andyguo
*/
var utils = (function () {
/**
* @name: 工具类函数集合
* @author: andyGuo
* @version: 1.0
* @description: 常用工具类
* @dateTime: 2020-7-20
*/
/**
* @name: domOperateTools
... | true |
c17d05494a61fb6cab282e3f8639c5b04fcd849d | JavaScript | colefin8/react-drills-hooks | /app-4/src/App.js | UTF-8 | 646 | 2.671875 | 3 | [] | no_license | import React, { useState } from "react";
const App = () => {
const [username, changeUsername] = useState(""),
[password, changePassword] = useState("");
return (
<div>
<input
placeholder="username"
onChange={e => changeUsername(e.target.value)}
value={username}
/>
... | true |
3638c993e6d7a7ef233d7161be2ea91e3c856d74 | JavaScript | KleinDevDE/UBoard | /js/date.js | UTF-8 | 616 | 3.421875 | 3 | [] | no_license | setInterval(function () {time();}, 1000);
function time(){
var date = new Date();
day = date.getDate();
month = date.getMonth();
year = date.getUTCFullYear();
hours = date.getHours();
minutes = date.getMinutes();
seconds = date.getUTCSeconds();
if (day < 10) day = "0" + day;
if (month < 10) month = "0" + month;
if (h... | true |
da8d8e6dbf324216ce519baca539fa522d042b68 | JavaScript | JoanNicho/CursoIngresoJS | /8-TPs/jsFerreteFacturacion.js | UTF-8 | 1,121 | 3.625 | 4 | [] | no_license | /*1. Para el departamento de facturación:
A. Ingresar tres precios de productos y mostrar la suma de los mismos.
B. Ingresar tres precios de productos y mostrar el promedio de los mismos.
C. ingresar tres precios de productos y mostrar precio final (más IVA 21%).
*/
function Sumar ()
{
var p1;
var p2;
var p3;
var... | true |
6361bb6ef0e0dae59d9aa0c24a8215ac41fb2ea6 | JavaScript | Express-Server/express-server | /signup.js | UTF-8 | 1,881 | 2.546875 | 3 | [] | no_license | const gensalt = require('@kdf/salt')
const {knex} = require('./db-connection')
const {hashPassword} = require('./auth')
const PASSWORD_MISSMATCH_MESSAGE = 'Passwords don\'t match!'
const PASSWORD_TOO_SHORT_MESSAGE = 'Password is too short! Must be 8 or more characters.'
const USER_EXISTS_ERROR_MESSAGE = 'This usernam... | true |
1e9c24b10ee7843b65c4de55f98eedd004ccb541 | JavaScript | YiZhang-Paul/Daily_Programmer | /challenge_280/easy/zeroToHundred.js | UTF-8 | 1,654 | 3.671875 | 4 | [] | no_license | /* jslint esversion: 6 */
(() => {
document.addEventListener("DOMContentLoaded", () => {
/**
* check if right hand counting is valid
* @param array []
*
* pattern : right hand counting pattern
*
* returns boolean
*/
function rightHandValid(pattern) {
return !pattern.slice(2).some((digit, in... | true |
829d6dff04436526338b7df7aaa2173259690dc2 | JavaScript | innogames/StarCrash | /depcreated (webgl)/source/htdocs/js/libs/utils.js | UTF-8 | 1,086 | 3 | 3 | [] | no_license | define([], function() {
return {
fetchJSONFile : function (path, callback) {
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState === 4) {
if (httpRequest.status === 200) {
var data = JSON.parse(httpRequest.responseText);
if (ca... | true |
c198568cd300a52072d7568c03d05ffd7adfa7e3 | JavaScript | VMaya/Silex | /test/functional/dialogs.js | UTF-8 | 3,955 | 2.515625 | 3 | [] | no_license | var assert = require('assert')
, expect = require('chai').expect
, helper = require('../helper.js');
// store the driver and webdriver instances
// created by the helper.js methods
var driver, webdriver;
// check command line input params
if (!helper.checkParams()){
console.error('You are supposed to call grunt wit... | true |
2ac92497c02d0057808cf9d499e785b4537c8300 | JavaScript | jin4900/traverip | /app/assets/javascripts/picture-show.js | UTF-8 | 2,179 | 2.59375 | 3 | [] | no_license | $(function(){
$(document).on('turbolinks:load', function() {
function mainImage(picture){
var imghtml = `<img class="image-show" src="${picture.image}">`
return imghtml;
}
function info(picture){
var image = picture.user_avatar ? `<img class="avatar" src="${picture.user_avatar}">`: `<img... | true |
7e91957eb6135d6ece3c7a4c63749b9ef5f1598f | JavaScript | itsmingjie/babo | /app/js/app.js | UTF-8 | 9,697 | 2.640625 | 3 | [] | no_license | const db = firebase.firestore();
var user = null;
const source = document.getElementById("boba-template").innerHTML;
const bobaTemp = Handlebars.compile(source);
// configure timezone
Date.prototype.toDateInputValue = function() {
var local = new Date(this);
local.setMinutes(this.getMinutes() - this.getTimezoneOff... | true |
ea6e81fc0bf5ad92da0405bd20a2944fc8b2c50e | JavaScript | jorisvervuurt/JVSBME680 | /examples/poll_air_quality.js | UTF-8 | 4,266 | 3.515625 | 4 | [
"MIT"
] | permissive | // Enable strict mode.
'use strict';
// Load the JVSBME680 module.
const { BME680 } = require('../index');
// Initialize the BME680 object.
const bme680 = new BME680();
/**
* Pauses code execution.
*
* @param {number} duration The duration (in milliseconds).
* @returns {Promise} A promise that is resolved when ... | true |
881a5490d7ad3bd5c6e083170d8637dd04d6fc7b | JavaScript | jr31112/TIL | /Javascript/05_flow.js | UTF-8 | 861 | 3.453125 | 3 | [] | no_license | let userName = prompt('넌 누구니?')
let message
if (userName == 'ssafy'){
message = `<h1>Hello SSAFY</h1>`
} else if (userName == '1q2w3e4r'){
message = `<h1>Admin page입니다</h1>`
} else {
message = `<h1>${userName} 환영합니다.</h1>`
}
document.write(message)
switch(userName){
case '1q2w3e4r':{
message... | true |
bb5adcb3c137d1db0c924fb528c10bbdd2567e60 | JavaScript | sabaoempo/simpleRichTextEditor | /events.js | UTF-8 | 306 | 2.515625 | 3 | [] | no_license | $(document).on('click', '.bold', function(){
boldText();
})
$(document).on('click', '.italic', function(){
italicText();
})
$(document).on('click', '.underline', function(){
underlineText();
})
// $(document).on('click', function(){
// console.log('something')
// exportHTML();
// }) | true |
738f74199b6729c034fffa61f15aac283733416c | JavaScript | lminuti/PWADemo | /DemoJS/sw.js | UTF-8 | 1,742 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | // https://serviceworke.rs/
const cacheName = 'demo-v1';
const staticAssets = [
'./',
'./index.html',
'./index.js',
'./person-element.js',
'./demo.webmanifest',
'./styles.css'
];
self.addEventListener('install', e => {
console.log('install');
// "waitUntil" hold the service worker in ... | true |
3be3e36e93f6aee17f8beaf55f5a79a32f1db2a5 | JavaScript | Saikrisnan-P/sai-weather.github.io | /public/httpsfunctions.js | UTF-8 | 3,467 | 3.140625 | 3 | [] | no_license | let baseUrl= "http://localhost:5500";
//Loads the main json object file consisting of all the cities data
export let loadData = function()
{
return new Promise((resolve, reject) =>
{
try{
let wholeDataRequest = new XMLHttpRequest();
wholeDataRequest.open('GET',`${baseUrl}/all-t... | true |
97b309b6b40406e000397a7159727b031f0e5a45 | JavaScript | Nadjakoroleva/vika-hero | /js/script.js | UTF-8 | 2,810 | 3.25 | 3 | [] | no_license | let herro3X = 0;
let herro3Y = 0;
let herro2X = 0;
let herro2Y = 0;
let x = 100;
let y = 400;
let herro4;
let herro;
let herro3;
let dx = 35;
let dy = 35;
let px= 0;
let py= 0;
let health = 100;
let dHelth = 0;
let a = 0;
function setup() {
createCanvas(800, 800);
herro3X = random(100, 700);
herro3Y = random(100, ... | true |
aae39558316799d20078caa06cdad29b5161c83a | JavaScript | gmiejski/twitter_live_stats | /web/src/main/node/js/graph.js | UTF-8 | 4,176 | 2.765625 | 3 | [] | no_license | /**
* Created by piotrek on 6/20/15.
*/
$(function () {
var links = [];
var nodes = {};
var minValue = Infinity;
$('#graph-refresh-button').click(refreshGraph);
refreshGraph();
function refreshGraph() {
$.get('http://localhost:8080/keywords/connections', function (data) {
... | true |
062639bc872d2dcd2d0708543c9a0862cfc61ccc | JavaScript | Rimski/whatsForDinner | /public/js/pantry.js | UTF-8 | 1,754 | 2.6875 | 3 | [] | no_license | var app = angular.module("mealPlannerApp");
app.controller("PantryController", ["$scope", "theService", function ($scope, theService) {
$scope.theService = theService;
$scope.theService.getPantry().then(function (response) {
$scope.pantry = response.data;
});
$scope.addIngredient = function... | true |
c1a05c77fa481b37dbdbc2821a16b8c536c1800c | JavaScript | coltoncooper/Web-Fundamental | /Javascript/bday_countdown/birthday.js | UTF-8 | 936 | 3.234375 | 3 | [] | no_license | function bdayCelebration(daysUntilMyBirthday){
if (daysUntilMyBirthday > 30){
console.log(daysUntilMyBirthday + " days until my birthday. Such a long time...:(")
}else if(daysUntilMyBirthday > 5){
console.log(daysUntilMyBirthday + " days until my birthday. I'm very excited")
}else if(daysUnt... | true |
5fc74033aa135bfbd4c09fca614acf419db9ec40 | JavaScript | RassaLibre/ReactGCKarma | /jsx/App/ui/Todo.jsx | UTF-8 | 1,276 | 2.609375 | 3 | [] | no_license | /** @jsx React.DOM */
goog.provide('App.ui.Todo');
goog.require('App.ui.todo.AddForm');
goog.require('App.ui.todo.List');
App.ui.Todo = React.createClass({
/**
* Property types
*/
propTypes: {
label: React.PropTypes.string,
add_new_todo: React.PropTypes.func,
todos: React.PropTypes.func
},
/... | true |
35df70819faab8d39deadc798e7a14c998c4b282 | JavaScript | akadaica4/thi-module1 | /Tran-Nhat-Nam/cau3/java.js | UTF-8 | 1,234 | 4.09375 | 4 | [] | no_license | class Employee {
name;
age;
address;
salary;
totalWorkingHours;
constructor(name, age, address, salary) {
this.name = name;
this.age = age;
this.address = address;
this.salary = salary;
}
inputWokingHours() {
this.totalWorkingHours = +prompt("Hãy n... | true |
fa4ef06f5919eaeef0c120879212e87bab11cd61 | JavaScript | ajithpyneeds/lenovo_files | /dasta2/dasta.in/wp-content/themes/dasta/js/Unit Query Engine/spreadsheet-formulae5679.js | UTF-8 | 2,749 | 2.90625 | 3 | [] | no_license |
( function ( rootNamespace ) {
/*
* Utility constants
*/
var error = new Error( '#ERROR!' );
/*
* Utility functions
*/
var utils = { };
utils.anyIsError = function anyIsError () {
var n = arguments.length;
while ( n-- ) {
if ( arguments[ n ] instanceof Error ) {
return true;
}
}
retur... | true |
f07330ce9f83c472b7870cfe2ab6a5b7ae7bf086 | JavaScript | to-the-end/to-the-end | /utils/audio-loop.js | UTF-8 | 1,102 | 3.03125 | 3 | [
"MIT"
] | permissive | 'use strict';
class AudioLoop {
constructor(game, soundKey) {
this.game = game;
this.baseLoop = this.game.add.audio(soundKey);
this.baseLoop.loop = true;
this.playingSounds = [];
}
start() {
this.playingSounds.push(this.initialSound);
this.baseLoop.play();
}
// Adds an additional la... | true |
43d1cdddc0f645d16028535eb79b76ebde988e1e | JavaScript | mroderick/elix | /src/SelectionInViewMixin.js | UTF-8 | 3,364 | 2.8125 | 3 | [
"MIT"
] | permissive | import defaultScrollTarget from './defaultScrollTarget.js';
import symbols from './symbols.js';
/**
* Mixin which scrolls a container horizontally and/or vertically to ensure that
* a newly-selected item is visible to the user.
*
* When the selected item in a list-like component changes, the selected item
* shou... | true |
704727425f236dce7ee6309690920450f2399ecc | JavaScript | ChocolateLoverRaj/test-semver | /packages/test-semver/index.js | UTF-8 | 864 | 2.796875 | 3 | [] | no_license | /**
* @module @programmerraj/test-semver
*/
import randomItem from 'random-item'
/**
* Returns `'noice'`.
* @returns {string}
*/
export const lib = () => 'noice'
/**
* Returns `3`.
* @returns {number}
*/
export const good = () => 3
const kindMessages = [
'Thank You',
'You are amazing',
'Good',
'Nice... | true |
bcc319bd7e485fbfdec7ca7aa0d6b4048cccd09a | JavaScript | lglash/laura-homework | /Assignment - Week 4/Relaxr Week 3/js/index.js | UTF-8 | 1,848 | 3.4375 | 3 | [] | no_license | //this is the log message to console to verify that JS file is loaded//
console.log ('javascript file linked to index.html');
//this below is for JS to execute only after all elements have rendered on the page//
$(document).ready(function(){
//this below is the log message to the console to verify JQuery has loa... | true |
75cee19d12a2eae01ab32a9a11999784ea24b3a1 | JavaScript | ChristopherRobertson/ShoppingCart | /navBarSolution01.jsx | UTF-8 | 546 | 3.03125 | 3 | [
"MIT"
] | permissive | // use of "props" to set data
function NavBar({ menuitems }) {
const { Button } = ReactBootstrap;
// remove all even numbers in the NavBar
let list1 = menuitems.filter(item => item % 2 !== 0);
let list2 = list1.map((item, index) => {
return <Button key={index.toString()}>{item}</Button>;
});
// note tha... | true |
474ce13844d361bf5b01c89445be07abcb460602 | JavaScript | NirvanaNimbusa/my-corona-data | /new-york-city-data.mjs | UTF-8 | 3,537 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | /*
Copyright 2020 Google LLC
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 in writing, software
dist... | true |
04bc5a413a6e2cfde16b42c5cf3d98779515609a | JavaScript | guetatanouar/nappdeal | /controllers/transaction.js | UTF-8 | 12,438 | 2.578125 | 3 | [] | no_license | const User = require("../Models/User");
const Product = require("../Models/Product");
const Transaction = require("../Models/Transaction");
function respondWithResult(res, statusCode) {
statusCode = statusCode || 200;
return function(entity) {
if(entity) {
return res.status(statusCode).jso... | true |