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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ecb19d135ee996c5304623676ad2f2bc1d17ff16 | JavaScript | AureGitHub/Quiz-2015 | /controllers/session_controller.js | UTF-8 | 2,098 | 2.859375 | 3 | [] | no_license | // MW Comprueba si la session ha muerto (2 min)
exports.sessionDead = function(req, res, next) {
if(req.session.user){
var actual = new Date().getTime();
console.log(actual);
console.log(req.session.user.timeout);
if(req.session.user.timeout > actual){
var timeout = actual + 120000; //regenero e... | true |
91ad4e8fcf3c3d671e71d0ead2af72246d5b41f3 | JavaScript | LiamZZZ/mooncake | /imports/ui/components/Words.js | UTF-8 | 1,798 | 2.515625 | 3 | [] | no_license | import React from 'react';
// import { Table } from 'react-bootstrap';
import $ from 'jquery';
import { Bert } from 'meteor/themeteorchef:bert';
export default class Words extends React.Component {
voiceUp(target, voice) {
const loader = $(target).find('span.lmc-loading');
const audio = new Audio();
if (... | true |
3db86347e2f27a97a050342ad81299c895e7a732 | JavaScript | MaxRobinsonTheGreat/KillerKlicker | /app.js | UTF-8 | 3,127 | 2.84375 | 3 | [] | no_license | 'use strict';
// Use express to open a web server
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const server = require('http').createServer(app);
const io = require('socket.io')(server, { wsEngine: 'ws' });
const MAX_CLICKS = 200;
app.use(express.static(__dirna... | true |
dd9b836eb31f7ae93f21cbdb8c70ddfaeb22b476 | JavaScript | AkiraDemenech/To_be_the_Hero | /frontend/src/pages/Postar/index.js | UTF-8 | 2,303 | 2.5625 | 3 | [] | no_license | import React,{useState} from 'react';
import {Link} from 'react-router-dom';
import {FiArrowLeft} from 'react-icons/fi';
import imgLogo from '../../assets/logo.svg'
import api from '../../services/api';
import '../Register/styles.css';
export default function RegistrarCaso () {
const [title,setTitle] = useState(... | true |
4c656e692674ecf81afc335b2a90a1ce341235f7 | JavaScript | teusday/bookshelf | /book/book.js | UTF-8 | 5,872 | 2.578125 | 3 | [] | no_license | class Book extends HTMLElement {
constructor() {
super();
var shadow = this.attachShadow({mode: 'open'});
var style = document.createElement('style');
style.textContent = '.rotate {' +
'writing-mode: vertical-rl;'+
'margin-top: 3px;'+
'}\n'+
'h5 {' +
'margin-right: 2px... | true |
68e6783f90246a19dedc0e34d4cb73fd6bf1b2a3 | JavaScript | beards-of-zeus/beards-of-zeus | /server/db/orm-model.js | UTF-8 | 1,215 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
var db = require('./database');
var Sequelize = require('sequelize');
module.exports = function(){
//create user table
var User = db.define('Users', {
userId: {type: Sequelize.STRING,
unique: true,
notEmpty: true,
notNull: true,
primaryKey: true
},
email: Sequ... | true |
b7a81dfd3525e429daee9c58dd88edadd202d16c | JavaScript | Edward-FitzSimons/InvasiveNodeServer | /speciesTrackingServer.js | UTF-8 | 7,645 | 3.109375 | 3 | [] | no_license | // Express provides a framework that makes handling HTTP
// request/repsonse sequences simpler
var express = require('express');
// Body Parser - body parser is a convenient piece of "middleware"
// that parses the incoming body of the HTTP request before your route
// handler gets access. The nice thing about this is... | true |
afc1df3a6bbe8abba8e8d309462f908d9b073f6d | JavaScript | Mosbycr/SummerTreats | /public/assets/js/summerTreats.js | UTF-8 | 1,042 | 3.171875 | 3 | [] | no_license | $(function() {
//when click devour me button creats key and value to be changed in database
$(".devbtn").on("click", function(event) {
var id = $(this).data("id");
var nowEaten = {
devoured: true
};
$.ajax("/api/treats/" + id, {
type: "PUT",
data: nowEaten
}).then(function(... | true |
e5eaaeba54086382127c91893b5abd4835925e90 | JavaScript | thomasclaudiushuber/Basta-TypeScript-Workshop | /02_Basistypen/10_unionTypes/done/main.js | UTF-8 | 355 | 3.375 | 3 | [] | no_license | function append(text, appendix) {
if (typeof appendix === "number") {
return text + Array(appendix).join(" ");
}
if (typeof appendix === "string") {
return text + appendix;
}
}
console.log(append("Thomas", " Claudius ") + "Huber");
console.log(append("Thomas", 10) + "Huber");
append("Tho... | true |
003b1132f11f75d3c5d530d727c042bba819dfca | JavaScript | connected-web/gamebot | /lib/api/handleMessage.js | UTF-8 | 900 | 2.578125 | 3 | [] | no_license | function handleMessage (api, data, log = true) {
const matchers = api.matchers || []
const text = data.text
const gamebot = api.findUserByName(api.options.slackbot.name)
const sender = api.getUserById(data.user)
// ignore messages if they came from gamebot
if (sender && gamebot && sender.id === gamebot.id... | true |
a8c8cfb9743a5ad7a85e1100c30b761a61c9192d | JavaScript | ebraheem002/fewpjs-oo-initializing-instances-re-coded_iraq_web001 | /index.js | UTF-8 | 591 | 3.171875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Write your code here
class Breakfast{
constructor(food,drink){
this.food = food;
this.drink = drink;
}
}
let Breakfast1 = new Breakfast("egg","milk");
class Lunch{
constructor(salad,soup,drink,){
this.salad = salad;
this.soup = soup;
this.drink = drink;
}
}
let newlunch = new Lunch("v... | true |
367cf8c994993f7c682cc81023445b5dc7c23f09 | JavaScript | kellolo/js-2-08_20.11 | /students/Denis Bushev/lesson_4/js/script.js | UTF-8 | 501 | 3.296875 | 3 | [] | no_license | const text = "He travelled in the Caucasus, the Crimea and gained the impressions for his 'southern cycle' of romantic narrative poems: 'Kavkazsky plennik' (The Prisoner of the Caucasus), 'Bratya razboyniki' (The Robber Brothers), and 'Bakhchisaraysky fontan' (The Fountain of Bakhchisaray). I can't say bad things about... | true |
ac2bec699d8a57fae2e8c61cd65342a79b82399d | JavaScript | vivekTabes/cronTab | /src/client/pages/HomePage.js | UTF-8 | 9,073 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import parser from 'cron-parser';
import URLconfig from './URLconfig.json';
import {Input} from 'antd';
var cronstrue = require('cronstrue');
class Home extends Component{
constructor(prop){
super(prop)
this.state = {
cronExpression: '*/5 * * * *',
huma... | true |
88a16b3b0b5ea006fab4091bd423629caa1e95f1 | JavaScript | aselmajt/done-criteria | /examples/unnamed.js | UTF-8 | 456 | 2.953125 | 3 | [
"MIT"
] | permissive | var DoneCriteria = require('../lib/done-criteria')
, exit = false;
var doneCriteria = new DoneCriteria(['unko', 'geri'], function() {
console.log('all done!');
exit = true;
});
setTimeout(function() { doneCriteria.done('unko'); }, 1000);
setTimeout(function() { doneCriteria.done('geri'); }, 2000);
var loop = f... | true |
cb18539ec17909f73f7cb9607727f8c94af4b35c | JavaScript | Pustur/edabit-js-challenges | /src/Poker Hand Ranking/index.js | UTF-8 | 1,849 | 3.203125 | 3 | [
"MIT"
] | permissive | const CARDS_ORDER = [
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'J',
'Q',
'K',
'A',
];
const frequencyMap = arr =>
arr.reduce((map, item) => map.set(item, map.get(item) + 1 || 1), new Map());
const isSameSuit = cards => new Set(cards.map(([, suit]) => suit)).size === 1;
const isSequen... | true |
c1c65a34cd3eb9aa074a0691920e92ad46cbae23 | JavaScript | owaini/node-weather-website | /public/js/app.js | UTF-8 | 3,159 | 3.03125 | 3 | [] | no_license |
let form = document.querySelector('form');
let btn = document.querySelector('.btn');
let info = document.querySelector('.info')
let message = document.querySelector('.message');
let loaded = document.querySelector('.loaded');
// let city = document.querySelector('.city');
form.addEventListener('submit', (e)... | true |
79765395784f4c5d53fad63aa05a90541c4043de | JavaScript | MartaNiemiec/Udemy-The_Complete_JavaScript_Course_2018-Jonas | /7_ES6/script.js | UTF-8 | 25,787 | 4.5 | 4 | [] | no_license | ///*
//=====================================================
// lecture: let and const
//=====================================================*/
//
//
//
//// // ES5 - var = function-scoped
//// var name5 = 'Jane Smith';
//// var age5 = 23;
//// name5 = 'Jane Miller';
//// console.log(name5);
/... | true |
f0f7e141fc7583046c9df2ad099829e8dd750651 | JavaScript | martineboh/facebook-post-preview | /src/ducks/publications.js | UTF-8 | 1,207 | 2.71875 | 3 | [] | no_license | // Actions
const REQUEST = "post-preview/publications/REQUEST";
const RECIEVE = "post-preview/publications/RECIEVE";
const RECEIVED = "post-preview/publications/RECEIVED";
// Reducer
export default function reducer(state = {}, action = {}) {
switch (action.type) {
case REQUEST:
return {
...state,
... | true |
b13a58208a93744dfd6232bb65e18a7ee60d0410 | JavaScript | Rauru/Examen2Lenguajes | /mathjs/mathjs/app.js | UTF-8 | 1,974 | 3.65625 | 4 | [] | no_license | 'use strict';
var text = '{ "name":"John", "birth":"1986-12-14", "city":"New York"}';
var exp = '{ "Type": " * ", "Left": { "Type": "+" , "Left": "1", "Right": "2" }, "Right": "3" }';
var exp1 = '{ "Type": " * ", "Left": "2", "Right": "3" }';
const expresion = { Type: '*', Left: { Type: '+', Left: 1, Right: 3 }, Righ... | true |
a57688ccfed0eefbc29730853600d9254e525480 | JavaScript | shilpamittal0115/DemoProtractorFramwork | /tests/calculator.js | UTF-8 | 926 | 2.640625 | 3 | [] | no_license | let homepage = require('../pages/homePage');
describe('demo calculator test', function () {
it('additional test', function () {
homepage.getUrl('http://juliemr.github.io/protractor-demo/');
homepage.enterFNumber('3');
homepage.enterSecondNumber('4');
homepage.goButton();
... | true |
4a78960d72fce7e018e3756e2bd49abdadcdab05 | JavaScript | kramarenko/sicp-js | /chapter_1/examples/money.js | UTF-8 | 649 | 3.390625 | 3 | [] | no_license |
const count_change = amount => cc(amount, 5);
const cc = (amount, kinds_of_coins) => {
console.log('amount', amount, 'kinds', kinds_of_coins);
return amount == 0
? 1
: amount < 0 || kinds_of_coins == 0
? 0
: cc(amount, kinds_of_coins - 1)
+ cc(amount - ... | true |
966378904f0023fe7a53a914f8b411be66193c3a | JavaScript | ZenkaiDeveloper/Algorithms-Coding-Challenges | /Basic Algorithms/BinarySearch.js | UTF-8 | 391 | 3.734375 | 4 | [] | no_license | function binarySearch(sortedArr, target){
let left = 0;
let right = sortedArr.length-1;
let mid = Math.floor(right+left/2);
while(right >= left){
mid = Math.floor(right+left/2);
if(target < sortedArr[mid]){
right = mid-1;
}else if (target > sortedArr[mid]) {
left = mid+1;
}else if (s... | true |
55455f9d343be87071505d816af5b08fd994baba | JavaScript | christopher-robert/exercises | /136.single-number.js | UTF-8 | 153 | 3 | 3 | [] | no_license | /**
* @param {number[]} nums
* @return {number}
*/
var singleNumber = function(nums) {
return nums.reduce((accum, num) => accum ^ num, 0);
};
| true |
d8e17673b7bc6d60aa2d528c360ff518c61298da | JavaScript | chromium/chromium | /third_party/blink/web_tests/printing/script-tests/page-break-widows.js | UTF-8 | 1,479 | 2.875 | 3 | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"MIT",
"Apache-2.0"
] | permissive | description("Test for widows");
function test()
{
createBlockWithRatioToPageHeight("page1-1", 0.5).style.pageBreakBefore = "always";
// Here about 10 lines are avaliable at the bottom of the current page.
// We can leave about 5 lines in the next page. It doesn't violate widows restriction.
createBlock... | true |
67d2b78562226b4da40156cc6c997fdf2290f56c | JavaScript | ppmyor/momentum | /src/todo.js | UTF-8 | 2,560 | 3.359375 | 3 | [] | no_license | const toDoForm = document.getElementById("todo-form");
const toDoInput = toDoForm.querySelector("input");
const toDoList = document.getElementById("todo-list");
const TODOS_KEYS = "todos";
const DONE_CLASSNAME = "done";
let toDos = [];
function saveToDos() {
localStorage.setItem(TODOS_KEYS, JSON.stringify(toD... | true |
c305b9a4c134ad5d997b9ba9f0ba50ce7091a7c5 | JavaScript | littledian/algorithms | /src/chapter/2/merge-bu-sort.js | UTF-8 | 401 | 2.703125 | 3 | [] | no_license | import MergeSort from './merge-sort'
export default class MergeBuSort extends MergeSort {
sort (array) {
if (!Array.isArray(array)) {
return
}
const n = array.length
for (let sz = 1; sz < n; sz += sz) {
for (let lo = 0; lo < n - sz; lo += (sz + sz)) {
this._merge(array, lo, lo + ... | true |
3b8152607974741447f2645856e356ffd71f1795 | JavaScript | prakrutijoshi/Training-Aug-21 | /JS/JS/day2/prac1.js | UTF-8 | 177 | 3.25 | 3 | [] | no_license | function checkstr(str)
{
if(str=="")
{
return "True";
}
else
{
return "False";
}
}
var result = checkstr("Hello");
console.log(result); | true |
8824d9c51ecc54157b7e485bbf2c868a4327ca25 | JavaScript | anneFly/ember-memory-game | /js/controllers.js | UTF-8 | 6,035 | 2.5625 | 3 | [] | no_license | /*
* Controllers
*/
Memory.cardController = Em.ArrayController.create({
content: [],
deck: [],
selectedDiff: null,
pairsLeft: null,
init: function(){
this._super();
var self = this;
$.getJSON('../data/cards.json', function(data){
data.forEach(function(item){
self.pushObject(Memory.Card.create(item)... | true |
0ccfeee9359cb528889c1dab545d828a13f3e808 | JavaScript | TUXCMD/unmark | /assets/js/unmark.add.js | UTF-8 | 1,298 | 2.78125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | /*!
Add Mark
*/
(function ($) {
// Wait for Page to load
$(document).ready(function () {
// Gets an HTML list of data and prepends the list
// Run as a callback for the getData function below
function built_label_list(res) {
var list = unmark.label_list(res);
... | true |
88a77c29857cc9cf38fa549b8146244ed030e3f6 | JavaScript | aujlaramandeep27/WDIO_DEMO_2 | /tests/sortMonsters.spec.js | UTF-8 | 1,022 | 2.65625 | 3 | [] | no_license | const LoginPage = require('../pages/login.page');
const ButtonsAreaPage = require('../pages/buttonsArea.page');
const MonsterListPage = require('../pages/monsterList.page');
describe('Test Suite', () => {
before(() => {
// Add code here
});
beforeEach(() => {
browser.url('');
LoginPage.login('bob@b... | true |
89ee35bfb1cc34d3eb63b591b93619b16e25072f | JavaScript | kudla/wip-pool | /site/src/pages/FlowDemo/utils/completeConstruction.js | UTF-8 | 712 | 2.515625 | 3 | [
"MIT"
] | permissive |
export const completeConstruction = ({constructionQueue, demands, doneCount}) => constructionOrder => {
function updateDone(construction) {
if (construction.constructionOrder === constructionOrder) {
const doneOrder = doneCount;
const doneTime = Date.now();
doneCount +... | true |
ed556552e0fa518c6d77902e528ccfb53cde95d0 | JavaScript | con266667/HackTheStorm | /script.js | UTF-8 | 9,479 | 2.796875 | 3 | [] | no_license | //TYPEWRITER
var TxtRotate = function(el, toRotate, period) {
this.toRotate = toRotate;
this.el = el;
this.loopNum = 0;
this.period = parseInt(period, 10) || 2000;
this.txt = '';
this.tick();
this.isDeleting = false;
};
TxtRotate.prototype.tick = function() {
var i = this.loopNum... | true |
71871f310ab1b3227ddadc2efbc9c0f85596f459 | JavaScript | pableke/trees | /tests/trees.test.js | UTF-8 | 2,363 | 2.734375 | 3 | [
"MIT"
] | permissive |
const request = require("supertest");
const server = require("../src/index");
describe("GET /", () => {
it("it should has status code 200", function(done) {
request(server)
.get("/")
.expect("Content-Type", /html/)
.expect(200)
.end(function(err, res) {
done(err);
});
});
});
describe("Attribu... | true |
a5fe65ed78112ab7250206fe05205e6ef3f5a1d3 | JavaScript | DANTDM24/EarBeats | /src/commands/join.js | UTF-8 | 489 | 2.515625 | 3 | [
"MIT"
] | permissive | async function join(message, serverQueue) {
console.log(serverQueue);
if (!message.member.voice.channel)
return message.channel.send(
"You have to be in a voice channel"
);
try {
var connection = await message.member.voice.channel.join();
connection.voice.setSelf... | true |
77df41e0774951dbfe776d32173b40810267e588 | JavaScript | Oksana-coder/goit-js-hw-07 | /js/task-7.js | UTF-8 | 471 | 3.15625 | 3 | [
"MIT"
] | permissive | const fontSizeControlRef = document.querySelector('#font-size-control')
const textRef = document.querySelector('#text');
fontSizeControlRef.value = 16;
fontSizeControlRef.addEventListener('input', onInputChange);
function onInputChange() {
const currentFontSize = fontSizeControlRef.value;
textRef.style.fontS... | true |
cac84d327b52578dac1c52277df62ee31a5ee45f | JavaScript | ruskeezy/react-playground | /components/app.js | UTF-8 | 778 | 2.8125 | 3 | [] | no_license | import React from 'react';
import Child from './child';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
words: ['fox', 'falco', 'marth']
}
this.changeWords = this.changeWords.bind(this);
this.renderChildren = this.renderChildren.bind(this... | true |
fee81ba97f76f667bd8b43e0fde88f99ae67d1bb | JavaScript | giobyte8/PoSForPeople | /src/services/ProductService.js | UTF-8 | 13,868 | 2.5625 | 3 | [] | no_license | import {Brand, MeasurementUnit, Product, PurchasePrice, SalePrice} from '../model/entities';
import sequelize from '../model/database';
import moment from 'moment';
import DateFormatter from "./DateFormatter";
import DateService from "./DateService";
const Sequelize = require('sequelize');
class ProductService {
fin... | true |
47ed44f34ad20ad44577155f722732eff3581a0e | JavaScript | SaadiaELF/Popcornpedia-Project | /scripts/script.js | UTF-8 | 13,505 | 3.03125 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
renderRecentSearchBtns(retrieveRecentSearches()); // if searches have been made previously, they are loaded with the page
$(document).foundation();
$("#add-movie").on("click", function (event) {
// when text is submitted in search form
event.preventDefault();
var movi... | true |
b4c0664f3f94c408278e07da795567503d87a813 | JavaScript | richRemer/bodewell-keyed | /keyed.js | UTF-8 | 1,931 | 2.96875 | 3 | [] | no_license | /**
* Create a keyed entity class.
* @param {function} config
* @param {object} [proto]
* @returns {function}
*/
function keyed(config, proto) {
var entities = {};
if (proto) {
Keyed.prototype = Object.create(proto);
Keyed.prototype.constructor = Keyed;
}
function Keyed(key) {
... | true |
13fabed9b9bb9854bba49695993c5790d424275a | JavaScript | cs165/homework3-honsu001 | /results-screen.js | UTF-8 | 1,811 | 3.265625 | 3 | [] | no_license | // TODO(you): Modify the class in whatever ways necessary to implement
// the flashcard app behavior.
//
// You may need to do things such as:
// - Changing the constructor parameters
// - Adding methods
// - Adding additional fields
class ResultsScreen {
constructor(containerElement) {
this.containerElement = c... | true |
d568b77fea4fe9a39678247cc7e440fd2cc196de | JavaScript | TheCacophonyProject-archive/TheCacophonyProject.github.io | /js/forms.js | UTF-8 | 653 | 2.578125 | 3 | [] | no_license | $(function() {
$("#contact").on("valid invalid submit", function(g){
g.stopPropagation();
g.preventDefault();
if (g.type === "valid"){
var form = $("#contact");
var post_url = form.attr('action');
var post_data = form.serialize();
$.ajax({
type: 'POST',
url: post_url,
data: post_data,
... | true |
d42ac52997c0a967517e06a302a05c1e1edcdd38 | JavaScript | jmedinac1987/my_website | /backend/controller/SendEmailController.js | UTF-8 | 1,317 | 2.546875 | 3 | [] | no_license | "use strict";
const email_model = require("../models/email_model");
const EmailRequest = require("../requests/EmailRequest");
const message_email_default = {
success: false,
message: "Lo sentimos :S, por favor suministre una cuenta e-mail valida"
};
async function sendEmail(req, res) {
const { error } = EmailRe... | true |
0cd04da1754ad30f0fe943d588351cc5d8e55b16 | JavaScript | brianturk/wordguess-cli | /lettersGuessed.js | UTF-8 | 407 | 3.453125 | 3 | [] | no_license | exports.LettersGuessed = function () {
this.letters = [],
this.didGuess = function (letter) {
let alreadyGuessed = false
this.letters.forEach(function (guessed) {
if (letter === guessed) {
alreadyGuessed = true;
}
})
if (!alreadyGuessed) {
... | true |
994c0c8bb6155702ddb45674199d29ca1269adb5 | JavaScript | Pochelyk/carousel | /js/script.js | UTF-8 | 625 | 2.515625 | 3 | [] | no_license | $(document).ready(function () {
// $("ul").append("<li>конец</li>");
// $("ul").prepend("<li>начало</li>");
// $("li").remove(":first-child");
// $("li").remove(":last-child");
$(".star").on("click", function () {
$("ul").prepend("<li>начало</li>");
});
$(".end").on("click", functi... | true |
e36f2b7fa5f44304ff06bee4ac0cb758fd443597 | JavaScript | KateF28/camunda-bpm-app | /src/utils/outputAmountString.js | UTF-8 | 269 | 2.75 | 3 | [] | no_license | export const outputAmountString = amountValue => {
if (/^-?[0-9]+[.][0-9]$/.test(amountValue)) {
return `${amountValue}0`;
} else if (/^-?[0-9]+$/.test(amountValue)) {
return `${amountValue}.00`;
} else {
return amountValue;
}
}
| true |
41e4dd0bedebf83536283a5600723a6e3cf9982d | JavaScript | juendo/BandBuds | /BandBuds/static/js/bba-ajax.js | UTF-8 | 9,317 | 2.578125 | 3 | [
"MIT"
] | permissive | $( document ).ready( function() {
// I'm Going button pressed
$( '#im-going' ).click( function(){
var gig_id = $( this ).data( 'gigid' );
$.get('../../ajax/im_going/' + gig_id, function(response) {
$( '#im-going' ).html(response);
$( '#im-going' ).toggleClass( 'not-going-button' );
... | true |
e4352ce69d596df7717b9d2a381e2cab13e15b82 | JavaScript | lighthousemo/functions | /anon.js | UTF-8 | 314 | 3.53125 | 4 | [] | no_license | function foo(callback) {
console.log("foo says " + callback());
}
// function returnsHello() {
// aasdfksdfsd
// return "hello";
// }
//
// foo(returnsHello)
var someName = function() {
asdfasdfsdf
}
foo(someName);
// foo(function() { // anonymous function
// asdfsdfsdf
// return "hello";
// });
| true |
4f91df0f5b670e57331b7a757081d2b695a92f81 | JavaScript | manjiaxiong/webxiong | /018-react/08-todolist-react-redux/src/store/reducer.js | UTF-8 | 1,504 | 3.328125 | 3 | [] | no_license | const defaultState={
list:[],
task:''
}
/*
1:reducer是一个函数,并且是一个纯函数(固定的输入就会有固定的输出),主要是用来处理业务数据
2:reducer需要返回一个新的state对象,并且不能更改参数中传递过来的state,
原因是传递过来的state是store中的state,所有组件中state都共享store中的state,
这个state有store来维护,store根据reducer返回新的state来更改自己的state,在组件中getState()
返回的是store中的state
*/
export default (state=... | true |
8cf02de7a518a91cac45c868c309a9de7c0f10d4 | JavaScript | tejashwinir/IplDataProject | /test.js | UTF-8 | 3,463 | 2.625 | 3 | [] | no_license | let expect = require("chai").expect
let path = require("path")
let file = path.resolve("ipl.js")
let match = require(file)
describe("ipl", function () {
it("number of matches played per year of all the years", function (done) {
let fileName = path.resolve("./testSamples/question1matches.csv");
let ... | true |
b8a2061c364852c2ca32e8d3dae00d57c2a7b3aa | JavaScript | AllBlacksTeam/javascript-revision | /exercises/2-arrays/2-ex-arrrays.js | UTF-8 | 60 | 2.640625 | 3 | [] | no_license | var numeros = [1,3,2,5,4];
console.log(numeros.toString()); | true |
8228733f013039fc6a0c7d25c12012649a40f90a | JavaScript | Nil9711/Emoji-Picker-App | /src/EmojiList.jsx | UTF-8 | 1,568 | 2.6875 | 3 | [] | no_license | import React, { useState } from "react";
import Emoji from "./Emoji";
import { withStyles } from "@material-ui/core/styles";
const styles = {
search: {
display: "flex",
justifyContent: "center",
},
input: {
width: "90vw",
height: "2rem",
fontSize: "2rem",
},
emojisList: {
overflow: ... | true |
4a990a31851d90714b483115d8d8d045c0de9de8 | JavaScript | rkyli/url-shortener-microservice | /server.js | UTF-8 | 3,479 | 2.6875 | 3 | [] | no_license | 'use strict';
var dotenv = require('dotenv');
dotenv.config();
var express = require('express');
var mongo = require('mongodb');
var mongoose = require('mongoose');
var bodyParser = require('body-parser');
var cors = require('cors');
var dns = require('dns');
var shortid = require('shortid');
var validurl = require('v... | true |
f1478a98a23ac46287bb386313f428ed23a827dc | JavaScript | fmfn/pastalog | /test/fakeData.js | UTF-8 | 1,914 | 2.875 | 3 | [
"MIT"
] | permissive | // Module for adding fake data
function doNegativeLog(step, bias) {
const noise = Math.random() + bias;
const fraction = (step + 1) / 15000;
const val = -1 * Math.log(fraction);
return val + (noise - 0.5) * 1;
}
function getAccuracy(step, bias) {
const noise = Math.random() + bias;
const fraction = (step ... | true |
6a59fbb5ff806f1634b1b0143abb17920c4f56bc | JavaScript | alvinjackson101/movie-db | /js/movie-db.js | UTF-8 | 970 | 2.6875 | 3 | [] | no_license | $( document ).ready(function() {
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.themoviedb.org/3/movie/top_rated?page=1&language=en-US&api_key=8df4c6a67bf88f75905c5867a433bfec",
"method": "GET",
"headers": {},
"data": "{}"
}
... | true |
aa06f83681149f93f9e410d800bd6d492597dc97 | JavaScript | shreyash0023/Crypto-Token-Simple-CrowdSale | /Truffle_GBT_CROWDSALE/interactions/check_token_balance.js | UTF-8 | 439 | 2.6875 | 3 | [] | no_license | /* This script reads the balance stored in the GB Token contract
* for the specified account .
*/
var GBToken = artifacts.require("./GBTokenAndCrowdsale.sol");
module.exports = function(callback) {
var accountToCheck = web3.eth.accounts[0];
GBToken.deployed()
.then(function(instance){
return ... | true |
464266a3989b570967cf7f8da8a54672af3e1b16 | JavaScript | springrider/PL101 | /2-3.js | UTF-8 | 863 | 3.109375 | 3 | [] | no_license | var melody2_mus =
{ tag: 'seq',
left:
{ tag: 'seq',
left: { tag: 'note', pitch: 'a4', dur: 250 },
right: { tag: 'note', pitch: 'b4', dur: 250 } },
right:
{ tag: 'seq',
left: { tag: 'note', pitch: 'c4', dur: 500 },
right: { tag: 'note', pitch: 'd4', dur... | true |
8b93db6a0371937da855066bbd8a2449d5dba947 | JavaScript | borntofrappe/Practice-Front-End-Web-Development | /Modal for a Settings- Panel/script.js | UTF-8 | 732 | 2.984375 | 3 | [] | no_license | // target the button which triggers the animation
const toggleModal = document.querySelector(".container button");
// target the div which is subject to the animation
const modal = document.querySelector(".container .modal");
// listen for a click event on the button, at which point toggle the class of active on ... | true |
659686b6a5698758e8e73a1ceeece1eebb2edc60 | JavaScript | cyanideio/spinal-cord | /src/model.js | UTF-8 | 5,084 | 2.71875 | 3 | [] | no_license | 'use strict'
const EventEmitter = require('events').EventEmitter
const SyncMethod = require('./backends/restful-native')
/**
* Model to Replace Backbone.Model
*/
class Model extends EventEmitter {
/**
* Returns {} for data by default
* @return Object
*/
get defaults() {
return {}
... | true |
f6ab3a5040cb7ef66c24361419b5dd8de19bd5e2 | JavaScript | jamigibbs/javascript-problems | /fullstack-prep/01/only-one.js | UTF-8 | 349 | 3.421875 | 3 | [] | no_license | function onlyOne(){
var args = arguments,
truthyCount = 0;
for(var i = 0; i < arguments.length; i++){
truthyCount += arguments[i] ? 1 : 0;
}
return truthyCount > 1 || truthyCount === 0 ? false : true;
}
//EXAMPLE TESTS
console.log(onlyOne(false, false, true));
// OUTPUT: true
console.log(onlyOne... | true |
002b84f4af85eb4fd66f57a03a30a9271062f3ce | JavaScript | zboizz/vanillaJS_practice | /vanillaJS/paintjs/app.js | UTF-8 | 5,036 | 3.171875 | 3 | [] | no_license | const canvas = document.getElementById("jsCanvas");
//https://developer.mozilla.org/ko/docs/Web/API/CanvasRenderingContext2D
const colors = document.getElementsByClassName("jsColor");//붓색깔
const range = document.getElementById("jsRange");//굵기
const mode = document.getElementById("jsMode");//fill
const saveBtn = documen... | true |
1c3c67a3239a00e5d90e5f3df23c25e4f15d51cc | JavaScript | esme/algorithms | /javascript/dailyTemperatures.js | UTF-8 | 1,188 | 4.6875 | 5 | [] | no_license | /*
Given a list of daily temperatures T,
return a list such that, for each day in the input,
tells you how many days you would have to wait until a warmer temperature.
If there is no future day for which this is possible, put 0 instead.
For example, given the list of temperatures T = [73, 74, 75, 71, 69, 72, 76, 73],
... | true |
2ae2f4b8320ca85fddb60a3508621c5c04a5dd7b | JavaScript | denisijka/js-size-scroll-coordinates | /js/script.js | UTF-8 | 33,008 | 3.28125 | 3 | [] | no_license | // ===================================================================================
// 1. Размеры окна браузера
// clientWidth и clientHeight
// Доступная ширина и высота окна.
/*
const mainElement = document.documentElement;
const mainElementWidth = mainElement.clientWidth;
const mainElementHeight = mainE... | true |
eca4af8081096fd8f931a7fbcb99f600aba64271 | JavaScript | L-F-Escobar/DragonStack | /backend/app/dragon/index.js | UTF-8 | 1,092 | 2.921875 | 3 | [] | no_license |
const TRAITS = require("../../data/traits.json");
const DEFFAULT_PROPERTIES = {
dragonId: undefined,
nickName: "unnamed",
generationId: undefined,
get bday() {
return new Date()
},
get randomTraits() {
const traits = [];
TRAITS.forEach(TRAIT => {
const ... | true |
5b4b2b4aa7f532cd539c9dd0c8ea414b31087b28 | JavaScript | space2pacman-templates/samodelka | /src/js/inc/ordering.js | UTF-8 | 355 | 2.5625 | 3 | [] | no_license | $('.ordering-table__checkbox').on('change', function () {
if ($(this).is(':checked')) {
$('.ordering-table__row:nth-child(odd)').css("background-color", "#fafafa");
$('.ordering-table__row:nth-child(even)').css("background-color", "#ffffff");
$(this).parents('.ordering-table__row').css("back... | true |
acca68afd24e42f52636577f50bc0427b550bab7 | JavaScript | rae-ralston/LG-simple-JS-library | /dist/filter.js | UTF-8 | 1,394 | 2.890625 | 3 | [
"MIT"
] | permissive | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var filter = function filter(collection, predicate) {
if (collection === undefined) {
return [];
}
var fn = predicate || function (a) {
return a;
};
if (typeof fn === 'function') {
return filterByFunction(collection,... | true |
fda42008caa11ff7baaef6543480cd33669d2504 | JavaScript | julgachancipa/holbertonschool-higher_level_programming | /0x13-javascript_objects_scopes_closures/100-map.js | UTF-8 | 168 | 2.515625 | 3 | [] | no_license | #!/usr/bin/node
const list = require('./100-data').list;
console.log(list);
const mList = [];
list.map((item, i) => {
mList[i] = item * i;
});
console.log(mList);
| true |
463094fe5ddf032f0eaeeca88bffe8c223ce508b | JavaScript | mirceaagr/informea3.theme | /scripts/countries.js | UTF-8 | 891 | 2.625 | 3 | [] | no_license | jQuery(document).ready(function(){
jQuery('.text-center a').each(function(index,a){
jQuery(a).attr('href','javascript:void(0)');
});
// filters the countries in countries page
jQuery('.text-center a').click(function(){
jQuery('html,body').animate({scrollTop: offset - (offset * 0.3)}, 1... | true |
c439bf792f25a12efb70afdc6c3c5de4c7b10e95 | JavaScript | awhipple/go-test | /engine/gfx/Text.js | UTF-8 | 996 | 2.9375 | 3 | [] | no_license | import Image from "./Image.js";
export default class Text {
constructor(str, x, y, options = {}) {
this.str = str;
this.x = x;
this.y = y;
this.center = options.center;
this.style = options.style;
}
draw(ctx) {
ctx.font = this.style || "bold 200px Arial"
var xShow = this.x - (this.ce... | true |
9eb126be4eb351ea916d06073af768ba0c4b8047 | JavaScript | Vijaianand90/calculator | /src/App.js | UTF-8 | 7,789 | 2.703125 | 3 | [] | no_license | import React, { Component } from "react";
import "./App.css";
import Control from "./components/control";
import { Container, Row, Col } from "react-bootstrap";
import ResultPane from "./components/resultpane";
import Summary from "./components/summary";
class App extends Component {
state = {
result: "",
e... | true |
82d30af3322d10c88272d8bc993551f0ae2b2087 | JavaScript | maxassis/Maxwelb-Assis | /semana3/blackjack/nossoJogo.js | UTF-8 | 836 | 4.0625 | 4 | [] | no_license | //NOSSO JOGO
console.log("Bem vindo ao jogo de Blackjack!")
let saques = 4
let textos = []
let valores = []
if (confirm("Quer iniciar uma nova rodada ?")) {
true
for (var i = 0; i < saques; i++) {
const carta = comprarCarta()
textos.push(carta.texto)
valores.push(carta.valor)
var soma... | true |
a386e493860cdaf8d4a6c2b6f0948515f53dae8c | JavaScript | clfeng/arithmetic_study | /threeSum.js | UTF-8 | 873 | 3.578125 | 4 | [] | no_license | /**
* @param {number[]} nums
* @return {number[][]}
*/
var threeSum = function (nums) {
let l,
r,
set = new Set();
nums.sort((pre, next) => {
return pre - next;
});
for (let i = 0; i < nums.length; i++) {
const element = nums[i];
l = i + 1;
... | true |
a6343e8a0d686404520b8b9e0136dc236d754287 | JavaScript | klau88/oompaa | /demo/main.js | UTF-8 | 3,887 | 2.71875 | 3 | [] | no_license | var link = "www.thomassio.nl:2001";
//var link = "localhost:2001";
$(document).ready(function(){
$('h1').html(link);
var container = $("#container")
container.masonry( {
itemSelector: '.demo'
});
getGroups(5);
getPlussers(5);
getGroupFromId(614);
getPlusserFromId(1);
$('#linkB').click(function(){
li... | true |
bbd8f69f28083f16867477853eb7fade81689715 | JavaScript | kimtrue/verita | /14_javascript/ch03_object/test13.js | UTF-8 | 1,003 | 3.796875 | 4 | [] | no_license | /**
* 객체의 디스트럭처링
*
*/
function getMember(){
return {
id: "a",
name: "aba",
age: 1
};
}
let m = getMember();
console.log(m.id, m.name, m.age); //a aba 1
/*
//객체
//변수 선언자리에 {} or [] 가 오면 destructuring 하겠다는 의미
let {id, name, age} = getMember();
console.log(id, name, age); /... | true |
65cf1ffe2e646c9bdac4bb9194e27ab768d81f5d | JavaScript | Erling-b/frontend-master-folder | /javascript øving/1-1-5/index.js | UTF-8 | 126 | 3.15625 | 3 | [] | no_license | var x = 23
var y = 54
var tall = x*y;
console.log(tall);
document.body.innerHTML +=`
<article>${x}x${y}=${tall}</article>
`
| true |
06ac93eb478977afb05e631764686a5b644ab7e3 | JavaScript | bdadam/JSModulesWorkshop | /code-samples/exercises/3/js/counter.js | UTF-8 | 510 | 2.609375 | 3 | [] | no_license | TODO
var counter = (function() {
var ctr = 0;
var parser = company.app.parser;
return {
inc: function(value) {
ctr += (parser.parseNumber(value) || 1);
PubSub.publish('counterValueChanged', ctr);
},
dec: function(value) {
ctr -= (parser.parseNumber(value) || 1);
PubSub.publish('count... | true |
f577016dc2b8c180e74e068b808b648a8f8de0b1 | JavaScript | pavankalyan-codes/FrontEndMentor | /crypto-price-watcher/script.js | UTF-8 | 2,804 | 2.96875 | 3 | [] | no_license | fetchBtc();
fetchDoge();
fetchEth();
fetchXrp();
async function fetchData() {}
async function fetchBtc() {
let response = await fetch(
"https://rest.coinapi.io/v1/exchangerate/BTC/USD", {
headers: {
"X-Coinapi-Key": "4564B6D2-3BB3-46E1-80F1-9FBD2C18F78F",
},
... | true |
d868234c9ac79cb1ba39ce4624013479d7176c71 | JavaScript | BrainCloudEquipe/SimuladorPerforma | /scripts/scripts.js | UTF-8 | 8,170 | 3.609375 | 4 | [] | no_license | //funcoes para pegar os valores dos elementos de cada questão do questionário. Haverá também um alert caso a pessoa não selecione algum campo
var maquinasValores = [];
maquinasValores[1] = 0.02 / 100;
maquinasValores[2] = 0.03 / 100;
maquinasValores[3] = 0.05 / 100;
maquinasValores[4] = 0.07 / 100;
var adquirintesVa... | true |
8661050aeea02b7fdb9fd99ef08c36e7a4c40d65 | JavaScript | natallia-js/multiply | /src/index.js | UTF-8 | 630 | 3.09375 | 3 | [
"MIT"
] | permissive | module.exports = function multiply(first, second) {
let num1 = first.split('').reverse();
let num2 = second.split('').reverse();
let stack = [];
for (let i = 0; i < num1.length; i++) {
for (let j = 0; j < num2.length; j++) {
let mult = num1[i] * num2[j];
stack[i + j] = (stack[i + j]) ? stack[i... | true |
87fc271e6302140a15549b2710e911f1d556ba40 | JavaScript | rolger/at.rolger.vb.app | /app/js/filters.js | UTF-8 | 1,761 | 2.9375 | 3 | [] | no_license | 'use strict';
function filterWeekdays(dates, weekday) {
if (weekday === 'Alle') {
return dates;
}
var result = new Array();
var day = 0;
if (weekday === 'Montag') {
day = 1;
} else if (weekday === 'Donnerstag') {
day = 4;
}
if (day != 0) {
for (var int = 0; int < dates.length; int++) {
var dateP... | true |
83b766bc9a6258a2f86ab9c381e1a3ede72b075d | JavaScript | ZEROwolfHwang/ZhiRen | /zero/containers/4Tab/Student1.js | UTF-8 | 10,376 | 2.921875 | 3 | [] | no_license | /**
* Created by zerowolf Date: 2018/4/23 Time: 下午3:56
*/
import React, {Component} from 'react';
import {
Platform, StyleSheet, Text, Alert, View, TouchableOpacity, Image, Dimensions, ListView
} from 'react-native';
const {width, height} = Dimensions.get('window');
import MyTabView from '../../views/MyTabView';... | true |
babb42b9a8881f748518e58af3c3259a9fbf79e2 | JavaScript | chantalimerti/extra-hw | /js/main.js | UTF-8 | 283 | 3.203125 | 3 | [] | no_license | var textOne = "sweet dog";
var textTwo= "very talented";
$(document).ready(function(){
$("h2"). text(textOne);
switchText();
function switchText() {
if ($("h2").text()==textOne){
$("h2").text(textTwo);
} else {
$("h2").text(textOne);
}
setTimeout(switchText, 3000);
} | true |
0727bcbe3a1f790f32ffaa6fcfc272d024840d29 | JavaScript | wangzhengbo/fe-demo | /js/rxjs/basic/filter/ignoreElements2.js | UTF-8 | 565 | 3.046875 | 3 | [] | no_license | // RxJS v6+
import { interval, throwError, of } from 'rxjs';
import { mergeMap, ignoreElements } from 'rxjs/operators';
// 每100毫秒发出值
const source = interval(100);
// 忽略所有值,只发出 error
const error = source.pipe(
mergeMap(val => {
if (val === 4) {
return throwError(`ERROR AT ${val}`);
}
return of(val);... | true |
feea5f63afcd6bb06ce58ca9731ef136b8f8ece3 | JavaScript | nicholasxjy/react-webpack2-starter | /src/utils.js | UTF-8 | 683 | 2.640625 | 3 | [] | no_license | const devicePixelRatio = window.devicePixelRatio || 1
export function cropImage(url, width, height, ratio) {
const temp = ratio || devicePixelRatio
return `${url}??imageView2/1/w/${width * temp}/h/${height * temp}`
}
export function blurryImageCrop(url, width = 30, height = 30, radio, radius = 3, sigma = 5) {
co... | true |
77945f001feb6cd83b8c967a3ea33e37f1fbba27 | JavaScript | Chellyyy/LeetCode | /problems/0049.group-anagrams.js | UTF-8 | 1,314 | 3.75 | 4 | [
"MIT"
] | permissive | /**
* Create by Chelly
* 2020/9/9
*/
/**
* 题目描述
* 给定一个字符串数组,将字母异位词组合在一起。字母异位词指字母相同,但排列不同的字符串。
*
* 注意
* 所有输入均为小写字母。
* 不考虑答案输出的顺序。
*/
/**
* 示例
* 输入: ["eat", "tea", "tan", "ate", "nat", "bat"]
* 输出:
* [
* ["ate","eat","tea"],
* ["nat","tan"],
* ["bat"]
* ]
*
*/
/**
* @param {string[]} strs
* @retu... | true |
300d955a9bc874130ff22ff6b7c039ca629cda69 | JavaScript | BryttLucas/html-Tutoral | /jquery/js/jq/userList.js | UTF-8 | 914 | 2.90625 | 3 | [] | no_license | const baseUrl = "http://localhost:8080";
let users = null;
$().ready(() => {
refresh();
$("#refresh").click(() => {
refresh();
});
});
const refresh = () => {
$.getJSON(`${baseUrl}/users`)
.done((res) => {
console.log("Users:", res.data);
users = res.data;
... | true |
248dd05be99bf97e8c558fbca824e9c48ac4bd2f | JavaScript | Volcaner/study | /algorithm/src/public/public.js | UTF-8 | 11,553 | 2.78125 | 3 | [] | no_license | // 获取地址参数
var getHrefParam = function(name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null) {
return unescape(r[2]);
}else {
return null;
};
};
// 判断字符串非空
var isNorU = function(str){
if(str == undefined || str == null || st... | true |
cb795e81567902d0be75aef2fd434c675389434f | JavaScript | RaufERK/react_redux_lecture | /src/redux/reducer.jsx | UTF-8 | 1,113 | 2.71875 | 3 | [] | no_license | // import {
// EDIT,
// DELETE,
// ADD_ITEM,
// SET_COUNTER,
// SET_LIST,
// INC,
// DEC,
// } from './actionTypes';
import * as action from './actionTypes';
const initState = {
counter: 0,
counter1: 3000,
counter2: 3000,
goods: {},
users: [],
list: [],
};
export default function reducer(st... | true |
1adc8930bc61700fcc984c25faf1ccf69d3e44d7 | JavaScript | SolvoSupport/chrome_escpos | /src/js/printTCP.js | UTF-8 | 1,121 | 2.59375 | 3 | [
"MIT"
] | permissive | function printTCP(s, ip, port, response) {
try {
chrome.sockets.tcp.create({}, function (createInfo) {
var socketId = createInfo.socketId;
if (!socketId) {
response({ status: false, error: "Error al comunicarse con: " + ip + " : " + port });
return;
... | true |
4f6d17a3ab3338f0def0ed1b94b90d2589dba227 | JavaScript | gorodish/astronaut_group_project | /client/src/views/eventsView.js | UTF-8 | 2,074 | 3.109375 | 3 | [] | no_license | var makeRequest = function(url, callback) {
var request = new XMLHttpRequest();
request.open("GET", url);
request.onload = callback;
request.send();
};
var requestComplete = function() {
if(this.status !== 200) {
return;
}
var jsonString = this.responseText;
var localNews = JSON.parse(jsonString)... | true |
af1b1fe364757456c4badbe809b4b51469dcfb27 | JavaScript | safiyc/survey-page-fcc | /script.js | UTF-8 | 836 | 3.21875 | 3 | [
"MIT"
] | permissive | // Prevent more than 3 checkbox checks
function checkboxCount(el) {
let count = 0;
if (document.getElementById("survey-form").games.checked) {
count = count + 1;
}
if (document.getElementById("survey-form").browsing.checked) {
count = count + 1;
}
if (document.getE... | true |
f5d8b48f6be596cf9c6c713d9ab6b2601c9a5f55 | JavaScript | damiansp/js | /rhino/07_Arrays/03_sparseArrays.js | UTF-8 | 258 | 3.28125 | 3 | [] | no_license | let a = new Array(5); // len = 5
a = []; // len = 0
a[1000] = 0; // len = 1001
let a1 = [, ]; // len = 1
let a2 = [undefined]; // len = 1
console.log(0 in a1); // false (no 0 index)
console.log(0 in a2); // true 0 = undefined
| true |
979e9844c623c9c3e64155e7de95b5a250679565 | JavaScript | howardmann/js_study_notes | /testing/test/promises.spec.js | UTF-8 | 4,977 | 3.09375 | 3 | [] | no_license | let expect = require('chai').expect
let promises = require('../promises').promises
let chai = require("chai");
let sinon = require('sinon');
let chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
// Note
// Examples below show the various syntaxes for writing tests for promises
// I prefer the fir... | true |
fd9abf714da06dfba49783728cb8b5bc4163215a | JavaScript | zq210wl/summarize | /summarize/功能实现/AMD实现.js | UTF-8 | 1,819 | 2.921875 | 3 | [] | no_license | define('/folder/c.js', ['/folder/a.js', '/folder/b.js'], function(a, b){
// do something ...
return a + b;
});
require('/folder/c.js');
(function(){
var modulePathMap = {};
var modules = {};
function config(options) {
modulePathMap = options.paths;
}
function define(moudleName, depende... | true |
9309c4d16b782f93a87e48c15cf83fc94bf16c04 | JavaScript | SDC-JMP/altitude-apparel-reviews-api | /helper/loadData.js | UTF-8 | 2,232 | 2.703125 | 3 | [] | no_license | const fs = require('fs');
const readline = require('readline');
const path = require('path');
const dataDir = path.join(__dirname, '../data');
const { Review } = require('../server/models/reviewModel');
const etlLoad = (filename, model, callbacks) => {
const rl = readline.createInterface({
input: fs.createReadS... | true |
207ff3a53709d99a2eeedaa6da6493a8fe581b50 | JavaScript | jc00500/yagl | /graph.js | UTF-8 | 22,098 | 2.859375 | 3 | [] | no_license | var YAGL;
(function (YAGL) {
var Graph = (function (gp, scene) {
/*
* Graph is a model for a graph data structure.
* vertices contains a set of YAGL.Vertex objects.
* edges contains a set of YAGL.Edge objects.
* adjacencyList is a mapping of vids to arra... | true |
c8806bbab8eec9e32ce5776d94658619e51dc995 | JavaScript | donghyeKim/ReactJSWithDjango | /frontend/src/views/ToDoPage/ToDoPage.v2.js | UTF-8 | 1,703 | 2.984375 | 3 | [] | no_license | import React , { useState , useEffect } from 'react';
import '../../assets/scss/TodoPage/TodoPage.scss';
// 이 예제에서는 ToDo를 여러 컴포넌트로 분리합니다.
// 아래 컴포넌트들은 삽입부와 리스트부를 나누어 둔 것 입니다.
import ToDoInput from './Components/ToDoInput';
import ToDoList from './Components/ToDoList';
function TodoPage(props) {
// 입력에 관련된 값은 굳이 T... | true |
6b40d0d4e42b4eb6138e9ef75e59cccb4b5115b8 | JavaScript | Li-YangZhong/The-Advanced-Web-Developer-Bootcamp | /173-/spread.js | UTF-8 | 333 | 3.9375 | 4 | [] | no_license | var arr1 = [1,2,3]
var arr2 = [4,5,6]
var arr3 = [7,8,9]
//ES5
var combined1 = arr1.concat(arr2).concat(arr3)
console.log(combined1)
var combined2 = [...arr1, ...arr2, ...arr3]
console.log(combined2)
//-----------
var newArr = [3,2,4,1,5]
//ES5
console.log(Math.max.apply(this,newArr))
//ES2015
console.log(Math.ma... | true |
67eff470a03782014776e186974ca7a6ddda915f | JavaScript | samhoward1990/TriviaGame | /assets/javascript/app.js | UTF-8 | 1,047 | 3.46875 | 3 | [] | no_license | var answers = ["G minor"];
var correct = 0;
var incorrect = 0;
var unanswered = 0;
var totalnumberofseconds = 10;
var changetimerevery = 1000;
function timeUp() {
for (var i = 0; i < answers.length; i++) {
var correctAnswer = answers[i];
var userAnswer = "";
var options = document.getElement... | true |
9f872f59e9e7b1102b69ec9b84c392b67e0948b7 | JavaScript | wdevon99/React-Native-Boilerplate | /src/redux/reducers/userReducer.js | UTF-8 | 268 | 2.5625 | 3 | [] | no_license | //defining the default state
const defaultUserReducerState = {
};
// User Reducer Function
const userReducer = (state = defaultUserReducerState, action) => {
switch (action.type) {
default:
return state;
}
};
export default userReducer;
| true |
0e4a6add86a3725d6493a02f0d2cab3d8bd53a21 | JavaScript | Tabofa/postman-demo | /frontend/src/Components/ContentTable.js | UTF-8 | 3,985 | 2.65625 | 3 | [] | no_license | import React, { Component } from "react";
import { Table, Button, ButtonGroup } from "reactstrap";
import { getAll, markAsDone, createNew, deleteById } from "../Tools/HttpCalls";
import AddField from "./AddField";
class ContentTable extends Component {
constructor(props) {
super(props)
this.state =... | true |