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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51453a4ebec7c33e2459ccd5dbf92050b3dead1c | JavaScript | keshidong/messageChannel | /index.js | UTF-8 | 2,524 | 2.8125 | 3 | [] | no_license | function makeid (length = 9) {
let result = ''
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
const charactersLength = characters.length
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength))
}
return result
}
co... | true |
a34cc4a9061410e78f12502a95d4d7be939648fe | JavaScript | SnipInText-org/super-selector | /api/collect.js | UTF-8 | 245 | 2.53125 | 3 | [
"MIT"
] | permissive | const Collect = new function(){
//collect logs as a json array
let content = [];
this.log = function(str, options){
console.log(str + "\n" + new Error().stack);
}
this.error = function(str, options){
}
} | true |
8e7e6ef504f19e276a7f4085d5957010382aa161 | JavaScript | julenr/pomodoro | /public/js/controllers/mainCtrl.js | UTF-8 | 2,455 | 2.546875 | 3 | [
"MIT"
] | permissive |
// public/js/controllers/mainCtrl.js
angular.module('mainCtrl', [])
.controller('mainController', ['$scope', '$http', 'Task' ,
function($scope, $http, Task) {
// object to hold all the data for the new task form
$scope.taskData = {};
// loading variable to show the spinning loading icon
$scope.loading ... | true |
c2d7135128feb61a267ebcfb37e6f6e95263725f | JavaScript | JeffLoo-ong/banhmibot | /server.js | UTF-8 | 3,246 | 2.71875 | 3 | [] | no_license | require('dotenv').config()
const express = require('express')
const bodyParser = require('body-parser');
const { Wit, log } = require('node-wit');
// START Init
const app = express()
const port = 3000
// END Init
// START Middleware
// Support parsing of application/json type post data
app.use(bodyParser.json());
... | true |
83180b76fc40012448e05b15c05a25e1e5d4af8f | JavaScript | StarbaseAlpha/Triples | /triples.js | UTF-8 | 3,760 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
function Triples(database) {
async function put(subject, predicate, object) {
if (!subject || !predicate || !object) {
throw ('The subject, predicate, and object parameters are required.');
}
let data = {
"subject": isNaN(subject) ? subject.toString() : parseFloat(subject),
... | true |
875b97a426f1a57ab6680c8c1140f1619a4f0c4f | JavaScript | amoghabhardwaj/imad-2016-app | /ui/main.js | UTF-8 | 1,694 | 3.359375 | 3 | [] | no_license | //Counter Examples
//var counter = 0;
function onClick(){
//counter = counter +1;
//document.getElementById("count").innerHTML = counter.toString();
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if(request.readyState == XMLHttpRequest.... | true |
a1cc3defaf70acf1d726271690e6f6813fe9a8b9 | JavaScript | Krishna-123/SentimentAnalysis | /restaurant/src/pages/components/SpecificRes.js | UTF-8 | 6,617 | 2.734375 | 3 | [] | no_license | import React, { Component } from 'react' ;
import $ from 'jquery';
export default class SpecificRes extends Component{
constructor(){
super();
this.state = { name: "enter the name",
review: "enter what you think about the restaurant",
allreviews:[]
};
this.addAuthor = this.... | true |
09d2ced5afd2b4559bd98f69995d5140cc575a32 | JavaScript | Alexey-co/web_academy | /src/javascript_array/javascript_array.js | UTF-8 | 871 | 3.484375 | 3 | [
"MIT"
] | permissive | import "./javascript_array.scss";
// ArrayMap
const products = [
{
title: "phone",
price: 100
},
{
title: "laptop",
price: 2500
},
{
title: "TV",
price: 500
},
{
title: "Desktop",
price: 1500
}
];
// const elements = [];
// for (let i = 0; i < products.length; i++) {
//... | true |
cd76c34c5a2f54114b4ba2e434bc4c60ac9e4c71 | JavaScript | abubakrmuhammad/dexiejs | /js/db.js | UTF-8 | 335 | 2.84375 | 3 | [] | no_license | /********************
* DexieJS Practice
********************/
const db = new Dexie('MyDatabase');
db.version(1).stores({ friends: '++id, firstName, lastName, age' });
/*
// Update Friend
const updateFriend = () => {
db.friends.update(2, { name: 'Ali' }).then(count => {
console.log(count + ' users updated.')... | true |
0ab17b174ae43615e0c2aff28040d2db2a33e17c | JavaScript | fkroockmann/formbuilderjs | /src/elements/select.js | UTF-8 | 1,771 | 2.8125 | 3 | [
"MIT"
] | permissive | (function () {
'use strict';
FormBuilder.register('select', function (config) {
var self = {};
self = new FormBuilder.ElementMock(config);
self.options = (typeof config.options === 'object') ? config.options : [];
self.multiple = config.multiple || false;
if ((/number|string/).test(typeof config.selec... | true |
810ec9ebe39999231e0d3088e58e9cca39f5b141 | JavaScript | burczu/react-redux-router-training-examples | /src/components/class-comp.js | UTF-8 | 430 | 2.75 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
// klasa komponentu
class Component extends React.Component {
// kontrola typu przekazanej wartości
static propTypes = {
text: PropTypes.string.isRequired
}
// obowiązkowa implementacja!
render() {
return <p>{this.props.text}</p>;
}
}
... | true |
620a17ba7839bb369f8ef60aa73f5fa40cdc19aa | JavaScript | dakotaJang/machine-learning-shapes | /shapes-generator/src/dj-tf-data-canvas/dj-tf-data-canvas-triangle.js | UTF-8 | 2,777 | 3 | 3 | [
"MIT"
] | permissive | import { DjTfDataCanvas } from "./dj-tf-data-canvas";
export class DjTfDataCanvasTriangle extends DjTfDataCanvas {
drawTriangle(ctx, p0, p1, p2){
ctx.fillStyle = 'black';
ctx.lineCap = 'round';
ctx.lineWidth = 5;
ctx.beginPath();
ctx.moveTo(p0.x, p0.y);
ctx.lineTo(p1.x, p1.y);
... | true |
cbd4322f9fbd3f69a0aaf8da24d71ea85e790373 | JavaScript | kfox/gradus | /rules/theory.1st_species.js | UTF-8 | 4,374 | 2.625 | 3 | [] | no_license |
var Violation = Gradus.Constraints.Violation;
Gradus.FirstSpecies = new Gradus.Constraints();
// Return a first guess at which notes could go on top of
// a cf, in place of a rest
Gradus.FirstSpecies.naiveSonorities = function(bass, rest, prev, penultimate) {
// Note: assumption here is that the penultimate note is... | true |
a7159e175e458a06e8a2c67597b8ccbc87930ba1 | JavaScript | grazidiandra/lab-javascript-chronometer | /javascript/chronometer.js | UTF-8 | 1,495 | 3.453125 | 3 | [] | no_license | class Chronometer {
constructor() {
this.currentTime = 0;
this.intervalId = 0;
// //bonus
// this.currentTimeMil = 0;
// this.intervalIdMil = 0;
}
startClick(callback) {
this.intervalId = setInterval( () => {
this.currentTime += 1;
}, 1000);
// //bonus
// this.interval... | true |
e3f1917b5eee9b101c407245a6df9744770efcd7 | JavaScript | hanri777/weight-contr-spboot-app | /src/Components/AdminComponent/AdminEditUserComponent.js | UTF-8 | 14,667 | 2.578125 | 3 | [] | no_license | import React, { Component } from "react";
// For Date format
import moment from 'moment'
// Form library for form
import { Formik, Form, Field, ErrorMessage } from 'formik'
import './AdminAddEditUserComponent.css'
import AdminManagementService from '../../api/AdminManagementService'
import AuthenticationService from '... | true |
d8b2e488b886d5a015e61963de59aa8fca459959 | JavaScript | markfickett/dicehistogram | /index_templates/chart.js | UTF-8 | 7,934 | 2.75 | 3 | [] | no_license | <%text>
var MARGIN = {top: 30, right: 30, bottom: 50, left: 50};
var LEGEND_WIDTH = 200;
var HEIGHT = 300 - (MARGIN.top + MARGIN.bottom);
d3.selectAll('.chart').attr('height', HEIGHT + 'px');
Object.keys(g_chartIdToConfig)
.forEach(extractChartDetails);
/**
* Looks up the <svg> to render into in the DOM, and chart... | true |
023972b835f2a39382e912f4c0d0ddd901ec2c1c | JavaScript | ntbrewer/power-of-attorney | /src/strings/pdf.js | UTF-8 | 14,165 | 2.59375 | 3 | [
"MIT"
] | permissive | // @flow
const PDF_STRINGS = {
instructions: 'Instructions for Completing Power of Attorney Form',
printInstructions:
'Print two original copies (one for the caregiver, one for the parent(s)/legal guardian) of these documents and wait to sign both copies until you are in front of a notary public or two witness... | true |
3b169540b7ef79d5d0415306187d19c3d4a90010 | JavaScript | TejasviRaj/sudoku-react-redux | /src/Sudoku/ConflictTests/CheckForConflicts.js | UTF-8 | 1,242 | 2.84375 | 3 | [] | no_license | //Author- Tejasvi Raj Pant
import checkItemRepeats from './CheckItemRepeats'
export default function checkForConflicts(board) {
for (let row of board.rows) {
for (let cell of row.cells) {
cell.hasConflict = false;
}
}
for (let row of board.rows) {
let cellsInCurrentRow... | true |
8a51d378853c62c97cdc172da52e5d24f4d1f73e | JavaScript | kadumkomut/javascript-dsa | /Javascript Interview/callBindApply.js | UTF-8 | 928 | 3.9375 | 4 | [] | no_license | // let name1 = {
// firstname : "kadum",
// lastname : "komut"
// }
// let name2 = {
// firstname : "eliza",
// lastname : "siram"
// }
// let printfullName = function(hometown) {
// console.log(this.firstname+" "+this.lastname+" from "+hometown);
// }
// // call - function borrowing
// printfull... | true |
87d6684c8cc01e0f890838027eeaa6d8b55c981e | JavaScript | ibabkov/let_it_code | /problems/stackAndQueue/max_stack_716/index.js | UTF-8 | 571 | 3.234375 | 3 | [
"MIT"
] | permissive | export class MaxStack {
constructor() { this._stack = []; }
push = (val) => { this._stack.push(val); };
pop = () => this._stack.pop();
top = () => this._stack[this._stack.length - 1];
_peekMaxIndex = () => {
let maxIndex = null;
for (let i = 0, max = -Infinity; i < this._stack.length; i++) {
... | true |
ced34649b341b5b6ee55cc82833e2534d7116992 | JavaScript | evgeniygolikov/keksobooking | /js/components/filters.js | UTF-8 | 1,297 | 2.84375 | 3 | [] | no_license | export default class Filters {
constructor(element) {
this.element = element;
this.typeSelect = element.querySelector('#housing-type');
this.priceSelect = element.querySelector('#housing-price');
this.roomCountSelect = element.querySelector('#housing-rooms');
this.guestCountSelect = element.queryS... | true |
7252350c77f5100362068df38b68668ee125f3f5 | JavaScript | venkateshreddy/React-Basics | /src/StudentsTiles.js | UTF-8 | 4,310 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import { Row, Col } from 'react-bootstrap';
import StudentTile from './StudentTile';
import './App.css';
import AddStudent from './AddStudent';
class Students extends Component {
constructor() {
super();
this.state = {
show: false,
n... | true |
3ec3c527d606552f62603ad17bd3a5891e0e0509 | JavaScript | freeeeaker/algorithm | /src/mergeSort.js | UTF-8 | 586 | 3.5 | 4 | [] | no_license | // 归并排序
// 思路: 二分之后 排序
function merge (arr1, arr2) {
var arr = []
var left = [].slice.call(arr1)
var right = [].slice.call(arr2)
while(left.length && right.length) {
arr.push(left[0] > right[0] ? right.shift() : left.shift())
}
return [...arr, ...left, ...right]
}
module.exports = function mergeSort (... | true |
6fd30637bfe686ca487e7778629a3142a7709e23 | JavaScript | MJbae/200609_ReviewWebBasic_HTML_CSS_JS | /200809_BaseballGame/src/GameResult.js | UTF-8 | 418 | 3.03125 | 3 | [] | no_license | class GameResult {
constructor(digit, strike, ball) {
this.digit = digit;
this.strike = strike;
this.ball = ball;
}
isDone() {
return this.ball == 0 && this.strike == this.digit;
}
toString() {
let resultString = `${this.strike}S${this.ball}B`;
if (this.strike === 0 && this.ball === ... | true |
74e7d7dafcba019712bf1e9a33585069858ec5d4 | JavaScript | alun/app-comparison | /quotes-exporter/src/sheet.js | UTF-8 | 912 | 2.65625 | 3 | [] | no_license | const google = require('./google');
/**
* Converts Promise resolve/reject functions to classic Node.js callback(err, res)
* @param {*} resolve
* @param {*} reject
*/
function toErrRes(resolve, reject) {
return (err, res) => {
if (err) reject(err);
else resolve(res);
}
}
class Sheet {
... | true |
becc1b85b8493a8c88ae8979ac4ad9a12768d8ba | JavaScript | dianaof/TGIF | /loyalty-statistics.js | UTF-8 | 6,755 | 2.640625 | 3 | [] | no_license | let chamber;
if (document.URL.includes("senate")) {
chamber = "senate";
} else {
chamber = "house";
}
fetch(`https://api.propublica.org/congress/v1/113/${chamber}/members.json`, {
method: "GET",
headers: {
"X-API-key": "USiTg4aV1o26w6EjIpr190WMQ6HdnmD1gael0wFG"
}
})
.then(function(response) {
if (... | true |
422a5f54dd0dcda2881fe627344dd8007d11d6f9 | JavaScript | Analogbird/aBird.co.module | /test/index.js | UTF-8 | 5,851 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
require('should');
let options = {
apiKey: '680e4bec6651c1b7682202b43761f392d633dd99',
timeout: 3600
},
bird = require('../lib/index').fly(options),
testMask,
duplicateMask;
if (process.env.URL !== 'API') {
bird.url = 'http://localhost:9090/';
}
describe('Tests:', (... | true |
e5516a11235006f787877b0a1ed782fc4985cce4 | JavaScript | morganlaneap/bootstrappy | /js/bootstrappy.js | UTF-8 | 4,999 | 2.703125 | 3 | [] | no_license | /**
* Created by Morgan Lane on 04/09/2017.
*/
var element = "";
function bootstrappify() {
var editor = $('.bootstrappy-editor');
var result = $('.bootstrappy-result');
var markup = "";
var bootstrappy = editor.val();
var lines = bootstrappy.split('\n');
var sections;
var c... | true |
166c1f8e20ab64ea1b09f4820c8f7d1d25b5479f | JavaScript | sandstreamdev/std | /date/parseHourMinutePair.js | UTF-8 | 223 | 2.6875 | 3 | [
"MIT"
] | permissive | export default (text = "") => {
const [hoursString, minutesString] = text.split(":");
const hours = parseInt(hoursString || "0", 10);
const minutes = parseInt(minutesString || "0", 10);
return [hours, minutes];
};
| true |
6b591eb3634b0fe634fea03640e014dfa37358d8 | JavaScript | DYstebo/multiple-reactions | /reactions.js | UTF-8 | 10,035 | 2.9375 | 3 | [] | no_license | const Discord = require('discord.js');
const client = new Discord.Client();
const config = require('./config.json');
var store = require('json-fs-store')();
client.config = config;
client.once('ready', () => {
console.log('Ready to react!');
});
const prefix = config.prefix;
client.on('message', message => {
con... | true |
905d3e8fbcaf785a8f3d39678139bef5da3f9eb0 | JavaScript | gwdean/whalesong | /js-assembler/runtime-src/baselib-equality.js | UTF-8 | 1,472 | 2.984375 | 3 | [] | no_license | // Equality function
(function(baselib) {
var exports = {};
baselib.equality = exports;
var eqv = function(x, y) {
if (x === y) { return true; }
if (plt.baselib.numbers.isNumber(x) && plt.baselib.numbers.isNumber(y)) {
return jsnums.eqv(x, y);
} else if (plt.baselib.chars.isChar(x)... | true |
b513a5797a22f2c4d97398b909752e627578a341 | JavaScript | gauravtha2406/TODO-APP-REACT.JS- | /src/App.jsx | UTF-8 | 1,373 | 3.03125 | 3 | [] | no_license | import React, { useState } from "react";
import "./index.css";
import ToDoLists from "./ToDoLists";
const App=()=>{
const[inputList , setInputList]=useState("");
const[items, setItems]=useState([]);
const itemEvent= (e)=>{
setInputList(e.target.value);
}
const listOfitems=()=>{
// here... | true |
a6cc10355ed0d7356b29294c05031cd9a6462bc1 | JavaScript | JimmyCT/GreenfieldHR7 | /database/seed_postgres_example.js | UTF-8 | 1,211 | 2.84375 | 3 | [] | no_license | const fs = require('fs');
const pg = require('pg');
var conString = "pg://localhost:5432/postgres";
const client = new pg.Client({
connectionString: conString //change to connectionString: process.env.DATABASE_URL when deployed to Heroku
// ssl: true
});
client.connect();
let insertRestToDB = (restaurants) => {
... | true |
cd69ec3e51f5d148db64214323b9c579bd12f561 | JavaScript | aaronwhyte/cave2d | /public_html/js/physics/worldevent.js | UTF-8 | 2,597 | 3.265625 | 3 | [] | no_license | /**
* A union of all the world event types and their fields, as a SkipList node.
* @constructor
*/
function WorldEvent() {
this.next = [];
this.cellRange = new CellRange(0, 0, -1, -1);
// This is a vector along which collision acceleration should be applied,
// for default elastic collision resolution.
//... | true |
af2f6cbbdcaefd629d429016bc8a13a7970996a5 | JavaScript | bioxim/cliente_foobe | /controllers/changelogController.js | UTF-8 | 1,659 | 2.71875 | 3 | [] | no_license | const Changelogs = require('../models/Changelogs');
// Agrega un nuevo Contenido WEB
exports.nuevoChangelog = async (req, res, next) => {
//console.log(req.body);
const changelog = new Changelogs(req.body);
try {
// almacenar el registro
await changelog.save();
res.json({ mensaje: 'Se agrego un nuevo changelo... | true |
fad06348a29173acd41f2024ec40432a62840e2d | JavaScript | Yezlion/Yesi-s-Repository | /ex2.js | UTF-8 | 1,709 | 3.671875 | 4 | [] | no_license | window.onload = function () {
init();
}
function init () {
var newUl = createUlFromArray([
'alpha',
'bravo',
'charlie',
[
['name', 'Frank'],
['profession', 'Spartan'],
['random', 'entries']
],
[
['name', 'Leonidas'],
['profession', 'Preschool Teacher']
]
... | true |
343310a9579c17a44eac52d7ec9073da93da2534 | JavaScript | akinuri/js-lib | /canvas/backgroundColor.js | UTF-8 | 238 | 2.859375 | 3 | [] | no_license | CanvasRenderingContext2D.prototype.backgroundColor = function (color) {
this.save();
this.beginPath();
this.rect(0, 0, this.canvas.width, this.canvas.height);
this.fillStyle = color;
this.fill();
this.restore();
}; | true |
a527b3fc7e667978999e26ef8404de29e1ef750b | JavaScript | aplesss/CoolingoWeb_final | /BackEnd/Server/index.js | UTF-8 | 1,019 | 2.625 | 3 | [] | no_license | const express = require("express");
const app = express();
var cors = require('cors');
app.use(cors({origin: '*'}));
// parse requests of content-type: application/json
// parse requests of content-type: application/x-www-form-urlencoded
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extende... | true |
f74d4853445686b2c3c5653e502583f88d93b473 | JavaScript | djooyang/COMP-2800-Team-BBY-13-LetsPack | /server/controller/controller.js | UTF-8 | 10,761 | 2.6875 | 3 | [] | no_license | "use strict";
var Event = require('../model/event');
var Login = require('../model/login');
var Invite = require('../model/invite');
var ItemDb = require('../model/item');
var StarterPack = require('../model/starterpack');
const sanitizeHtml = require('sanitize-html');
/*add library for authentication*/
const passpor... | true |
1ddfe66403534ba3c63c515c29f211caaf51b788 | JavaScript | Dianamal242/StudentDashboard | /tools/data/jasmine-standalone-2.4.1/spec/DateRoundSpec.js | UTF-8 | 6,381 | 3.109375 | 3 | [
"ECL-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | describe("DateRound", function() {
var dateRound;
//beforeEach(function() {
// dateRound = new DateRound();
//});
//it("should be able to round a minute with small numbers", function() {
// d = dateRound.roundMinute(100*1000);
// //expect(dateRound.roundMinute(100)).toEqual(60);
// expect(d)... | true |
aed7fde5c5c5c6095ab61aeed47977632a4cdcc6 | JavaScript | lipl1994/sss | /newproject/index.js | UTF-8 | 1,419 | 2.734375 | 3 | [] | no_license | /* console.log(123); */
const express=require('express'); //加载express 核心模块
const app=express() //暴露出的对象
const hbs= require('hbs');
const path = require('path');
const bodyParser = require('body-parser');
/* app.set() 对app这个应用进行设置的方法
app.use() 、、可以让app 这个应用加载一些中间件的方法
*/
app.use(bodyParser.json()); //处理表单... | true |
30de71a78394c4122b1895b150de59b445f831bc | JavaScript | acharyakavita/Arcade-Game | /js/app.js | UTF-8 | 10,874 | 3.609375 | 4 | [] | no_license | /*Application file having the main game logic for Arcade game*/
// Enemies our player must avoid
class Enemy {
constructor(x, y, speed) {
this.x = x;
this.y = y;
this.speed = speed;
this.sprite = 'images/enemy-bug.png';
}
// Update the enemy's position, required method for ga... | true |
ba390e3ea4bc5fcfcd02c295834394f65a679ad2 | JavaScript | keishikamioka/NirinMarket | /WebContent/js/formconfirm.js | UTF-8 | 10,771 | 2.859375 | 3 | [] | no_license | var Cnt = jQuery('#ContactInput'), //入力部分
Cfm = jQuery('#ContactConfirm'), //確認部分
BtCfm = '#BtConfirm', //確認ボタン
BtSnd = jQuery('#BtSend input'),//送信ボタン
BtCsl = '#BtCancel',//キャンセルボタン
CntItem = jQuery('#ContactInput .CntItem'),//入力の包容タグ
CfmItem = jQuery('#ContactConfirm .CfmItem di... | true |
82517209b7735868906136670b3c07b6c0d3ca26 | JavaScript | jwoods02/uni-iot-dashboard | /src/server/arduino.js | UTF-8 | 1,021 | 2.53125 | 3 | [] | no_license | const SerialPort = require("serialport");
// Change the portNum to the appropriate port for your connection
const portNum = "";
// Set sensorRef equal to the document ID of the relevant sensor
const sensorID = "";
const admin = require("firebase-admin");
const serviceAccount = require("../firebase.json");
const Readl... | true |
ca1b146f457a2b72e25bce95ac16e7c3f6e7afec | JavaScript | tenny7/elibrary_frontend | /src/modules/books/Add.js | UTF-8 | 3,164 | 2.71875 | 3 | [] | no_license | import React from 'react'
import axios from 'axios'
export default class Add extends React.Component {
constructor(props) {
super(props);
this.state = {
title: "",
pages: "",
}
this.handleInput = this.handleInput.bind(this)
this.handleSubmit = this.... | true |
912605e51ee300a4aa2b46c950dd69ee86b57236 | JavaScript | stephenc29/node-red-contrib-music | /BeatSync/clock.js | UTF-8 | 3,997 | 2.8125 | 3 | [] | no_license | // DECIDE WHETHER TO USE SOCKETS INSTEAD OF REQUESTS
// NEED TO UPDATE TO ALLOW NEGATIVE OFFSETS WITHOUT ACTUALLY PUTTING THE TIME BACK (gentle offset slowdown method) DO THIS FOR beat.js too
var ipAddressRetriever = require("./ipAddress.js");
var offset = 0; // offset from real-time in milliseconds (can simulate mul... | true |
1793e3b9160054e557b292d4a25bb113002efcd0 | JavaScript | ohidurgclan/imac-configuration | /cart.js | UTF-8 | 4,241 | 3.34375 | 3 | [] | no_license | /*------------------------------------------------
Default Variable For HTML Elements.
--------------------------------------------------*/
let bestPrice = document.getElementById('bestCost');
let memoryPrice = document.getElementById('extraMemory');
let storagePrice = document.getElementById('extraStorage');
l... | true |
071c52f0585204423c61b5e9cf7a2f97b3719c06 | JavaScript | cybor97/Card2019 | /card2019/uiElements/pxsnowflake.js | UTF-8 | 1,031 | 2.578125 | 3 | [] | no_license | /*
####
######
######
####
*/
class PXSnowflake extends IUIElement {
appear() {
let parts = [];
let width = this.size.width, height = this.size.height;
let partWidth = ~~(width / 6), partHeight = ~~(height / 4),
x = this.location.x, y = this.location.y;
for (let yOffse... | true |
b4d93d94e81e934e695edbcdeba2f13c18ff3b46 | JavaScript | AtlasOfLivingAustralia/fieldcapture-mobile-android | /GreenArmyMobile/src/main/assets/static/sZOUMmPch5shtxpuJYFlk1GJm37gej62Q1m4lPaUrRO.js | UTF-8 | 76,296 | 2.875 | 3 | [
"MIT"
] | permissive | /**
* vkBeautify - javascript plugin to pretty-print or minify text in XML, JSON, CSS and SQL formats.
*
* Version - 0.99.00.beta
* Copyright (c) 2012 Vadim Kiryukhin
* vkiryukhin @ gmail.com
* http://www.eslinstructor.net/vkbeautify/
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/l... | true |
10469630a37dc035db3e58dc9d4ff3026b71bd14 | JavaScript | MagdielCAS/p5-maurer-rose | /sketch.js | UTF-8 | 1,701 | 2.859375 | 3 | [] | no_license | var vw, vh;
let s = 10;
var n = 2;
var d = 29;
var nMin = 0;
var nMax = 20;
var nStep = 1;
var dMin = 0;
var dMax = 360;
var dStep = 0.1;
var dvelocity = 1;
var dvelocityMin = -10;
var dvelocityMax = 10;
var dvelocityStep = 0.01;
var dnoise = true;
var lightTheme = true;
var gui;
function setup() {
vw = window... | true |
9a32f1f3894d10229bdacfa435464a029186b5ed | JavaScript | chueyng/WDI12_Homework_LearningLab | /AngieNg/week_07/10-ajax/ajax-intro/app/assets/javascripts/xhr.js | UTF-8 | 592 | 3.140625 | 3 | [] | no_license | $(document).ready(function () {
$('#getInfo').on('click', function () {
$.ajax('/info').done(function (info) {
var output = "<p>Lucky number: " +info.lucky_number + "</p> <p> Time: " +info.time + "</p>";
output += "<p>Uptime: "+info.uptime+"</p>";
$('#result').html(output);
})
});
$('#g... | true |
6f2954ebeb3904f243b94dec544b2a66e9298450 | JavaScript | matsuyoro/otoko_koinobori | /game.js | UTF-8 | 4,583 | 2.5625 | 3 | [] | no_license | enchant();
window.onload = function () {
var game = new Game(320, 320);
game.preload('otoko.gif','koinobori2.gif','karasu.gif','kazaguruma.gif','poll.gif','senpuki.gif');
game.onload = function () {
// 初期設定
var score = 0;
//haikei
var poll = new Sprite(4,270);
poll.image = game.assets['poll.gi... | true |
221e2a509bebef791aac851365dfd2ec4d9f1232 | JavaScript | wvha/js-2019 | /leetcode/easy/589-tree-preorder-traversal.js | UTF-8 | 528 | 3.390625 | 3 | [] | no_license | // sol 1
// while node has children, for each, add its first child
var preorder = function(root) {
return compose(root, []);
}
function compose(node, list) {
if (!node) {
return list;
}
list.push(node.val);
if (node.children) {
node.children.forEach(child => {
compose(child, list);
})
}
return lis... | true |
56e867be68e69db8522ac45f17c218000f3e7a0c | JavaScript | frankli-n/walkinwardrobe | /clothclick.js | UTF-8 | 645 | 3.25 | 3 | [] | no_license | function showAtticus(){
document.getElementById("atticushead").style.visibility = "visible";
}
function showFrankie(){
document.getElementById("frankiehead").style.visibility = "visible";
}
function showLuke(){
document.getElementById("lukehead").style.visibility = "visible";
}
<script>
// Get the video
var video... | true |
8f50d0a34dc22b03f8a725c61fa08be18475ef46 | JavaScript | MadGamesmith/SleepwalkingBot | /madbot.js | UTF-8 | 861 | 2.578125 | 3 | [] | no_license | require('dotenv').config();
const Discord = require('discord.js');
const client = new Discord.Client({
partials: ["MESSAGE"] //this enables access to messages written before bot login
});
const botToken = process.env.BOT_TOKEN;
const rulesChannel = process.env.RULES_CH;
client.login(botToken);
client.on('ready... | true |
b02a316b5a2baade02cf3473977efc43838b1dd1 | JavaScript | kevinchisholm/getting-started-with-express-the-node-js-web-application-framework | /example-1.js | UTF-8 | 669 | 3.1875 | 3 | [] | no_license | //reuire the express nodejs module
var express = require('express'),
//set an instance of exress
app = express();
//for any requests to the root of the application
app.get('/', function (req, res) {
//construct the HTML that we will return
var HTML = ''
+ '<!DOCTYPE html>'
+ '<html>'
+ '<head>'
+ '<meta cha... | true |
5f22b1af12d8b58435305a29d748267d2d74f958 | JavaScript | discoverygarden/lib4ridora | /js/lib4ridora_authority.js | UTF-8 | 6,979 | 2.609375 | 3 | [] | no_license | /**
* @file
* Interfere with islandora_authority
*/
(function($) {
/**
* Attaches the copyfield behaviour to all required fields
*/
Drupal.behaviors.lib4ridora_authority = {
attach: function(context, settings) {
const COPY_ATTR_NAME = 'copy_from_islandora_authority_hidden_name'; // the attribute... | true |
50d4023e66f65a3e9d2cac47298bc3122205e28a | JavaScript | parksnrec55/philkkw.github.io | /jsonweather-html/scripts/remote_wu.js | UTF-8 | 1,988 | 2.984375 | 3 | [] | no_license | // Current Location Scripts
$(function () {
var status = $('#status');
(function getGeoLocation() {
status.text('Getting Location...');
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude;
var long = position.... | true |
d696866d031cf952c55874cb89378ff9d5218365 | JavaScript | SriChandan2498/jobverz | /src/draft/ScatterPlot.js | UTF-8 | 1,352 | 2.765625 | 3 | [] | no_license | import React, { useEffect } from 'react';
import * as d3 from 'd3';
const DATA = [
{ x: 10, y: 20 },
{ x: 20, y: 50 },
{ x: 80, y: 90 }
];
function ScatterPlot() {
useEffect(() => {
const margin = { top: 10, right: 40, bottom: 30, left: 30 },
width = 450 - margin.left - margin.right... | true |
4fc5a9f99b3fedb41bb74b0adae1f5425184190a | JavaScript | nvw123/htmlEdit | /front/src/utils/common.js | UTF-8 | 5,651 | 2.703125 | 3 | [] | no_license | import {alignType, displayMode, fontBlod, fontColor, fontItalic} from "./config";
import _ from 'lodash'
/**
* 通过键值获取列表中的json数据
* 通过 key 获取列表元素 再获取 type 值
* */
export const getValueByKey = (attrs, key, type) => {
return objectMap(attrs, key).get(type) || false;
}
const objectMap = (objs, key) => {
return n... | true |
216005d1f48dd45e749702ff05ea25fcffd677da | JavaScript | Habernet/burger | /controllers/burgers_controllers.js | UTF-8 | 2,122 | 3.25 | 3 | [
"MIT"
] | permissive | // Bring in express so we can make our router
const express = require('express');
// Bring in burger.js so we can access our model and use our DB
const burger = require('../models/burger');
// Create our router and then create our routes
let router = express.Router();
// root route
router.get('/', (req, res) => {... | true |
5af53a1a21d18e395107afc95bcd0ff686daef14 | JavaScript | ncnegoleo/angular-default-login | /routes/api.js | UTF-8 | 2,239 | 2.828125 | 3 | [] | no_license | /*jshint esversion: 6 */
const express = require('express');
const router = express.Router();
var users = [{
firstName: "leonardo",
lastName: "soares",
username: "ncnegoleo",
password: "123",
id: 1
}];
//var users = [];
router.get('/users', function (req, res) {
res.json(users);
});
router.ge... | true |
1d81e1a5f4e6a2e1e7da807e113b72534f5cbffc | JavaScript | perymerdeka/js-fundamental | /destructuring.js | UTF-8 | 296 | 2.890625 | 3 | [] | no_license | const MyId = {
'name': 'feri lukmansyah',
'age': 20,
'testimony': 'ini adalah testimony saya',
}
const news = MyId;
console.log(news);
const MyIds = {
named: 'feri lukmansyah',
age: 20,
testimony: 'ini adalah testimony saya',
}
const {named, age, testimony} = MyIds;
console.log(named); | true |
b5536ea8298fe55ffbb2adbf25dc326e51fa9ac3 | JavaScript | lenon461/amqplib-simple-wrapper | /src/test.js | UTF-8 | 1,989 | 2.640625 | 3 | [
"MIT"
] | permissive | const amqp = require('amqplib');
class SMSQ {
constructor(url, queueName, options) {
this._url = url;
this._queueName = queueName;
this._options = options || {durable: false};
// public
this.connect = undefined;
this.channel = undefined;
this.queue = undefin... | true |
9f5ae763c084d6997950e6d15f5119efac110293 | JavaScript | dylanbuchi/javascript-data-structures-algorithms | /data_structures/arrays/reverse_string.js | UTF-8 | 412 | 3.875 | 4 | [] | no_license | const reverseString = (string) => {
if (string) {
let reversed = "";
const letters = [...string];
const len = letters.length - 1;
for (let i = len; i >= 0; i--) {
reversed = reversed.concat(letters[i]);
}
return reversed;
}
return string;
};
cons... | true |
ea5f2736afd83bd266b13784f4e96aeade70521e | JavaScript | MarcoWorms/marcoworms.github.io | /pathfinding/main.js | UTF-8 | 803 | 3.109375 | 3 | [] | no_license | var ctx = null;
var spritesheet = null;
var spritesheetLoaded = false;
var world = [[]];
var worldWidth = 16;
var worldHeight = 16;
var tileWidth = 32;
var tileHeight = 32;
var pathStart = [worldWidth, worldHeight];
var pathEnd = [0, 0];
var currentPath = [];
function onload() {
console.log("Page loaded.");
... | true |
81e658a9c55ca7c45c4b01cad6997cdfd9a24771 | JavaScript | serenadeai/protocol | /javascript-echo/index.js | UTF-8 | 1,839 | 2.859375 | 3 | [] | no_license | const WebSocket = require("ws");
const id = Math.random().toString();
let websocket = null;
const connect = () => {
if (websocket) {
return;
}
// connect to the Serenade, which runs a websocket server on localhost, port 17373
websocket = new WebSocket("ws://localhost:17373");
websocket.on("error", (e)... | true |
452c4934784e919af42b2abb74034af6527ce630 | JavaScript | Ray-227/iqonline-practice-2.1 | /src/components/UiKit/DropDown/index.jsx | UTF-8 | 1,290 | 2.71875 | 3 | [] | no_license | import React from 'react';
import './index.scss';
{/* <DropDown index="3" title="Test 3" li="text, text, text"></DropDown> */}
export default class DropDown extends React.Component {
constructor(props) {
super(props);
this.state = {
index: Number(this.props.index) - 1,
li: this.props.li.split('... | true |
5e06b3e52a4250bb1ec2da945b66c30f284b1aab | JavaScript | stolksdorf/pico-utils | /parse_engine.js | UTF-8 | 800 | 3.109375 | 3 | [] | no_license | /* Usage
const rules = {
'aa' : ()=>'woo',
'bb(.)b' : ([letter], raw, pre)=>'foo' + letter + ` (${pre})`
};
console.log(parse(rules, `g bbtb aa aa goo bbdb`));
*/
const parse = (rules, text)=>{
const Rules = Object.entries(rules).map(([rgx, fn])=>[new RegExp(rgx),fn]);
let remaining = text, result = [];
w... | true |
41f154de566bce0891127a0da97236987935c9b2 | JavaScript | Adekunle24/adekunle24.github.io | /server/controllers/recipe.js | UTF-8 | 2,644 | 2.640625 | 3 | [] | no_license | // import all the models
import allModels from '../models';
// assign recipeModel to model recipe
const recipeModel = allModels.recipes;
const userModel = allModels.users;
// this is a test api to display all registered users
const getTotalRecipes = (req,res) => {
recipeModel.findAll({
include: [{
model: u... | true |
f1281aad8556c2818252af360ac69ead92abe925 | JavaScript | min9105/transpile | /lib/cjs_amd.js | UTF-8 | 3,206 | 2.875 | 3 | [] | no_license | "format cjs";
var esprima = require("esprima"),
optionsNormalize = require("./options_normalize"),
getAst = require("./get_ast"),
types = require("ast-types"),
n = types.namedTypes;
var dirnameExp = /__dirname/;
var globalExp = /global/;
module.exports = function(load, options){
var ast = getAst(load);
var sou... | true |
fac5a49bd21470ddc6578db6e37b07ebd318a96e | JavaScript | vsumitra/react-charts-prototype | /lib/reducers/marketListReducer.js | UTF-8 | 690 | 2.59375 | 3 | [] | no_license | import * as types from '../actions/actionTypes';
import initialState from './initialState';
export default function marketListReducer(state = initialState.marketList, action) {
switch (action.type) {
case types.ADD_MARKET_SELECTION:{
return {
selectedMarketIds: [...state.selectedMarketIds, ... | true |
767e28c850c1b03eb44570f2294c823df8718da2 | JavaScript | nahummor/react-tailwind | /src/components/UI/List/List.js | UTF-8 | 1,465 | 2.5625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import classnames from 'classnames';
const List = ({ listData, selectedItemIndex, onItemChange }) => {
const [listItems, setListItems] = useState([]);
const [selectedItem, setSelectedItem] = useState(selectedItemIndex);
const onClickItem = (event) => {
... | true |
2da5427241499ef57d0a70c9c78ea31a870f1a43 | JavaScript | donttellmywife/notes_mvp | /src/js/_modules/api.js | UTF-8 | 1,070 | 2.75 | 3 | [
"MIT"
] | permissive | const apiUrl = `http://cthulhu.hp.consul/`
function GET(url) {
return fetch(`${apiUrl + url}`)
.then(checkStatus)
.then(getJson)
.catch(handleError)
}
function POST(url, data = {}) {
return fetch(`${apiUrl + url}`, {
method: 'POST',
body: JSON.stringify(data),
})
.then(checkStatus)
.... | true |
64734e683661fa25d99a5b7aeffa269161115d46 | JavaScript | hwesol13/ES6-for-the-lazy | /examples.destructuring.js | UTF-8 | 2,628 | 3.9375 | 4 | [] | no_license | // example data
const defaultHeroSkills = ['flight', 'strength', 'speed', ['heat vision', 'freezing breath']];
const hero = {
name: 'Super Man',
item: 'cape',
skills: defaultHeroSkills,
planet: 'Krypton',
friends: {
batman: {
skills: ['tech', 'strength'],
isHuman: true,
planet: 'earth'... | true |
ab147493c2596b6d3e026586c66baeeeb99ba464 | JavaScript | tim123abc/mars-rover-challenge | /test/MissionCommand.test.js | UTF-8 | 1,180 | 2.875 | 3 | [] | no_license | import expect from "expect"
import {executeMission} from "../src/MissionCommand.js"
describe('Mission Command', () => {
describe('executeMission', () => {
test('returns expected output based on specification examples and answers', () => {
const exampleOne = `4, 8
(2, 3, E) LFRFF
(0, 2, ... | true |
ff5654920adc2957d3cbf02642a9d20858b77482 | JavaScript | mbehrlich/js-tic-tac-toe | /board.js | UTF-8 | 2,800 | 3.796875 | 4 | [] | no_license | class Board{
constructor( grid = [ [" ", " ", " "], [" ", " ", " "], [" ", " ", " "]]){
this.grid = grid;
}
isValidMove(pos){
let x = pos[0], y = pos[1];
if (x < 0 || x > 2 || y < 0 || y > 2){
return false;
} else if (isNaN(pos[0]) || isNaN(pos[1])) {
return false;
} else {
... | true |
34f442bcd1f5ccb08f9c1ffbcf5e7709f85aa903 | JavaScript | xcanisha/ThatsTheQuestion | /js/main.js | UTF-8 | 2,250 | 2.984375 | 3 | [] | no_license | var xhr = new XMLHttpRequest();
var raw;
var hoofdvraag;
var hoofdvraagAntwoord;
var deelvragen;
var deelvraagAntwoord;
var i = 1;
var anagram;
var splitted;
var extraLetter = '';
//Verbinding met API maken
xhr.open('GET', 'https://opentdb.com/api.php?amount=50&type=multiple');
//Bij het inladen van de pagina wordt d... | true |
f2cdbee3aeff15541503767ec02ef5d10002a664 | JavaScript | XylianBaker/Klassenstruktur | /js/test.js | UTF-8 | 1,416 | 4.21875 | 4 | [] | no_license | // Cosntructure Syntax 🚧
const Person = new Object();
Person.surename = 'Jan';
Person.lastname = 'Kammellander';
Person.height = '174';
Person.gender = '👨';
Person.age = 16;
// Constructor 👷♂️
function School(name, location) {
this.name = name;
this.location = location;
this.whereIsTheSchool = functio... | true |
ac7f652543d463c75c1a2b1802ca56660e51b9bb | JavaScript | forkkit/firestorter | /examples/importCSV/index.js | UTF-8 | 2,216 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
/* eslint-env node */
/* eslint no-console:0 */
/**
Small node example that shows how to import a CSV file into firestore.
*/
const fs = require('fs');
const csvParse = require('csv-parse');
const firebase = require('firebase');
require('firebase/firestore');
const firebaseApp = firebase.initi... | true |
3a72e134b010bc5a37e36dfb8a5551eae3447a84 | JavaScript | BGSU-LITS/bgsu-template | /src/tippy.js | UTF-8 | 990 | 2.703125 | 3 | [] | no_license | /**
* Provides improved tooltips for elements.
* @modules tippy
*/
import tippy from 'tippy.js';
import 'tippy.js/dist/tippy.css';
import 'tippy.js/themes/light-border.css';
import css from './scss/tippy.scss';
/**
* Sets up a tooltip for selected elements' titles.
* @param {string} selector Selector used to ide... | true |
7eb3ba393343a6a56767d5ff20f4b2f7a9635f80 | JavaScript | chongguang/Connect | /services/GameManager.js | UTF-8 | 4,183 | 3.1875 | 3 | [
"MIT"
] | permissive | var Token = require('./Token.js');
var GameManager = function(player1, player2, board){
this.player1 = player1;
this.player2 = player2;
this.board = board;
this.currentPlayer = player1;
if(this.player1.color == this.player2.color){
throw new Error("player1 and player2 have the same color")
}
};
GameManager.... | true |
989e98e2fcac711fa62ddd21ef61e9d137d4735e | JavaScript | AlexReyna258/reto1-scraping-alexReyna | /App/index.js | UTF-8 | 2,878 | 2.640625 | 3 | [] | no_license | let btnscrap = document.getElementById('scrap-profile')
btnscrap.addEventListener('click', async () => {
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
if (tab !== null) {
chrome.scripting.executeScript({
target: { tabId: tab.id },
function: scrapingProfile,
});
... | true |
a57c8ad47f58c3f11f17cc06e3cc6d9459e78fe0 | JavaScript | boopathi/babel-minify | /packages/babel-plugin-transform-global-defs/src/index.js | UTF-8 | 7,816 | 2.71875 | 3 | [
"MIT"
] | permissive | // @flow
/*::import type {NodePath, Binding, Scope, Node, PluginOptions} from 'Babel';*/
import isPlainObject from 'lodash.isplainobject';
import isObjectLike from 'lodash.isobjectlike';
/*::type RawDefinition = [string, mixed]*/
/*::type Definition = {
expr: string,
value: mixed,
allExpr: string[],
root: st... | true |
2b3d1f59dc08480dbc3c941b0498fa8bfb1a1152 | JavaScript | quocanh969/Free-2-lance-admin | /src/Reducers/GeneralReducers/TopicDetail.reducer.js | UTF-8 | 633 | 2.515625 | 3 | [] | no_license | const initState = {
topicInfo: null,
newTopicName: '',
newTopicImg: '',
isSubmitted: false,
}
const TopicDetailReducer = (state = initState, action) => {
switch (action.type) {
case 'TOPIC_STATE_UPDATE':
return {
...state,
topicInfo: action.topi... | true |
bd3a3c55215ab7421157361d7f9ab3b51ee04dbc | JavaScript | yu19910513/README-generator | /index.js | UTF-8 | 4,843 | 2.671875 | 3 | [
"MIT"
] | permissive | // TODO: Include packages needed for this application
const fs = require('fs');
// const license = require('./utils')
const inquirer = require('inquirer')
const generateREADME = (answer) =>
`# ${answer.title}
${answer.badge}
## Description
${answer.desc}
## Table of Contents
- [Installation](#installation)
- [Tests](#t... | true |
daf801780745d56e1383c242b4543ff34fae6339 | JavaScript | swolecoder/LeetCodeSolution | /Day16/findDuplicate.js | UTF-8 | 2,735 | 3.421875 | 3 | [] | no_license | /**
* @param {string[]} paths
* @return {string[][]}
*/
/*
Imagine you are given a real file system, how will you search files? DFS or BFS?
DFS. In this case the directory path could be large. DFS can reuse the shared the parent directory before leaving that directory. But BFS cannot.
If the file content is very l... | true |
45be5c2d2e56e014c63e291833ab0bdb4ce2a2eb | JavaScript | orianemgn/Kater-Klub | /kata/binaryAddition.js | UTF-8 | 224 | 3.421875 | 3 | [] | no_license | //Binary Addition
//https://www.codewars.com/kata/551f37452ff852b7bd000139/train/javascript
function addBinary(a,b){
if(a+b >= 0){
return (a+b).toString(2)
} else {
return (~(a+b).toString(2))
}
} | true |
c49efef81e5ba952316f4bf5c7a217ab9426e96d | JavaScript | raison00/video-features | /clientModule/scripts/cescripts/validation/ValidationManager.js | UTF-8 | 7,099 | 3 | 3 | [] | no_license | //#MODULE - ValidationManager
//> Author: Mike Byrnes
//>
//> Create Date: 2014-03-05
//>
//##DESCRIPTION: Module to handle multiple validations
define( [ "jquery", "validation" ], function ( $, ValidationModule ) {
//###Method - validate(value)
//Public method to validate a field.
//
//> parameters
... | true |
680703faeb3f9aebbaebb719f277a5099e13d378 | JavaScript | jkup/doe | /lib/api.js | UTF-8 | 1,010 | 2.671875 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const path = require('path');
const marked = require('marked');
const postMeta = require('yaml-front-matter');
const dirPath = path.join(__dirname, '../', 'posts');
/**
*
*
* @param {number} [limit=5]
*/
function queryPosts(limit = 5) {
const files = fs.readdirSync(dirPath);
let... | true |
7fdeb1e285452e95eca6e9a981c27eb82e40ee20 | JavaScript | voidtuxic/input2midi | /src/lib/async.js | UTF-8 | 206 | 2.640625 | 3 | [
"MIT"
] | permissive | const chain = (array, method) => {
let promise = Promise.resolve();
array.forEach(element => {
promise = promise.then(() => method(element));
});
return promise;
};
module.exports = { chain };
| true |
c795307bcf92e5286fd41b4006b0879bd627b9d8 | JavaScript | dfogas/greyzone | /src/client/lib/bml/dicethrow.js | UTF-8 | 1,504 | 2.90625 | 3 | [
"MIT"
] | permissive | /*
String(dicetype) String(dicekey) -> JSObject(Dice?)
TODO: možná by funkce měla brát jako parametr kostku(ImmutableMap)
BML: true
*/
export default function dicethrow(type, dicekey) {
var diceThrowResult;
var result;
switch (type) {
case 'operations':
result = Math.ceil(Math.random() * 6);
... | true |
4b8d5d8b5b200a0b08dbb0e1c328fa7194c07051 | JavaScript | isaacev/MiniPy | /src/runtime/interpreter.js | UTF-8 | 28,674 | 2.84375 | 3 | [] | no_license | // [MiniPy] /src/runtime/interpreter.js
exports.Interpreter = (function() {
// require type enumerations
var enums = require('../enums').enums;
var ErrorType = enums.ErrorType;
var TokenType = enums.TokenType;
var ValueType = enums.ValueType;
var Type = require('./types').Type;
var Scope = require('./scope').... | true |
e0101ef7458d7f6219eba31ce7780bd2ef06563f | JavaScript | nashae/basicJSalgorithmic | /ex34.js | UTF-8 | 1,221 | 3.125 | 3 | [] | no_license | import readline from "readline-sync";
const listUser = [['tya', 'test1', "admin"], ['milo', "test2", "user"], ['lili', 'test3', "user"]]
const inputUser = () => {
const login = readline.question('saisissez votre login :')
const mdp = readline.question('saisissez votre mdp :')
return [login, mdp]
}
const ... | true |
9b53d87300d768d449b550a0b410e825048b38a8 | JavaScript | NightingaleV/team-pomodoro-app | /frontend/src/utils/usePromise.js | UTF-8 | 1,198 | 2.71875 | 3 | [] | no_license | import { useCallback, useEffect, useState, useRef } from 'react';
export function usePromise(initialState = {}) {
const [state, setState] = useState(() => {
return {
data: undefined,
isLoading: false,
error: undefined,
...initialState,
};
});
const currentPromiseRef = useRef(null... | true |
68b057c5643c2afe5957d42d96a2764c65f549fa | JavaScript | jasondelponte/Apollo | /assets/js/apollo.js | UTF-8 | 12,585 | 2.625 | 3 | [] | no_license |
var ApolloApp = (function(context){
var config = null;
var ws = null;
var board = null;
function selected(id) {
if (!ws.conn) {
return;
}
entityRemove = {
Act: {
G: {
C: WsConn.PlayerGameCmd.selectEntity,
... | true |
73ecf3e8e2137eb77a7dee0e48947443063dcc8f | JavaScript | ElijahLogan/aws-signup-in | /src/containers/AddNote.js | UTF-8 | 1,635 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import Amplify, {API,graphqlOperation} from 'aws-amplify';
const createNote = `mutation CreateNote($input: CreateNoteInput!) {
createNote(input: $input) {
id
note
owner
}
}
`;
export default class AddNote extends Component {
constructor(prop... | true |
70ac47e999cf23e12756b8111df7eda5956a8df0 | JavaScript | tylerjoh/ITM_352_F20_repo | /Assignment2Example/Server.js | UTF-8 | 4,339 | 2.734375 | 3 | [] | no_license | var express = require('express');
var app = express();
var myParser = require("body-parser");
var data = require('./public/product_data.js');
var products = data.products;
var fs = require('fs');
app.use(express.static('./public'));
app.use(myParser.urlencoded({ extended: true }));
var filename = "user_data.json";
i... | true |
479251fa39afbeffc9ac790fb8a11138d8b23690 | JavaScript | CyprianWojtas/dysk-sieciowy | /serwer-plikow/html/programy/notatnik/skrypt.js | UTF-8 | 2,363 | 2.5625 | 3 | [
"MIT"
] | permissive | let editor = ace.edit("editor");
let modelist = ace.require("ace/ext/modelist");
editor.setOptions({scrollPastEnd: 1, wrap: true});
function wczytaj(plik, tylkoOdczyt = false)
{
let plikNazwa = plik.split("/");
plikNazwa = plikNazwa.pop();
plik = sciezkaNaURL(plik);
$.get(plik, (odp, sukces, typ) =>
{
$("tit... | true |
b5f827755a2ba99284fb363fe66a5f67dae48679 | JavaScript | wuxj-adair/vue-component | /org/print/apply.js | UTF-8 | 1,049 | 3.484375 | 3 | [] | no_license | //apply
Function.prototype.myApply = function(context=window, args=[]) {
//给context新增一个独一无二的属性以免覆盖原有属性
const key = Symbol()
context[key] = this
//通过隐式绑定的方式调用函数
const result = context[key](...args)
//删除添加的属性
delete context[key]
//返回函数调用的返回值
return result
}
//bind
//就是返回一个函数,里面执行了appl... | true |