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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
576839baf216c8c6e64c4d4cb01c41830235fd7f | JavaScript | tutinformatics/ofbiz | /plugins/manufacturingWarehouse/vue-storefront/core/lib/search/adapter/graphql/gqlQuery.js | UTF-8 | 3,129 | 2.578125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"OFL-1.0",
"LicenseRef-scancode-unknown",
"EPL-1.0"
] | permissive | function processNestedFieldFilter (filter) {
let processedFilter = {}
let filterAttributes = filter.attribute.split('.')
if (filterAttributes.length > 1) {
let nestedFilter = filter.value
for (let i = filterAttributes.length - 1; i >= 0; i--) {
nestedFilter = { [filterAttributes[i]]: nestedFilter }
... | true |
e96a5393f328825c4a1b0ede2f6988328f444318 | JavaScript | ZFudge/ProjectEuler-Javascript | /problem8.js | UTF-8 | 454 | 4.28125 | 4 | [] | no_license | /* A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a^2 + b^2 = c^2
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc. */
function pythagorean() {
for (let a = 10; a < 1000; a++) {
for (let ... | true |
c9b152a8ea07386e801c0cf71feac0a749ec28db | JavaScript | cloudqjp/hackathon_matterjs | /pooh/js/BK/ballpool_test.js | SHIFT_JIS | 2,682 | 2.6875 | 3 | [] | no_license | var Engine = Matter.Engine, //V~[Vу_OǗRg[[ƂȂ郁\bh
World = Matter.World, //Z̈̍쐬E삷郁\bh܂
Body = Matter.Body, //̂̃f쐬E삷郁\bh܂
Bodies = Matter.Bodies, //ʓIȍ̃f쐬郁\bh܂
Constraint = Matter.Constraint, //쐬E삷郁\bh܂
Composites = Matter.Composites,
Common = Matter.Common,
Vertices = Matter.Vertices, //_̃Zbg쐬E삷郁\bh܂
Mous... | true |
9f78a23733bb1c6a41cb3a1bbc962a2f9efd4a43 | JavaScript | muratkeremozcan/books | /Kyle-Simpson_Luis-Antecio/You-Dont-Know-JS/2.scope&closures/ch4/closure3.js | UTF-8 | 456 | 3.59375 | 4 | [] | no_license | function wait(message) {
setTimeout( function timer(){
console.log( message );
}, 5000 );
}
wait( "Hello, closure!" );
// We take an inner function (named timer) and pass it to setTimeout(..).
// But timer() has a scope closure over the scope of wait(),
// 5 thousand milliseconds after we ... | true |
d6892c59fb775097b5d286fe1c7bd07232d6126f | JavaScript | panzerstadt/storybook-components | /src/components/Tensorflow/BrightnessPredictor/index.js | UTF-8 | 2,015 | 2.6875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import useInterval from "./helpers/useInterval";
import Camera from "./helpers/Camera";
import predictBrightness from "./predict";
const RGB_SCALE = 0.02;
// sml model learning bright and dark
export const isBright = async canvas => {
const clrs = canvas
.ge... | true |
fe83b1c9d6c9b94a0af3cf4a211108c0ba44ce54 | JavaScript | davidalencia/web-code | /static/scripts/lib/render-file-list.js | UTF-8 | 2,273 | 2.546875 | 3 | [
"MIT"
] | permissive | /* global Map, Set, Promise */
/* eslint no-var: 0, no-console: 0 */
/* eslint-env es6 */
import Stats from './web-code-stats.js';
import BufferFile from './buffer-file.js';
function renderFileList(el, array, options) {
options = options || {};
var useOptions = {
hideDotFiles: (options.hideDotFiles !== undefined... | true |
b180cbd085df666e69e5d7810ced5769e11eedb0 | JavaScript | GabeHeath/LQ | /test/core_spec.js | UTF-8 | 4,768 | 2.65625 | 3 | [] | no_license | import {List, Map} from 'immutable';
import {expect} from 'chai';
import {setEntries, next, vote, restart} from '../src/core';
describe('application logic', () => {
describe('setEntries', () => {
it('adds the entries to the state', () => {
const state = Map();
const entries = List.of('Jurassic Par... | true |
6bb04fb3538512e84892853733f635c21221bb92 | JavaScript | AYCHDeveloper/Ember | /packages/ember-metal/lib/path_cache.js | UTF-8 | 935 | 2.640625 | 3 | [
"MIT"
] | permissive | import Cache from './cache';
const IS_GLOBAL_PATH = /^[A-Z$].*[\.]/;
const isGlobalPathCache = new Cache(1000, key => IS_GLOBAL_PATH.test(key));
const firstDotIndexCache = new Cache(1000, key => key.indexOf('.'));
const firstKeyCache = new Cache(1000, (path) => {
let index = firstDotIndexCache.get(path);
return... | true |
7b59ac1719692033a0fd5c8a3b3ccddea4e08396 | JavaScript | arkhemlol/storekeeper | /src/js/level/Direction.js | UTF-8 | 1,494 | 2.78125 | 3 | [] | no_license | import _ from 'underscore';
let Direction = {
NONE: 'none',
LEFT: 'left',
RIGHT: 'right',
UP: 'up',
DOWN: 'down'
};
_.extend(Direction, {
isValid: function(direction) {
return _.contains([
Direction.NONE,
Direction.LEFT,
Direction.RIGHT,
... | true |
00de4746b3e13849209ebac6f7cf2c9be5223525 | JavaScript | SvetlanaSS/Simple_CMS | /js/ajax-fetch.js | UTF-8 | 4,141 | 3.109375 | 3 | [] | no_license | /*jshint esversion: 6 */
console.log('---AJAX Fetch');
console.log( '-----Revealing Module Pattern-----');
/**
* Module with AJAX functions for fetching data. Uses fetch
*
*/
var ajaxFetch = (function() {
/**
* Fetch data from API
* @param {String} dataurl - the url to the API
* @param {String} queryString... | true |
785290eecaec650b6d5b6348b4cb15b7f79692b9 | JavaScript | alexaugusto23/dio_js | /js/restespreadoperator.js | UTF-8 | 1,670 | 3.90625 | 4 | [] | no_license | function sum (a,b) {return a+b;}
function sumargs (a,b)
{
var value = 0;
for(var i=0; i < arguments.length; i++)
{
value += arguments[i];
}
return value;
}
//rest operator ...
function sumargs2 (...args)
{
console.log(args);
console.log(arguments);
}
function sumargs3 (...args)
{
... | true |
881cb5615400784a687406e062eab877f67d4c5b | JavaScript | kwalx/HTML-Codding | /Oleh_Smolkin/Euler project/15_Lattice_paths.js | UTF-8 | 858 | 3.9375 | 4 | [] | no_license | // Starting in the top left corner of a 2×2 grid, and only being
// able to move to the right and down, there are exactly 6 routes
// to the bottom right corner.
//
// How many such routes are there through a 20×20 grid?
const findNumberOfRoutes = (size) => {
// initialize matrix for dynamic
// DPMatrix[i, j] ... | true |
56a35ab6d500d38a1a8d133a1e1403102055bbaf | JavaScript | donatoverite/creativeshare | /web/main.js | UTF-8 | 269 | 2.578125 | 3 | [] | no_license | var items = {};
update();
function viewItem(){ clear();var item = document.getElementById('items').options[document.getElementById('items').selectedIndex];var content = items[item.value];addtext(content);
}
document.getElementById('items').onchange = viewItem;
| true |
1fa4337e3a469749d3379ea79604eeaa57f1ba0f | JavaScript | ToggyO/avstr | /src/Core/utils/local-storage.js | UTF-8 | 631 | 2.640625 | 3 | [] | no_license | /* eslint-disable no-useless-catch */
const { REACT_APP_PREFIX } = process.env;
export function writeToLocalState(key, state) {
try {
localStorage.setItem(`${REACT_APP_PREFIX}_${key}`, JSON.stringify(state));
} catch (e) {
throw e;
}
}
export function getFromLocalState(key) {
let state... | true |
a2efb3faac24e80f856a72ea16667e84350c5396 | JavaScript | osltd/oneshop.js | /src/roles/merchant/domain.js | UTF-8 | 1,920 | 2.6875 | 3 | [
"MIT"
] | permissive | const Role = require('../fundamental');
class Domain extends Role {
constructor(baseURL, credentials, role){
super(baseURL, credentials, role);
this.baseURL = baseURL;
this.credentials = credentials[role] || {
user : credentials.user || '',
pass : credentials.pass |... | true |
a863f42f77737ae05b66c83872d7864692eeaaa6 | JavaScript | chandrikas-optimus/jshint_demo | /app/pages/product/validate-add-to-cart-ui.js | UTF-8 | 2,615 | 2.546875 | 3 | [] | no_license | define([
'$',
], function(
$
) {
// NOTE: initially copied from Ballard
var trackValid = function(currentState, newState) {
return currentState && newState ? true : false;
};
var checkSelect = function($el) {
return !/select/i.test($el.val());
};
var checkQty = functio... | true |
27a543a305420d40051810f9c8e92a85b3214973 | JavaScript | Nisha991/iPod | /src/components/iPodScreen.js | UTF-8 | 1,851 | 2.640625 | 3 | [] | no_license | import React from 'react';
import './static/iPodScreen.css'
// Selects and returns the JSX to be returned based on the option selected in the main menu
const iPodScreen = ({primary, selected}) => {
switch (selected) {
//Base JSX for main menu
case 0:
return (
<div classN... | true |
6ce8f4969c1f22a2d916df113f9eb968c1ce9777 | JavaScript | markjvoltaire/Quest-Lab | /Data/season-data.js | UTF-8 | 3,465 | 2.625 | 3 | [] | no_license |
const liverpool = {
id: 'liverpool',
title: 'Battle At Anfield',
map: {
top: '61%',
right: '36%'
},
image: 'liverpool.jpeg',
description: ` It's a big game against one of the top teams in England......Liverpool
the game is tied and we have a penalty kick to give a victory... | true |
7332242464df29ae9b56589a76be71d597b033ce | JavaScript | lilingxi01/uno | /common/DeckBuilder.js | UTF-8 | 2,934 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | export default {
validColors: ['red', 'yellow', 'green', 'blue', 'special'],
validTypes: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'skip', 'reverse', '+2', 'wild', 'wild+4'],
deckConfig: {
colors: ['red', 'yellow', 'green', 'blue'],
colorCounts: {
0: 1,
1: 2,
2: 2,
3: 2,
... | true |
0f50e87149c394800dc3fd8571e8f60d1828ed51 | JavaScript | kushagra-03/Enque | /app/assets/javascripts/handlebar_helper.js | UTF-8 | 216 | 2.53125 | 3 | [] | no_license | $(document).ready(function(){
Handlebars.registerHelper('trimString', function(passedString) {
var theString = passedString.substring(0,50);
return new Handlebars.SafeString(theString)
});
}); | true |
87e1d8a295e3ffbbaa1b514e1d415d7c83ad844d | JavaScript | metal/metal-training | /playground/examples/metal-state/owner.js | UTF-8 | 228 | 2.5625 | 3 | [] | no_license | 'use strict';
import State from 'metal-state';
class MyClass extends State {
}
MyClass.STATE = {
foo: {
}
};
const obj = {};
const state = new MyClass(
{
foo: 1
},
obj
);
debugger;
console.log(state.foo, obj.foo);
| true |
195b824086b6b5ec944a54026b051083560f5735 | JavaScript | aby113/flower-html | /js/t.js | UTF-8 | 73 | 2.578125 | 3 | [
"MIT"
] | permissive | if("8" == 7){
console.log("참");
}else{
console.log("거짓");
} | true |
61d9f379cfb1e05c893aea86fd5f7ce18ff9f713 | JavaScript | abdelrady/CS572 | /Practice/fork01.js | UTF-8 | 195 | 3.140625 | 3 | [] | no_license | const fib = (number)=>{
if (!number) return 0;
if (number == 1) return 1;
return number + fib(number - 1);
}
process.on("message", (data)=>{
process.send(fib(parseInt(data)));
}) | true |
742ae01f16da7dc446336e4ddedf800b1924c010 | JavaScript | NaskoVasilev/JavaScript-Core | /JavaScript Advanced/Advanced functions/Functions-Exercise/commandProcessor.js | UTF-8 | 575 | 3.5 | 4 | [] | no_license | function solve(arr) {
let commandProcessor=(function () {
let result="";
return{
'append':(word)=>result+=word,
'removeStart':(num)=>result=result.substring(num),
'removeEnd':(num)=>result=result.substring(0,result.length-num),
'print':(word)=>console.... | true |
453596715851554d300a16a9bb37ddb33ba00a87 | JavaScript | Connor-Ashlock/oui-eat | /client/components/order-items.jsx | UTF-8 | 2,538 | 2.65625 | 3 | [] | no_license | import React from 'react';
class OrderItems extends React.Component {
constructor(props) {
super(props);
this.state = { items: {} };
this.getTotal = this.getTotal.bind(this);
this.getEachItemCount = this.getEachItemCount.bind(this);
}
getTotal() {
let total = 0;
for (let i = 0; i < this.... | true |
a60559428db15d29951a70193a40fc3fcce3561d | JavaScript | mcdnnll/RunningIndex | /src/server/utils/startupCheck.js | UTF-8 | 781 | 2.546875 | 3 | [
"MIT"
] | permissive | const logger = require('./logger').appLogger;
const env = process.env;
/**
* Function to perform startup check, ensuring that environment variables
* have been correctly provided prior to initialising the server.
*/
module.exports = function startupCheck() {
if (typeof env.NODE_ENV === 'undefined' ||
(env.NO... | true |
047f4387bf1393ea646e5378ca905e308045f429 | JavaScript | minhphuoc275/nodejs-sample | /08_oop2.js | UTF-8 | 343 | 3.5 | 4 | [] | no_license | function course(name, tuition){
this.sName = name;
this.iTuition = tuition;
}
course.prototype.describe = function(){
console.log("Hello " + this.sName + " " + this.iTuition);
}
//Create oop nodejs with name is "NodeJS Programming" and tuition is 100 USD
var nodejsCourse = new course("NodeJS Programming", 100);
n... | true |
3bdfb952f7317450719dfa6da278b12ef7e03194 | JavaScript | BFlorian91/twitch-chat-in-term | /index.js | UTF-8 | 877 | 2.625 | 3 | [] | no_license | const tmi = require('tmi.js');
const datas = {
colors: {
reset: "\x1b[0m",
black: "\x1b[30m",
red: "\x1b[31m",
green: "\x1b[32m",
yellow: "\x1b[33m",
blue: "\x1b[34m",
magenta: "\x1b[35m",
cyan: "\x1b[36m",
white: "\x1b[37m"
}
}
function getTime() {
const date = new Date();
... | true |
555807733a45c556d2923113df2635ebe5a49b94 | JavaScript | 287/code.js | /toArrayIfNot.js | UTF-8 | 223 | 2.90625 | 3 | [] | no_license | /**
* 如果不是数组的话,把他放进数组
* @include isArray fillArray
* @param {array|any} o
* @return {array}
*/
function toArrayIfNot(o, length = 1){
return isArray(o) ? o : fillArray([], o, 0, length);
} | true |
7d78c5db3fa84bdd9407f39c43f3988ef01f45eb | JavaScript | pixelpox/nodejs | /server-test/server-test/bin/getHueLightInfo.js | UTF-8 | 597 | 2.96875 | 3 | [] | no_license | var HueApi = require("node-hue-api").HueApi;
var displayStatus = function(status) {
console.log(JSON.stringify(status['state']['on']))
//console.log(JSON.stringify(status, null, 2));
};
//var host = "192.168.0.233",
// username = "1RDgumH03HYnN-UU8xSw28SGnml8HFiHtMN-igGS",
var api = new HueApi(huehost,... | true |
beac31a51881f32b882c35367ff16b7e7ae255c5 | JavaScript | ElonMusk-AI/wreckball | /sketch.js | UTF-8 | 1,636 | 2.78125 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
const Constraint = Matter.Constraint;
var engine,world;
var ground0;
var building0,building1,building2,building3,building4,building5,building6,building7,building8,building9,building10,building1... | true |
6d8ece90ecff4fb91ffcecafb57ef12256983173 | JavaScript | FatB0YY/other-lessons-js | /modal-window/main.js | UTF-8 | 939 | 2.796875 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function() {
let modal = document.querySelector(".r-modal");
let modalBtn = document.querySelector("#modalBtn");
let modalClose = document.querySelectorAll("#modalClose");
modalBtn.addEventListener("click", function() {
const ANIMATION_SPEED = 200;
... | true |
2e029f50b27daf420caa7947a87cbd810f3148d1 | JavaScript | chris14b/Music-Visualiser | /js/music-scene.js | UTF-8 | 4,863 | 2.640625 | 3 | [] | no_license | import Scene from "./scene.js"
export default class MusicScene extends Scene {
static DARK_TIME_THRESHOLD = 0.5; // seconds of quiet, after which colour will change
static SMOOTHING_TIME_CONSTANT = 0.97;
static SILENT_THRESHOLD = 0;
static RESET_VALUES_TIME_THRESHOLD = 1;
static FFT_SIZE = 2048;
... | true |
9e974b1ca9ab3ae3e2e8fc37c9b9e26ac2c893b9 | JavaScript | arbyte-br/Arbyte-Atividades | /turma-2/caickmarques/Lista_9/E4.js | UTF-8 | 312 | 3.671875 | 4 | [] | no_license | let numeroPrimo = require('prime-number');
let rs = require('readline-sync');
let numero = rs.questionInt('Informe um numero para saber se ele e numero primo: ');
if (numeroPrimo(numero)) {
console.log(`O ${numero} é numero primo`);
} else {
console.log(`O ${numero} não é numero primo`);
} | true |
08da3ccda195363fec2c9087f5a5dddc75d47063 | JavaScript | Luismi-Hub/DWEC_Javascript | /Unidad7/Worksheet1/Ejercicio8.js | UTF-8 | 764 | 3.109375 | 3 | [] | no_license | window.addEventListener("load", () => {
// Cambiar el tamaño de la fuente de las noticias. Tres tamaños
let noticias = $("div");
$(noticias[0]).css("font-size", "0.8rem");
$(noticias[2]).css("font-size", "1.2rem");
// Mostrar y ocultar noticia al pulsar sobre cada título
noticias.find("h3").on... | true |
dfb8ca1c526307301257b4340ef9cb87a99f2285 | JavaScript | GrammaClock/grammaclock.github.io | /script.js | UTF-8 | 3,776 | 3.359375 | 3 | [] | no_license |
"use strict";
// DIGITAL CLOCK
//////////////////////////////////////////////////////////////////////////////////////////////////////
function runDigitalClock(){
var today_d = new Date();
var hour_d = today_d.getHours();
var minute_d = today_d.getMinutes();
var period_d = getPeriod_d(ho... | true |
69e2f5d424dcb6634109c191341490d34d5e2727 | JavaScript | TELEUZI/solar-system | /js/entities/Planet.js | UTF-8 | 599 | 2.890625 | 3 | [] | no_license | import IconCreatorService from '../services/IconCreatorService';
export default class Planet {
constructor(x, y, radius, velocity, orbitRadius, src) {
this.image = IconCreatorService.createIcon(src);
this.startX = x;
this.startY = y;
this.radius = radius;
this.velocity = velocity;
this.radian... | true |
311c9675ce4aeced32446c00d2246a8ac22d86e6 | JavaScript | littlelittleany/functioncuntion | /index.js | UTF-8 | 3,605 | 3.515625 | 4 | [] | no_license | const sounds = Array.from({ length: 6 });
const backgroundColor = [230,220,190];
const myCanvas = {width:600, height:600};
const lineColor = [0, 0, 0,];
const activeLineColor = [255, 255, 255];
const lineWidth = 3;
const activeLineWidth = 9;
const ball1 = {
x: 300,
y: 300,
r: 100,
speed: 1,
fill... | true |
3ccb4feef8ca2b3c34d9acbae1e4bab6d9644112 | JavaScript | brocawernicke/old-jekyll-backup | /fitself/js/index.js | UTF-8 | 7,613 | 2.59375 | 3 | [
"MIT"
] | permissive | let videoWidth, videoHeight;
let qvga = {width: {exact: 320}, height: {exact: 240}};
let vga = {width: {exact: 640}, height: {exact: 480}};
let resolution = window.innerWidth < 640 ? qvga : vga;
// whether streaming video from the camera.
let streaming = false;
let camvideo = document.getElementById('video');
let ca... | true |
3f40044b2dc97bfaab3dff6056fb8fc82a0db186 | JavaScript | minnuss/Digital-Clock | /main.js | UTF-8 | 625 | 3.171875 | 3 | [] | no_license | const divClock = document.querySelector('.digitalClock');
function clock() {
const date = new Date();
let hour = date.getHours();
let min = date.getMinutes();
let sec = date.getSeconds();
hour = hour < 10 ? '0' + hour : hour;
min = min < 10 ? '0' + min : min;
sec = sec < 10 ? '0' + sec : s... | true |
e81a7eafa16229d7896343dc1b01dc9e04479719 | JavaScript | altafshaikh/todo-app-frontend | /src/main.js | UTF-8 | 1,395 | 2.75 | 3 | [
"MIT"
] | permissive | import { formSubmission } from "./helper/formSubmission.js";
import { deleteCheck } from "./helper/deleteCheck.js";
import { renderTodo } from "./helper/renderTodo.js";
import { filterTodo } from "./helper/filterTodo.js";
import { endpoint } from "./endpoints.js";
window.onload = () => {
document.forms.taskList.addE... | true |
da69491dc80256f8368658bf25235ff3e8de096e | JavaScript | DevFarzan/Quiz-taker | /public/javascripts/Result.js | UTF-8 | 375 | 2.78125 | 3 | [
"MIT"
] | permissive | //alert('gdsghdghd')
$(document).ready(function(){
var a= sessionStorage.getItem('Result');
$("#get").html(a)
var results = JSON.parse(a);
var calculation = 0;
results.forEach(function(entry) {
if(entry==true){
calculation++;
}
})
percentage = calculation/resu... | true |
b294ff27b0a97c88dd320b1dafbac3e7b28f925d | JavaScript | rodrigobell/programming-practice | /Javascript/13-capitalize-words.js | UTF-8 | 326 | 3.625 | 4 | [] | no_license | function capitalizeWords(string) {
var words = string.split(" ");
var result = "";
for (var i = 0; i < words.length; i++) {
upperCase = words[i].charAt(0).toUpperCase() + words[i]. slice(1);
result += upperCase + " ";
}
result = result.slice(0,-1);
return result;
}
console.log(capitalizeWords("mike ... | true |
91e74e6401502e51ba6b8a2c7101ed04d6d22dc5 | JavaScript | yichenzhu1337/telus-junior-developer-program-lessons | /4-functional-js/0-what-is-functional-programming.js | UTF-8 | 845 | 4.125 | 4 | [] | no_license | /***** Pure vs Impure functions *****/
/******************************************/
// 1. Pure
function greet(name) {
return `Hello, ${name}!`
}
greet('Alonzo') // "Hello, Alonzo!"
greet('Alan') // "Hello, Alan!"
// 2. Impure
let name = 'Alonzo'
function greet() {
console.log(`Hello, ${name}!`)
}
greet() // H... | true |
4b8cfdccd89eccd9b6093fe21e981c4a1af1666f | JavaScript | dvdln/xform | /lib/transform.js | UTF-8 | 697 | 2.953125 | 3 | [] | no_license | /**
* @param {Object} template
* @param {Object} source
* @param {Map} data
* @returns {Object}
*/
export function transform(template = {}, source = {}, data = new Map()) {
let result = {};
for (let key of Object.keys(template)) {
let node = template[key];
let value = source[key];
let context = {... | true |
fd6c6576dbe5bf632aaec872c3899a0c5c0146db | JavaScript | Ruotongw/nessieRepo | /app/static/js/multi.js | UTF-8 | 1,056 | 2.921875 | 3 | [] | no_license | //Popup for multi-event scheduling appears and checks if any checkboxes
//are checked through CheckBoxCount() function. Then, returns True or False.
//From variety post of stack overflow, but specifcally Lalji Dhameliya:
//https://stackoverflow.com/questions/901712/how-to-check-whether-a-checkbox-is-checked-in-jquery
... | true |
1079514a31bd679df3a9d3846fcf844d4a60be47 | JavaScript | danlubbers/codewars-api | /src/App.js | UTF-8 | 3,081 | 3.109375 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import './App.scss';
import axios from 'axios';
import profileImg from './assets/codewars-profile-image.jpeg';
import graphicHeader from './assets/codewars-header-graphic.png';
import codewarsLogo from './assets/codewars-logo-small.png';
const App = () => {
con... | true |
c41efa713cc88e305d8ad75a5889df56f5f3ce1b | JavaScript | hochan222/simple_func | /script.test.js | UTF-8 | 427 | 2.828125 | 3 | [] | no_license | const formatNumber = require("./script");
test("1000", () => {
expect(formatNumber(1000)).toBe("1,000");
});
test("123456", () => {
expect(formatNumber(123456)).toBe("123,456");
});
test("1234567", () => {
expect(formatNumber(1234567)).toBe("1,234,567");
});
test("12345678", () => {
expect(formatNumber(1234... | true |
fee3d870b38639a179463802c8b3bd774c4a5d9e | JavaScript | MrRobin12/website | /tabs/test folder/Shake Template/script.js | UTF-8 | 1,463 | 3.078125 | 3 | [] | no_license | window.addEventListener("deviceorientation", handleOrientation, true);
var x = null;
var y = null;
var z = null;
function handleOrientation(event) {
var absolute = event.absolute;
var alpha_z = event.alpha;
var beta_x = event.beta;
var gamma_y = event.gamma;
x = beta_x;
y = gamma_y;
... | true |
8898d5b979513479aa611ff908d3352b534c5b58 | JavaScript | yangpeng20171201/Node-Demo | /buffer-test/write_value.js | UTF-8 | 280 | 3.1875 | 3 | [] | no_license | buf = Buffer.alloc(256);
// length 参数是写入的字节数。 如果 buf 没有足够的空间保存整个字符串,则只会写入 string 的一部分。 只部分解码的字符不会被写入。
len = buf.write("www.runoob.com");
console.log("写入字节数 : "+ len); | true |
254a519216dcf7bc9e6380e58c4f86e76c57ebb7 | JavaScript | tomsoderlund/simple-browser-session | /simpleSession.js | UTF-8 | 2,727 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* SimpleSession module
* @description Library to get/set session values from cookie and/or URL query string.
* @module SimpleSession
* @author Tom Söderlund
*/
const DEFAULT_COOKIE_NAME = 'app'
let cookieName = DEFAULT_COOKIE_NAME
const stringifyObject = obj => typeof obj === 'object' ? JSON.stringify(obj) :... | true |
e67814c06053e96c41a8e1df394708937b651d89 | JavaScript | dalfageme/newtral | /back/controllers/user.js | UTF-8 | 1,329 | 2.546875 | 3 | [] | no_license | const userModel = require('../models/user');
const taskModel = require('../models/task');
const mongoose = require('mongoose');
async function login(req, res){
let email = req.body.email;
let password = req.body.password;
let user = await userModel.findOne({email: email});
if(!user){
return res.status(500... | true |
f7fd9b4f73aeaf58576bec26b7f04a5ea63d013e | JavaScript | FabioVlad/324-Final-Ejer3 | /ejercicio1/ejercicio1-completar-objeto.js | UTF-8 | 53,300 | 2.75 | 3 | [] | no_license | // primer ejercicio con three.js
// crear una geometria teniendo en cuenta el orden de los vértices
var camera, scene, renderer;
var cameraControls;
var clock = new THREE.Clock();
var ambientLight, light;
function init() {
var canvasWidth = window.innerWidth * 0.9;
var canvasHeight = window.innerHeight * 0.9;
// ... | true |
14957dbc0fb33a616694e7c677d2bc9596989b62 | JavaScript | dxprog/slack-test | /js/image-cell.js | UTF-8 | 972 | 3.125 | 3 | [] | no_license | /**
* A single Image cell for use in an ImageGride
*
* @constructor
* @param {HTMLElement} parent The cell's parent element
*/
function ImageCell(parent) {
this.parent = parent;
this.el = document.createElement('div');
this.el.classList.add('image-cell');
this.image = document.createElement('img'... | true |
c4b2fbab00db35ed00cdb12233de312a230d8a4c | JavaScript | JohnHayes7/spa_store | /spa_store_frontend/js/vendor_helpers.js | UTF-8 | 2,768 | 3.03125 | 3 | [] | no_license | function addVendors(vendorsAry){
let topVs = document.getElementById('top-vendors-list')
vendorsAry.forEach(v => {
let vId = v.id
let vName = v.attributes.name
let vTagline = v.attributes.tagline
let vendor = createVendor(vId, vName, vTagline)
createVendorPreviewElemen... | true |
7f250f3449872cc04689f9d6c17fe2edc3737c2f | JavaScript | petercole-401-advanced-javascript/data-structures-and-algorithms | /challenges/stacksAndQueues/stacks-and-queues.js | UTF-8 | 1,572 | 3.34375 | 3 | [] | no_license | 'use strict';
class Node {
constructor(value, next) {
this.value = value;
this.next = next;
}
}
class Stack {
constructor(){
this.top = null;
}
push(value){
const node = new Node(value, null);
node.next = this.top;
this.top = node;
}
pop(){
let popValue = 'Empty Stack';
if (t... | true |
b7a9e2c20bf1ed896422bf2cc163bda738c8c276 | JavaScript | dhristoskov/Simple-JS-Tasks | /Coffee Bill/app.js | UTF-8 | 1,666 | 3.609375 | 4 | [] | no_license | function numberValidation (price) {
let num = parseFloat(price);
if(typeof num !== 'number'){
throw new TypeError ('the price should be a number')
}
return num.toFixed(2);
}
function calcSum () {
var table = document.getElementById('product-list').getElementsByTagName('td');
let total =... | true |
c1cf581ca750a461978c7499010d05fb6c878455 | JavaScript | haid0109/kbh-billeder | /indexing/post-processing/print-asset-exceptions.js | UTF-8 | 1,066 | 2.53125 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* The post processing step that steps through all currently indexed assets
* and deletes every asset that was not indexed during this run of the update to
* the index.
*/
function printAssetExceptions(state) {
var errors = state.queries.reduce((result, query) => {
return result.concat(que... | true |
946d261b00ad99642fcd9628984fea7118237aee | JavaScript | TFisch/movie-tracker | /src/api/apiCalls.js | UTF-8 | 4,358 | 2.546875 | 3 | [] | no_license | import { apiKey } from '../api/apiKey';
export const fetchMovies = async () => {
try {
const url = `https://api.themoviedb.org/3/discover/movie?api_key=${apiKey}&language=en-US&sort_by=popularity.desc&include_adult=false&include_video=false&page=1&primary_release_year=2018`;
const response = await fetch(url)... | true |
75ee7b81f73e23e6825c95117b25f2cd3fb785b4 | JavaScript | dhl1337/favour | /app/components/main/MainService.js | UTF-8 | 2,018 | 2.5625 | 3 | [] | no_license | (() => {
angular
.module('favourApp')
.service('MainService', ['$firebaseObject', '$firebaseArray', 'fb', MainService]);
function MainService ($firebaseObject, $firebaseArray, fb) {
let currentUser = null;
let ref = new Firebase(fb.url);
ref.onAuth(user => user ? curren... | true |
4f37e2e4838b0d2a92f9965abfdd0498ff11c7e3 | JavaScript | Jorce-Li/idol-miniprogram | /miniprogram/components/calendar/calendar.js | UTF-8 | 8,889 | 2.8125 | 3 | [] | no_license | // components/calendar/calendar.js
/**
* 日历选择组件
* author: jorce
*/
const moment = require('moment');
Component({
/**
* 组件的属性列表
* data [Date] 当前现实的月份
*/
properties: {
date: {
type: null,
value: moment()
},
storeData: {
type: Object,
value: {
attributes: {
... | true |
aaf1056f169dbcc08731756187bf88afd52351f4 | JavaScript | nicholas-zeiss/Chat-Palette | /app/client/auth/auth.js | UTF-8 | 1,804 | 2.59375 | 3 | [] | no_license | /**
*
* Authorization controller for login and sign up pages. Handles submission of login/sign up details.
* If successful, the controller sets the session token and username onto the window's sessionStorage
* and routes us to the chat view. If unsuccessful, the controller removes the token should one already ex... | true |
edb21121588d0904e1c4e35bce820b0869068362 | JavaScript | Quan-HHH/test | /js/call-apply-bind/apply.js | UTF-8 | 289 | 2.75 | 3 | [] | no_license | Function.prototype.myApply = function(context) {
context = context || window
context.fn = this
let args = arguments[1]
let res = ontext.fn(...args)
delete context.fn
return res
}
function foo(age,ages) {
console.log(this.name, age, ages)
}
foo.apply({name: 'qjx'}, [18,19]) | true |
5036697e21ab5a45edaebcc936001ba837dc41ac | JavaScript | paynd/redux_data_loading | /app/reducers/contacts.js | UTF-8 | 631 | 2.5625 | 3 | [] | no_license | import { LOAD_CONTACTS, LOAD_CONTACTS_SUCCESS, LOAD_CONTACTS_ERROR } from '../actions/contacts'
const initialState = {
isLoading: false,
result: [],
}
export default function contacts(state = initialState, action = {}) {
switch (action.type) {
case LOAD_CONTACTS:
return {
...state,
isL... | true |
3329d4e8bfce8eeead3a8f320e9700522df3584b | JavaScript | pelias/parser | /tokenization/split_funcs.js | UTF-8 | 1,176 | 3.171875 | 3 | [
"MIT"
] | permissive | /**
split the input text in to 'sections' according to field delimiter rules
eg:
foo-bar baz, bing-bong bop baz
|------||---||--------||--||---| tokens
|===========|==================| sections
**/
const whitespace = new RegExp(/^\s$/)
const quotes = `"«»‘’‚‛“”„‟‹›⹂「」『』〝〞〟﹁﹂﹃﹄"'「」`
function fieldsFuncBo... | true |
b96b57d6f7139ad42fe8aba770501a239127e73c | JavaScript | NenadZdravkovic97/Pizza_Dough_Calculator | /old_version/oldapp.js | UTF-8 | 1,616 | 3.015625 | 3 | [] | no_license | // Navbar toggle
let toggleBtn = document.querySelector('.toggle');
let items = document.querySelectorAll('.item');
let spanNav = document.querySelector('#btnNav')
// navigation links - add active classes DOM
const sections = document.querySelectorAll("section");
const navItems = document.querySelectorAll(".links");
... | true |
b43cdfea7a0d20bd83537f44affc6f5a8eddce15 | JavaScript | tanvirul15/githubFinder | /ui.js | UTF-8 | 3,297 | 2.6875 | 3 | [] | no_license | class UI {
constructor() {
this.profile = document.getElementById("profile");
this.searchContainer = document.getElementById("searchBox");
}
showProfile(user) {
this.profile.innerHTML = `
<div class="card card-body mb-3">
<div class="row">
<div cla... | true |
05005625dd40a8ce5c25a817dfaea5223c4695a7 | JavaScript | Jakehoffman22/clubwebsite | /workshops/2017-18/4lock/main.js | UTF-8 | 735 | 2.875 | 3 | [
"MIT"
] | permissive | var slider0=document.getElementById("slider0");
var slider1=document.getElementById("slider1");
var slider2=document.getElementById("slider2");
var slider3=document.getElementById("slider3");
function check1(){
if(slider0.checked==true && slider1.checked==true && slider2.checked==true) {
setTimeout(functio... | true |
9f4f6bf7c7e2137034f9f135ef222427574ec9f7 | JavaScript | Slava674/Phish-Off | /PhishOff/app/app/static/js/quizlevel1Qs.js | UTF-8 | 4,338 | 2.875 | 3 | [] | no_license | // Level 1 Email and text Phishing quiz questions.
// 8 questions will be stored.
// Created by Viacheslav Rawles.
// variable to store level 1 quiz questions
var questions = [{
"question": "What is the biggest reason for the success of phishing attacks?",
"choice1": "A. Weak security policies",
"choice2"... | true |
9411e6e3b1c5cb0af199477268762141d1ff92ec | JavaScript | oyegbilepraise/Resturant_Chatbot | /server.js | UTF-8 | 5,287 | 2.75 | 3 | [] | no_license | const express = require('express')
const app = express()
const cors = require('cors')
app.use(cors({
origin: '*'
}))
app.use(express.json());
app.use(express.urlencoded({extended: true}))
let array = []
let arr = `Hello Welcome to K Resturant` + "<br>" + "<br>" + 'Kindly select the number to place your order' + "... | true |
90373e4a1dbad289831d40e2319a66519f09c495 | JavaScript | rafassilveira/Cursos | /StudyFlow/AgileCode/object_api/object_api_9.js | UTF-8 | 609 | 4.25 | 4 | [] | no_license | /*
definePropertyconfigurable– Permite que uma determinada
propriedade seja apagada enumerable– Permite que uma
determinada propriedade seja enumerada value– Define o
valor de uma determinada propriedade writable–
Permite que uma determinada propriedade tenha seu valor
modificado
*/
con... | true |
122a837d68a167ec9b394ebbabd4ef5c9e66d3c8 | JavaScript | MachochinLopez/the-modern-react-bootcamp | /12 - Lights Out Game/react-lights-out-starter/src/Board.js | UTF-8 | 3,030 | 3.390625 | 3 | [] | no_license | import React, {Component} from "react";
import Cell from "./Cell";
import './Board.css';
class Board extends Component {
static defaultProps = {
ncols: 6,
nrows: 6,
chanceLightStartsOn: Math.random()
};
constructor(props) {
super(props);
// TODO: set initial state
this.state = {
... | true |
57d0fd1abe48ca669c6f4d0ffc4bfad368fccd82 | JavaScript | Jasonyang0422/NWind-SalesTeam | /routes/router.js | UTF-8 | 1,046 | 2.5625 | 3 | [] | no_license | var express = require('express');
var Member = require('../models/db').model;
var router = express.Router();
module.exports = router;
router.get('/', function(req, res, next){
Member.find({}).sort('-_id')
.then(function(members){
res.send(members);
})
.then(null, next);
});
router.post('/', function(req, ... | true |
ce5f9f92fd69bf1bcf19489fd57ded293ba167d9 | JavaScript | DJouve/Explorius-Human-Tech | /scripts/egypt.js | UTF-8 | 2,014 | 3.171875 | 3 | [
"MIT"
] | permissive | // Feature
const feature = document.querySelector(".feature-background")
const featureElement = document.querySelectorAll(".feature-element")
const featureImg = document.querySelector(".feature-img-js")
const featureImgContent = ["../assets/img/hieroglyphe/F.svg","../assets/img/hieroglyphe/H.svg","../assets/img/hierog... | true |
c72cd4aa6d5c5e197a379e9c03bcc1333198d34e | JavaScript | beelzebub041/Roller_Server_Homework | /gameStatmachine.js | UTF-8 | 958 | 2.578125 | 3 | [] | no_license | const StateMachine = require('javascript-state-machine');
module.exports = function FSM() {
const fsm = new StateMachine({
init: 'GameInit',
transitions: [
{ name: 'Init', from: 'GameInit', to: 'GameWait' },
{ name: 'Spin', from: 'GameWait', to: 'GameSpin' },
{ n... | true |
4eb6963932a3574a2a7f03c12127f08f033d8e88 | JavaScript | LoremsNightmare/workStation | /milestone-3 (basicJS)/module-19/19.5-factorial.js | UTF-8 | 155 | 3.515625 | 4 | [] | no_license | // 7! = 7 X 6 X 5 X 4 X 3 X 2 X 1
//n! = n * n+1
let factorial = 1;
for (let i = 1; i < 7; i++) {
factorial = factorial * i
}
console.log(factorial); | true |
96d6eb05c1d5c14a2fe93f95fd0a62ddc4bea85c | JavaScript | LuanVidal/Trabalho-Fisica | /js/index.js | UTF-8 | 344 | 3.4375 | 3 | [] | no_license | function typeWriter(element){
const TextoArray = element.innerHTML.split('');
element.innerHTML = '';
TextoArray.forEach((letra, i) => {
setTimeout( () =>{
element.innerHTML += letra;
}, 75 * i)
});
}
const Title = document.querySelector('#text... | true |
6b0c08bd24c020fffb90566fbfb8acdc73448980 | JavaScript | liuchaodong1967/dongge | /utils/aibum.js | UTF-8 | 2,428 | 2.578125 | 3 | [] | no_license | const app = getApp();
/**
* 相册授权
* @param string successCallback 为成功回调
* @param int num errorCallback 为失败回调
* @return array 先检测授权,如果没有授权,发起授权,后期授权弹窗提示
*/
const Authalbum= function (successCallback, errorCallback) {
wx.getSetting({
success(res) {
if (!res.authSetting['scope.writePhotosAlbum']) {
... | true |
5d11665e6ba93264b610f505e8d79250cb23137c | JavaScript | cfg-hbcuhsi/team-7 | /src/routes/scholarships/id.js | UTF-8 | 1,821 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | import React, { useState, useEffect} from "react";
import NavBar from "../../components/NavBar";
import { Row, Container, Col } from "react-bootstrap";
import PropTypes from 'prop-types';
import { useParams } from "react-router-dom";
import Scholarships from "../../json/scholarships.json"
import "./colleges.css";
//fu... | true |
9e16a69cc809dce76c9fa73fcbf9d3608cc39d82 | JavaScript | mistkafka/eloquent_javascript_code | /ch05-higher-order-function/call-apply-bind.js | UTF-8 | 229 | 3.46875 | 3 | [] | no_license | // call
var obj = {num: 2};
function plusToThis(a, b, c) {
return this.num + a + b + c;
}
console.log(plusToThis.call(obj, 1, 2, 3));
var args = [1, 2, 3]
console.log(plusToThis.apply(obj, args));
console.dir(plusToThis);
| true |
53bc44e834f15772eadbd31eac3ff343ea54f4e5 | JavaScript | stanja/git_repo | /js 1/scripts/main.js | UTF-8 | 659 | 4.3125 | 4 | [] | no_license | //Functions: piece of code that does one or more actions
// var name=prompt();
// function go(name, age) {
// if (age < 20) {
// return name+'!';
// } else {
// return name
// }
// }
//
//
// alert (go(name, 21));
function go(){
alert('hi');
}
//Arrays
var myList = ['apples', 12, go, ['Tanja', 'Ika']];
//... | true |
b72ba0ee0c60af1143addcfdf3afd8529782e789 | JavaScript | ESTUDIANTEGIT/libro | /libro.js | UTF-8 | 1,260 | 3.828125 | 4 | [] | no_license | /*var titulo = prompt("Introduce el titulo de un Libro que te Guste", " ");
var autor = prompt("Introduce el Nombre del Autor del Libro", " ");
var editorial = prompt("Introduce el Nombre de la Editorial del Libro", " ");
*/
function ObtenerTitulo(titulo)
{
var titulo = prompt("Introduce el Nombre del Titulo del Lib... | true |
cf0bb68b9d1c222d1a496266c818323ec815e29f | JavaScript | ditsky/Storythief | /backend/frontend/src/Join.js | UTF-8 | 1,834 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Button, Form, FormGroup, Label, Input, FormText } from 'reactstrap';
import './App.css';
class Join extends Component {
constructor(props) {
super(props);
this.state = { socket: this.props.socket, roomName: '', userName: '' };
this.handleRoomChange = th... | true |
84f3f823f086c4b0dadc228731e928e629e564ed | JavaScript | Kunjung/punching-game | /sketch.js | UTF-8 | 3,356 | 3.390625 | 3 | [] | no_license | let score;
let lives;
let gameOver;
let rightButton;
let leftButton;
let upButton;
let downButton;
let buttonSize = 40;
let fallSpeed = 5;
let rightWindow;
let leftWindow;
let upWindow;
let downWindow;
let windowSize = 150;
let buffer = 20;
let song;
let leftPose;
let rightPose;
let upPose;
let downPose;
fu... | true |
25dfd660ba6923b780da8d2c1aabeb8c26ffb8b3 | JavaScript | aaronbini/Quake-Tracker | /src/services/usgs-service.js | UTF-8 | 2,256 | 3 | 3 | [] | no_license |
usgsService.$inject = ['$http'];
export default function usgsService ($http) {
return {
get (time) {
return $http.get(`https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_${time}.geojson`)
.then(res => res.data);
},
//returns number of quakest that have occurred in or n... | true |
d021a812ebd7864fb9ff8bee031cff4c79338a28 | JavaScript | prathmesh77/Express_Project | /controllers/friends.controller.js | UTF-8 | 770 | 2.765625 | 3 | [] | no_license | const friendsModel=require('../Models/friends.model');
function getFriends(req,res){
res.status(200).json(friendsModel);
}
function getFriend(req,res){
const friendId=Number(req.params.friendId);
const friend=friendsModel[friendId];
if(friend){
res.json(friend);
}else{
res.sta... | true |
393c38cd8bb72022b49e515224bc452acd5036f3 | JavaScript | moh2020amin/mynewrep | /indexJs.js | UTF-8 | 4,465 | 3.296875 | 3 | [] | no_license |
var productName = document.getElementById("proudctName");
var proudctPrice = document.getElementById("proudctPrice");
var proudctCategury = document.getElementById("proudctCategury");
var proudctDesc = document.getElementById("proudctDesc");
function cleartextBoxInputs() // clear textbox input
{
productNam... | true |
09824a880547120e1b6b0a14c7b181fbf1da8df7 | JavaScript | klfinn5/JavaScript-Projects | /Basic JavaScript Projects/Project1_expressions_alert/JS/main.js | UTF-8 | 302 | 3.671875 | 4 | [] | no_license | var A = ('Daily problem: 4x-7='); //pop up problem
var B = "Why was 7 afraid of 9?"; //joke
var C = " Because 7, 8, 9!";
var B = B.fontcolor ("blue"); //joke question color
var C = C.fontcolor ("purple"); //joke answer color
window.alert(A) //pop up
document.write(B + C) //concatenate variables
| true |
7b0b10b66f3679bbc5d4cd311c0ca1be1c2891c6 | JavaScript | xKerman/png-datastream | /src/chunks/gama.js | UTF-8 | 1,949 | 3.03125 | 3 | [
"MIT"
] | permissive | // -*- coding: utf-8 -*-
import ChunkInterface from '../chunkinterface.js';
import ChunkType from '../chunktype.js';
import PNGError from '../pngerror.js';
const GAMMA_BYTES = 4;
const GAMMA_COEFFICIENT = 100000;
/**
* gAMA (Image gamma) chunk
*
* @see https://www.w3.org/TR/PNG/#11gAMA
* @implements {ChunkInter... | true |
6c958971edb2c07c3cc29847009c761a6745ff06 | JavaScript | ininahazwe/react-social-network | /services/PostService.js | UTF-8 | 998 | 2.8125 | 3 | [] | no_license | export default class PostService {
posts = [
{
content: 'Salut je bois un verre au starbucks',
user_id: 2,
likes: 0
},
{
content: 'Je me promene dans le parc',
user_id: 1,
likes: 0
},
{
conten... | true |
fc83dbf8a3ce5c3cb2b6b61f51193b7a0b7e9464 | JavaScript | fmagrosoto/htmlDnD | /dnd.js | UTF-8 | 1,724 | 2.96875 | 3 | [
"MIT"
] | permissive | (function () {
var dragSrcEl = null;
function iniDragStart(e) {
this.style.opacity = '0.4';
dragSrcEl = this;
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('text/html', this.innerHTML);
}
function iniDragEnd(e) {
this.style.opacity = '1';
[].forEach.call(cajas, functio... | true |
b585845391ce21925110b776b0d6f185b759c9b7 | JavaScript | achhunna/php-chat-forum | /js/script.js | UTF-8 | 3,818 | 2.59375 | 3 | [] | no_license | function isEmpty(str) {
return (!str || 0 === str.length);
}
$(document).ready(function(){
function showComment(){
$.ajax({
type:"post",
url:"ajax.php",
data:"action=showcomment",
success:function(data){
$("#commentOutput").html(data);
}
});
}
function clearEntry(){
$("#username").val... | true |
f659738b85e98f8948645defcb4186ad0fd94ea3 | JavaScript | ashwin0925/node_exercise | /day3/form.js | UTF-8 | 702 | 2.65625 | 3 | [] | no_license | const http = require('http')
const qs = require('querystring')
const fs = require('fs')
const server = http.createServer((req, res) => {
var store = '';
req.on('data', (chunk) => {
store = store + chunk
})
req.on('end',() => {
if(req.url === '/form' && req.method === 'GET') {
fs.createReadStream... | true |
ce34c6e75333f0c2a8bd7a187b062aa917165851 | JavaScript | DanilovaZhanna/ToDo | /src/Redux/appSlice.js | UTF-8 | 2,564 | 2.515625 | 3 | [] | no_license | import { createSlice } from '@reduxjs/toolkit'
const appSlice = createSlice({
name: 'app',
initialState: {
error: null
},
reducers: {
ERROR: (state, action) => {
state.error = action.payload;
}
}
})
const {actions, reducer} = appSlice;
export const { ERROR } =... | true |
b7d9fe6c2e81644335da2c4fe6788cdc6b1e57fe | JavaScript | Ne0phite/Express2 | /rps.js | UTF-8 | 1,618 | 2.96875 | 3 | [] | no_license | const express = require('express');
const app = express();
app.get('/:userChoice', (req, res) => {
let rand = Math.floor(Math.random() * 3);
let rock = [{"user":"rock","ai":"rock","result":"tie"},
{"user":"rock","ai":"paper","result":"lose"},
{"user":"rock","ai":"scissors","result":"win... | true |
2c7eea2d927610a237b9e533b53a50dc30d707b1 | JavaScript | tierlord/CloudComputing-ChatServer | /js/chatfunction.js | UTF-8 | 9,121 | 2.609375 | 3 | [
"MIT"
] | permissive | // Alina Elena Aldea-Ionescu - 310194
// Joffrey Schneider - 762380
var socket = io();
var usr = ""; // username
var userList = []; // list of users
var attachedFile = null;
// When entering the chatroom, the own username is transmitted through the socket
$(document).ready(function() {
var cookie = Cookies.get("cre... | true |
6944369d6f834aed6b1c73c99085bb644993a106 | JavaScript | KajaePage/info2180-lab4 | /app.js | UTF-8 | 1,412 | 3.109375 | 3 | [] | no_license |
document.addEventListener("DOMContentLoaded", loadDOM)
function loadDOM(){
console.log("Website has Loaded!")
displaySearch()
}
function displaySearch(){
document.getElementById('button').onclick = function() {
let uri = "http://localhost/info2180-lab4/superheroes.php";
... | true |
109d7991954c65c5cc8d47ded01405345fb502d2 | JavaScript | mahyarABS/bachelorProject | /parser2.js | UTF-8 | 1,307 | 2.8125 | 3 | [] | no_license | var http = require("http");
var https = require("https");
/**
* getJSON: REST get request returning JSON object(s)
* @param options: http options object
* @param callback: callback to pass the results JSON object(s) back
*/
var getJSON = function(options, onResult)
{
console.log("rest::getJSON");
var pro... | true |
02aae87b30868da532b1ebf87b096df1192faa5f | JavaScript | cooljasonmelton/jason-chess | /src/reducers/turn.js | UTF-8 | 245 | 2.515625 | 3 | [] | no_license | export default function turn(state = { turn: true }, action) {
switch (action.type) {
case 'UPDATE_TURN':
return {
turn: action.payload,
};
default:
return state;
}
} | true |
3093f9feb43a773ff286be340a77f3de1c2d6c8d | JavaScript | msts0716/portfolio | /html/stopwatch/js/stopwatch.js | UTF-8 | 1,739 | 3.015625 | 3 | [] | no_license | $(function(){
//コンマ
var count = 0;
var DotCount = 0;
var Seccond = 0;
var Minute = 0;
var timerID;
var RapCount = 0;
var countup = function(){
count++;
Dot();
}
var SecUp = function(){
Seccond++;
}
var MinUp = function(){
Minute++;
}
//スタート&ストップ
$('.Start').on('click',function(){
var Mode = $(t... | true |