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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2c312278c868034a4b1585ececcee83dce06cf8a | JavaScript | mursel/node_playground | /fileio.js | UTF-8 | 478 | 2.59375 | 3 | [
"MIT"
] | permissive | var fs = require('fs');
var fileStream = undefined;
exports.init = function (fileName, append, enc, fn) {
encoding = (enc == undefined) ? 'utf8' : enc;
if (append) {
fileStream = fs.createWriteStream(fileName, { 'flags': 'a', 'encoding': '" + encoding+"' });
} else {
fileStream = fs.creat... | true |
6131fc0c403d105d8a6e9833aa68d4c14fbf3959 | JavaScript | sylvak/Dice-game | /app.js | UTF-8 | 4,369 | 3.09375 | 3 | [] | no_license | let body;
let bodyVKole;
let aktivniHrac;
let kostka;
let koncoveBody;
init();
document.querySelector('.tlacitko-hod').addEventListener('click', function () {
//hod kostkou, vybere náhodné číslo
kostka = Math.floor(Math.random() * 6) + 1;
//zobrazí výsledek ve hře
let kostkaDOM = document.querySelect... | true |
c1bef2cdb2881ad5979ff94dd8e49c9c8e6e590e | JavaScript | xinpuchen/awesome-coding | /Algorithm/Greedy/接雨水.js | UTF-8 | 523 | 3.828125 | 4 | [
"MIT"
] | permissive | /**
* 接雨水
*
* 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水
*
* 输入:[0,1,0,2,1,0,1,3,2,1,2,1]
* 输出:6
*
*/
const trap = (arr) => {
let min = 0,
max = 0;
let l = 0,
r = arr.length - 1;
let result = 0;
while (l < r) {
min = arr[arr[l] < arr[r] ? l++ : r--];
max = Math.max(max, min);
r... | true |
df68f08f1aa1cc5d0a4973988f11f0fa8b6730aa | JavaScript | Alokakaluarachchi/APlus-React-Web | /Client/aplus-web/src/redux/reducers/transactionReducer.js | UTF-8 | 623 | 2.609375 | 3 | [] | no_license | import { ADD_TRANS, VIEW_TRANS, UPDATE_TRANS } from '../actionTypes';
const initialState = {
list : []
}
export default function(state = initialState, action)
{
switch (action.type)
{
case ADD_TRANS :
return {
...state,
list : [ ...state.list, action.payload ]
}
cas... | true |
0a43df389dec864cb1c562212351db3f0feec883 | JavaScript | kevindai777/Flatten2DVector-Leetcode-251 | /flatten2dvector.js | UTF-8 | 901 | 4.625 | 5 | [] | no_license | //Objective is to design a class that can flatten a 2D array and has 2 methods:
//next: returns the next element in the flattened array
//hasNext: returns if there is a following element
//Design that uses dfs to create the flattened array
class Flatten {
constructor() {
this.arr = []
this.index ... | true |
26c91587f4eabe5a496807ccd3e8d961cf1cdae6 | JavaScript | zhilonng/red-packet-game | /Script/player/bullet.js | UTF-8 | 1,956 | 2.578125 | 3 | [] | no_license | var com = require('common');
const LEFT = 0;
const MIDDLE = 1;
const RIGHT = 2;
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first ti... | true |
fc6ded828a27d57e5ce68adfd052bf14cdf58e74 | JavaScript | tranngoc95/assessments | /week-08-React/field-agent-ui/src/components/Agent/AddAgent.js | UTF-8 | 3,473 | 2.8125 | 3 | [] | no_license | import { useState } from "react"
import ErrorMessages from "../ErrorMessages";
function AddAgent({setDisplay, getList, URL}) {
const emptyAgent = {
"agentId": 0,
"firstName": "",
"middleName": "",
"lastName": "",
"dob": "",
"heightInInches": ""
}
const [err... | true |
0a5a9fa498376e7c63261f759abdc9b10c262a61 | JavaScript | modulex/modulex.github.io | /src/api/scroll-view/base.js | UTF-8 | 2,318 | 3 | 3 | [] | no_license | //这个模块的API文档只写出ScrollView Class,其实在内部代码里面scroll-view这个模块是scroll-view/base模块的别名,也就是scroll-view这个模块提供的接口
/**
@module scroll-view
*/
/**
@class ScrollView
@constructor
@extends Component.Container
@param config {Object} 配置对象,详情参考其Attribute
@example
require(['scroll-view'], function(ScrollView){
var content = '... | true |
02aeb26192a90d262bd58f45202446095c07c5fb | JavaScript | abbshr/discron | /discron.js | UTF-8 | 1,393 | 2.59375 | 3 | [] | no_license | const FIFO = require('./fifo')
/**
* @class 分布式定时调度任务
*/
class Discron {
/**
*
* @param {*} requestKeyPrefix
* @param {*} taskTypeCount
* @param {*} responseKey
* @param {*} redisCfg
*/
constructor(requestKeyPrefix, taskTypeCount, responseKey, redisCfg, logger) {
this.logger = logger
t... | true |
38e7891b2d1bda6f38182e60df43952edd0fea92 | JavaScript | Venkat876/simple | /Expensify-app/src/reducers/filters.js | UTF-8 | 666 | 2.75 | 3 | [] | no_license | const filterStateDefault = {
text : '',
sortBy : 'date',
startDate : undefined,
endDate : undefined
}
const filterReducer = (state = filterStateDefault , action) =>{
switch(action.type){
case 'SET_TEXT_FILTER':
return {
...state,
text : action.text
};
case 'SORT_BY_DATE':
return {
... | true |
1d86d2f4d8f65dabe4b06f8eb6395cbdb6b7e18a | JavaScript | shanbady/Jquery-ajaxBookmarkable | /js/ajaxBookmarkable.js | UTF-8 | 902 | 2.984375 | 3 | [] | no_license | /*
Copyright 2010 , Shankar Ambady
This script detects any hash tags that are created in an ajax site and upon reloading the page, it refreshes the page with the hash parametes passed in as GET queries.
It is then up to the server to process and use the passed in GET params.
This is useful for creating sites that ha... | true |
c5a24acd644a850800c22a5db17c8320bd5b49e9 | JavaScript | divyamarora92/Divyam_Devsnest_THAs | /THA 09/seatbooking.js | UTF-8 | 1,047 | 3.375 | 3 | [] | no_license | const box=document.querySelector('.container');
var booked=document.querySelector('#booked');
var remaining=document.querySelector('#remaining');
let bookedSeats = 0;
let remainingSeats = 36;
for(var i=0;i<36;i++){
let element=document.createElement('div')
element.classList.add('child')
element.classList.ad... | true |
340bfb6d69975473b7b47378b238eaaafd2b5d26 | JavaScript | samueleallegranza/course-app | /api/app/models/room.model.js | UTF-8 | 481 | 2.640625 | 3 | [] | no_license | const sql = require("./db.js");
// constructor
const Room = function (room) {
this.idroom = room.idroom;
this.name = room.name;
this.codroomtype = room.codroomtype;
};
Room.getAll = (result) => {
sql.query("SELECT * FROM rooms", (err, res) => {
if (err) {
console.log("error: ", err... | true |
b11bb35e335c082601266223153efc83fcb52c11 | JavaScript | pjosifovic/36-full-stack-crud | /lab-pedja/frontend/src/action/country.js | UTF-8 | 1,387 | 2.515625 | 3 | [
"MIT"
] | permissive | import uuid from "uuid";
import superagent from "superagent";
// ====================================================
// SYNC ACTIONS
// ====================================================
export const getAction = countries => ({
type: 'GET_CREATE',
payload: countries,
});
export const createAction = country =>... | true |
ef9cc2172864dfc8ec2cc71637ea6f6b253653be | JavaScript | SamM/graphics | /elements.js | UTF-8 | 1,233 | 3.59375 | 4 | [] | no_license | //Returns true if it is a DOM node
function isNode(o){
return (
typeof Node === "object" ? o instanceof Node :
o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName==="string"
);
}
//Returns true if it is a DOM element
function isElement(o){
return (
... | true |
2c2142679837cbe19f05dc59e053c314a3b201e5 | JavaScript | abaldawa/rtl-nodejs-assignment | /routes/tvMazeShows.js | UTF-8 | 2,411 | 2.546875 | 3 | [] | no_license | /**
* User: abhijit.baldawa
*
* This module exposes REST endpoint for /shows URL
*/
const
express = require('express'),
router = express.Router(),
{formatPromiseResult} = require('../utils'),
{db} = require('../database/database'),
COLLECTION_NAME = "shows";
/**
* REST Endpoint <BASE_URL>/sho... | true |
1854c66e8f22015b20058ef6d323550d4f877a74 | JavaScript | Hasan-Iqtedar/rock-paper-scissors | /scripts/main.js | UTF-8 | 3,263 | 3.75 | 4 | [] | no_license | let computerScore = 0;
let playerScore = 0;
let rockButton = document.querySelector('#rock');
let paperButton = document.querySelector('#paper');
let scissorsButton = document.querySelector('#scissor');
let playerScoreDiv = document.querySelector('#playerScore');
let computerScoreDiv = document.querySelector('#comput... | true |
b00fe94fbbcdb34eac335812e4ca7aedb4655590 | JavaScript | linocatucci/JS-Jonas | /projects/5-Advanced-JS/version 2/first_class_functions.js | UTF-8 | 872 | 4.375 | 4 | [] | no_license | // first class functions : passing functions as arguments also called callback functions
var years = [2001, 2000, 1971, 1953, 1967, 1999, 1990];
function arrayCalc(arr, fn) {
var arrayResult = [];
for (var i = 0; i < arr.length; i++) {
arrayResult.push(fn(arr[i]));
}
return arrayResult;
}
f... | true |
1f7eb0ea017861669afa38d9468122593cb16557 | JavaScript | Afreda323/Realtime-Chat-App | /server/test/message.test.js | UTF-8 | 768 | 2.640625 | 3 | [] | no_license | const expect = require("expect");
const {
generateMessage,
generateLocationMessage
} = require("../utils/message");
describe("Generate Message", () => {
it("Should generate correct message object", () => {
const message = generateMessage("Jim", "Ayy lmao");
expect(message).toBeAn("object");
expect(me... | true |
47bb16677e54fd6a40dcb7311c343238e3404741 | JavaScript | GovindThakur9540/User-Management-System-Frontend | /src/redux/reducers/alert.js | UTF-8 | 364 | 2.71875 | 3 | [] | no_license | const initState = {
alertContent: null
};
const alert = (state = initState, action) => {
const { type, payload } = action;
switch (type) {
case 'POP_ALERT':
return { ...state, ...payload };
case 'CLEAR_ALERT':
return { ...state, ...payload };
default:
return ... | true |
d3387c692684be61f2faa18fa4bcb8d57c23472f | JavaScript | SzymonKwasek/react_todo_app | /todo_app_front/src/TodoForm.js | UTF-8 | 857 | 2.671875 | 3 | [] | no_license | import React, {Component} from "react";
import "./TodoForm.css"
class TodoForm extends Component {
constructor(props){
super(props)
this.state = {inputValue: ""}
}
handleChange = (e) =>{
this.setState({inputValue: e.target.value})
}
handleSubmit = (e) =>{
... | true |
09cb090b3d3b97451485f326576f8e3da6b6baf3 | JavaScript | rodrigodinis20/rodrigodinis20 | /tests/js-next/src/02-rest-spread.js | UTF-8 | 980 | 3.609375 | 4 | [] | no_license | /**
* Return an array containing the function arguments
*/
exports.argsAsArray = function() {
return arguments;
};
/**
* Return an array containing the function arguments,
* but discarding the first two
*/
exports.lastArgs = function() {
return arguments;
};
/**
* Return a function which applies the pro... | true |
6f9eb4abde0b51d09123295917150ec20c1399a3 | JavaScript | joshuaclayton/elm-ports-example | /src/static/map.js | UTF-8 | 1,076 | 2.75 | 3 | [
"MIT"
] | permissive | export default class Map {
constructor(google, element, clickedCallback) {
this.google = google;
this.element = element;
this.clickedCallback = clickedCallback;
this.map = this._initializeMap();
}
registerLatLngs(latLngs) {
const bounds = new this.google.maps.LatLngBounds();
latLngs.forE... | true |
f4cade7ebcef618f38fa947bac4491d6bcc9f9a1 | JavaScript | aria-grande/sliding-puzzle | /src/SlidePuzzleController.js | UTF-8 | 3,653 | 2.8125 | 3 | [] | no_license | import React, { Component } from 'react';
import './SlidePuzzleController.css';
import Board from './Board';
import If from './If';
import Popup from './Popup';
class SlidePuzzleController extends Component {
constructor(props) {
super(props);
this.state = {
trialCount: 0,
nowPlaying: false,
... | true |
78576572061e958605409347d23aae88b9c38b0e | JavaScript | taj-code/language | /js/scripts.js | UTF-8 | 1,195 | 2.96875 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
$("#lang").submit(function(event) {
event.preventDefault();
const userNameInput = $("input#userName").val();
const birthdayInput = $("input#birthday").val();
const colorInput = $("input#color").val();
const musicInput = $("input:radio[name=music]:checked").val();
... | true |
68ab098c8bf313dcd61c688fa5477c211c4f6560 | JavaScript | cybersyntactics/hex-react | /src/SvgMap.js | UTF-8 | 9,310 | 2.75 | 3 | [] | no_license | // Code taken directly from: https://blog.rapid7.com/2016/05/25/building-svg-maps-with-react/
// Code then modified with functions from: https://gist.github.com/iammerrick/c4bbac856222d65d3a11dad1c42bdcca
import React from 'react';
//import autobind from 'autobind-decorator'
export default (ComposedComponent) => {
c... | true |
71b0f1da9b2e6cd805b2608e94461568dcccd5b1 | JavaScript | Sim923/Electron_altX | /app/utils/jig-tool.js | UTF-8 | 2,630 | 3.078125 | 3 | [
"MIT"
] | permissive | import { randomBytes } from 'crypto';
import vocabulary from './jig-tool-vocabulary';
const {
first: firstNames,
last: lastNames,
address1,
address2,
} = vocabulary;
class JigTool {
constructor () {
this.alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
this.processedAddresses = new Map();
}
generateFi... | true |
f30bdcf6f5300f5da6cc0de0c4f40814cb727877 | JavaScript | flynx/ImageGrid | /legacy/ui (gen1)/markers.js | UTF-8 | 168 | 2.515625 | 3 | [
"MIT"
] | permissive |
function toggleMarkers(){
var marker = $('.v-marker, .h-marker')
if(marker.css('display') == 'none'){
marker.fadeIn()
} else {
marker.fadeOut()
}
}
| true |
41888f496b6ebfb3b47e5a6b45fb933755f90535 | JavaScript | beiyannanfei/test | /达内WEB前端配套课件代码资料/07_JavaScript核心编程/代码/day23/1.js | UTF-8 | 291 | 3.609375 | 4 | [] | no_license | var s1 = '456.789abc';
var n1 = Number(s1);
console.log( typeof s1 );
console.log( typeof n1 );
//console.log( NaN == NaN ); //false
//console.log( isNaN(n1) );
if( isNaN(n1) ){
console.log('您输入的工资数非法');
}else{
console.log('您输入的工资数有效的'+n1);
}
| true |
50e93c3dc6bc967374a9106c57d45d5460a69674 | JavaScript | zuojj/study | /archives/screenshots/linux/screenshot.js | UTF-8 | 1,393 | 2.609375 | 3 | [] | no_license | /**
*
* @authors Benjamin (zuojj.com@gmail.com)
* @date 2016-08-17 11:53:24
* @version $Id$
*/
var webpage = require('webpage'),
page = webpage.create(),
args = require('system').args,
html = ['---' + args[0],
'url: ' + args[1],
'filepath: ' + args[2],
... | true |
ffabd5efc1920f04fb58b47369e17f49bc4c8d32 | JavaScript | Sohel-788/Js-tricks | /string-array-devide.js | UTF-8 | 2,069 | 3.390625 | 3 | [] | no_license | const anthem='Aamar sonar bangla ami tomai valo basi';
// split method. এটা দিয়ে নির্দিষ্ট অংশ বাদে বাকি দের কে ভাগ করা যায় কোন একটা এরে থেকে।
const word=anthem.split(' ');
// const word=anthem.split(' ',3); একটা নির্দিষ্ট সংখ্যা পর্যন্ত
// const withoutA=anthem.split('a')
//slice method.//array theke index diye ekta... | true |
eaf561183f44d5424e3e12bc62ad9c537b33e18a | JavaScript | michaelwu-74/Industrial-Fallout-Version-1.1- | /person.js | UTF-8 | 939 | 3.203125 | 3 | [] | no_license | function setup() {
player = new Person();
}
var x;
x = -100;
function keyPressed(){
if (keyIsDown(32)) {
let force = createVector(0, -16);
player.applyForce(force);
}
}
function draw() {
//point of view around "man"
let gravity = createVector(0,1);
player.applyForce(gravity);
player.up... | true |
1a915ac408b9cf3e8d39aecdb701f8ed121c908e | JavaScript | marema31/myfreecodecamp | /js/ArgumentsOptional.js | UTF-8 | 405 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env js
function addTogether() {
if(!Number.isFinite(arguments[0])){
return undefined;
}
if(arguments.length ==1){
var a=arguments[0]
return function(val){
if(Number.isFinite(val)){
return val+a;
}
return undefined;
};
}
if(!Number.isFinite(arguments[1])){
... | true |
08c532f60c9aaf3750529acda474764b76d1045b | JavaScript | 47analogy/JavaScript-Free-Throws | /hackerrank/breakingRecords.js | UTF-8 | 1,867 | 3.9375 | 4 | [] | no_license | /*
Maria plays college basketball and wants to go pro. Each season
she maintains a record of her play. She tabulates the number of
times she breaks her season record for most points and least
points in a game. Points scored in the first game establish her
record for the season, and she begins counting from there.
... | true |
c44b13f92842082dcfb2973d838ca4554395edf2 | JavaScript | patriciachrysy/restaurant-page | /src/common.js | UTF-8 | 274 | 2.609375 | 3 | [] | no_license | function loadTitle(text) {
const title = document.createElement('h1');
title.innerHTML = text;
return title;
}
function loadYellowBar() {
const div = document.createElement('div');
div.className = 'underline';
return div;
}
export { loadTitle, loadYellowBar }; | true |
ec063619d496a66e0941752191d7d6c25b19d3f4 | JavaScript | kosarik/wtf | /src/App.js | UTF-8 | 1,538 | 2.671875 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import logo from './brudda.jpg'
import {BrowserRouter as Router, Switch, Route, Link} from "react-router-dom"
function App() {
const initial = ['Brudda, ', 'you do now da way?']
const [uganda, setUganda] = useState(initial)
return (
<Router>
<div>
... | true |
0bd8a760ce4bc5b0a44d0dee455a772683dda2de | JavaScript | xiaodanhuang/some-study | /data_structure/stack/orderedStack.js | UTF-8 | 722 | 3.9375 | 4 | [] | no_license | function Stack(){
this.dataStore=[];
}
Stack.prototype.push=function(item){
this.dataStore.push(item);
}
Stack.prototype.pop=function(item){
return this.dataStore.pop();
}
Stack.prototype.size=function(item){
return this.dataStore.length;
}
Stack.prototype.clear=function(item){
this.dataStore=[];... | true |
33b564ad2de6b0c454970a21454b1d3b2f49eb66 | JavaScript | Velpoverkkk/Hwork2 | /script.js | UTF-8 | 2,291 | 3.03125 | 3 | [] | no_license | var inputData = document.querySelector('input[type="text"]');
var ulSpisok = document.getElementById('spisok');
var spans = document.getElementsByTagName('span');
var line = document.getElementsByTagName('li');
var saveBtn = document.getElementById('save');
var clearBtn = document.getElementById('clear');
fun... | true |
650f757e21bdaabbf2a2334ce8f230e87b1a0168 | JavaScript | dinkar/up-and-down-js13k-2018 | /src/scenes/level.js | UTF-8 | 4,168 | 2.53125 | 3 | [] | no_license | import ballFactory from '../assets/ball-factory';
import Constants from '../constants';
import StateManager from '../managers/state-manager';
import floorFactory from '../assets/floor-factory';
import thornFactory from '../assets/thorn-factory';
import endpointFactory from '../assets/endpoint-factory';
import LevelConf... | true |
f9c079a75d9c01a3c6dfa894b8d85d6b2c8e743d | JavaScript | Djeisen642/htm-project-backend | /utils/password.js | UTF-8 | 1,419 | 2.703125 | 3 | [] | no_license | const Promise = require('bluebird');
const crypto = require('crypto');
const pbkdf2 = Promise.promisify(crypto.pbkdf2);
const randomBytes = Promise.promisify(crypto.randomBytes);
const constants = require('../config/constants');
function generateHashString(password) {
return randomBytes(constants.PASSWORD.KEYLENTH)
... | true |
372da1d6d97994be9da67e87851f9b220872ee2a | JavaScript | oliviertassinari/uniforms | /demo/imports/lib/utils.js | UTF-8 | 1,356 | 2.859375 | 3 | [
"MIT"
] | permissive | const URL_KEYS = ['preset', 'props', 'theme'];
export const updateQuery = state => {
const query = URL_KEYS.map(key => {
if (!state[key]) {
return null;
}
let value = state[key];
if (key === 'props') {
try {
value = JSON.stringify(value);
} catch (_) {
value = null... | true |
384aab4a166b27a811ffaa62c39fc014beadd2a8 | JavaScript | imonmahamud/recursionFunction | /lesson/lesson5.js | UTF-8 | 194 | 3.5 | 4 | [] | no_license | function power(n,b){
if(b==0){
return 1
}
var result=n* power(n,b-1)
console.log('N = '+n+' B = '+b+' Result = '+result);
return result
}
var result=power(5,4)
result | true |
a96fb0cf49c7b3e3e121f4ab40b033766e211158 | JavaScript | andersonguelphjs/markpaulanderson | /greatKanji/flashcards/app/services/animationService.js | UTF-8 | 12,548 | 2.75 | 3 | [] | no_license | flashApp.service('animationTest', function() {
var numCoins = 0,
score = 0,
coins = [],
canvas,
coinsToDestroy = [];
//redraw loop
function gameLoop() {
var i;
//so instead of a timer, what we are doing here is adding this function everytime teh browswer wants to paint. Brilliant
wi... | true |
0de449fc9c903b4e8c1472f4f88c02468d713079 | JavaScript | minhquan130599/quanlydetainghiencuukhoahoc | /public/app/js/app.lib.js | UTF-8 | 6,074 | 2.578125 | 3 | [] | no_license | /**
* Chuẩn hóa tên tiếng Việt
* (object) obj: Đối tượng DOM đang thực thi
*/
function unicode_username(obj) {
var fullName = obj.value;
var arr = fullName.split(/\s/);
var tmp = "";
for(index in arr)
{
if (arr[index]!= "")
tmp += arr[index][0].toUpperCase() + arr[in... | true |
76212f4caa7522e516373afe7cf02de5cadc4921 | JavaScript | ptomato/demitasse | /test/second.js | UTF-8 | 500 | 2.609375 | 3 | [
"ISC"
] | permissive | // const { describe, skip, it } = require('../index.js');
const { equal } = require('assert');
const FAIL = !!process.env.FAIL;
describe('second', () => {
new Array(10).fill(0).forEach((_, idx) => {
it(`should be ${idx}`, () => {
if (FAIL && idx === 7) throw new Error('hallo');
equal(idx, FAIL && idx... | true |
8b98e1934fd81b9689a962f206eb003d15d1cc89 | JavaScript | funmia/news-summary-challenge | /js/test-library/assert.js | UTF-8 | 564 | 2.828125 | 3 | [] | no_license | (function(exports){
var assert = {
isTrue: function(assertionToCheck) {
if (!assertionToCheck) {
throw new Error("Expected:" + assertionToCheck + " to be true");
}
},
isEqual: function(actual, expected) {
if(actual !== expected) {
throw new Error("Expected:" + actual + "... | true |
180806fd7a116065790e382a9305a4492a38027e | JavaScript | DzyubSpirit/Functor | /JavaScript/4-functor-fp.js | UTF-8 | 285 | 2.640625 | 3 | [] | no_license | 'use strict';
global.api = {};
api.fp = {};
api.fp.maybe = x => fn => api.fp.maybe(x && fn ? fn(x) : null);
api.fp.maybe(5)(x => ++x)(console.log);
api.fp.maybe(5)(x => x * 2)(x => ++x)(console.log);
api.fp.maybe(5)(null)(console.log);
api.fp.maybe(null)(x => x * 2)(console.log);
| true |
901a1dbdeed3c3a645aab89545b30b15cb63e580 | JavaScript | nghcamtu/react-udemy-basic | /src/App-hook.js | UTF-8 | 3,799 | 3.53125 | 4 | [] | no_license | // Đây là cách viết state và setState khi dùng functional component
// File này dùng để so sánh với file App.js (dùng class)
import './App.css';
import React from 'react';
import Person from './Person/Person'
import {useState} from 'react'; //import để dùng được state trong functional component.
//Cái nào liên quan đế... | true |
21dd21e9757e2ed0495edd6a3f669191479027db | JavaScript | iamalvinaringo/ping-pong | /js/scripts.js | UTF-8 | 692 | 3.453125 | 3 | [
"MIT"
] | permissive |
//Business Logic
var range = [];
function pingPong(userInput){
for(i= 1;i<= userInput;i++){
range.push(i);
}
for(index=0;index<=range.length;index++){
if(range[index]%15 === 0) {
range.splice(index, 1, "pingpong");
} else if(range[index]%5 === 0) {
range.splice(index, 1, "pong");
} else if(range[ind... | true |
de67072b512fd06ab84703fe65b3d45ddd0fe4c6 | JavaScript | SIFANWU/RestaurantAdvisor | /controllers/user.js | UTF-8 | 2,435 | 2.65625 | 3 | [] | no_license | var User = require('../models/user');
/**
* The user login by searching username from user collection
* @param req
* @param res
*/
exports.login = function (req, res) {
var data = req.body;
var username = data['username'];
var password = data['password'];
try{
User.findOne({username:usernam... | true |
f2f5b142068c044d02ca745fe4c360b4cb865c11 | JavaScript | naglismoc/net0515 | /tasks.js | UTF-8 | 1,509 | 3.53125 | 4 | [] | no_license |
let sk = 7;
if(sk == 1){
console.log(1);
sendSmsToTeacher();
}
if(sk == 2){
console.log(2);
}
if(sk == 3){
console.log(1);
}
if(sk == 4){
console.log(2);
}
if(sk == 5){
console.log(1);
}
if(sk == 6){
console.log(2);
}
let day;
switch (0) {
case 0:
day = "Sunday";
break;
case ... | true |
1a1db4cb6c752a88b1713cc4ee4529029dcee0dd | JavaScript | luxinyi93/WebDeveloper | /demo/DouBan/js/index.js | UTF-8 | 1,306 | 2.828125 | 3 | [] | no_license | $(function() {
var ROOT_URL = 'https://api.douban.com/v2/';
var RECENT_MOVIE = ROOT_URL + 'movie/in_theaters';
var TOP10_MOVIE = ROOT_URL + 'movie/top250';
requestDataFromNet(RECENT_MOVIE, setHtmlRecentMovieData);
requestDataFromNet(TOP10_MOVIE, setHtmlTop10Movie);
});
// 获取正在热映的电影的数据
function setHtmlRecentMovieDa... | true |
f7dee45d3fc607e10097977ff3c9971cbfeb6e15 | JavaScript | WayneGreeley/codesmith-js | /020.js | UTF-8 | 94 | 3.15625 | 3 | [] | no_license | //Challenge: Type Coercion
console.log(10 + 5);
console.log("10" + 5);
console.log(5 + "10"); | true |
5b3050f6bef01dda76b1c3d826b77a6ba06ba018 | JavaScript | Sunshine-ki/BMSTU5_EVM_NODE | /lab_03/TASK_1/static/second_code.js | UTF-8 | 1,061 | 3.40625 | 3 | [] | no_license | "use strict";
// onload - функция, которая вызывается когда собрался HTML.
// window - это глобальной объект.
window.onload = function () {
// Получаем (ссылку) на поля.
const field_find_mail = document.getElementById("field-get-info");
// Получаем кнопку, при нажатии на которую должна выдаваться информация.
cons... | true |
14dee4c13515a2185f9d0149428dd18eebe5b831 | JavaScript | mriyaz/React-Redux-Flash-Card-Application | /src/app2.js | UTF-8 | 1,759 | 2.9375 | 3 | [] | no_license |
//Action Creators
const addDeck=name=>({type:'ADD_DECK',data:name});
const showAddDeck=()=>({type:'SHOW_ADD_DECK'});
const hideAddDeck=()=>({type:'HIDE_ADD_DECK'});
//Reducers
const cards = (state,action) => {
switch (action.type) {
case 'ADD_CARD':
let newCard=Object.assign({},action.data,{
scor... | true |
9982c048b8630ba7686fddbb45256702ca2f88dd | JavaScript | clucasalcantara/linq-js | /lib/IterableConcretizer.js | UTF-8 | 3,383 | 3.703125 | 4 | [
"MIT"
] | permissive | const { map } = require('./functions/map');
const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;
const isAsyncFunction = (instance) => {
return Object.getPrototypeOf(instance) === AsyncFunction.prototype;
}
/**
* Auxiliary class that wraps an iterable instance (object that
* implements the... | true |
9c0d2ad397f91a7f515eac3a92069445b9e22fd3 | JavaScript | Swapnali323/frontend | /src/components/productDetails.js | UTF-8 | 2,841 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react'
export default class ProductDetails extends Component {
constructor(props) {
super(props)
this.state = {
name:"",
price:"",
category:"amazona product",
productImage:""
}
// this.onChangeDate ... | true |
090b18a9f0b9017138b2cb0860144a221019085d | JavaScript | JeffRisberg/LU05 | /src/tools/WrapFont.js | UTF-8 | 3,621 | 2.734375 | 3 | [] | no_license | function WrapFont(content, textSize_, textColor,textStyle) {
CAAT.Actor.call(this);
var content_;
var textColor_ = textColor || FONT_COLOR;
var textStyle_ = textStyle || "Action Man Bold";
var align_ = "left";
var alignV_ = "";
//var textStyle_ = textStyle || "SF Cartoonist Hand Bold";
//var textStyle_... | true |
f21f65a838d0a4376657be3ccbf2816c1f98fa63 | JavaScript | Teperi/portfolio_LampGames | /nodejs/server_game.js | UTF-8 | 3,771 | 2.875 | 3 | [] | no_license | var express = require('express'); // Express contains some boilerplate to for routing and such
var app = express();
var http = require('http').Server(app);
var io = require('socket.io').listen(http);
// 접속중인 플레이어를 담는 배열
var players = {};
// 총알
var bullet_array = [];
// 최상위 경로 설정
app.use('/', express.static(__dirname... | true |
81a5003894233b151afe3a2c1ab486f1a9a514c3 | JavaScript | erictheredsu/JS_test | /SL_Client/practice/fileOperation.js | UTF-8 | 755 | 2.671875 | 3 | [] | no_license | const fs = require('fs');
// fs.readFile('./data/example_item.json','utf8', function(err, data){
// if(err)
// {
// console.log("error Code:" + err.code + "detail:" + err.message);
// return;
// }
// });
let data = fs.readFileSync('./data/csv/ItemCode_Add_808.csv', 'utf8');
let content... | true |
452e161e0ef9665841d8c6654d920f7ec3d3d214 | JavaScript | tgoodwin/ctis-lambda | /index.js | UTF-8 | 2,764 | 2.5625 | 3 | [] | no_license | var childProcess = require('child_process');
var path = require('path');
var AWS = require('aws-sdk');
var sha1 = require('sha1');
var AWS_BUCKET_NAME = 'ctis-lambda-test';
// img_data is a Buffer, path is a filename
var s3_upload_image = function(img_data, path, callback) {
var s3 = new AWS.S3();
var params = {
... | true |
08416a310b68d7833d803c3dd15edd957d1501af | JavaScript | Shiv2195/Distractor-Filtering-Test | /js/autoSlide.js | UTF-8 | 1,527 | 2.953125 | 3 | [] | no_license | var i = 0;
window.userAnswer = []
var images = [{
src: '../images/1.png',
time: 2000
},
{
src: '../images/2.png',
time: 2000
},
{
src: '../images/3.png',
time: 2000
},
{
src: '../images/4.png',
time: 2000
},
{
src: '../images/5.... | true |
5057957e036c126c94c5eeeb8d00fb6b6a1651d3 | JavaScript | ranstyr/interno_final | /src/common/services/app-state.js | UTF-8 | 1,171 | 2.625 | 3 | [] | no_license | export class AppState {
/* @ngInject */
constructor($rootScope) {
this.$rootScope = $rootScope;
// Affects loading of translations
this.preLoginMode = true;
this.executionMode = 0;
this.isMarketClosed = false;
this._handleSignalR();
}
_handleSignalR() {
//this.$rootScope.$on('p... | true |
44a06ce1883768a925ad36cb77e0c0b37f95bb50 | JavaScript | orellabac/vbscriptmigration | /spec/mathSpec.js | UTF-8 | 2,815 | 2.734375 | 3 | [] | no_license | var vb_math = require('../math');
describe("math functions", function() {
it("Abs ", function() {
/*...*/
expect(vb_math.Abs(1)).toEqual(1);
expect(vb_math.Abs(-1)).toEqual(1);
expect(vb_math.Abs(48.4)).toEqual(48.4);
expect(vb_math.Abs(-48.4)).toEqual(48.4);
});
it(... | true |
73e396130249efdcb1e4161bf09fc0549ebeaebc | JavaScript | miniponz/objects | /lib/classes.js | UTF-8 | 929 | 3.15625 | 3 | [] | no_license | class House {
constructor(location, floors, bedrooms, bathrooms) {
this.location = location;
this.floors = floors;
this.bedrooms = bedrooms;
this.bathrooms = bathrooms;
}
getPrice(){
return '$' + (this.floors * 1000000).toLocaleString();
}
}
class Car {
constructor(make, model, year, colo... | true |
75e546a0757147be00699f088c685b3ae8f7da5a | JavaScript | contour66/NewsScraper | /public/javascript/query.js | UTF-8 | 1,098 | 2.796875 | 3 | [] | no_license | // $("#scrape-button").on("click", function(event) {
// // event.preventDefault() prevents the form from trying to submit itself.
// // We're using a form so that the user can hit enter instead of clicking the button if they want
// event.preventDefault();
// // This line will grab the text from the input box
/... | true |
5249cb86e0e3c132cf67205b53afc69937d11c7a | JavaScript | antonmaenpaa/todo-list | /script.js | UTF-8 | 1,554 | 3.4375 | 3 | [] | no_license | // Skapa en Todo lista där man kan ta bort varje enskild todo.
// Tänk på att bryta ner uppgiften i mindre bitar! =)
window.addEventListener('load', main);
function main() {
addEventListeners();
}
function addEventListeners() {
const addToList = document.getElementById('addItem');
const deleteFromLis... | true |
253f7ab2695a7d74348fb22c2e4345ec2d4e36db | JavaScript | adeyinkakoya/coindrant | /public/js/convert.js | UTF-8 | 5,120 | 3.390625 | 3 | [
"MIT"
] | permissive |
// Json data for Current Bitcoin Price in USD
var btcReq = new XMLHttpRequest();
btcReq.open('GET', 'https://blockchain.info/ticker',true);
btcReq.onload = function () {
// begin accessing JSON data here
var data = JSON.parse(this.response);
price=data['USD']['last']; // Price of Bitcoin in USD
price=price.toFix... | true |
ca5969cc46cf70cebe508aff45ef2cf6b7d9baac | JavaScript | Clarenceguoshuai/nativeProxy | /7promise版本.js | UTF-8 | 1,241 | 2.578125 | 3 | [] | no_license | const http = require("http");
const server = http.createServer();
server.on("request", (req, res) => {
var { connection, host, ...originHeaders } = req.headers;
var options = {
"method": req.method,
// 随表找了一个网站做测试,被代理网站修改这里
"hostname": "www.nanjingmb.com",
"port": "80",
... | true |
2adafee7e76509c1a9ced68b72fa324f08503ad1 | JavaScript | lachlanmcglennon/idle-concrete-factory | /scripts/utils.js | UTF-8 | 708 | 2.75 | 3 | [] | no_license | import Vue from "vue"
const eventBus = new Vue()
// Use like: utils.eventBus.$emit("notificate", "Welcome!")
// Clamp
const clamp = (value, min, max) => {
return Math.min(Math.max(value, min), max)
}
// Format
const format = (value) => {
let formatedValue
if (value >= 1000000) {
formatedValue = value.toExpo... | true |
5caea3ed456d3f6c49aa592f69e1216ceb6a162c | JavaScript | rouletz/exerciseJavascript | /exerciseObject5.js | UTF-8 | 703 | 3.5 | 4 | [] | no_license | function complexConversion (text) {
var temp = [];
var pisah1 = text.split(',');
for (i=0;i<pisah1.length;i++){
var pisah2 = pisah1[i].split(':');
for(j=0;j<pisah2.length;j++){
temp.push(pisah2[j])
}
}var obj = {};
for(k=0;k<temp.length;k++){
if(((k+1)%2!==0) && ((k+1)!==temp[k].length-1)){
obj[temp... | true |
b5f11c926206d2aeff10d2e9c7dc2a4875a56b04 | JavaScript | binxor/nextjs_flashcards | /pages/index.js | UTF-8 | 1,727 | 2.515625 | 3 | [] | no_license | import React from 'react'
import Head from 'next/head'
import Nav from '../components/nav'
import Card from '../components/card'
import Button from '../components/button'
import data from '../data/flashcardData.json'
class Home extends React.Component {
constructor(props) {
super(props)
this.state = { clickC... | true |
f7a55450779e3cd0fb464f8999884182c3d27a39 | JavaScript | Sajad321/Alamjad_FrontEnd | /src/components/common/p2.js | UTF-8 | 2,354 | 2.78125 | 3 | [] | no_license | const createPagination = () => {
let pageNumbers = [];
if (state.searchType == "0") {
for (let i = 1; i <= state.totalPages; i++) {
let number =
i == state.currentPage ? (
<li key={i} className="page-item active">
<a className="page-link" href="#">
{i}
... | true |
7b5d9786ef09714ce6622864203cc0b7afa14c3f | JavaScript | jeck899/Andre-FrontEnd | /JS/Advanced JS/Objects.js | UTF-8 | 1,225 | 4.4375 | 4 | [] | no_license | //reference Type
let box1 = {value:10};
let box2 = box1;
let box3 = {value:10};
// box 1 == box 2 != box3 -- different box / container / reference
// context
// this - selects the current environment of your selected object
// this.alert === window.alert(console.log(this)) -- what is on the left of the dot (wind... | true |
0ba289a07bec11d7a07950b0c39450a9afda5ca6 | JavaScript | jmartin432/blackjack | /src/js/index.js | UTF-8 | 8,139 | 3.40625 | 3 | [] | no_license |
function setBackground() {
let r = Math.floor(Math.random() * 256);
let g = Math.floor(Math.random() * 256);
let b = Math.floor(Math.random() * 256);
let color_string = r + ', ' + b + ', ' + g;
let r_step = [-1, 1][Math.floor(Math.random() * 2)];
let g_step = [-1, 1][Math.floor(Math.random() * ... | true |
d5674545ed0ba819502f270b46fdf0ae16a844ac | JavaScript | samybaxy/codility | /src/oddOccurences.js | UTF-8 | 754 | 3.625 | 4 | [] | no_license | //https://app.codility.com/demo/results/training82JV6C-8EZ/
function solution(A) {
if(A.length === 1) return A[0];
//Sort the Array
A.sort((a,b) => a - b);
for(let i = 0; i < A.length; i += 2) {
if(A[i] !== A[i+1]) return A[i];
}
}
//Prefer this solution which is 100% performan... | true |
bf4a87f472b9b24e8ed23e23efbee38574a4a6b6 | JavaScript | EmmaMFitzGerald/fewpjs-iterators-fndcl-fnexpr-filter-lab-online-web-ft-071519 | /index.js | UTF-8 | 570 | 3.40625 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Code your solution here
function findMatching(driversArray, driversString){
let match = driversArray.filter(name => {
return name.toUpperCase() === driversString.toUpperCase()
})
return match
}
function fuzzyMatch(driversArray, driversString){
let match = driversArray.filter(name => {
... | true |
53a339efae872ce7d5253918387a01adfcb4f8a3 | JavaScript | eval-usertoken/congo | /spec/parseArguments.spec.js | UTF-8 | 1,111 | 2.59375 | 3 | [] | no_license | var congo = require('../congo');
describe('congo', function() {
describe('parseArguments', function() {
it('defaults to localhost/test when incorrect arguments are used', function() {
var config = congo.parseArguments();
expect(config.host).toBe('localhost');
expect(config.name).toBe('test');
... | true |
f02d7dcbbec70e3a4db5c3d9158a11a918c2e6ef | JavaScript | JordanHuntbach/events | /public/script.js | UTF-8 | 11,121 | 2.578125 | 3 | [] | no_license | $(document).ready(function () {
var ip;
if($('body').hasClass('admin')){
$.get("https://freegeoip.net/json/?", function(data) {
ip = data["ip"];
var cookie = document.cookie;
var token = cookie.substr(cookie.indexOf('=') + 1);
var query = '/events2017/ch... | true |
121975b45e8fd271ab45743b4b6c86bf45e8bceb | JavaScript | aartishchev/919965-code-and-magick-20 | /js/util.js | UTF-8 | 1,584 | 3.296875 | 3 | [] | no_license | 'use strict';
(function () {
var getRandomInteger = function (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
var getRandomArrayElement = function (array) {
return array[getRandomInteger(0, array.length - 1)];
};
var shuffleArray = function (array) {
var currentIndex = a... | true |
3e55aef255bd42401c1dfecad99ef4293f0ed06f | JavaScript | beellz/JavaScript-Quiz | /app.js | UTF-8 | 402 | 2.65625 | 3 | [] | no_license | function gameon() {
const move = document.getElementById("move-off");
const quizContainer = document.getElementById("quizContainer").style.display = 'none';
move.addEventListener("click", start);
function start () {
move.style.display = 'none';
document.getElemen... | true |
1abce35695dca6533d95b95a901019f53ffd22fa | JavaScript | tigger0jk/isthereawarriorsgametonight | /js/site.js | UTF-8 | 3,690 | 2.953125 | 3 | [] | no_license | var teamName = 'Warriors';
basePath = './';
// Try to auto-detect if we're in a different subdomain to load a different team
teamPath = window.location.pathname.replace(/\//g, "");
if(teamPath.length > 0) {
// if our team name has a space (lookin at you Trail Blazers) we need to convert the %20 to a space
teamName... | true |
830d93ed0369af896c7acb992a5fff7e0d62c6e5 | JavaScript | FernandoRCandiani/Oracle-Alura-Front-End | /JavaScript- Programando na linguagem da web/9- AjaxBuscando pacientes com AJAX/Introdução ao AJAX/js/buscar-pacientes.js | UTF-8 | 378 | 2.65625 | 3 | [] | no_license | var botaoAdicianar = document.querySelector("#buscar-pacientes");
botaoAdicianar.addEventListener("click", function(){
console.log("Buscando pacientes");
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://api-pacientes.herokuapp.com/pacientes");
xhr.addEventListener("load", function(){
... | true |
e805dd068aea15b874ad04036c55b26f71fc7236 | JavaScript | wisebed/wisegui | /js/wisegui-google-maps-view.js | UTF-8 | 8,156 | 2.765625 | 3 | [] | no_license | /**
* Represents a location
*/
function Coordinate(latitude, longitude, x, y, z, phi, theta, rho) {
// geographical coordinates
this.latitude = latitude;
this.longitude = longitude;
// cartesian coordinates
this.x = x;
this.y = y;
this.z = z;
// spherical coordinates
this.phi = phi;
this.theta = theta;
... | true |
4e9a35c6b05e5a9b97057fea96e7508544dc6902 | JavaScript | QwertyJacob/metrics-graphics-js-demo | /js/main.js | UTF-8 | 4,019 | 2.828125 | 3 | [] | no_license | 'use strict';
(function() {
/*
* Config for using the quandl.com data api v1.
*/
var company = {
// This could be derived from the returned metadata but
// this is neater and only slightly fragile.
displayName: 'Apple Inc.',
symbol: 'AAPL'
};
var startDate =... | true |
cf3d7f332f52c0c7344d04ddc0b04db7202a05ed | JavaScript | rahulyhg/Vedic-Rishi-Astro-NodeJS-Client | /sdk/matchmaking.js | UTF-8 | 758 | 2.640625 | 3 | [] | no_license | var f = require('./sdk');
userID = "<YourUserIdhere>";
apiKey = "<YourApiKeyHere>";
// create a male profile data
maleData = {
'date': 25,
'month': 12,
'year': 1988,
'hour': 4,
'minute': 0,
'latitude': 25.123,
'longitude': 82.34,
'timezone': 5.5
};
// create female data
femaleData = {... | true |
153727c93927f5382d406ac245788b9cfad8029d | JavaScript | GaryPerkins/acorns-test | /tests/searchTests.js | UTF-8 | 3,990 | 3.3125 | 3 | [] | no_license | /**
Test to verify that a search result has the expected values provided to the search request
Had issues with getting dropdowns to work via nightwatch, tried a lot of different hacky ways
and even those weren't working. The way the dropdown select element is used is out of the ordinary, I would
typically collaborate ... | true |
5cb00f80e5c5d02b0ce0d13a60a0a64afb21d4f6 | JavaScript | Henrique-Moreira/mole-game | /front end/js/jAlertWifi.js | UTF-8 | 3,367 | 2.984375 | 3 | [
"MIT"
] | permissive | // ----------------------------------------------------------------------------------------
// Biblioteca: jAlertWifi.js
// Criado por Wilton de Paula Filho
// Data: 04/22/2021
// Dependencias: jQuery library, jPanelWifi.css
// Objetivo: Apresentar um alert() personalizado, a partir de um painel utilizando jQuery
// --... | true |
31ed980c4d88fc6d4f4d2f5fe9d04291fba1eff6 | JavaScript | JovanCucic19/mean_forma | /app/account/test.js | UTF-8 | 739 | 2.71875 | 3 | [] | no_license | function onChange() {
/*reader.readAsText(file);*/
function EL(id) {
return document.getElementById(id);
} // Get el by ID helper function
var FR= new FileReader();
FR.onload = function(e) {
EL("img").src = e.target.result;
EL("b64").innerHTML = e.target.result;
... | true |
ed2bc45a94d2e96310f2b97460e68f1befa6fe72 | JavaScript | maiamendi/Workspace-inicial | /js/products.js | UTF-8 | 4,488 | 3.1875 | 3 | [] | no_license | const ORDER_ASC_BY_COST = "Menor precio";
const ORDER_DESC_BY_COST = "Mayor precio";
const ORDER_BY_PROD_SOLD = "Relevancia";
var currentProductsArray = [];
var currentSortProdCriteria = undefined;
var minCount = undefined;
var maxCount = undefined;
function sortProducts(criteria, array) {
let result = [];
if ... | true |
5531788445f32f37d3072a6d3f271733099ca807 | JavaScript | sethjust/webkit | /LayoutTests/svg/animations/script-tests/animate-path-to-animation.js | UTF-8 | 2,485 | 2.6875 | 3 | [] | no_license | description("Test calcMode spline with to animation. You should see a green 100x100 path and only PASS messages");
createSVGTestCase();
// FIXME: We should move to animatePathSegList, once it is implemented.
// Setup test document
var path = createSVGElement("path");
path.setAttribute("id", "path");
path.setAttribute(... | true |
99b0396403ae5357c967e272ff389d6b73cc4a8c | JavaScript | DiegoHarari/smart_buddy | /src/ava/commands/environmentCommand.js | UTF-8 | 1,008 | 3.1875 | 3 | [] | no_license | const object = { keyword: 'office', command: 'OBJECT' };
const action = { keyword: ['status', 'check', 'how'], command: 'ACTION' };
class EnvironmentCommand {
constructor() {}
randomInt(min, max) {
return min + Math.floor((max - min) * Math.random());
}
async parse(phrase) {
const objectIndex = phrase... | true |
48597de5ad4c889fbc0d35649ab81030ba0d3632 | JavaScript | manno-xx/Phaser3CMD | /MultiSceneTemplateClass/js/main.js | UTF-8 | 2,131 | 3.421875 | 3 | [
"MIT"
] | permissive | /**
* This demonstrates the use of multiple scenes.
*
* In Phaser you can create multiple scenes.
* This, for instance, allows you to seperate the code between a menu and the actual game
*
* This is a template for a game with multiple scenes.
*
* There are two classes defined. Each with at a key (see the s... | true |
cf1e9a6bb800293ec1b8c10e5f61568b12ad85c7 | JavaScript | kevinyee1993/flex-project | /scrapers/yelp_restaurants.js | UTF-8 | 4,782 | 2.796875 | 3 | [] | no_license | //SCRAPER FOR YELP, all restaurants
const PostToDatabase = require('../app/util/post_request');
// const showPageInfo = require('./yelp_showpage');
// const showImageInfo = require('./yelp_showpage');
const fetch = require('node-fetch');
const cheerio = require('cheerio');
//note, pages for yelp are shown as 0, 10, 2... | true |
32ae50881d7dbee4ca754097e278d6a1972bc903 | JavaScript | zbrsnd/gitrepo | /klasa 1/public_html/p5/p5/empty-example/sketch3.js | UTF-8 | 591 | 3.1875 | 3 | [] | no_license | var x, y; //współrzędne obiektu
var krok = -1;
function setup() {
// put setup code here
createCanvas(600, 600);
background(200);
x = 575;
y = 475;
}
function draw() {
noFill();
noStroke();
if (mouseIsPressed) {
if (mouseButton === LEFT) { // SPRAWDZANIE KTÓRY PRZYCISK MYSZY JEST NACIŚNIĘTY " =... | true |
a1f52f33f352d0c3c3868d1cbf4a74b802a7b3d6 | JavaScript | darwinv/domainchecker | /js/roanjacheckdomain.js | UTF-8 | 1,244 | 2.65625 | 3 | [] | no_license | $(document).ready(function(){
/*$(document).on('click', '.choose-domain', function(e) {
var count,$container,state;
$container=$('div.cont-checkdomain');
count= parseInt($container.find("#num-domains").html());
state = $(this).data('state');
switch(state){
case 1 :
case undefined ... | true |
172a5baca2455d3fa808277940e9af5f69e5be4d | JavaScript | jolasman/LAIG2016 | /LAIG2_T6_G01/laig/reader/MySceneGraph.js | UTF-8 | 56,805 | 2.734375 | 3 | [] | no_license |
function MySceneGraph(filename, scene) {
this.loadedOk = null;
// Establish bidirectional references between scene and graph
this.scene = scene;
scene.graph=this;
// File reading
this.reader = new CGFXMLreader();
this.reader.open('scenes/'+filename, this);
}
MySceneGraph.prototype.onXML... | true |
694e20db4d6590757b540cc3d8b0e5d1b02f5965 | JavaScript | toshism/some | /web/some/src/components/Search.js | UTF-8 | 1,179 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react'
import PropTypes from 'prop-types'
import debounce from 'debounce'
export default class Search extends Component {
constructor(props) {
super(props);
this.handleChange = debounce(this.handleChange, 300);
this.state = {searchStr: this.props.value}
... | true |
c36b81e62a54cee25e3531ebef45a507984c4734 | JavaScript | kritsaran25/project-workshopII | /customer.js | UTF-8 | 550 | 2.625 | 3 | [
"MIT"
] | permissive | $(function() {
$.get("customers.json", function(data) {
console.log(data);
var i = 0
for (i = 0;i< data.length;i++){
var j = i +1;
htmlString = '<tr><th scope ="row">'+j+'</th><td>'+data[i].customerID+'</td><td><a href="customerdetail.html" onclick="setCookies('+i+')">'
... | true |
88b91cc1eb6f3e57fe686523b31ca9a9776ccb95 | JavaScript | arayhan/skydu-academy-reactjs-basic | /src/pages/Blog.jsx | UTF-8 | 1,347 | 2.546875 | 3 | [] | no_license | import React, { Component } from "react";
import { Link } from "react-router-dom";
class Blog extends Component {
state = {
posts: null,
};
componentDidMount() {
this.fetchPosts();
}
fetchPosts = () => {
fetch(`https://jsonplaceholder.typicode.com/posts`)
.then((data) => data.json())
.then((json) =>... | true |