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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
95d024883a200c4ce434f085638291a0e36981f6 | JavaScript | camplight/organic-oval-benchmarks | /client/common/timers-stats.js | UTF-8 | 881 | 3.015625 | 3 | [] | no_license | var testCount = 0
var count = 0
var startTime
var endTime
var buffer = []
module.exports.capture = function () {
count += 1
}
module.exports.init = function (amount) {
startTime = window.performance.now()
var intervalID = setInterval(function () {
endTime = window.performance.now()
var time = endTime - ... | true |
f667a2ee9faffeae95eb539d20337b695383e059 | JavaScript | RumRogers/MemoryGame_JS | /js/src/audioplayer.js | UTF-8 | 1,671 | 2.90625 | 3 | [] | no_license | function AudioPlayer()
{
this.audioResources = {}; // Hashmap audioId->audioResource
var _currentFX;
var _bgMusic;
this.playFX = function(audioResId)
{
if(!AudioPlayer["SFX enabled"])
return;
if(_currentFX)
_stopAudio(_currentFX);
_currentFX = this.... | true |
0667e570d3003107b34f421c9247a97ffcd7f0ed | JavaScript | davemilne-london/ReactApp | /src/components/Course.js | UTF-8 | 1,229 | 2.8125 | 3 | [] | no_license | // src/components/CourseInput.js
import React, {useState} from "react";
import CourseDisplay from './CourseDisplay.js';
import './Course.css';
const CourseControls = props => {
const [courseName, setCourseName] = useState('');
const [courses, setCourses] = useState([]);
const inputBox = React.creat... | true |
76f7998ca38b473e2313fc20896b42b48d21d343 | JavaScript | margueriteblair/Javascript-Algorithms | /dropelements.js | UTF-8 | 1,123 | 3.65625 | 4 | [] | no_license | function dropElements(arr, func) {
for (var i = 0; i < arr.length; i++) {
if (func(arr[0])) {
break;
} else {
arr.shift();
console.log(arr)
}
}
return arr;
}
// dropElements([1, 2, 3, 4], function(n) {return n > 5;})
function dropElements2(arr, func) {
... | true |
cd8b76ae4d996954e284fd7e965e04ac77274d0f | JavaScript | nsisodiya/canva-challenge | /client/common/sequentialExec.js | UTF-8 | 294 | 2.546875 | 3 | [] | no_license | define("sequentialExec", function () {
const sequentialExec = function (arr, callback) {
var pp = Promise.resolve();
arr.forEach(function (v, i, A) {
pp = pp.then(function () {
return callback(v, i, A);
});
});
return pp;
};
return sequentialExec;
});
| true |
87121316fe1e860f538265c9d13b4260f9ff856a | JavaScript | kl32/address-book | /addressbook.js | UTF-8 | 871 | 3.484375 | 3 | [] | no_license | "use strict";
let userData = [];
function fetchRequest(url) {
return fetch(url)
.then(res => res.json())
.catch(err => console.log("Something went wrong"));
}
fetchRequest("https://randomuser.me/api/")
.then(data => {
console.log(data);
const image = data.results["0"].pict... | true |
8e6da5857b4e19de0eed439fad87ee66ed94ff90 | JavaScript | lxyc/practice | /10-RegExp/chapter01/03-量词.js | UTF-8 | 525 | 4.15625 | 4 | [] | no_license | // {m,} 至少出现m次
// {m} 出现m次
// ? === {0,1} 出现或者不出现
// + === {1,} 至少出现1次
// * === {0,} 出现任意次,有可能不出现
const str = '123 1234 12345 123456'
// 贪婪匹配,尽可能多的匹配
const regex = /\d{3,}/g
console.log(str.match(regex))
// 惰性匹配,满足条件即可
const regex1 = /\d{3,}?/g
console.log(str.match(regex1))
/**
* 量词后面加个问号就能实现惰性匹配,以下是所有的惰性匹配情形
* ... | true |
1993662f2a059ffe035ea2826728e3bc7ee0281e | JavaScript | mmrsky/VEOH-harjoitus | /controllers/auth_controller.js | UTF-8 | 1,943 | 2.578125 | 3 | [] | no_license |
const userModel = require('../models/user-model');
// User handler
const handleUser = (req, res, next) => {
if (!req.session.user) {
return next();
}
userModel.findById(req.session.user._id).then((user) => {
req.user = user;
next();
}).catch((err) => {
console.log(err);... | true |
b0e06ef745dc975a9ad26db4734ad05ef029f53a | JavaScript | L-Zheng/ZHJSNative | /ZHJSNative/JSNative/Js/event.js | UTF-8 | 14,147 | 3.078125 | 3 | [
"MIT"
] | permissive | /** js语句必须带有 ; 注释方式使用带有闭合标签的
* 【iOS原生是把该文件读取成字符串执行,没有结束标志js代码出错】
* var变量的作用区域 当前function上下文
*/
/** ❌ios9 特殊处理
* 不识别 let变量、() => {}箭头函数 、function函数不能有默认值 如:function(params = {})() 、多参数函数 function (...args)
* 识别 const、 var、 function(){}
* 如果当前function里面又调用了其他function var作用域不会延伸到其它function
* 如果当前... | true |
43fc5a12cb2a0db4a4f37c8c1d6dd970ae3fd1c2 | JavaScript | preetisahani16/Youtube-Analyser | /youtube.js | UTF-8 | 1,906 | 2.71875 | 3 | [] | no_license | //https://www.youtube.com/watch?v=F8xQ5joLlD0&list=PL-Jc9J83PIiFj7YSPl2ulcpwy-mwj1SSk
//https://www.youtube.com/playlist?list=PL-Jc9J83PIiFj7YSPl2ulcpwy-mwj1SSk
const puppeteer = require("puppeteer");
let page;
let url = process.argv[2];
(async function () {
let browser = await puppeteer.launch({
headl... | true |
6c419c75abc72aed63ec5392cd0686f27d0ff4a3 | JavaScript | drakotech/git | /show-notes/git-branch-workflow.js | UTF-8 | 1,227 | 2.875 | 3 | [] | no_license | /* Basic Git Branching Workflow
git branch
//* master
Shows what branch you are on, on your local machine. The
asterisk means you are on the master branch.
git checkout -b readme-styling
//Switched to a new branch 'readme-styling'
checkout is the command to use when creating a new branch.
readme-styli... | true |
76de7f929598fc8bda831470563d411fbf87a0b5 | JavaScript | JaxonBarker/HRUS | /DevMountain/unit5/skills2/shelfie/src/Components/Form/Form.js | UTF-8 | 834 | 2.65625 | 3 | [] | no_license | import React from "react";
import axios from 'axios';
class Form extends React.Component {
constructor() {
super();
this.state = {
name: "",
price: 0,
imgurl: ""
};
}
handleInput = (val) => {
this.setState({
name: val,
price: val,
imgurl: val
})
}
ad... | true |
dad1a42cdd27586bfc9d9228d8af06fb98d6fefc | JavaScript | DevPedroA78/Tarea-File-system | /appendFile.js | UTF-8 | 381 | 3 | 3 | [] | no_license |
// SINTAXIS: fs.appendFile(path, data[, options], callback)
// CONCATENA el contendio de este archivo al FINAL del original
const fs = require('fs')
fs.appendFile('creato.txt', 'Hola desde el file de de appendFile.', 'utf-8', (error) => {
if(error) {
console.log('Error de appendFile: ', error)
r... | true |
3e9da8f6eaf139bf1b3827db1a9920079c4bd3d3 | JavaScript | bluesophia/selfstudy | /180207-nodejs/http_server.js | UTF-8 | 952 | 3.0625 | 3 | [] | no_license | var http = require('http'); // CommonJS 방식 http 모듈 가져오기 (AMD, CommonJS)
var hostname = '127.0.0.1'; //ip설정
var port = 8080; //port설정
/*여기서 port라는 개념이 등장하는데요 간단히 말씀드리면 웹서버와 연결되는 문이라고 생각해주세요.
우리 컴퓨터의 port는 0번부터 65535개의 port가 존재합니다.
우리가 localhost:8080 으로 접속을 하게되면
컴퓨터가 이해하기론 localhost = 127.0.0.1이라고 인식을 합니다.
뒤이어 몇번째 문으로 들... | true |
7783ae885699f1422af17146b8be3569827ff092 | JavaScript | bazaarvoice/cloudbreak | /mock/cloudbreak/service/InfoService.js | UTF-8 | 1,005 | 2.546875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"ANTLR-PD",
"CDDL-1.0",
"bzip2-1.0.6",
"Zlib",
"BSD-3-Clause",
"MIT",
"EPL-1.0",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-jdbm-1.00",
"Apache-2.0"
] | permissive | 'use strict';
exports.getCloudbreakInfo = function() {
return new Promise(function(resolve, reject) {
var examples = {};
examples['application/json'] =
{
"app":
{
"name":"cloudbreak",
"version":"MOCK"
... | true |
a374fcc6d287c596b3f2d5c471b7b03c72c709fd | JavaScript | fuqqnl/node-login | /login-3/client/public/js/ajaxSubmit.js | UTF-8 | 1,726 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* @file 用ajax进行form表单的提交
*/
(function () {
$('body').on('click', '#login .button-sign-in', function () {
// 登录
var username = $('.username').val();
var password = $('.passwd').val();
var remenber = $('#remenber').is(':checked');
var url = '/userLogin';
$.ajax({
... | true |
9a58ed1aef35379d37adc83f997bfb5972c8706f | JavaScript | mrpachara/chatbot-app-webpack | /src/app/api-client/send-fetch.js | UTF-8 | 838 | 3.0625 | 3 | [] | no_license | 'use strict';
/**
* Request to specified URL with the given method.
*
* @param {string} url URL to be sent to.
* @param {string} method HTTP method.
* @param {*} [data] The data to be sent. For GET method it will be converted to query string.
* @param {{[key: string]: *}} [headers] The request headers.
*
* @... | true |
7da12116855afde5eb9130a3352b047a59a27fb7 | JavaScript | VigneshMurugan/30-seconds-of-code | /test/squareSum.test.js | UTF-8 | 419 | 2.671875 | 3 | [
"CC0-1.0"
] | permissive | const {squareSum} = require('./_30s.js');
test('squareSum is a Function', () => {
expect(squareSum).toBeInstanceOf(Function);
});
test('squareSum returns the proper result', () => {
expect(squareSum(2, 3, 4)).toBe(29);
});
test('works with negative numbers', () => {
expect(squareSum(-2, 3, -4)).toBe(29);
});
t... | true |
767b061ac8853c6c5e6c738f47fd0f0f478e79dd | JavaScript | applezest/scoreboard | /src/pages/Scoreboard.js | UTF-8 | 1,271 | 2.5625 | 3 | [] | no_license | import React from 'react';
import Header from "../components/Header";
import {CustomPlayer} from "../components/CustomPlayer";
import AddPlayerForm from "../components/AddPlayerForm";
import {connect} from "react-redux";
import '../index.css';
import styles from './Scoreboard.module.css'
class Scoreboard extends Reac... | true |
5a2f24ded86fffc278c7ac3bf81233690a0839a1 | JavaScript | blairacuda/inittrack | /src/utilities/BeastDispatcher.js | UTF-8 | 2,741 | 2.96875 | 3 | [] | no_license | import React, {useReducer} from 'react';
export const BeastDispatch = React.createContext(null);
export function BeastDispatcher(){
const [characterList, dispatch] = useReducer((state, action)=>{
switch(action.type){
case 'initial':
return [
...state,
getInitialCharacter(... | true |
ae706998a9670238cc2f8784f2ff061c943f6ba7 | JavaScript | Offirmo/offirmo-monorepo | /stack--2021/Z-tosort/2017/the npm rpg v1/interactive_mode/ask_question.js | UTF-8 | 451 | 2.96875 | 3 | [
"CC0-1.0",
"MIT",
"Unlicense"
] | permissive | // https://nodejs.org/api/readline.html
const readline = require('readline')
let rli = readline.createInterface({
input: process.stdin,
output: process.stdout
})
function ask_question(question) {
return new Promise((resolve, reject) => {
rli.clearLine(process.stdout, 0)
rli.question(question + '\n', answer => ... | true |
f14925809b16740b5407e7b4160d06981cb7523e | JavaScript | HCDevid/exercism-solutions | /javascript/pangram/pangram.js | UTF-8 | 549 | 3.671875 | 4 | [] | no_license | var Pangram = function(sentence) {
this.sentence = sentence; //sentence has to be made a property upon variable initialization
};
Pangram.prototype.isPangram = function () {
var cleanedSentence = this.sentence.toLowerCase();
var alphabet = "zqxjkvbpygfwmucldrhsnioate";
var pangramState = true; //true by default, f... | true |
7e4d105e7008ea185b5e7d4a01486ac580ef7e72 | JavaScript | domtriola/appacademy | /projects/w5d4/asynchronous_js/tic-tac-toe/playScript.js | UTF-8 | 729 | 3 | 3 | [] | no_license | const Game = require('./game.js');
const Board = require('./board.js');
const Player = require('./humanPlayer.js');
const readline = require("readline");
const reader = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
let completionCallback = () => {
reader.question... | true |
72db57e0a0f05c92e082b81221a187ca7e5a5632 | JavaScript | warwick-one-metre/dashboard | /static/fetch-logs.js | UTF-8 | 1,477 | 2.90625 | 3 | [
"MIT"
] | permissive | var lastLogMessageId = 0;
function updateLog(messages) {
if (messages) {
var length = messages.length;
for (var i in messages) {
var message = messages[length - i - 1];
var row = $('<tr>');
if (message[2] == 'warning')
row.addClass('text-warning');
if (message[2] == 'error')
... | true |
d5055e965ca995f5a66ed9910fd53e22254599ee | JavaScript | muncman/muncman.github.io | /js/temp.js | UTF-8 | 566 | 3.265625 | 3 | [
"MIT"
] | permissive | /* For use with errorHandling.html */
function handleErr(msg, url, line) {
var txt = "There was an error on this page.<br /><br />";
txt += "Error: '" + msg + "'<br />";
txt += "URL: " + url + "<br />";
txt += "Line: " + line
output = document.getElementById("error");
output.innerHTML = txt;
... | true |
c06949b9fb674db5351ba09979a98cf22bd9e0df | JavaScript | hamoghamdi/reactnd-project-would-you-rather | /src/actions/shared.js | UTF-8 | 1,394 | 2.59375 | 3 | [] | no_license | import { receiveUsers, addUserQuestion, addUserAnswer } from './users'
import { receiveQuestions, addQuestion, addAnswer } from './questions'
import { setAuthedUser } from './authedUser'
// import from api
import { getInitialData, saveAnswer, saveQuestion } from "../utils/api"
export function handleInitialData(authedI... | true |
56d0f23f98b633617dc44b633241cdcea4a9072e | JavaScript | NomiDomi/techstudium | /client/src/Components/Answer/index.js | UTF-8 | 493 | 2.625 | 3 | [] | no_license | // Import the style for the component
import './index.css';
function Answer(props) {
const answer = props.answer;
const buttonClasses = props.selected ? 'answer selected' : 'answer'
return (
<div className="answer-container">
<button
value={answer.isCorrect}
className={but... | true |
41a2439476d90557c9794bf577c8f842611b5934 | JavaScript | JollyRay/PAIlab3 | /src/main/webapp/resources/scripts/validate.js | UTF-8 | 585 | 3 | 3 | [] | no_license | function proverka2(input) {
let value = input.value;
let rep = /[0-9]/;
if (value!=="-")
if (rep.test(value)) {
value = /-?[0-9]+[\.\,]?[0-9]*/.exec(value);
input.value = value;
}else{
input.value ='';
}
let val = Number(input.value);
let placeFromMessage = do... | true |
047a4e5aa6b93e0d6d505ac9446ad2882ee43ba4 | JavaScript | pauly-van/data-structures | /sprint-two/src/linkedList.js | UTF-8 | 2,501 | 4.1875 | 4 | [] | no_license | var LinkedList = function() {
var list = {};
list.head = null;
list.tail = null;
list.addToTail = function(value) {
let newNode = Node(value); // create new node
if (list.tail === null && list.head === null) { // when there are no nodes in our list container
list.head = newNode;
//list.he... | true |
3329355aabc337f72768087757c299620466fc5b | JavaScript | yousgoose/NYCDAAngularJs | /Assignment2/sandbox.js | UTF-8 | 5,740 | 2.640625 | 3 | [] | no_license | angular.module('MyApp', [])
.controller('YourController', function ($timeout, $interval) {
var self = this;
self.turn = 'user';
self.startGame = 0;
self.gameCount = 1; //level
self.loopCount = 0;
self.readState = 0;
self.firstPlay = 0;
self.userArray = [];
self.simonArrayCopy = [];
... | true |
d579399c5b4180404bffd1aa004f9f79e29e8edb | JavaScript | KlannerZeta/arythmetic_expression_parser | /PAE.js | UTF-8 | 7,082 | 2.984375 | 3 | [] | no_license | function PAE(string){
//FUNCTIONS DECLARATIONS::
function apply(f, array){
return reduce(array.slice(1), f, array[0]);
}
function sum(init, current){
if ( isNaN(init) && isNaN(current) ) {
throw 'FATAL ERROR AT PLUS';
} else if ( isNaN(init) ){
return current;
} else if ( isNaN(current) ) {
retur... | true |
375cf0f8971641823741091620865ddf41536f4a | JavaScript | ing-bank/lion | /packages/ui/components/localize/src/number/utils/normalSpaces.js | UTF-8 | 296 | 3.3125 | 3 | [
"MIT"
] | permissive | /**
* @param {string} value
* @returns {string} value with forced "normal" space
*/
export function normalSpaces(value) {
// If non-breaking space (160) or narrow non-breaking space (8239) then return ' '
return value.charCodeAt(0) === 160 || value.charCodeAt(0) === 8239 ? ' ' : value;
}
| true |
ac69642f7dc8368ebb078c84602a35d36c0ff590 | JavaScript | MastersAcademy/js-course-2018 | /homeworks/alexander.chunarev_AlexanderChunarev/homework_2/Palindrom.js | UTF-8 | 223 | 3.578125 | 4 | [
"MIT"
] | permissive | function checkPalindrom(str) {
return str === str.split('').reverse().join('');
}
for (let i = 500; i <= 1000; i++) {
if (checkPalindrom(i.toString())) {
console.log(`The digit ${i} is palindrome`);
}
}
| true |
e667129b4761e86bf8e4cb7a54c0210308899de8 | JavaScript | Tenari/planner | /imports/ui/components/Goal.jsx | UTF-8 | 1,146 | 2.578125 | 3 | [] | no_license | import React, { Component, PropTypes } from 'react';
import ReactDOM from 'react-dom';
import { Goals } from '../../api/goals.js';
import Step from './Step.jsx';
// App component - represents the whole app
export default class Goal extends Component {
renderSteps() {
const that = this;
return <ul>
{
... | true |
87654b3ba5606d04e9480766994354ffce7454a5 | JavaScript | Rahul10159683/WebSite1 | /PrecompiledWeb/WebSite1/JScript2.js | UTF-8 | 606 | 3.390625 | 3 | [] | no_license | var myIndexx = 0;
var myIndexy = 0;
ticker();
function ticker() {
var x = document.getElementsByClassName("ticker1");
var y = document.getElementsByClassName("ticker2");
for (var i = 0; i < x.length; i++) {
x[i].classList.remove("active");
}
for (var i = 0; i < y.length; i++) {
y... | true |
728809067127c9b7817e7d28d53db300a66abbd4 | JavaScript | thomasobadia/online_music_tool | /scripts/room.js | UTF-8 | 6,163 | 2.703125 | 3 | [] | no_license | /**
* ROOM CONNECTION AND SOCKET HANDLING
*/
var socket = io.connect('https://harmonyngal.ovh:8080/', { secure: true })
const button = document.querySelector('#button')
const $validate = document.querySelector('#validate')
// Removing anchor
const removeElement = (id) => {
var elem = document.getElementById(id... | true |
5c8fae175aaac585b7275acc0204e2ccd39679bb | JavaScript | Frias115/JuegoCorazon | /src/js/game.js | UTF-8 | 2,476 | 2.578125 | 3 | [] | no_license | (function() {
'use strict';
function Game() {
this.player = null;
this.jumpTimer = 0;
this.bulletTimer = 0;
this.layer;
}
Game.prototype = {
create: function () {
var x = this.game.width / 2
, y = this.game.height / 2;
this.physics.startSystem(... | true |
cc745196ddd1b00180720ccbd8fe7850b24fae96 | JavaScript | Mbur1988/Extended_API_Mashup | /public/javascripts/index.js | UTF-8 | 559 | 3.09375 | 3 | [] | no_license | // Navigate to trending route when event triggered
const go = (event) => {
window.location.href = window.location.origin + '/trending/' + input.value;
}
// Add event listners to the search button and link enter key press
const button = document.getElementsByClassName("search")[0];
const input = document.getEl... | true |
630cba0398d1d4eb2ffb155b83486efe297404d3 | JavaScript | ejames9/Algorithms | /JavaScript/repeatStringNumTimes.js | UTF-8 | 568 | 4.125 | 4 | [] | no_license | /*
repeatStringNumTimes.js
This is an algorithm that takes a string and a number as arguments, repeats The
string `num` number of times and concatenates the duplicates into one string...
Eric James Foster, MIT License..
*/
function log(str) {
return console.log(str);
}
function repeatStringNumTimes(str, num) {... | true |
a63ac2302d086a43c959f9a9bb6f910ad7584c52 | JavaScript | SpaceAppsPOA2014/gravity-bird | /public/app/js/app.js | UTF-8 | 1,111 | 2.609375 | 3 | [] | no_license | var map = new Map('map', [sidebar]),
api = new API('/'),
popup = map.createPopup();
map.setView([51.505, -0.09])
map.onLocate(function(location){
var marker = location && map.addMarker([location.Y, location.X]);
marker.bindPopup("Loading Geoid Height").openPopup()
api.geoid(location.Y, location.X, functio... | true |
51000a6def3bd769041a9eb3f76825e5f8e61255 | JavaScript | MozhdeAmiri/Mozhi_Hospital | /api/controllers/restPatientController.js | UTF-8 | 5,867 | 2.765625 | 3 | [
"CC0-1.0"
] | permissive | const Patient = require('../../models/patient');
const async = require('async');
const Surgery = require('../../models/surgery');
const { body, validationResult } = require('express-validator/check');
const { sanitizeBody } = require('express-validator/filter');
// Display list of all Patients.
exports.patient_list =... | true |
a6f950f25c497ef65961808f16b90339d791bb80 | JavaScript | codentacos/MiniApp1-TicTacToe | /app.js | UTF-8 | 5,615 | 3.453125 | 3 | [] | no_license |
//----------------------------------------------//
// MODEL - HANDLES DATA AND STATE OF GAME
//----------------------------------------------//
const td = document.getElementsByTagName('td');
const table = document.getElementsByTagName('table')[0];
const resetbtn = document.getElementsByClassName('reset')[0];
const xW... | true |
6fc498844993ee7d01951166f9059f8b72db1921 | JavaScript | hariom127/react-redux | /src/redux/feature/featureReducer.js | UTF-8 | 400 | 2.625 | 3 | [] | no_license | import { FEATURE_BUY } from './featureTypes'
const initialState = {
numOfFeature : 30
}
const featureReducer = (state = initialState, action) => {
switch (action.type) {
case FEATURE_BUY: return {
...state,
numOfFeature : state.numOfFeature - 2
... | true |
4e6dfdbe258cc3133e0024dc411be7dd5b127ec6 | JavaScript | h8rt3rmin8r/h8rt3rmin8r | /js/Etherscan-WebSocket.js | UTF-8 | 2,929 | 2.640625 | 3 | [] | no_license | var ws;
var socketurl;
if (location.protocol === 'https:') {
socketurl = "wss://" + "socket.etherscan.io" + "/wshandler";
} else {
socketurl = "ws://" + "socket.etherscan.io" + "/wshandler";
}
$().ready(function () {
//disable the certain buttons until a successfull connection is made
$("#btnDisconnec... | true |
16e762288b155435f29661f6af9ac26b0f0944c9 | JavaScript | kkdung/todayquiz-server | /models/NuguRes.js | UTF-8 | 1,579 | 2.875 | 3 | [
"MIT"
] | permissive | /*
Builder 패턴으로 Response 세팅 해주는 DTO
*/
// const audioPlayerDirective = require('./audioPlayerDirective');
// const displayDirective = require('./displayDirective');
class NuguRes {
constructor() {
this.version = "";
this.resultCode = "OK";
this.output = {};
this.directives = [];
//req = new nug... | true |
f1348720051cd0779e96cf52e8f43aa9fd2abd3d | JavaScript | build-farm-fresh-produce/back-end | /auth/auth-router.js | UTF-8 | 2,335 | 2.6875 | 3 | [] | no_license | const router = require('express').Router();
const Auth = require('./auth-model.js');
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
const secrets = require('../config/secrets.js');
router.post('/register', async (req, res) => {
const data = await Auth.addUser(req.body)
try {
... | true |
4e17da0d0728cea6983479e59392aab0a7340f04 | JavaScript | ryan87ly/shipid | /frontend/server/controllers/connector.js | UTF-8 | 2,829 | 2.546875 | 3 | [] | no_license | var moment = require('moment');
var PluginStatus = require('./pluginstatus');
var plugins = {};
var ulutil = require('./util.js');
var util = require('util');
var Connector = function(server, mqClient){
var self = this;
this.io = require('socket.io')(server);
this.mqClient = mqClient;
mqClient.subscribe('log');
... | true |
ed47434ce1fc80fae1f23f6a34b3d30ece2a9ad8 | JavaScript | james-401-advanced-javascript/data-structures-and-algorithms | /challenges/arrayShift/__tests__/array-shift.test.js | UTF-8 | 312 | 2.5625 | 3 | [] | no_license | 'use strict';
let insertShiftArray = require('../array-shift');
describe('shift array', () => {
it('inserts value in middle of array', () => {
expect(insertShiftArray([2,4,6,8], 5)).toEqual([2,4,5,6,8]);
expect(insertShiftArray([4,8,15,23,42], 16)).toEqual([4,8,15,16,23,42]);
});
});
| true |
cec994f2e3da55e62bd42aabdee86fb4ad5d3e41 | JavaScript | d-saravanan/react-sample-app | /src/Components/counter.jsx | UTF-8 | 2,350 | 2.796875 | 3 | [] | no_license | import React, { Component } from "react";
import { link } from "fs";
class Counter extends Component {
constructor(props) {
super(props);
this.state = {
id: this.props.data.id,
value: this.props.data.initValue,
imageUrl: "https://picsum.photo/150",
imageAlt: "Random Photo",
tags... | true |
2dd179bb3aa3face003f90983b8f2f9126294c73 | JavaScript | vianarafael/rafachess | /src/piecesLogic/knight.js | UTF-8 | 4,851 | 2.75 | 3 | [] | no_license | import { Piece } from "../piecesStyles";
import { useContext } from "react";
import { BoardContext } from "../App";
const Knight = ({ color }) =>
{
const { board, setBoard, turn, setTurn, playerColor } = useContext(
BoardContext
);
function selectOptionsKnight(
x,
y,
[
... | true |
8eb07571d3a6daf647c945bb9cb7d1bc8400f14f | JavaScript | akshayatuldeshmukh31/cardstax-node-server | /app/server_starter.js | UTF-8 | 3,222 | 2.546875 | 3 | [] | no_license | /*
*********************************************************************************
File - server_starter.js
This file contains the functions to start the Express server and the MongoDB
server. Since, this is the main intialization file, Mongo variables will also be
initialized in this file.
******************... | true |
3471b533cab04f304c59c0219da3fe633aa90395 | JavaScript | fehmer/simple-exiftool | /test/index.js | UTF-8 | 5,264 | 2.515625 | 3 | [
"MIT"
] | permissive | "use strict";
const Fs = require("fs");
const Path = require("path");
const Exec = require("child_process").exec;
const Expect = require("chai").expect;
const Exif = require("..");
describe("giving invalid paths to exiftool", () => {
it("should return error when source is undefined", (done) => {
Exif(un... | true |
de6718b1bc983fc6a8b08890ba5eabe79c2cfb8f | JavaScript | t0kar/Algebra_CSS-objekti-cars | /app.js | UTF-8 | 652 | 2.71875 | 3 | [] | no_license | var car = {
brand: "Alfa Romeo",
model: "Giulietta",
style: "hatchback",
year: "2013",
assembly: "Italy",
engine: {
type: "diesel",
size: "1998",
power: "140"
},
transmission: {
type: "manual",
gears: "6"
},
overview: function overview() {
... | true |
0ff7ec5024777e2fce2b4f5ccd9bff56c076f4fc | JavaScript | mauricetmeyer/flush | /lib/watcher.js | UTF-8 | 2,247 | 2.71875 | 3 | [
"MIT"
] | permissive | /*
*
* watcher.js
*
* Author: Maurice T. Meyer
* E-Mail: maurice@lavireo.com
*
* Date: 08-10-2016
*
* (c) Laviréo 2016
*/
const path = require('path');
const emitter = require('events').EventEmitter;
const watcher = require('chokidar');
const bind = require('./helpers').bind;
const mixin = require(... | true |
7a9be606ad5647050a4b8d8143f0b849c9927c72 | JavaScript | valepm0511/scl-2018-05-bc-core-am-datadashboard | /src/main.js | UTF-8 | 1,377 | 2.828125 | 3 | [] | no_license | let users = null;
let progress = null;
let cohorts = null;
let usersStats = null;
//conectamos al json de users
fetch('../data/cohorts/lim-2018-03-pre-core-pw/users.json')
.then(response => response.json())
.then(usersJSON => {
users = usersJSON;
//console.log(users);
jsonOk();
})
.catch(error => {
console.error("N... | true |
7dbe5b34727094c4d336eb8cc233deabcc3c9007 | JavaScript | leito25Clone/ping-pong-multiplayer | /paddle.js | UTF-8 | 1,062 | 3.3125 | 3 | [] | no_license | function Paddle(width, height, color) {
if (width === undefined) width = 20;
if (height === undefined) height = 100;
if (color === undefined) color = "blue";
this.x = 0;
this.y = 0;
this.width = width;
this.height = height;
this.color = color;
this.rotation = 0;
this.scaleX = 1;
this.scaleY = 1;
this.speed... | true |
2a4117a49fbc4c1c1a60b80159a741272d517afa | JavaScript | galaxyjet/fkit | /src/sum.js | UTF-8 | 359 | 3.140625 | 3 | [
"MIT"
] | permissive | import add from './uncurried/add'
import fold from './uncurried/fold'
/**
* Calculates the sum of the elements in a list.
*
* @param {Array} as The list.
* @returns {Number} The sum of the elements in the list of `as`.
* @example
*
* import { sum } from 'fkit'
* sum([1, 2, 3]) // 6
*/
export default function ... | true |
f83a35ab9cd9eebfc884ab5e79279e47239e6700 | JavaScript | vlad88813/social-network | /src/components/Profile_info/ProfileStatusCopyHooks.jsx | UTF-8 | 1,511 | 2.75 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
//localState может быть только в классовой компоненте либо использовать хуки
const ProfileStatusHooks = (props) => {
let [status, setStatus] = useState(props.status);
let [editMode, setEditMode] = useState(false);
// state = {
// editM... | true |
1ffc6e3bfa41fe74357dc0329a8fb48b2565c21b | JavaScript | sabahat70/CodingChallenges | /JavaScript/semi.js | UTF-8 | 101 | 2.59375 | 3 | [] | no_license | var cars = ['bmw', 'corvette', 'porche'];
var x = 3
cars.forEach((car) => console.log(car));
| true |
416652550188899ec3d6bf6ca6f5fb6799293793 | JavaScript | gglnx/grunt-legacssy | /tasks/legacssy.js | UTF-8 | 3,421 | 2.578125 | 3 | [
"MIT"
] | permissive | /*
* grunt-legacssy
* https://github.com/pokornyr/legacssy
*
* Copyright (c) 2013 Robin Pokorný
* Licensed under the MIT license.
*/
'use strict';
module.exports = function(grunt) {
var css = require('css'),
chalk = require('chalk'),
maxmin = require('maxmin'),
options;
grunt.registerMul... | true |
35191f3ce10ea5fcb0092ca5c4e6abfa384e4b60 | JavaScript | nekoulahaddad/job-search | /src/useFetchJobs.js | UTF-8 | 2,341 | 3.03125 | 3 | [] | no_license | import axios from 'axios';
import {useReducer,useEffect} from 'react';
import {MAKE_REQUEST,GET_DATA,ERROR,HAS_NEXT_PAGE} from './Actions'
//step-1 --> put the link of the rest API
const jobUrl = "https://cors-anywhere.herokuapp.com/https://jobs.github.com/positions.json";
//step-2 initilize a state
const initialSt... | true |
4dbc79de29b960f1e5dedb96d87d93e90cbd0ad0 | JavaScript | grrr-amsterdam/classifier-prototype | /lib/associater.js | UTF-8 | 1,676 | 2.921875 | 3 | [] | no_license | var _ = require('lodash');
module.exports = function (trainingData) {
var relations = {};
// Tally up all the occurences of combinations of tags
_.pluck(trainingData.data, 'tags')
.forEach(function (tags) {
tags.forEach(function (tagA) {
if (!relations[tagA]) {
relations[tagA] = [];
}
tags.fo... | true |
bc00f5e4a9a1f719cf7f4840c7c7da940edad0df | JavaScript | bmnewlund/herokuworkoutlogserver | /routes/profile.js | UTF-8 | 1,310 | 2.65625 | 3 | [] | no_license | var router = require('express').Router();
var sequelize = require('../db');
var User = sequelize.import('../models/user');
var Profile = sequelize.import('../models/profile');
router.post('/', function(req, res) {
//variables
var firstName = req.body.profile.firstName;
var lastName = req.body.profile.las... | true |
7cc36420873f5830696cc927789323c5ed906239 | JavaScript | O-NO-0/ERRRRRRRRROR | /asynchronousBallMovement/js/form.js | UTF-8 | 608 | 2.828125 | 3 | [] | no_license | class Form{
constructor(){
}
display(){
var title = createElement('h1')
title.html("OH GOD NO PLE---,its just a car game nothing else OK")
title.position(130,0);
var input = createImput("savTIRe NAme")
var button = createButton('START')
imput.position(130,160);
button.position(200,160);
button.mousePres... | true |
76829f1c9939f874f5e7eaf282ba9b69e57a95b3 | JavaScript | LaFrimousse/VITAProject | /W12/js/categoriesLayout.js | UTF-8 | 7,335 | 2.53125 | 3 | [
"MIT"
] | permissive | (function(window) {
'use strict';
var App = window.App;
var Device = App.Device;
var PointsDrawing = App.PointsDrawing;
var CategoriesStorage = App.CategoriesStorage;
var Firebase = App.Firebase;
var CategoriesLayout = (function() {
var verbose = false;
var nbOfPictureSelected = 0;
var allP... | true |
1604526f5b6049e16f569f5955e0fc8faf221f46 | JavaScript | PatatalouiS/MatriXMiX_Web | /client/src/utils/utils.js | UTF-8 | 2,486 | 3.046875 | 3 | [] | no_license |
import * as math from 'mathjs';
import { API_URL } from './constants';
export const isComplex = (value) => (value.re || value.im);
export const isNumber = (value) => (typeof value === 'number');
export const isString = (value) => (typeof value === 'string');
export const NewArray = (size, init = null) => {
retur... | true |
eeb23ff95070e67c9dfd9e7027f7d359cb34a173 | JavaScript | Kakashi1hatake/Bigbrackets | /hotel reservation/book.js | UTF-8 | 1,917 | 2.859375 | 3 | [] | no_license | (function($){
function floatLabel(inputType){
$(inputType).each(function(){
var $this = $(this);
// on focus add cladd active to label
$this.focus(function(){
$this.next().addClass("active");
});
//on blur check field and remove class if needed
$this.blur(function(){
if($this.val() === '' |... | true |
9e82935e8308ab07b2e64a7445bc2db4d62d2780 | JavaScript | ItSoftwares/KTPrime | /js/empresa/servicos_prestados.js | UTF-8 | 1,765 | 2.765625 | 3 | [] | no_license | $(document).ready(function() {
atualizarServicosPrestados();
servicosPrestados = servicosPrestados==null?[]:servicosPrestados;
});
function toDate(time) {
data = new Date(time*1000);
return colocarZero(data.getDate())+"/"+colocarZero(data.getMonth()+1)+"/"+data.getFullYear()+", "+colocarZero(data.getHo... | true |
bc17d388b031d01a614cdd3cbbd1a5d22cda605a | JavaScript | bep/docuapi | /assets/js/helpers/highlight.js | UTF-8 | 2,086 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | export class Highlight {
constructor(
opts = {
contentSelector: '.content',
markClass: 'da-highlight-mark',
}
) {
this.opts = opts;
this.nodeStack = [];
}
apply(re) {
const treeWalker = document.createTreeWalker(
this.content(),
NodeFilter.SHOW_TEXT,
{
acceptNode: (node) => {
if (... | true |
b2d39dbecff96998bdefac1ef98a20796498e079 | JavaScript | im5K/algorithm | /leetcode for offer/q1 leetcode680验证回文字符串 easy/anwer2(ac).js | UTF-8 | 981 | 4.03125 | 4 | [] | no_license | /**
* @param {string} s
* @return {boolean}
*/
var validPalindrome = function(s,flag=false) {
for(let i = 0;i<s.length;i++ ){
let j = s.length-1-i
if(j<=i){
return true
}else if(s[i]!==s[j]&&flag==false){
console.log(i,j,s.substring(i+1,j+1... | true |
74fd4d73aacc6ba60e0ed1517a6992332c6cef83 | JavaScript | unegma/tutorcruncher-utilities | /lib/LessonUtilities.js | UTF-8 | 4,634 | 2.984375 | 3 | [
"MIT"
] | permissive | const { UnhandledArraySizeError } = require('./errors');
const BaseUtilities = require('./BaseUtilities');
/**
* Lesson Utilities
*/
class LessonUtilities extends BaseUtilities {
/**
* Lesson Utilities
*
* @param tutorCruncherApiKey
* @param errorLogUrl
* @param errorLogPrefix
*/
constructor(t... | true |
46875d69a625c89736fbd140cfdece05603e43cc | JavaScript | bodii/test-code | /JavaScript/JavaScript_core/bind.js | UTF-8 | 661 | 3.84375 | 4 | [] | no_license | /**
* bind方法也能指定函数内部的this指向,但是它与call/apply有所不同.
* 当函数调用call/apply时,函数的内部this被显式指定,并且函数会立即执行。而
* 当函数调用bind时,函数并不会即执行,而是返回一个新的函数,这个新的函数与
* 原函数有共同的函数体,但它并非原函数,并且新函数的参数与this指向都已经绑
* 定,参数为bind的后续参数.
*/
function fn(num1, num2) {
return this.a + num1 + num2;
}
var a = 20;
var object = { a: 40 };
var _fn = fn.bind(ob... | true |
f0b759906b16e965161e2ecbadaa14ac84b17fbd | JavaScript | AlqanbarRami/LoginPage | /script.js | UTF-8 | 3,360 | 3.671875 | 4 | [] | no_license | // 2 variables user and pass
const userName = "test";
const userPassword = "1234";
// create div , p , button
const subject = document.createElement('p')
const mainDiv = document.createElement('div');
const div= document.createElement('div');
const mesg = document.createElement('p');
const button = document.createEle... | true |
29d904decb2431e0b8d6f7429f9d3e7ae13bc876 | JavaScript | VictorAngullo/JavaScript-Exercises | /js-session-8-exercises/3.async-await/exercise-2.js | UTF-8 | 204 | 2.875 | 3 | [] | no_license |
const getCharacters = async () => {
fetch('https://rickandmortyapi.com/api/character')
.then(res => res.json())
.await(characters => console.log(characters));
}
getCharacters();
| true |
5f3eeca6ad909eb8407170b335dfff9f36233fef | JavaScript | Aksiuszka/Odlicznik-Sesyjny | /app.js | UTF-8 | 978 | 3.296875 | 3 | [] | no_license | /*Przypisuję wartości zmiennym potrzebnym do stworzenia licznika*/
const timeLeft = document.getElementById('time-left')
const koniecSesji = new Date ('06/20/2021')
const sekundy = 1000
const minuty = sekundy*60
const godziny = minuty*60
const dni = godziny*24
let timerdID
function zliczamCzas (){
cons... | true |
6f214e59cca967b70c38c85c2a1ab9a7b1b91686 | JavaScript | ferculell/VideoMemoryTest | /js/index.js | UTF-8 | 4,602 | 3.65625 | 4 | [] | no_license | // En este array guardamos los objetos con los datos de los videos a reproducir
const videos = [];
// En esta variable guardamos los puntos obtenidos
let points = 0;
// En estas variables guardamos los datos del usuario
let userName;
let userSurname
let userAge;
// Disparamos el modal inicial para pedir sus datos al ... | true |
dade7d487ee2a34d32af43a2cf4abe3fe7a012ab | JavaScript | antonsnarov/ChessTask_Horse | /script.js | UTF-8 | 1,381 | 3.453125 | 3 | [] | no_license | const chess =Array(8).fill(Array(8).fill(0));
let draw =()=>{
let out ='';
let m =0;
for(let i in chess){
let arr = chess[i];
for(let k in arr){
if(m%2==0){
out +=`<div class="chess-block" data-x="${k}" data-y="${i}"></div>`;
}
else{
... | true |
1721d8523602f7bb1c8359d3ff4cf56c8f9f6edd | JavaScript | girish-ankit/nodejs | /test/scope-b.js | UTF-8 | 412 | 2.859375 | 3 | [] | no_license | var aFile = require('./scope-a');
// Access variables defined with 'exports' key word
console.log('Exports Variable:=> '+aFile.e);
console.log('Exports Function:=> '+aFile.f());
// Access variables defined with 'global' key word
console.log('Global Variable:=> '+c);
console.log('Global Function:=> '+d());
// Access... | true |
c96678f70cc1e0a6f3574a5e876548e5b5d97380 | JavaScript | bghebrit/Algoritms | /shiftup.js | UTF-8 | 355 | 2.921875 | 3 | [] | no_license | shiftUp(){
var index = this.heaps.length - 1;
while(index > 1){
var parentInd = Math.floor(index / 2)
if( this.heap[parentInd] < this.heap[index] ){
break
}
var temp = this.heap[index]
this.heap[index] = this.heap[parentInd]
this.heap[parentInd] = temp... | true |
23d5e262f272a8d4cf3c81265c67f614a7caf282 | JavaScript | krmgopi/genetic-material | /script.js | UTF-8 | 597 | 3.3125 | 3 | [] | no_license | // Get Id's from DOM
let startBtn = document.getElementById('startBtn');
let stopBtn = document.getElementById('stopBtn');
let genes = document.getElementsByClassName('genetic-material')
// Event Listener
startBtn.addEventListener('click', startAnimation);
stopBtn.addEventListener('click', stopAnimation);
function st... | true |
ea5582c17962b4387b0031dc796e39a9d9195818 | JavaScript | SyTW2019/E08 | /server/routes/api/users.js | UTF-8 | 6,931 | 2.6875 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const bcrypt = require('bcryptjs');
const config = require('config'); //para almacenar el jwtsecret y la uri de mongo
const jwt = require('jsonwebtoken');
const auth = require('../../middleware/auth');
//MOdelo del Schema de Usuario
const User = requ... | true |
540d239fb28c6e2c04b76bba0a595f17487e1608 | JavaScript | philippbosch/beautiful-react-hooks | /src/usePrev.js | UTF-8 | 793 | 3.5 | 4 | [
"MIT"
] | permissive | import { useEffect, useRef } from 'react';
/**
* On each render returns the previous value of the given variable/constant.
*
* ### Usage:
*
* ```js harmony
* const TestComponent = () => {
* const [seconds, setSeconds] = useState(0);
* const prevSeconds = usePrev(seconds);
* const everySecond = useInterv... | true |
e4716786bd34dfcf095038f88783d65cad39c309 | JavaScript | occultskyrong/express-access-logger | /utils/datetime.js | UTF-8 | 1,721 | 3.03125 | 3 | [
"MIT"
] | permissive | /**
* Created by zhangrz on 2018/3/3.
* Copyright© 2015-2020
* @version 0.0.1 created
*/
/**
* 时间格式化函数
* @param {Date} defaultDate 时间
* @param {string} defaultFormat 格式化字符串
* @return {*}
*/
const datetimeFormat = (defaultDate, defaultFormat = 'yyyy-MM-dd hh:mm:ss.S') => {
let date ... | true |
6222301f0830d38fd7b21f82c7d90e58d78001c4 | JavaScript | Hank0438/fugle_intern | /crawler/test.js | UTF-8 | 1,481 | 2.734375 | 3 | [] | no_license | var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs'));
var string = '1. 標的:3662 2. 分類:多 3. 分析/正文: 只限還沒買 後天有空可以跑開戶券商的買一張 我自己是4+1 其中一個戶頭買了兩張 收購價128 過了就是現賺快3萬 沒過可能賠到1萬5以上,以3662線型來看 跌破80機會不大 就算破了一年內站上80也是一塊蛋糕 今天量才不到5000 要過3萬8千戶的機會也很低 4. 進退場機制: 1.收購少於3萬8千張失敗-還券後直接停損或80元停損 2.超過3萬8千戶抽籤又沒抽到,25%在日本人手上,... | true |
0ab183d913b0c8fe3f1f1202aeb0246b5da1f00c | JavaScript | nreek/tradelinx | /src/util/deferred.js | UTF-8 | 1,810 | 3.078125 | 3 | [] | no_license | /* This class does not extend Promise because Babel does not currently support
* extending built-in classes. When this capability does become available,
* note that the then and catch handlers that update the state property in the
* constructor must return Promises (super.then?) not Deferreds to avoid
* infinite r... | true |
a1dcacd7fa024e137147d9c93fd07395015fd29e | JavaScript | nat3mac/Solar-Decathlon | /deprecated/js/lights.js | UTF-8 | 1,122 | 2.546875 | 3 | [] | no_license | $(document).ready(function(){
toggleOn1=false;
toggleOn2=false;
toggleOn3=false;
toggleOn4=false;
toggleOn5=false;
$('#roomIcon1').click(
function(){
if(toggleOn1==true){
$(this).css('opacity', '.3');
toggleOn1=false;
}else{
$(this).css('opacity', '1');
toggleOn1=true;
}
}
);
$(... | true |
bdcd9cd966d9984af6fd9536caa7f2ed845f3c50 | JavaScript | Nideesh1/BeerBelly | /public/HW5/js/login.js | UTF-8 | 2,387 | 2.90625 | 3 | [] | no_license | (function() {
// Get elements.
const txtEmail = document.getElementById('txtEmail');
const txtPassword = document.getElementById('txtPassword');
const btnSubmit = document.getElementById('btnSubmit');
const btnGoogleLogin = document.getElementById('btnGoogleLogin');
// Add login event.
btnSubmit.addEven... | true |
3f343e137910ae2ff7b21f0ad585aed83fceab53 | JavaScript | biguHQ/bigu-meteor | /lib/methods.js | UTF-8 | 686 | 2.515625 | 3 | [] | no_license | Meteor.methods({
createChat: function(options) {
return createChat(options);
},
sendMessage: function(chatId, userId, message) {
return sendMessage(chatId, userId, message);
}
});
var sendMessage = function(chatId, userId, message) {
return Message.insert({
chatId: chatId,
userId: userId,
... | true |
3ff31716dbeda95092e61619d2b79858ebc5661b | JavaScript | sergio8221/openDataRecipes-ajax.php | /script.js | UTF-8 | 7,761 | 3 | 3 | [] | no_license |
// Elementos
let elemResulBusca = document.getElementById('resulBusca');
let elemBusca = document.getElementById('busca');
let elemBtn = document.getElementById('btn-busca');
let elemNPag = document.getElementById('nPag');
let elemPasoPagina = document.getElementById('pasoPagina');
let elemPagAnterior = document.getEl... | true |
0ddd7b43313ac5a794103f164cd6e0529460e175 | JavaScript | lucamattiazzi/yegg | /src/routes/LogisticMap/index.js | UTF-8 | 3,280 | 2.84375 | 3 | [
"MIT"
] | permissive | import React from 'react'
import { Logistic } from './lib'
const fixFn = val => () => val
export class LogisticMap extends React.Component {
state = {
valueGenerator: undefined,
started: false,
lambda: 4,
renderedPoints: 32,
points: 2000,
interval: 10,
}
componentWillUnmount() {
thi... | true |
775d24d4773a5a06675273df993c9ec15abf5707 | JavaScript | rjgcabrera/react-redux-cryptochart | /client/src/components/chart.js | UTF-8 | 578 | 2.53125 | 3 | [] | no_license | import React from 'react';
import { Sparklines, SparklinesLine, SparklinesReferenceLine } from 'react-sparklines';
function average(data) {
const avg = data.reduce((acc, curr) => acc + curr, 0) / data.length;
return (avg).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
export default (props) => {
return (
... | true |
3081813350a0ffcd7ab9677e32e1ba5de7d0fa88 | JavaScript | walkerrandolphsmith/project-euler | /js/src/009/pythagorean-triplet.js | UTF-8 | 582 | 3.640625 | 4 | [] | no_license | export function getProductOfPythogreanTripletWhoseSumEquals(sum){
var counter = 1;
while(true){
var radical = Math.sqrt(counter * counter + (2 * sum));
if(radical === Math.floor(radical)){
var n = counter;
var m = Math.floor((((-1 * counter) + radical) / 2));
if(m < 0){
m = Math.... | true |
409d716e597aeb4ce83a9efdc8b302ccc27f5ef2 | JavaScript | ingrid/CuddlePit | /jsGame/jsGame.Sound.js | UTF-8 | 1,086 | 3.421875 | 3 | [] | no_license | // Extremely simple sound library. Can load or cache a sound and play it.
// Either just use jsGame.Sound.play(url) or cache it first with
// jsGame.Sound.load(url), then call play with that same url.
// Right now the cache is hidden in the closure
jsGame.Sound = function(){
var cache = {};
// Load will create a... | true |
bec5e7882888e2f89f8ab0d96825ce6f9e414ae0 | JavaScript | arklit/react-mesto-auth | /src/components/Login.js | UTF-8 | 1,081 | 2.515625 | 3 | [] | no_license | import React from "react";
import AuthForm from "./AuthForm";
function Login(props) {
const [email, setEmail] = React.useState('');
const [password, setPassword] = React.useState('');
function editEmail(e) {
setEmail(e.target.value);
}
function editPassword(e) {
setPassword(e.target.value)
}
fun... | true |
4b1d9bb82a55e6fb140b58dd4ca1c7fde780c270 | JavaScript | andela-cofor/invertedIndex | /public/js/invertedIndex.js | UTF-8 | 2,433 | 3.03125 | 3 | [] | no_license | /**
* An inverted-index class
* @class
*/
class InvertedIndex {
/**
* class constructor
* @constructor
*/
constructor() {
this.index = {};
this.object = {};
this.allFiles = {};
this.allLength = {};
this.allFilesTitle = [];
}
/**
* Gets Indexes
* @param {jsonObj} object receive... | true |
3e68266690d0a953474484e7eaf80d493bc78b6d | JavaScript | shashwat-15/Valorant | /js/placement.js | UTF-8 | 1,410 | 2.65625 | 3 | [] | no_license | document.querySelector(".checkout-btn").addEventListener('click', () => {
if(document.getElementById("selected-last-rank") !== null && document.getElementById("selected-matches") !== null && document.getElementById("selected-server") !== null &&
document.getElementById("selected-agent") !== null && document.ge... | true |
1279da4463a0d5e680ad3d444fa9d2e67a45d9f9 | JavaScript | Appliary/poetry-angular | /app/generic/listView/listViewService.js | UTF-8 | 969 | 2.515625 | 3 | [] | no_license | app.factory('listViewService', function() {
var listeners = [];
const GLOBAL_EVENT = 'GLOBAL';
return {
emit: function(event, args) {
if(event && angular.isString(event)){
listeners.forEach(function(listener) {
if(listener.event == GLOBAL_EVENT || listener.event == event)... | true |
94c67a6a4f022a975bd08bd77152be2bce264f19 | JavaScript | maridigiolo/javascript-exercises | /jsexe/square.js | UTF-8 | 200 | 3.234375 | 3 | [] | no_license | function printSquare (total) {
for (var a = 0; a < total; a++) {
for (var b = 0; b < total; b++) {
process.stdout.write('*');
}
process.stdout.write("\n");
}
}
printSquare(5);
| true |
5bcf0723d62a2cfe8b7db19365b096c6c9098f9e | JavaScript | FloresZamoraIthanAdrian/Problemas_Algoritmia_4IV9 | /src/Pages/Js/Page1.js | UTF-8 | 1,747 | 3.078125 | 3 | [] | no_license | import React, { Component } from 'react';
import Btn from '../../components/Btn';
import Input from '../../components/Input';
import TextArea from '../../components/TextArea';
class Page1 extends Component {
constructor(props) {
super(props);
this.reverseBtn = this.reverseBtn.bind(this);
... | true |
9f82083f605038ac4d0e793ffb23feb0c9f50469 | JavaScript | 1993lxb/test | /wms/src/main/webapp/js/resizeAndUpload.js | UTF-8 | 3,500 | 2.53125 | 3 | [] | no_license | /**
* resize and upload
* author jinan
*/
;
(function($) {
$.extend($.fn, {
resizeAndUploadIMG : function(options) {
var defaults = {
bindId: undefined,
fileSize: 5, // 上传文件大小,单位MB
exts: ['jpeg', 'png'], // 允许上传的图片格式
width: 640, // 图片最大宽度
height: 440, // 图片最大高度
... | true |