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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ac8a70115686b350e09b301fd988134b5b3a2a42 | JavaScript | AnatoliyLastochkin/Cripto-Market | /scripts/components/App/App.js | UTF-8 | 2,398 | 2.671875 | 3 | [] | no_license | import Filter from '../Filter/Filter.js';
import Table from '../Table/Table.js';
import Portfolio from '../Portfolio/Portfolio.js';
import TradeWidget from '../TradeWidget/TradeWidget.js';
import {dataService} from '../Services/DataServuce.js';
import './App.css';
export default class App {
constructor({element}) {... | true |
d03f166a91937d9c74b2ae78b2ff5973fd81ef79 | JavaScript | vsmithy/BingoCage | /app/History.js | UTF-8 | 4,571 | 3.046875 | 3 | [
"MIT"
] | permissive | /**
* The History component shows the previous values that have been drawn. it can
* be used to verify if someone has won the game. Each of the sections are vestically
* scrollable once the list becomes longer than the screen height.
*/
import React, { Component } from 'react'
import { Button, TouchableOpac... | true |
8e674322437b3aab482cddd66831f1efbe5f4984 | JavaScript | dariooliveirajr/javascript_algorithms_data_structures | /palindrome.js | UTF-8 | 519 | 3.625 | 4 | [] | no_license | function palindrome(str) {
let result = true;
let newArr = []
let theStr = str.toLowerCase().replace(/\W|_/g,'').split('')
if(theStr){
theStr.forEach(el => {
newArr.unshift(el)
})
}else {
return false
}
console.log(theStr)
console.log(newArr)
for(let... | true |
df5994b7eee7879244b62107b33d94efab6d5deb | JavaScript | DaveSvatora/imageapi | /reader.js | UTF-8 | 2,690 | 2.546875 | 3 | [
"MIT"
] | permissive | const fs = require('fs')
const path = require('path')
const dir = 'uploads'
const full = 'full'
const host = 'http://192.168.1.2:8080'
module.exports = function getAllFiles() {
let years = []
fs.readdirSync(dir).forEach(year => {
let months = []
let writeYear = true
let stat = fs.stat... | true |
587c1ea95bf79affeb25a81b33eca6f4d7b550e0 | JavaScript | langren1353/ThoughtWork | /Guess Number/main/main.js | UTF-8 | 808 | 3.25 | 3 | [] | no_license | // Write your cade below:
function main(sysData, yourData) {
return findDifferent(sysData, yourData);
};
function findDifferent(sysData, yourData){
var removeData = new Array();
var counterA = 0, counterB = 0;
for(var i = 0; i < sysData.length; i++){
if(sysData[i] == yourData[i]){
removeD... | true |
474e578779008bd50cdc4a349c7f33e9aa31ceb1 | JavaScript | Sean-Beyer/TTA-Course-Work | /HTML/HTML-and-CSS-Projects/Basic_HTML_and_JavaScript_1/Basic_JavaScript_1.js | UTF-8 | 213 | 2.6875 | 3 | [] | no_license | alert("Hello, World!");
function My_First_Function() {
var String = "Awwwwwwwwwww......";
var result = String.fontcolor("blue");
document.getElementById("Irish").innerHTML =
result;
} | true |
1079a5a2d53e9cb017a57cafa156bdae29a0e5e7 | JavaScript | ckarande/workshops-reactive-architectures | /event-source/server/user.js | UTF-8 | 279 | 2.6875 | 3 | [] | no_license | var userId = 0;
var users = {};
exports.create = function(cb) {
userId += 1;
var user = users[userId] = { id: userId };
cb(null, user);
}
exports.get = function(id) {
var user = users[id];
if(user) {
cb(null, user);
} else {
cb(new Error("missing"));
}
}
| true |
3c7fecfa7293438d312d5df3f16409b701341761 | JavaScript | arkaaaadiy/ReleaseTime | /src/store/events.js | UTF-8 | 2,908 | 2.5625 | 3 | [] | no_license | import firebase from 'firebase/app'
import Event from './event_help'
export default({
state: {
events: []
},
mutations: {
loadEvents(state, payload) {
state.events = payload
},
createEvent(state, payload) {
state.events.push(payload)
},
clearEvents(state){
s... | true |
0755164f1c6e7cc9155a9abccdf3d2180cd0366b | JavaScript | deepakkadarivel/mytv | /src/pages/series/seriesActions.js | UTF-8 | 2,204 | 2.625 | 3 | [] | no_license | import seamlessImmutable from 'seamless-immutable';
const seriesInitialState = seamlessImmutable({
fetchingEpisodes: {
isPending: false,
isRejected: false,
isFulfilled: false
},
fetchingDetail: {
isPending: false,
isRejected: false,
isFulfilled: false
},
... | true |
cf358bd7db14c946759586e0dec03fe5db1f881a | JavaScript | cindyliujiaxin/www | /try/try.js | UTF-8 | 354 | 3.15625 | 3 | [] | no_license | var s = 1;
window.onload = function(){
second();
}
function second(){
if((s%6==0||s%6==5)&&s < 60){
s = s+1;
m = 2000;
}
else if((s%6==1||s%6==2||s%6==3||s%6==4)&&s <= 59){
s = s+1;
m = 500;
}
else{
clearInterval(t);
}
document.getElementById("second").innerHTML = s;
... | true |
d24f59fc20c5635c262beba9ad8e16d2ef653035 | JavaScript | jebakani/Programming_Construct_JS | /Functions/CheckPalindrom.js | UTF-8 | 565 | 3.984375 | 4 | [] | no_license | //function to check two number is palindrome
function CheckPalindrome(a,b)
{
let res=0;
while(a!=0)
{
let rem=a%10;
res=(res*10)+rem;
a=Math.floor(a/10);
}
if(res==b)
{
return true;
}
else
{
return false;
}
}
//get input fro user
var prompt = require('pro... | true |
741ee50c7c59a7e9aaac5829cc5ed2a3f63af035 | JavaScript | artlemus/classwork | /store/script/catolog.js | UTF-8 | 3,041 | 3.078125 | 3 | [
"MIT"
] | permissive | // global variables
var items = [{
code: "1tvs",
title: "tv samsung",
price: 1000,
description: "this is the long description of the item",
category: "electronics",
image: "img/tv.jpg"
},
{
code: "1ph10",
title: "Iphone X",
price: 1200,
description: "this is th... | true |
b406edf3233920451529b74dfc68f245b54c4ecc | JavaScript | taibaaljanabi/assignments | /projects/practice TODO list project/app.js | UTF-8 | 993 | 3.15625 | 3 | [] | no_license |
// axios.get('https://jsonplaceholder.typicode.com/users').then((response)=> {
// // console.log(response.data)
// for( let user of response.data){
// let div = document.createElement('div')
// let username = document.createElement('h1')
// let name = document.createElement('h2')
... | true |
202ac3984f15bd0c40915c90c46b4b9b64f96f18 | JavaScript | RG0720/technology-research | /01-file-reader/02-memfile.js | UTF-8 | 643 | 3.046875 | 3 | [
"MIT"
] | permissive | const fs = require("fs");
const path = require("path");
const filePath = path.resolve(__dirname, "test.log");
fs.readFile(filePath, "utf-8", (err, data) => {
if (err) {
console.error(err);
return;
}
console.log(data);
});
try {
const data = fs.readFileSync(filePath, "utf-8");
console.log(data);
} c... | true |
614118824509ceea0a64bbe422954d0fc550ecc3 | JavaScript | AKaudinov/expensify-app | /src/selectors/expenses-total.js | UTF-8 | 370 | 2.90625 | 3 | [] | no_license | const getExpensesTotal = (expenses) => {
const allAmounts = expenses.map(expense => {
return expense.amount;
});
return allAmounts.reduce((prevValue, currentValue) => {
return prevValue + currentValue;
}, 0); //start with the inital value of 0, if there are no expenses, reduce will just r... | true |
9277cd92c71e6b5e55ed61ca0355c1b96f86f56b | JavaScript | jgam/leetcode | /93.js | UTF-8 | 1,271 | 3.21875 | 3 | [] | no_license | /**
* @param {string} s
* @return {string[]}
*/
var restoreIpAddresses = function(s) {
let ret = [];
let current=[];
backtrack(s,1);
function backtrack(currentStr,curCount){
if(currentStr.length === 0){
return;
}
if(curCount===4){
//termination needs to... | true |
5929f085b2cfb2f532ed56543340d3ceaffd1111 | JavaScript | newtornmoses/IT-BLOG | /public/js/main.js | UTF-8 | 11,552 | 2.59375 | 3 | [
"MIT"
] | permissive | var addarticle = $('.Formcontent');
var addarticlebtn = $('#addarticle');
var canclebtn = $('.Formcontent').find('form').find('input.cancle');
var createArticle = $('.Formcontent').find('form').find('input.create')
var addArticleform = $('.Formcontent').find('form');
// open addarticle model
addarticlebtn.on('click', ... | true |
cd702ab686e59f28b6db6fc60c566ce9e595f236 | JavaScript | asktami/Fullstack-Academy-Prep | /03-coercion-and-truthiness/05-zero-dark-thirty/zero-dark-thirty.js | UTF-8 | 799 | 4.5625 | 5 | [] | no_license | // ### Zero Dark Thirty
// Write a function `zeroDarkThirty` that accepts a number as an arguemnt.
// It should return a number with all of the zeroes removed
// If the number 0 is passed in as the argument, return [NaN]
// (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN).
// YOU... | true |
32595e46788efd6e6e04a6a8b8bc6db29d1d89dd | JavaScript | HriBB/bit-website | /server/utils/image.js | UTF-8 | 5,953 | 2.578125 | 3 | [] | no_license | import { async, await } from 'asyncawait'
import { parse } from 'path'
import { move, removeSync, existsSync } from 'co-fs-extra'
import createSlug from 'slug'
import gm from 'gm'
import config from 'config'
// public functions
/**
* Get image url
*
* @param {String} type Image type
* @param {Object} parent... | true |
b24039e5bf3c7b1310b5ff90a1955c93d6f26c61 | JavaScript | chilin89117/BT01-HTML5 | /BT01-10-MobileToDoApp/js/main.js | UTF-8 | 4,020 | 2.984375 | 3 | [] | no_license | // get the todo list from localStorage and parse it into JS object
var todoList = JSON.parse(localStorage.getItem("todos"));
$(document).ready(function () {
// use jQuery UI datepicker widget for date inputs
$("#todo_date_add, #todo_date_edit").datepicker({
changeMonth: true,
changeYear: true ,
showOtherMont... | true |
dd0af232279311bd04d484300b3379a026a74a14 | JavaScript | kalihman/seem4680bustracking | /Beacon/scanner.js | UTF-8 | 1,575 | 2.546875 | 3 | [
"MIT"
] | permissive | var EBS = require('eddystone-beacon-scanner');
var http = require('http');
var request = require('request');
var inspect = require('eyespect').inspector();
function sendSignal(data) {
var body = JSON.stringify(data);
var options = {
url: "http://52.221.223.238/scanner",
method: "POST",
... | true |
d05c871fb8338fd75d1e656fab4477092916c1b9 | JavaScript | michaelbonds/learnYouNode | /httpClient.js | UTF-8 | 278 | 2.515625 | 3 | [] | no_license | var http = require('http');
(function(args){
http.get(args[2], function(stream){
stream.on("data", function(data){
console.log(data);
}).setEncoding('utf8');
stream.on("error", function(error){
console.log(error);
});
});
})(process.argv) | true |
321ec6f9390306a20de59c659d1913e50e880847 | JavaScript | mark-marshall/webdb-iv-challenge | /routes/recipesHandlers.js | UTF-8 | 1,368 | 2.84375 | 3 | [] | no_license | // - `getRecipes()`: should return a list of all recipes in the database including the **dish** they belong to.
// - `addRecipe(recipe)`: should add a **recipe** to the database and return the `id` of the new **recipe**.
const knex = require('knex');
const knexConfig = require('../knexfile.js');
const db = knex(knexCo... | true |
228ce021d88bc7a2cfabe82313ba7a9ff6ee175a | JavaScript | EE2dev/d3-sankeySeq | /src/sankeySeq.js | UTF-8 | 6,077 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | // extension of sankey https://github.com/d3/d3-sankey
// based on Andrey's reply to http://stackoverflow.com/questions/21539265/d3-sankey-charts-manually-position-node-along-x-axis
import { interpolateNumber } from "d3-interpolate";
import { sum, max } from "d3-array";
import { scalePoint } from "d3-scale";
export... | true |
f16ce162d36f2e789007b5c8138dee92c7be52f4 | JavaScript | HemangiSA/Javascript_Demo | /first/array.js | UTF-8 | 83 | 3.140625 | 3 | [] | no_license | //array operation
var array=[1,2,3,5];
var x=array.toString();
document.write(x);
| true |
abb20e4ed5863cb6ccb72100af9c4e7cf1675bdf | JavaScript | AndrewOskolok/goit-react-nodejs-project | /backend/src/transactions/transactions.controller.js | UTF-8 | 1,996 | 2.515625 | 3 | [
"MIT"
] | permissive | const { v4: uuidv4 } = require('uuid');
const { UserModel } = require("../users/user.model");
async function createTransaction(req, res) {
const transactionId = uuidv4();
const userToUpdate = await UserModel.findByIdAndUpdate('5f85f5c86e965b45cca0574e', { $push: { transactions: { ...req.body, id: transactionId... | true |
838f4f4b4ef8ce23a55ca15834e4eb611707b693 | JavaScript | wseungjin/relay_17 | /be/routes/users.js | UTF-8 | 1,451 | 2.59375 | 3 | [
"MIT"
] | permissive | var express = require('express');
var router = express.Router();
const mysql = require('mysql');
const connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'relay17',
database : 'ilovedschool'
});
connection.connect();
router.get('/', function (req, res, next) {
console.log(res);
connect... | true |
9c25e77cf7398d1fa60a338cdee7a737fb790573 | JavaScript | sidDarthVader31/Node | /http.js | UTF-8 | 300 | 2.671875 | 3 | [] | no_license | const http=require('http')
const url='http://nodeprogram.com'
http.get(url,(response)=>{
response.on('data',(chunk)=>{
console.log(chunk.toString('utf-8'))
})
response.on('end',()=>{
console.log("fetched all data")
})
}).on('error',(error)=>{
console.error(`Got error: ${error.message}`)
}) | true |
0613a28a46186a2c71c44cc998e42b38a32d99d9 | JavaScript | SheldonLaw/version-control | /test/index.js | UTF-8 | 3,038 | 2.625 | 3 | [
"MIT"
] | permissive | // 测试三部曲:1. 环境准备;2. 执行代码;3. 验证执行结果
// { prepare, run, verify }
const fs = require('fs-extra');
const path = require('path');
const VersionControl = require('../version-control');
const versionControl = new VersionControl();
const codePath = '/Users/sheldonluo/workspace/cdn_trunk';
const currentTime = (new Date()).toSt... | true |
6b9c03aae1e86f9b7eb71427b14e66554eb58c34 | JavaScript | Reniejr/Publicis_Tech_Task | /src/components/PageFilters/PageFilters.jsx | UTF-8 | 2,146 | 2.59375 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import { useSelector, useDispatch } from "react-redux";
import { filterEvent } from "store/events/actions";
import { datesForm, typeEventForm } from "./data";
import { chunkArray } from "utilities";
import { getEvents } from "utilities/api";
import FilterForm from "..... | true |
8ae54102d1aa0f6334dabbba88eb68598cc8e86b | JavaScript | faiq/rick | /twitter.js | UTF-8 | 721 | 2.515625 | 3 | [] | no_license | var error = function (err, response, body) {
console.log('ERROR [%s]', err)
}
var success = function (data) {
console.log('Data [%s]', data)
}
var Twitter = require('twitter')
var config = {
"consumer_key": "4Tp0rLjI44zBb6uBDliUumXoF",
"consumer_secret": "Cy2zijcBlCloILZ5toCOavZpxjfLYgEIwXMeJXI2Tss24... | true |
c3423c4c3f488f005c9a7893d8f0fbc0b6888352 | JavaScript | fyllmax/Coding-Exercises | /jQuery-gautlet/5/app.js | UTF-8 | 918 | 2.96875 | 3 | [] | no_license | /*global $: true, alert: true */
"use strict";
$(document).ready(function(){
var randomInt = function (min, max) {
return Math.floor(Math.random() * (max - min)) + min;
};
var randNum = $("#rand-num");
var currentNum = $("#ent-num");
randNum.text(randomInt(100, 1000000000));
$(".btn-lg").on("click"... | true |
524364afd82e24b090c90876c587baa0994ac8cb | JavaScript | expovin/PresalesGame | /server/test.js | UTF-8 | 1,119 | 3.03125 | 3 | [] | no_license |
var Opportunities = require('./lib/ClassOpportunities');
var Presales = require('./lib/ClassPresales');
var Market = require('./lib/ClassMarket');
var oppy = [];
var market = new Market();
var presales = new Presales();
if(process.argv[2] === "oppy"){
oppy.push(new Opportunities(4, 4000, 4, 50));
oppy.push(... | true |
7c2842f916b2c39227c24259638b854542b74979 | JavaScript | Felix-Xiao/wangyi | /前端高级-单页应用开发/homework/MV & 组件化开发 React专题考试/7.confirm方法组件/src/Confirm/index.js | UTF-8 | 3,411 | 2.53125 | 3 | [] | no_license | import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
function confirm(config) {
return new Promise((resole, reject) => {
//创建div,并加到body上
var div = document.createElement('div');
document.body.append(div);
//根据config创建currentConfig,将visible设置为true,将来可以添加其他... | true |
ca07b43e5d14d6d4389b6b8fd526dfd0b0976895 | JavaScript | Vizzuality/TRASE-frontend | /scripts/components/tool/map-context.component.js | UTF-8 | 2,079 | 2.515625 | 3 | [
"MIT"
] | permissive | import ContextLayersTemplate from 'ejs!templates/tool/map/map-context.ejs';
import 'styles/components/shared/switcher.scss';
import 'styles/components/tool/map/map-context.scss';
export default class {
onCreated() {
this.el = document.querySelector('.js-map-context');
this.items = document.querySelector('.js... | true |
b56b850893b5debd3a57885d32e7120b3852a1b7 | JavaScript | jackChauT/HKT_DEMO | /armRobotServer.js | UTF-8 | 1,216 | 2.734375 | 3 | [] | no_license | const axios = require('axios');
module.exports = class ArmRobotServer {
constructor(host,port) {
this.host = host;
this.port = port;
console.log(`\n[Arm Robot Server] init`)
}
init() {
console.log("Init arm robot class")
}
startPickDrink(drinkType) {
... | true |
a7a71176c189b0c0d5cb62ecea0ae5b9de746185 | JavaScript | Holo-the-Wise/Youmuchanbot | /events/guildmemberadd.js | UTF-8 | 207 | 2.546875 | 3 | [] | no_license | module.exports = member => {
let guild = member.guild;
console.log(`${member.user.username} has joined ${guild}`);
guild.defaultChannel.sendMessage(`${member.user} has joined the server, welcome!`);
}
| true |
fd2004b2fa640c0ee886d564107210303826b005 | JavaScript | alvinlo92/toy-problems | /80. Remove Duplicates from Sorted Array II/removeDuplicatesFromSortedArrayII.js | UTF-8 | 770 | 4.09375 | 4 | [] | no_license | /**
* @param {number[]} nums
* @return {number}
*/
var removeDuplicates = function(nums) {
if (nums.length < 3) return nums.length;
let i = 1;
while (i < nums.length) {
if (nums[i] === nums[i - 1] && nums[i] === nums[i + 1]) {
nums.splice(i, 1);
} else {
i++;
}
}
retur... | true |
4a5cc533d917c5796e50ff66701190ba9368cbd1 | JavaScript | armigermama/refactoru-js9 | /bugcatcher_1.js | UTF-8 | 1,127 | 3.859375 | 4 | [] | no_license | /* Some helper functions for logging in and out,
as well as printing out data about the current user.
Should output:
/* Expected output:
Object {email: "john@doe.com", username: "John Doe", friends: [0,1,2,3]}
0, 1, 2, 3,
Not logged in */
var currentUser = null;
var login = function(email){
curren... | true |
ba259a8c1878c6c4a20de1841f59edfc52eaae9f | JavaScript | LeandroArista/TUDAI-INTERFACES | /TP1/Ej1/script/script.js | UTF-8 | 1,800 | 3.71875 | 4 | [] | no_license | let col=10;
let row=10;
let matriz = [];
for (let i = 0; i < row ;i++){
matriz[i]=[];
for (let j=0; j < col;j++){
let num=Math.floor(Math.random()*100);
matriz[i][j]=num;
FileReader.innerHTMl+="<td>"+num+"</td>";
}
}
console.table(matriz);
incisoA(matriz)
//inciso a Escribir una ... | true |
18b9775cc3fb0894c4270321cfbe2f3bc81adc88 | JavaScript | eliavco/traffic-signs-chart-tests | /extract.js | UTF-8 | 2,279 | 2.515625 | 3 | [] | no_license | const fs = require('fs');
const path = require('path');
const { race } = require('rxjs');
const indexHtmlPath =
"/Users/eliavcohen/Documents/Development/traffic-signs-chart-tests/dist/traffic-signs-chart-tests/index.html";
const deployPath =
"/Users/eliavcohen/Documents/Development/traffic-signs-android/app/src/main... | true |
f8f77bf1ca4f70c6d7b87d237b59358aea5019ee | JavaScript | GevorgyanMar/cart-interactivity | /cart-interactivity/src/CartFooter.js | UTF-8 | 838 | 2.734375 | 3 | [] | no_license | import './CartFooterCss.css';
function CartFooter (props){
let sum = sumProducts(props.data)
return(
<div className="footerItem">
<div className="footerTotal">
<h3>Subtotal:</h3>
<span>{"$"+ sum}</span>
</div>
<div className="footerBtn... | true |
719d869c92f89e4bdabfc16586f0754a9694209b | JavaScript | m0n1c4/m0n1c4.github.io | /projects/underpants/underpants.js | UTF-8 | 19,917 | 3.828125 | 4 | [] | no_license | // This is the proper way to start a javascript library
(function() {
// This makes the arguments variable behave the way we want it to and a few
// other things. For more info:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
'use strict';
// This allows us to use our "_" anywhere. In... | true |
23a66fcc034ab691b3d1a93f7fc88a26cd76c1e7 | JavaScript | ozotto/mypa | /client/app/scripts/directives/genereData.js | UTF-8 | 7,147 | 2.875 | 3 | [] | no_license | /*----------- Genere Data to TimeLine ------------*/
function generateData (visDataSet, categoriesData, articlesData, valueSelected, historicData, favoritesData) {
var newCategories = [];
var newArticles = [];
var newCategoriesTemp = [];
var date = new Date();
switch(valueSelected) {
cas... | true |
6450994a709f58ddad7670891875dc954c8a2808 | JavaScript | Sethuram52001/harry-potter-app | /src/components/spare.js | UTF-8 | 2,044 | 2.875 | 3 | [] | no_license | import React from 'react';
import { useState, useEffect, useRef } from 'react';
import Forms from './FormsCharacter';
const api_key = '$2a$10$UHNOpXzWjg7g2VTELvBbU.LrImDHAKrF18HqgVM.BYY64TTdQx3nW';
const Characters = () => {
const [charDetails, setCharDetails] = useState([]);
const click_ref = useRef(n... | true |
f35f3c224d6f56888c1ed78eaf7671564ed155b6 | JavaScript | nayyi1/jsl2 | /customrangeslider/js/app.js | UTF-8 | 1,121 | 3.21875 | 3 | [] | no_license | // UI
const range = document.getElementById('range');
range.addEventListener('input',(e)=>{
// console.log(typeof +e.target.value);
const getvalue = +e.target.value;
const label = e.target.nextElementSibling;
const rangewith = getComputedStyle(e.target).getPropertyValue('width');
// console.log(rang... | true |
ab4947fa3d7c5a5d8b4d077d0f7d2965b3231ede | JavaScript | KonstantinTwardzik/WebDevelopment | /CodeExamples/02-JavaScript/Functions/Functions.js | UTF-8 | 1,241 | 3.9375 | 4 | [] | no_license | console.log("\n# function statement");
function add(arg1, arg2) {
return arg1 + arg2;
}
console.log(add(1, 2)); // 3
console.log(add("Hello", "World")); // HelloWorld
console.log("\n# explicit type checking");
function add2(arg1, arg2) {
if (typeof (arg1) !== "number" || typeof (arg2) !== "number") {
... | true |
a9c0cc6069c071f5a90f13d4843c3b207b278fba | JavaScript | Chammz/react-booklist | /src/components/Book.js | UTF-8 | 716 | 2.578125 | 3 | [] | no_license | import React, {Component} from 'react'
import '../css/Book.css'
class Book extends Component {
constructor(props){
super(props);
this.state = {
favorited: false,
}
}
onClickFavorite = () => {
this.setState({
favorited: !this.state.favorited,
});
}
render(){
const favor... | true |
6b0fb0df14ea06d56becb17581db83846f4ad5e9 | JavaScript | hubertstrawa/node-book-store-project | /index.js | UTF-8 | 2,468 | 2.8125 | 3 | [] | no_license | const fs = require('fs');
const http = require('http');
const url = require('url');
const json = fs.readFileSync(`${__dirname}/data/data.json`, 'utf-8');
const bookData = JSON.parse(json);
const server = http.createServer((req, res) => {
const pathName = url.parse(req.url, true).pathname;
console.log(pathName... | true |
6d61f7d6d0a7f37369f823a5d6e4d5c8f52761bc | JavaScript | izhan/ruby_es6_module_transpiler | /spec/js-tests/export-cjs.js | UTF-8 | 181 | 2.546875 | 3 | [
"MIT"
] | permissive | "use strict";
var get = function(obj, key) {
return obj[key];
};
var set = function(obj, key, value) {
obj[key] = value;
return obj;
};
exports.get = get;
exports.set = set; | true |
87c36d04c02959c67f4c9e4f543f6912b2f3d088 | JavaScript | michaelmichaeli/AppSus | /apps/books/cmps/LongTxt.jsx | UTF-8 | 1,366 | 2.765625 | 3 | [] | no_license | export default class LongTxt extends React.Component {
state = {
isLongTxtShown: false
}
get displayTxt() {
const { isLongTxtShown } = this.state;
const { text, length } = this.props;
const txtToShow = (isLongTxtShown || text.length <= length) ? text : text.substri... | true |
3217d7360f7e68cdd6e063d3112822fdfb915572 | JavaScript | FaycalBekhechi/SaveThisSession | /src/chrome/js/background/service/ChromeWindowsService.js | UTF-8 | 1,380 | 2.53125 | 3 | [] | no_license | /**
* Created with PhpStorm.
* User: Faycal
* Date: 18/03/2016
* Time: 14:07
*/
import chromise from 'chrome/js/lib/chromise';
import isArray from 'lodash/isArray';
import InvalidWindowTypeException from 'shared/js/exception/InvalidWindowTypeException';
export default class ChromeWindowsService {
supp... | true |
cb2c45774a53e5fd9ef5a5d67d8fbe14a7f46dee | JavaScript | bagrounds/resource-server | /lib/configure-process-listeners.js | UTF-8 | 841 | 2.875 | 3 | [
"MIT"
] | permissive | /**
* Set event handlers on a process.
*
* @module configure-process-listeners
*/
;(function () {
'use strict'
/* exports */
module.exports = configureProcessListeners
/**
*
* @param {Object} process to configure
*
* @return {Object} configured process
*/
function configureProcessListener... | true |
644fff4ec43c192d82098414dfb36448fc30187d | JavaScript | mbulamboma/PHP-Web-Application-MVC | /Web/js/ajax/step2.js | UTF-8 | 3,303 | 2.546875 | 3 | [
"MIT"
] | permissive |
jQuery(document).ready(function() {
/*
Fullscreen background
*/
$.backstretch("./images/default/american.jpg");
/*
Form validation
*/
$('.step2-form input[type="text"]').on('focus', function() {
$(this).removeClass('input-error');
});
//check the ... | true |
2a9cc1b43a5c7d6123139b2fe7471732e8f4c78e | JavaScript | danukaw/notes-node | /playground/json.js | UTF-8 | 1,011 | 3.265625 | 3 | [] | no_license | console.log("starting json");
/* let personObj = {
name : 'danuka',
age : 33,
occupation : 'Software engineer'
};
console.log(typeof personObj);
let personString = JSON.stringify(personObj);
console.log(typeof personString);
console.log(" PersonString ", personString);
let placesStr = '{"name" : "kubuk... | true |
4a30976a65cb9fa16f293147697a8b2a1ee2ecda | JavaScript | A-J-C/3D-classroom-2018 | /scripts/buffers.js | UTF-8 | 3,959 | 2.8125 | 3 | [] | no_license | /* File: buffers.js
* Author: mxcm21
* Date: 05/03/2018
* Version: 1.0.0
* Description: This file initialises all buffers needed for the classroom.
* A box is used as a fundamental building block to build all other
* objects, so only buffers for a cude are needed. Also creates texture buffers. */
var n;
fu... | true |
a86211f1c60f88d4bb3aa46a0b0d72e7abff8529 | JavaScript | ankitsinghwakefit/js_oop | /assignments/this.js | UTF-8 | 2,993 | 3.75 | 4 | [] | no_license | console.log(this.document === document); // Output - True
console.log(this === window); //Output - true
var myFunction = function() {
console.log(this);
};
myFunction(); // Output - window
function f1() {
"use strict";
return this;
}
console.log(f1() === window); //Output -false
function foo() {
console.lo... | true |
ab432eb0649f49815e78635489d413fb765f19c1 | JavaScript | pedromfnakashima/codigos_versionados | /Cursos e Vídeos/JavaScript/Curso completo do iniciante ao mestre - Daniel Morales (udemy)/057iife-menu.js | UTF-8 | 956 | 3.828125 | 4 | [] | no_license |
// function init() {
// let isValid = false
// console.log('init menu', isValid)
// }
// init()
//- Definindo função auto-invocável
// (function() {
// let isValid = false
// console.log('menu', isValid)
// function init(){
// console.log('init do menu')
// }
// init()
// })()
... | true |
a13ca3a17e76dc5d34f902b38193439af21e1953 | JavaScript | cbrake/snippets | /nodejs/wrapper.js | UTF-8 | 856 | 3.265625 | 3 | [] | no_license | sys = require('sys');
var p = function(a) {
sys.puts(sys.inspect(a));
}
var myfunc = function(a, b, c, callback) {
console.log("in original func, a = " + a);
p(arguments);
callback('all done');
}
// try wrapping a function, callback and passing on arguments
// callback is assumed to be last argument
var mywr... | true |
54e82cd5c6db6ad56266712eb80ebdcdf114c090 | JavaScript | caciuleanuciprian/practica | /js/news-2.js | UTF-8 | 3,586 | 3.359375 | 3 | [] | no_license | //--------------------------Close button-----------------------------
// First article
document.querySelector('#closeBtn-1').onclick = closeNews1;
function closeNews1() {
let news = document.querySelectorAll('.newsoverlay');
news.forEach((elem) => {
(elem.classList.add('hide'))
});
let space ... | true |
7a491bdf48f9fc87e8f75e89090c91f28eb9f89b | JavaScript | UchuNoKen/basic-algorithm-scripting | /015-mutations.js | UTF-8 | 631 | 4.34375 | 4 | [] | no_license | /**
*
* 015 - Mutations
*
* @param {Array} arr
*
*/
// Function starter code
function mutation(arr) {
return arr;
}
mutation(["hello", "hey"]);
// my arrow function declarative solution
let mutation = arr => {
return arr[1]
.toLowerCase()
.split("")
.every(character => {
return arr[0].toL... | true |
b8703f4045aa28e4293b1cea5f39563f32c26ecc | JavaScript | jrathod9/Canvas-Collection | /Catastrophe/code.js | UTF-8 | 1,984 | 3.453125 | 3 | [] | no_license | var canvas = document.getElementById('main');
canvas.width = 600;
canvas.height = 500;
var c = canvas.getContext('2d');
var max_particles = 50; //ALTER PARTICLES
function randomNumber(upper, lower) {
return (Math.random()*(upper-lower)+1)+lower-1;
}
var particle = function(x,y,vx,vy,ax,ay){
this.x = x;
this... | true |
b1c50eb3c06cf8bc3ba9d606af58dbeabf9c4550 | JavaScript | sam17896/react-training | /react-cli-project/src/components/7-Props/index.js | UTF-8 | 667 | 2.546875 | 3 | [] | no_license | import * as React from "react";
import "./index.css";
import AddForm from "./AddForm";
import Header from "./Header";
import TodoList from "./TodoList";
const todos = [
{
id: 1,
title: "task 1",
done: false,
},
{
id: 2,
title: "task 2",
done: false,
},
{
id: 3,
title: "task 3"... | true |
cb6584e6a235ac61d04f92dc8fb30b21be8adc31 | JavaScript | ghuiiu/PinYouGouByGorx | /pyg_cart_web/src/main/webapp/js/controller/cartController.js | UTF-8 | 3,366 | 2.625 | 3 | [] | no_license | app.controller('cartController',function ($scope, cartService) {
/**
* 获取购物车列表
*/
$scope.findCartListFromRedis = function () {
cartService.findCartListFromRedis().success(
function (response) {
$scope.cartList = response;
//每次查购物车的时候,求和
... | true |
bce430447413cd536e4450a632e0304c2352d49b | JavaScript | ayman-93/sevenDiamond | /src/components/Card.js | UTF-8 | 1,270 | 2.75 | 3 | [] | no_license | import React from 'react';
// import CardImg from '../Assist/cardsPic/7_of_diamonds.png';
const cards = [[], [], [], []];
for (let i = 6; i <= 13; i++) {
const diamond = require(`../Assist/cardsPic/${i}_of_diamonds.png`);
const heart = require(`../Assist/cardsPic/${i}_of_hearts.png`);
const spade = require(`../As... | true |
b7c7032de3be3137ce20244f5756cf2f0b12f483 | JavaScript | 1self/visit-counter | /assets/js/thanks.js | UTF-8 | 2,977 | 2.6875 | 3 | [
"MIT"
] | permissive | window.addEventListener("load", executeOnLoadTasks);
function executeOnLoadTasks() {
document.querySelector('#btn-yes').addEventListener('click', function(event) {
var $weekCountActive = $('.week-count-active');
var $weekCountTotal = $('.week-count-total');
var totalWeeks = 15;
var onIt... | true |
38f36a13b122e95466bd61e273c80ff3ea5b3015 | JavaScript | joisadler/leetcode | /src/solutions/0001_two-sum/index.js | UTF-8 | 401 | 3.265625 | 3 | [] | no_license | /**
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
// O(N)
const twoSum = function (nums, target) {
const hash = {};
for (let i = 0; i < nums.length; i += 1) {
const current = nums[i];
const complement = target - current;
if (hash[current] !== undefined) {
return [h... | true |
7d1a7596de56b7c01c5f96f507359bbfe3425174 | JavaScript | reactive93/node_express | /myapp/json_t.js | UTF-8 | 845 | 2.640625 | 3 | [] | no_license |
const jsonwebToken = require("jsonwebtoken");
const fs = require("readline");
user = {
login:"5",
password:"5"
};
var token = jsonwebToken.sign(user,"secret",{expiresIn:"600000"});
console.log(token);
var verify = jsonwebToken.verify(token,"secret");
console.log(verify);
const console1 = fs.createInterfa... | true |
75583469931511ab3c6f1f1dca57f802b93458b1 | JavaScript | kenchris/app-widgets | /data.js | UTF-8 | 1,970 | 2.75 | 3 | [] | no_license | (function(exports) {
'use strict';
function getRandomItem(array) {
return array[Math.floor(Math.random() * array.length)];
}
function generateFakeListData() {
var kNumberOfItems = 500;
var possibleAvatarColors = [
'BurlyWood', 'green', 'orange', 'salmon', 'lightblue', 'BlueViolet', 'DarkSeaGreen',
];
va... | true |
8326a705938601d87b1c066ee6457781a007e8ff | JavaScript | rBroneak/react-playground | /src/components/Parent.js | UTF-8 | 945 | 2.953125 | 3 | [] | no_license | import React from 'react';
import Child from "./Child";
import { Sibling } from './Sibling';
// STATEFULL COMPONENT UPDATING ITS CHILD AND RECEIVING UPDATES FROM CHILD
export default class Parent extends React.Component {
constructor() {
super();
this.state = {
name: 'Frarthur',
totalClicks: 0
... | true |
98935bf23c57a498ff40196e6295b7c568d60205 | JavaScript | trevorColby/trevorColby.github.io | /javascript/homepageAnimation.js | UTF-8 | 28,088 | 2.640625 | 3 | [] | no_license | //Only load in items on first launch
var carouselLaunched = 0;
var isHorizontal = true;
var verticalOffset;
var n = 0; //the number of cards we have
//check for vibrate support
navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
//Need to check if we are on ... | true |
5e0d15a46d051e2e01a9ae20dc09a2d46e1180f9 | JavaScript | mhohl/morphclock | /morphdemo_alle_glyphen.js | UTF-8 | 2,091 | 2.875 | 3 | [
"MIT"
] | permissive | /* morphdemo_allglyphs.js */
/*
* Wir verteilen die gesamten Pfade auf die drei Bereiche
* standalone, transition und clock:
*/
const standalone = {};
const transition = {};
const exampleWidth = "12.5%";
for (let key of Object.keys(Morph.path)) {
if (key.length < 3 && key != "~") { // 2a, 2b
standalone[k... | true |
8a46016d7100901f0cee3a5b7acd5a820522aa6e | JavaScript | Ankitchaudharyy/Season-Detector | /src/index.js | UTF-8 | 1,578 | 2.671875 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import SeasonsDisplay from './SeasonsDisplay';
import Spinner from './Spinner';
class App extends React.Component{
// constructor(props){
// super(props);
// this.state = {lat: null, errMessage: ''};
// window.navigator.geolocat... | true |
bfe9d5318a4dd5ae173d59d678d44601ac640114 | JavaScript | cristinagreche/info-cucei | /db/index.js | UTF-8 | 7,750 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* @Author: schwarze_falke
* @Date: 2018-10-22T21:03:42-05:00
* @Last modified by: schwarze_falke
* @Last modified time: 2018-10-27T05:42:19-05:00
*/
const mysql = require('mysql');
// FIXME La conexion a la base de datos deberia hacerse solo una vez
/**
* [DB class used for connection to the Database... | true |
4e714a9fcbf36bbb70569304b9a7d04b9ec033ed | JavaScript | nati-alvarez/codecompanions | /client/src/components/dashboard/projectListing/Application.js | UTF-8 | 3,201 | 2.546875 | 3 | [] | no_license | import React, {Component} from 'react';
class Application extends Component {
constructor(){
super();
this.state = {
showAll: false,
}
}
render(){
console.log(this.props.app)
return (
<div className="application">
<a href={`#/d... | true |
7fb1156a6510ebc39301bb53fa3cad5383a95d33 | JavaScript | mille449/Web-Encounter-Manager | /js/combatant.js | UTF-8 | 4,231 | 3 | 3 | [] | no_license |
var CombatantIDCounter = 0;
function Log(msg, className){
$("#log_container").append("<div class=\"log "+className+"\">"+msg+"</div>");
// hackish, but it works. real way would be to do more math.
$("#log_container").scrollTop($("#log_container").children().length * 20);
}
function Combatant(name, maxhp)... | true |
2bd4868a04bed75d94cbe8d963bfea5ae0717207 | JavaScript | cocoazreal/scx | /static/js/fix.js | UTF-8 | 12,602 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // 产品
function fixProduct(e)
{
var obj_x = e.parentNode.parentNode.childNodes;
var productNumber = obj_x[0].innerHTML;
var productName = obj_x[1].innerHTML;
var materialNumber = obj_x[2].innerHTML;
var mouldNumber = obj_x[3].innerHTML;
var companyNumber = obj_x[4].innerHTML;
var processNumbe... | true |
5892278eead19a1d83b0735aa0da779612adaa08 | JavaScript | MaximeDEFRETIN/JQueryP4E2 | /javascript.js | UTF-8 | 1,682 | 3.359375 | 3 | [] | no_license | $(function(){
$('#button').click(function(){
//J'entre la valeur de chaque input dans desvariables différentes
var average1 = $('#average1').val();
var average2 = $('#average2').val();
var average3 = $('#average3').val();
var average4 = $('#average4').val();
var average5 = $('#average5').val()... | true |
43e097880a3ebfb2c95a08919da171dbeca26f95 | JavaScript | arjot-rai/coffee-shop-application-node | /javascript/orderDisplay.js | UTF-8 | 1,876 | 3.03125 | 3 | [] | no_license | var myObj;
function generateOrderTable(xmlhttp){
myObj = JSON.parse(xmlhttp.responseText);
var table = "<table border='1' id='order-table'>";
table += "<tr><th>Order Number</th><th>Order Detail</th><th>Total Price</th><th></th></tr>";
for(row in myObj){
table += "<tr id='" + myObj[row]... | true |
a79e8b9f6455a67493142ada6c71a5ca71369568 | JavaScript | ammy2-eng/wpd_lab4 | /model/nedb.js | UTF-8 | 992 | 2.65625 | 3 | [] | no_license | const Datastore = require('nedb');
class DAO {
constructor(dbFilePath) {
if (dbFilePath) {
this.db = new Datastore({ filename: dbFilePath, autoload: true });
console.log("conected to : " + dbFilePath);
} else {
this.db = new Datastore();
console.log... | true |
8e99f377825a5ddd14b5b0390bc523124ae54ea8 | JavaScript | PuneetShivaay/Employee-Management-System | /public/getPassbook.js | UTF-8 | 1,357 | 2.75 | 3 | [] | no_license | var passbookUrl;
function getPassbook(e, fileName) {
var selectedFile;
selectedFile = e.files[0];
getPassbookfunction(selectedFile, fileName); // call below written function
}
function getPassbookfunction(selectedFile, fileName) {
var today = new Date();
var uuid = create_UUID();
... | true |
8fd17c7aadfff871d1c13271d4ce5409727ac158 | JavaScript | phungvu2012/DragonLearn | /views/JS/10_berries.js | UTF-8 | 19,540 | 2.828125 | 3 | [] | no_license | // JavaScript Document
// Các class OOP
// Các function
function outBox(objtail, objhead) {
objhead.style.left = "675px";
objtail.style.width = "170px";
objhead.style.width = "215px";
for (let i=1; i<460; i++) {
setTimeout( function timer(){
objtail.style.left = parseInt(objtail.style.left) + 1 + "px";
... | true |
f2be587da839e59e12e0f3d8f3a330a66d04f0cd | JavaScript | fsarda/FreakOut | /appMenu.js | UTF-8 | 1,258 | 2.75 | 3 | [] | no_license | //Define call-backs for menu buttons
function doButton() {
alert("Button clicked");
}
var buildMenuList = function() {
if(swipemenu) {
//Optional: override default menu height (default = 70px)
swipemenu.setMenuHeight(100);
//Required: Add menu buttons (can be text, images,... | true |
05a942b815a6ba16b691f1f2580d1617442ea7ab | JavaScript | jeffreyzhu604/Data-Structures-Algorithms | /interview prep/maintaining_ll_pointer.js | UTF-8 | 2,642 | 4.71875 | 5 | [] | no_license | /*
Problem: head and tail are global pointers to the first and last element, respectively, of a singly
linked list of integers. Implement C functions for the following prototypes:
bool delete(Element * elem);
bool insertAfter(Element *elem, int data);
The argument to delete is the element to be d... | true |
79ecb99deb490bca86e8edaa187b00c44249948b | JavaScript | SkNuwanTissera/HexSpeak | /public/controllers/order.mail.controller.js | UTF-8 | 4,072 | 2.53125 | 3 | [] | no_license | 'use strict';
angular.module('PharmacyApp').controller('OrderMailController', ['$scope', 'VendorService',
function ($scope, VendorService) {
$scope.selectedDrug;
$scope.selectedVendor;
$scope.selectedVendorEmail;
$scope.quantity=1;
$scope.description;
$scope.date = ... | true |
4edc81912041efa2f3f1a251282026a3b6466318 | JavaScript | banatiarpit97/javascript-data-structures | /arrays/sort_elements_by_frequency.js | UTF-8 | 571 | 3.4375 | 3 | [] | no_license | var a = [2,5,2,8,5,6,8,8];
function frequency(){
let map = {};
let result = [];
for(let i=0;i<a.length;i++){
map[a[i]] = map[a[i]]?map[a[i]]+1:1;
}
let n = Object.keys(map).length
for(let i=0;i<n;i++){
let max = 0;
let elem;
for(let e in map){
i... | true |
258beabec8abf68a31b16e550c415cfd4f68eae1 | JavaScript | sascha-lecours/react-redux-cardgame1 | /src/gameData/targetPlayer.js | UTF-8 | 469 | 2.96875 | 3 | [] | no_license | import { store } from '../app';
// Returns a copy of a random player, unless one is marked
export default () => {
const { playerGroup } = store.getState().game;
const markedPlayer = playerGroup.slice().filter(({ marked }) => marked > 0);
// If a player is marked, always return that one. If not, choose a random on... | true |
b9c110dddb1a2b60824486395e6fcfa5cab8b7f0 | JavaScript | vane1995/JavaScript_Calculadora | /funciones.js | UTF-8 | 1,118 | 4.21875 | 4 | [] | no_license | /*
var sumar =function (a,b,c=3) {
return a+b+c;
}
var resultado = sumar(3,2,4);
var resultado1 = sumar(3,2);
console.log(resultado);
console.log(resultado1);
*/
//FUNCIONES RECURSIVAS
/*var factorial= function (n) {
if ((n==0) || (n==1)) {
return 1;
}else{
return (n*factorial(n-1));
... | true |
ef2ece7a340d8caa56fa97a2a75b6dd70367fe17 | JavaScript | Raghad64/Project4-Private-Blockchain-Notary-Service | /Mempool.js | UTF-8 | 3,076 | 2.671875 | 3 | [] | no_license | const bitcoinMessage = require('bitcoinjs-message');
const TimeoutRequestWindowTime = 5*60*1000;
const TimeoutValidWindowTime = 30*60*1000;
class Mempool{
constructor(){
this.mempool = [];
this.timeoutRequest = [];
this.mempoolValid = [];
this.timeoutValid = [];
//this.addRequestValidation();
}
//A ... | true |
bfdfc14abbcc64c5a4475da4d88e3a4a7d737044 | JavaScript | moeenah/wk1d4 | /map.js | UTF-8 | 430 | 3.734375 | 4 | [] | no_license | var words = ["ground", "control", "to", "major", "tom"];
function map (array, func) {
var newWords = [];
array.forEach(function(word, iteration) {
newWords.push(func(word));
});
console.log(newWords);
return newWords;
}
map(words, function(word) {
return word.length;
});
map(words, function(word) {
... | true |
acd41026b58cbd9b7154c49f6d0a77e0ca3dfdad | JavaScript | timnie123/learn-koa | /server/utils/srcToimg.js | UTF-8 | 1,408 | 2.640625 | 3 | [
"MIT"
] | permissive | const http = require('http');
const https = require('https');
const fs = require('fs');
const path = require('path');
const {promisify} = require('util');
const writeFile = promisify(fs.writeFile);
module.exports = async (src, dir, fileName) => {
if (/\.(jpg|png|gif)$/.test(src)) {
await url2Img(src, dir, fileN... | true |
e8d72a52d69a6ddf0101105ba02cfa43006b786f | JavaScript | emanuel-sceppaquercia/Minesweeper-game | /app.js | UTF-8 | 8,530 | 3.609375 | 4 | [] | no_license | document.addEventListener('DOMContentLoaded', () => {
const board = document.querySelector('.board');
let width = 10;
let mines = 20;
let flags = 0;
let lose = false;
let win = false;
let squares = [];
// create Board
function createBoard(){
// create a new array with the t... | true |
063e9a74627a55208a14e534d3be153263350517 | JavaScript | chuy99/7-de-marzo | /sketch.js | UTF-8 | 432 | 2.875 | 3 | [] | no_license | var pelotas=[];
function setup() {
createCanvas(400, 400);
//p1 = new Ball();
//p2 = new Ball();
for(var i=0; i<100; i++){
pelotas[i] = new Ball()}
}
function draw() {
background(220);
for(var i=0; i<pelotas.length; i++){
pelotas[i].mostrar();
pelotas[i].moverx();
pelotas[i].movery();
if (pe... | true |
027062c5ec1276fd7b7ddac14514b2490b6c5f57 | JavaScript | Dwabzy/Chatroom | /routes/userAuth.js | UTF-8 | 4,409 | 2.796875 | 3 | [] | no_license | const md5 = require('md5');
const userAuthFunctions = require('../files/userAuthFunctions');
class UserAuth {
constructor(app) {
this.login(app);
this.signup(app);
this.deactivateAccount(app);
}
login(app) {
app.post('/login', async (req, res) => {
let userna... | true |
c0ab52efd06c22bfcc0f6aa8aa8918b08febcac9 | JavaScript | chingu-voyage5/Geckos-Team-11 | /server/test/users.js | UTF-8 | 5,206 | 2.796875 | 3 | [
"MIT"
] | permissive | // valid: simple
const user1 = {
"username": "Gleider1",
"password": "abc1234",
"name": "Gleider Mackedanz",
"email": "gleider1@gmail.com"
}
// invalid: without email
const user2 = {
"username": "Gleider2",
"password": "abc1234",
"name": "Gleider Mackedanz2"
}
// invalid: already have the username
const ... | true |
fed40d846cb6b6f37145212949730c039dbb8b7a | JavaScript | kmmcc/command-line-tic-tac-toe | /server/index.js | UTF-8 | 819 | 3.46875 | 3 | [] | no_license | //require express
//require prompt
//set up simple express server
//make a function (class) that returns/console.logs a matrix/the board
//use prompt to take in user inputs
//the players switch each turn
//use a turn counter or turn boolean
//the prompts callback returns a new board with the players input pas... | true |
c662984f9c7f2071545324351fe1ec61c3343c72 | JavaScript | larguar/code-quiz | /js/main.js | UTF-8 | 9,316 | 3.40625 | 3 | [] | no_license | // pulls score list <ul>, creates a starter array, and pulls scores from local storage
var ul = document.querySelector('#score-list');
var noScores = document.querySelector('.no-scores');
// starts array empty
var scoresArray = [];
// if elements are stored, update array with local storage items
var storage = JSON.pa... | true |
4ef78a4578da6985aa97f53c65bbdc48e10c367a | JavaScript | billbunkum/nodeJSTutorial | /playground/arrow-function.js | UTF-8 | 761 | 4.46875 | 4 | [] | no_license | // ARROW FUNCTIONS
// STATEMENT SYNTAX
let square = (x) => {
let result = x * x;
return result;
};
// EXPRESSION SYNTAX
let exp_square = (x) => x * x;
console.log(square(9));
console.log(exp_square(7));
// `this` IS NOT BOUND IN ARROW FUNCTIONS
// arguments array IS ALSO NOT BOUND
// ES6 PROVIDES A WORK-AROUND
le... | true |
75c4b3697fa72e791958433f3194251c1d4910ba | JavaScript | SriSowmyaReddy/DiceGame | /app.js | UTF-8 | 3,440 | 3.453125 | 3 | [] | no_license |
var scores, totalScore, activePlayer, dice, gamePlaying;
init();
document.querySelector('.dice').style.display='none';
//addEventListener has two arguments
document.querySelector('.btn-roll').addEventListener('click', function(){
if(gamePlaying){ //if only we are palying
//generate a random number
... | true |
fadd622ef03e67b093b6416f102a32a1923ed405 | JavaScript | oneido/1.dashboard | /dashBoard.js | UTF-8 | 3,796 | 2.828125 | 3 | [] | no_license | let options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
var crd = pos.coords;
console.log('위치를 확인하여 API 통신을 시작합니다. ');
return getWeather(crd.latitude, crd.longitude);
};
function error(err) {
console.warn('ERROR(' + err.code + '): ' + err.message... | true |