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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
8df360a7bdc6dcc97df6f7099c1f788830238dfd | JavaScript | danielm82/ridge-test | /src/JsonTree/JsonTree.js | UTF-8 | 1,185 | 2.890625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react';
import TreeChildren from './TreeChildren';
import './JsonTree.scss';
function JsonTree({url, callback}) {
const [json, setJson] = useState();
/*
Note that I would normally place the API call outside of the ui component, and give it the retrieved json as a pro... | true |
92053d87fb99e47bb14d31af6108fca75a6a0acd | JavaScript | WICSE/public_html | /gitlogin.js | UTF-8 | 504 | 2.578125 | 3 | [] | no_license | function gitlogin()
{
var passwrd = prompt("Please enter the password", "");
if(passwrd == "i12code")
{
popup();
window.location= "F314672E739A45E23A51CCEC9E7CF.html";
return true;
}
else
{
popup();
window.location= "gitaccessedit.html";
return false;
}
}
function popup()
{
... | true |
fa5249e97475c24dea5ed47cba18ef124ecd1ed3 | JavaScript | t-kabaya/react-native-roll-picker2 | /lib/Picker.js | UTF-8 | 3,597 | 2.59375 | 3 | [] | no_license | /**
* Created by yjy on 16/8/3.
*
* props:
* data: 数据
* name: rowData[name] 返回列表数据
* onRowChange: (index) => {} 被选中的index
*
* method:
* setDataSource(data): 刷新数据
*
*/
import React, { Component } from 'react'
import {
Text,
View,
Image,
TouchableOpacity,
ScrollView,
ListView,
StyleSheet
} f... | true |
13ff272dbb6b1457f81f15036fc7d35e416970fa | JavaScript | michaelozirnyi/lectorium | /L5/main.js | UTF-8 | 2,449 | 3.1875 | 3 | [
"MIT"
] | permissive |
function prepareContent() {
//var elements = document.getElementsByClassName('content-item-wrap');
var elements = document.querySelectorAll('.content-item-wrap');
elements.forEach(function(element) {
var elHeight = element.getElementsByClassName("content-item")[0].offsetHeight;
element.s... | true |
ced5eb230534418ebbe14d5e473d7c714c49f659 | JavaScript | maxsap/TODO | /client/src/main/webapp/js/libs/aerogear.js | UTF-8 | 23,753 | 2.8125 | 3 | [
"MIT"
] | permissive | /*! AeroGear JavaScript Library - v1.0.0.Alpha - 2012-08-22
* https://github.com/aerogear/aerogear-js
* JBoss, Home of Professional Open Source
* Copyright 2012, Red Hat, Inc., and individual contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in complianc... | true |
d500c7e89338f79fefeecd74681668f3c700edb4 | JavaScript | vorobjovsh/gulp-starter-kit | /src/js/sum.js | UTF-8 | 64 | 2.75 | 3 | [
"MIT"
] | permissive | function sum(a, b) {
return console.log(a + b);
}
sum(a, b); | true |
1fab2f44de188ae66e85dde40e2bedc3fa4aba6e | JavaScript | walkanywhere/sql-protobuf | /index.js | UTF-8 | 1,888 | 2.796875 | 3 | [] | no_license | var protobuf = require('protocol-buffers-schema')
var mappings = {
'bigint': 'int64',
'integer': 'int32',
'text': 'string',
'real': 'float',
'date': 'string',
'boolean': 'bool'
}
// from https://github.com/michalbe/sql-create-table-to-json/blob/master/index.js
var removeComments = function (data) {
data ... | true |
5f6bc6522d4b9b8e2f15edda5d7676694a210654 | JavaScript | ps20221093/Year-10-Comupter-Design | /Button's point and click adventure/Introduction/sketch.js | UTF-8 | 822 | 3.03125 | 3 | [] | no_license | var b1;
var b2;
function setup()
{
createCanvas(500,500);
b1 = new Button(10,10,100,25);
b1.setText("Take me home ");
b1.setTextOver("Eskettit");
b1.setButtonOverFill(255,255,50);
b2 = new Button(10,100,130,25);
b2.setText("Pretty Not Easy")
b3 = new Button(10,190,100,25)
b3.setText("High scores")
b4 = ... | true |
3eea75aa1b6eb677c378256e418bf4ed779bc6b6 | JavaScript | arkadiusz-guzik/TravelMeetingApp | /src/main/resources/static/js/meeting-form-js.js | UTF-8 | 509 | 3.203125 | 3 | [] | no_license | let inputFile = document.getElementById('fimg');
let fileNameField = document.getElementById('file-name');
inputFile.addEventListener('change', function(event){
let uploadedFileName = event.target.files[0].name;
fileNameField.textContent = uploadedFileName;
})
let textField = document.getElementById("fdesc");
let... | true |
4f0cff174b2cbea5f8229d6d0c479ba4adfd1e53 | JavaScript | tapeshjoham/Matching-Game | /assets/inputerror.js | UTF-8 | 960 | 3.15625 | 3 | [
"MIT"
] | permissive | function makeChanges(error,message,inputTarget,errorTarget){
if(error==1){
inputTarget.css('border-bottom','2px solid red');
errorTarget.text(message);
}else{
inputTarget.css('border-bottom','none');
errorTarget.text(message);
}
}
function checkInputOnSubmit(minlength,inputTarget,errorTarget){
var input = ... | true |
d0094aec7fa2d2b74e229a687c0aeb25476fdb29 | JavaScript | ActionKbob/ltgsite | /src/application/scripts/components/carousel.js | UTF-8 | 901 | 2.734375 | 3 | [] | no_license | const Carousel = ( () => {
var carouselElements = document.querySelectorAll( '.carousel' );
[].forEach.call( carouselElements, function( el )
{
var items = el.querySelector( '.carousel-items' );
var itemCount = items.querySelectorAll( '.carousel-item' ).length;
var currentIndex = 0;
items.style.l... | true |
3da86d590dbf7f022ce37e72b9a781250feae6f3 | JavaScript | dev-seahouse/learnprojects | /treehouse/javascript/JavaScript_Loops_Arrays_Objects/Section_1_ Loops/challenge01/js/script.js | UTF-8 | 420 | 3.640625 | 4 | [] | no_license | var html = '';
var red;
var green;
var blue;
var rgbColor;
for (var i = 0; i < 10 ; i ++){
rgbColor = randomColor();
html += '<div style="background-color:' + rgbColor + '"></div>';
}
print(html);
function genColor(){
return Math.floor(Math.random() * 256 );
}
function randomColor(){
return 'rgb(' + genColor()... | true |
13b86ca1994ca04060dfdaf59ffeb6ff52c91e94 | JavaScript | MimitsuBot/mimitsu | /src/database/index.js | UTF-8 | 866 | 2.5625 | 3 | [
"MIT"
] | permissive | import { Sequelize } from 'sequelize';
import 'dotenv/config';
import chalk from 'chalk';
if (!process.env.DATABASE_URL) {
return console.error(
`${chalk.cyan(['Postgres'])} ${chalk.red(
'No enviroment variable "DATABASE_URL" was found. Set it in order to enable postgres connection'
)}`
);
}
const d... | true |
be89d8f24627b41aa13de6d66ab13ce02b516bad | JavaScript | Sachinwattamwar/Language_Guesser | /index.js | UTF-8 | 410 | 2.71875 | 3 | [] | no_license | const franc = require('franc');
const langs = require('langs');
const colors = require('colors');
const input = process.argv[2];
const string2 = franc(input);
if(string2 === 'und')
{
console.log("Could not find the language, Try with different and more sample tests".red)
}
else
{
const Language = l... | true |
18f5b29d16a208ec96c6fd8c469aa245b755c9f9 | JavaScript | wasdk/WebAssemblyStudio | /misc/arc-templates/arc_js/src/module.js | UTF-8 | 2,994 | 3.4375 | 3 | [
"MIT"
] | permissive | //constants for colors
const BLACK = 0x000000;
const WHITE = 0xFFFFFF;
const BLUE = 0x0000FF;
const RED = 0xFF0000;
function drawFrame(frame) {
//black and white columns
for(let y = 0; y < frame.height; y++) {
for(let x=0; x<frame.width; x++) {
//even or odd
if(x % 2 === 0) {
... | true |
7ab9fd6e004757bdc6cada14e7a8cf5c891b7736 | JavaScript | ttitto/TelerikAcademy | /Javascript/Homeworks/LoopsHW/LoopsHW/LoopsHW.js | UTF-8 | 1,564 | 3.421875 | 3 | [
"MIT"
] | permissive | /// <reference path="js-console.js" />
function Print1toN(n) {
var indx;
for (indx = 1; indx <= n; indx++) {
jsConsole.write(indx + " ");
}
}
jsConsole.writeLine("Task1: ");
Print1toN(5);
jsConsole.writeLine();
function PrintDivisibleBy3And7(n) {
var indx;
for (indx = 1; ind... | true |
ff300fe766b0b8589a356ff0490b6305f5b91ef3 | JavaScript | Shahrukhjethra/office_management | /controllers/employee.js | UTF-8 | 1,338 | 2.515625 | 3 | [] | no_license | const asyncHandler = require ('../middleware/async');
const Employee = require ('../models/Employee');
const ErrorResponse = require ('../utils/errorResponse');
exports.create = asyncHandler (async (req, res, next) => {
const employee = await Employee.create (req.body);
res.status (200).json ({
success: true,... | true |
a4970dede39d8d1a4fb5397dc837fcbc0df846c0 | JavaScript | KKurchavy/courses | /lecture_4/src/app/app-calculator/calculator.js | UTF-8 | 1,126 | 3.09375 | 3 | [
"Unlicense"
] | permissive | var computingTools = (function() {
var me = this;
me.expression = "";
return {
getNumbersArray: function() {
return document.querySelectorAll(".number");
},
getOperationsArray: function() {
return document.querySelectorAll(".operation");
},
get... | true |
e946d2414c7039ecf427a5857df6a2f76383ed2c | JavaScript | AubreyHewes/semver-check | /src/components/semver-explain-version.jsx | UTF-8 | 1,030 | 2.703125 | 3 | [
"MIT"
] | permissive | var React = require('react'),
semver = require('semver');
var SemverExplainVersion = React.createClass({
render: function() {
if (!this.props.version) {
return false;
}
var next = {
major: semver.inc(this.props.version, 'major'),
... | true |
fcdff5710514b864bc1b2b99d96706d7b8be4ab6 | JavaScript | harryho/cc-qyl | /basic-04/code/test/src/SuperClass.js | UTF-8 | 176 | 2.65625 | 3 | [] | no_license | export class SuperClass {
constructor (name){
this.id = Symbol(name);
this.name =name;
}
getName=()=>this.name
sampleMethod =()=> this.type;
} | true |
b61b691a01ca7566c8963b9f3ef621d7dd725d7f | JavaScript | SebasJansen/Winc_Academy | /EindOpdrachten/EindOpdrachtModule_3/app.js | UTF-8 | 690 | 3.15625 | 3 | [] | no_license | const body = document.querySelector('body');
const listItems = document.getElementsByClassName('color');
const listItemsQuery = document.querySelector(".menu")
const menu = document.querySelector(".menu-items")
// Add events to li's
const arr = [...listItems].forEach(listItem => {
c... | true |
fc1f4818fa105f7ac142836d97c49986323376b9 | JavaScript | KevinHenneberger/Simple-JavaScript-Projects | /codillity/codillity-4/script.js | UTF-8 | 634 | 3.5 | 4 | [] | no_license | function solution(A) {
var p = 0;
var ps = [];
while (true) {
var sum1 = 0;
var sum2 = 0;
for (var i = 0; i < p; i++) {
sum1 += A[i];
}
for (var i = p + 1; i < A.length; i++) {
sum2 += A[i];
}
... | true |
885b01183899045baa0d0c94bdabd3117a751486 | JavaScript | Alucarrd/web-server | /server.js | UTF-8 | 1,042 | 2.953125 | 3 | [] | no_license | var express = require('express');
var app = express(); //this is express app
var httpPort = process.env.PORT || 3000;
console.log(httpPort);
var middleware = require('./middleware.js');
//to add middleware at route level, just pass it in as 2nd function
app.use(middleware.logger);
app.get('/aboutus', middleware.re... | true |
0c909a68b55c53be32c2e5ada3b2b98393491f19 | JavaScript | Shumailakayani06/shumaiila-kayani-js1-ma3 | /question-2.js | UTF-8 | 714 | 3.171875 | 3 | [] | no_license | let game = document.querySelector("#game")
game.innerHTML = "LOADING....."
function getData (){
fetch("https://api.rawg.io/api/games?dates=2019-01-01,2019-12-31&ordering=-ratings")
.then(response => {
if(!response.ok){
throw Error("Error");
}
return response.json();
})
... | true |
1a62dee36be418ee960b8d628946075f02bf33bc | JavaScript | Helsinki-wolf/PersonalApp | /controllers/zomatoController.js | UTF-8 | 1,759 | 2.546875 | 3 | [] | no_license | const axios = require("axios")
let zomato_key = "f47c97ddbdfbfcb3db54458050f7fed9"
class ZomatoController {
static categories(req, res, next) {
axios({
method: "get",
url: "https://developers.zomato.com/api/v2.1/categories",
headers: {
"user-key": zomato_key
}
}).then(r... | true |
9b414c2252b90218a6ad5dbe7e50bf9e67561735 | JavaScript | dolfly/puppet-dashboard | /public/javascripts/jquery.placeholders.js | UTF-8 | 2,852 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | //= require <jquery>
/*!
* Cross-browser Placeholder Plugin for jQuery
*
* Copyright (c) 2009 Mark Dodwell
* Licensed under the MIT license.
*
* Requires: jQuery v1.3.2
* Version: 0.1.3
*/
(function($) {
var debug = false;
var placeholderColor = debug ? "red" : "#aaa";
var placeholderAttributeName =... | true |
c0933becdc75a6c21a198a84732b432a7c394be7 | JavaScript | wjsc/client-hangouts | /client.js | UTF-8 | 571 | 3.09375 | 3 | [
"MIT"
] | permissive | const fetch = require('node-fetch');
const SLEEP_TIME_MAX = 6000;
const SLEEP_TIME_MIN = 2000;
const random = () => Math.round(Math.random());
const sleep = ms => new Promise(resolve => setTimeout(resolve ,ms));
const miliseconds = random() ? SLEEP_TIME_MAX : SLEEP_TIME_MIN;
console.log(`The connection will hangout... | true |
7a02387ad1c0cda56273aec89217c2666f7e629a | JavaScript | jugonzal/lhl-lectures | /w1d2bo-reading-code-and-scopes/code/example4.js | UTF-8 | 244 | 3.640625 | 4 | [] | no_license | var counter = 10;
function increaseCounter() {
counter++;
}
for (var i = 0; i < 100; i += 10) {
increaseCounter();
}
function report() {
var counter;
console.log("The final result is: ", counter);
}
console.log(counter);
report();
| true |
7fcfaeb7255b25744a1215ae2d542c3fe97c9eea | JavaScript | rkylerd/be-social-functions | /handlers/unfollow-handler.js | UTF-8 | 804 | 2.5625 | 3 | [] | no_license | const { unfollow } = require('./services/followService.js')
exports.handler = async (request, event) => {
const { follower = "", followee = "" } = request || {};
// let response = {
// statusCode: 403,
// body: JSON.stringify({message: "You do not have the authorization to perform that action."... | true |
018773ceee428646dd1e671bacf77f6650d5dee0 | JavaScript | wirwinvega/node-socketio-colas | /public/js/socket.public.js | UTF-8 | 812 | 2.8125 | 3 | [] | no_license | var socket = io();
let lblTicket1 = $('#lblTicket1');
let lblTicket2 = $('#lblTicket2');
let lblTicket3 = $('#lblTicket3');
let lblTicket4 = $('#lblTicket4');
let lblDesk1 = $('#lblEscritorio1');
let lblDesk2 = $('#lblEscritorio2');
let lblDesk3 = $('#lblEscritorio3');
let lblDesk4 = $('#lblEscritorio4');
let ticket... | true |
1b7903b8edbfea64b2770477db10b34f00cf68c4 | JavaScript | shymii/hack | /static/js/dist/globalcovid-light.dev.js | UTF-8 | 4,846 | 2.9375 | 3 | [] | no_license | "use strict";
Chart.defaults.global.defaultFontColor = "#303030";
function commaSeparateNumber(val) {
while (/(\d+)(\d{3})/.test(val.toString())) {
val = val.toString().replace(/(\d+)(\d{3})/, '$1' + ' ' + '$2');
}
return val;
}
fetch("https://covid19-api.org/api/timeline").then(function (res) {
return ... | true |
2865e832c8d0da9d193ee292132398e99b7cc18e | JavaScript | jarindr/senior-webapp | /public/javascripts/main.js | UTF-8 | 261 | 3.046875 | 3 | [] | no_license | export function inintializeMain() {
setInterval( ()=> {
$('#chula-age').text(getCurrentAge().toFixed(9))
}, 50)
}
function getCurrentAge() {
const born = new Date('5/26/1917')
const now = new Date()
return (now-born)/(1000 * 3600 * 24*365)
}
| true |
02676e3f558a5ab62d6514a322754e4c3f51adb0 | JavaScript | gjax78/annotation_practice | /exercise-1/addNumbers.js | UTF-8 | 1,336 | 4.78125 | 5 | [] | no_license | //declare a function called addNumbers
function addNumbers() {
//declare variable called firstNum and assign it to a value of 9
var firstNum = 9
//declare a variable called secondNum assigned to a value of 14
var secondNum = 14
// reassign the firstNum variable to a value of 3
firstNum = 3
// reassign th... | true |
1bdde40a904b5dbe77ebffb2e40a385f00821fe0 | JavaScript | ihkawiss/wodss | /frontend/src/components/bet/Bet.js | UTF-8 | 6,162 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import React, {Component} from 'react';
import {connect} from 'react-redux';
import {Dialog, FlatButton, TextField} from "material-ui";
import {apiDeleteBet, apiPutBet} from '../../actions/bet-actions'
import {apiLoadMatchList} from '../../actions/match-list-actions'
import {strings} from "../../strings";
import "./Bet... | true |
a2e53e252965ca86de8d5ce3a797aba9b9c872ec | JavaScript | xinhecuican/githubDB_work | /lhx/res/10.8/files/ataola/coding/96111fb/code&nowcoder&huawei&hj6.js | UTF-8 | 406 | 3.046875 | 3 | [] | no_license | const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
rl.on('line', function (line) {
const res = [];
let num = parseInt(line);
for (let i = 2; i * i <= num; i++) {
while (num % i === 0) {
res.push(i);
num = num / i;
... | true |
d1dbcdff68b709507a8018e850ed9cb9a0db0add | JavaScript | 15235780117/home | /xiaomi/js/index.js | UTF-8 | 4,616 | 2.625 | 3 | [] | no_license | let banner = document.querySelectorAll(".img_box li");
let btn = document.querySelectorAll(".btn_box li");
let datupians = document.querySelector(".datupian");
btn.forEach(function (val, index) {
val.onclick = function () {
for (i = 0; i < banner.length; i++) {
btn[i].classList.remove("active");... | true |
1dc983650080ad8571b475f9be9781f087f439fa | JavaScript | node9909/exchatter | /tools/misspelled_personal.js | UTF-8 | 2,617 | 2.890625 | 3 | [
"MIT"
] | permissive | /*
Logs a list of misspelled words from a raw_iphone.json to the console like this:
frequency: word
Should be piped to "sort -nr" to order by most-misspelled
*/
var fs = require('fs'),
_ = require('underscore')._,
argv = require('argv'),
SpellCheck = require('spellcheck'),
spell = new SpellCheck( 'data/dictionarie... | true |
1b33c65753a581b20ed86917ef6b3492fb08a844 | JavaScript | yzgc/react-mobile | /src/config/apiConfig.js | UTF-8 | 1,118 | 2.578125 | 3 | [] | no_license |
const apiType = 0 // 用于确定当前环境 0:本地,1:dev, 2: sit, 3: 写死的, 4:nginx代理,活域名
const LOCAL_URL = `http://${location.hostname}:8001` // 模拟环境域名和端口(locahost || ip)
const DEV_URL = 'http://www.dev.com'
const SIT_URL = 'http://www.sit.com'
const PRODUCTION_URL = 'http://www.PRODUCTION.com'
const PROXY_URL = `http://${locati... | true |
053005a3c03426027558bc52ddffe38d290ca42a | JavaScript | unfaiyted/movies-application | /src/index.js | UTF-8 | 14,979 | 2.609375 | 3 | [] | no_license | /**
* es6 modules and imports
*/
// import sayHello from './hello';
// sayHello('World');
/**
* require style imports
*/
// const $ = require('jquery');
const {getMovies, getMovieDBData, deleteMovie, addMovie, addMovieData, getFullMovieData, getMovie, searchMovieDBData, addFav} = require('./api.js');
const {sayHel... | true |
63c69b6a6236b8ef6ede5226d403740def64751d | JavaScript | PaolaOlvera27/36_EvaluacionG3 | /ejercicio1.js | UTF-8 | 658 | 4 | 4 | [] | no_license | /*INICIO
Repetir 3 veces
Escriba: Eres el turno 1, elige piedra, papel o tijera
Lea: turno1
Escriba: Eres el turno 2, elige piedra, papel o tijera
Lea: turno2
Sí turno1 = turno2
entonces Escriba: Empataron
sí no, sí ....
FIN */
var i = 1;
for (var i = 1; i <= 3; i++) {
var turno1 = prompt ("Eres el Turno 1, elige pied... | true |
5edce3e869b58960868842aaa6f9fca9803b7b5e | JavaScript | marcinsukacz/homework_w6_d2 | /hw_tdd_jurassic_park_start/specs/park_spec.js | UTF-8 | 1,888 | 3.078125 | 3 | [] | no_license | const assert = require('assert');
const Park = require('../models/park.js');
const Dinosaur = require('../models/dinosaur.js');
describe('Park', function() {
let dino1;
let dino2;
let dino3;
let dino4;
let dino5;
let park;
beforeEach(function () {
dino1 = new Dinosaur('Diplodok', 'herbivore',... | true |
068937fa0b970d26719273d49f40a405c24ac4bc | JavaScript | mskkai/random-problem-solving | /sortby-height.js | UTF-8 | 399 | 3.359375 | 3 | [] | no_license | function sortByHeight(a) {
let persons = a.filter((val) => val != -1).sort((a, b) => a - b);
for (let index = 0; index < a.length; index++) {
if (a[index] != -1) {
if (persons.length > 0) {
a[index] = persons.shift();
}
}
}
return a;
}
(function () {
let input = [-1, ... | true |
054b8d82684d2e359163621b37ab592cc81ce891 | JavaScript | igokuly2k/NTCalc | /src/reducers/InputReducer.js | UTF-8 | 1,035 | 2.59375 | 3 | [] | no_license | const INITIAL_STATES = { error: '', number: '', picker: 'lcm', array: [], length: 0 };
export default (state = INITIAL_STATES, actions) => {
switch (actions.type) {
case 'Value_Change':
if (actions.payload.props === 'picker') {
return { ...INITIAL_STATES, picker: actions.payload.... | true |
9b9ba7bd29fd68f3de14a47523278c438ee7ec06 | JavaScript | FranzFelberer/clock_change | /src/App.js | UTF-8 | 1,982 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
//import logo from './logo.svg';
import './App.css';
import Input from './components/Input';
import SunTimesChart from './components/SunTimesChart';
class App extends Component {
constructor(props) {
super(props);
this.state = {
startDate: "2019-01-01",
... | true |
00b66942c6a5864d72c7fa9728246cd9ac449cf3 | JavaScript | kerlos-alfy/First-project-in-Nanodegree | /js/app.js | UTF-8 | 2,444 | 3.171875 | 3 | [] | no_license | //Start of the menu
let unorderedList = document.getElementById("unordered-list");
let containerCount = document.getElementsByClassName("landing__container")
.length;
for (i = 1; i < containerCount + 1; i++) {
let item = "#section" + i + "titlle";
let itemValue = document.querySelector(item);
let item... | true |
b2ceb86403f25dfcd0460a4252b3107b408f3626 | JavaScript | TonyLee-838/terminal-daily-spending | /interactive.js | UTF-8 | 7,667 | 2.59375 | 3 | [] | no_license | const inquirer = require("inquirer");
const chalk = require("chalk");
const {
getDateString,
autoCompleteDateInput,
autoCompleteMonthInput,
autoCompleteDescription,
} = require("./util");
const { startup } = require("./startup");
const { keyDB, dateDB, memoDB } = startup();
async function run() {
const an... | true |
4598e7a599e071d273be477d5f6362448430a13a | JavaScript | Manisha86/Manisha86 | /cc4-react-training/FindUniqueElements.js | UTF-8 | 612 | 3.3125 | 3 | [] | no_license | function FindUniqueElements(){
var i , j ;
isUnique();
for(int; i=0;i<arr.length,i++){
console.log;
var Boolean ,isUnique=false;
for(int ;j=0;j<i,j++){
if(arr[i]==arr[j]){
isUnique=true;
break;
... | true |
7bee191ccd8a2f435e78fd23877ee335e35c9575 | JavaScript | AntuV/longiinius-bot | /commands/historia.js | UTF-8 | 6,108 | 2.59375 | 3 | [] | no_license | const client = require("../client.js");
const db = require("../db.js");
const utils = require("../common/utils.js");
const dayjs = require("dayjs");
const config = require("../config.js");
let globalCooldown = false;
let alreadyWarnedUserCD = false;
let alreadyWarnedGlobalCD = false;
const historiaCommand = async (co... | true |
2a902e701aae8c83d1596ab4a1f83c7f09bb092e | JavaScript | jgx13245/bl-project | /2-part-bl-project-4.0/src/js/register.js | UTF-8 | 3,951 | 2.75 | 3 | [] | no_license | /*
六大主页里面的注册页的js代码
目的实现:1.每个输入框的验证,(尽量用正则)
2.右上角的登录按钮,点击时跳转到登录页面
3.验证码看项目开发情况进行相应的改进
4.先写着试试
*/
$(function() {
$(".check").click(function() {
$(".check img").toggle();
})
var reg_user = /^[0-9a-z_-]{6,20}$/i;
var reg_password = /^[0-9a-z_-]{6,18}$/i;
var reg_tel = /^1[0-9... | true |
9eb35ed6f06ea7bd238a1b0dc2371a780afe7574 | JavaScript | JoywayWang/Gitmia | /mia/js/cookie.js | UTF-8 | 1,113 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | let Cookie = {
getItem(key) {
var arr = document.cookie.split("; ");
for (let i = 0; i < arr.length; i++) {
let arrTemp = arr[i].split("=");
if (arrTemp[0] == key) {
return arrTemp[1];
}
}
},
setItem(key, value, day, path) {
... | true |
bb2f9c16395c068ed0fd1e6b507703da8b565bbd | JavaScript | kbgar24/inspiredApps-challenge | /src/actions.js | UTF-8 | 772 | 2.84375 | 3 | [] | no_license | const startPositions = {
redDot: {
type: 'red',
position: 'redStart',
},
greenDot: {
type: 'green',
position: 'greenStart',
},
blueDot: {
type: 'blue',
position: 'blueStart',
},
blackDot1: {
type: 'black',
position: 'blackStart1',
},
blackDot2: {
type: 'black',
... | true |
0705ba7958d0e56c7c631700f884e030a72191c6 | JavaScript | BrunoSDias/First-Jobs | /landingPage/app/controllers/membro-controller.js | UTF-8 | 632 | 2.640625 | 3 | [] | no_license | var MembroModel = require('../models/membro.js');
var membroController = {
cadastrar: function(req, res, next){
var membro = new MembroModel();
membro.nome = req.body.nome;
membro.email = req.body.email;
membro.whatsapp = req.body.whatsapp;
membro.salvar(function(resposta){
var retorno = '';
i... | true |
90a971e2e571a3872dfcd14ea5f7db088f0732d2 | JavaScript | jaykeunit/Taxi-Cab-Service | /test/indexFunctionstest.js | UTF-8 | 5,360 | 2.828125 | 3 | [] | no_license | describe('taxiServiceIndexTest', function () {
it('canary is passing', function () {
expect(true).to.be.eql(true);
});
beforeEach(function(){
this.event = {
preventDefault: function(){
this.tester = true;
},
dataTransfer:{
getData: function (prop){
return prop === 'CarType' ? 'fastCar' : ... | true |
d00e84a77df22f211474d8601ca4e8958e18384b | JavaScript | mariusstengel/webcomponents | /vimeoplayertimer.js | UTF-8 | 3,350 | 2.6875 | 3 | [] | no_license | "Use strict";
// 1
const template = document.createElement("template");
template.innerHTML = `
<div id="vimeoPlayer" class="w-100"></div>
`;
// 2
class vimeoPlayerTimer extends HTMLElement {
constructor() {
super();
this.attachShadow({mode: "open"});
this.shadowRoot.appendChild(template.... | true |
7b6c48cac1ca7c2b8b54e433c2fca02a410cd450 | JavaScript | Atomy-Toothpaste/Algorithm | /Xylitol/Queue.js | UTF-8 | 1,055 | 3.71875 | 4 | [] | no_license | class CircleQueue {
constructor(size) {
this.maxQueueSize = size;
this.array = [];
this.front = 0;
this.rear = 0;
}
isEmpyt() {
return this.front == this.rear;
}
isFull() {
return (this.rear + 1) % this.maxQueueSize == this.front;
}
enQueue(item) {
if (this.isFull()) {
... | true |
186189f94fd6480bf1fa4f1782ef934c217f911c | JavaScript | jjohnson2458/stogieboys | /global/scripts/js/global_js_functions.js | UTF-8 | 1,553 | 2.90625 | 3 | [] | no_license | /*
* global javasctipt funcitons
*/
function checkDecimal(obj, objStr){
var objNumber;
if(isNaN(objStr) && objStr!=''){
alert('Value entered is not numeric');
objNumber = '0.00';
}
else if(objStr==''){
objNumber = '0.00';
}
else if(objStr.indexOf('.')!=-1){
if(((... | true |
a2b62cc930c54633ef5cc3d024c1871d1e1120ce | JavaScript | Jiachengciel/Interview_Code | /js/去掉重复数据.js | UTF-8 | 249 | 3.46875 | 3 | [] | no_license | function deleteArray(arr){
arr.sort();
var newArr = [];
for(var i = 0; i < arr.length; i++){
if(arr[i] !== newArr[newArr.length-1]){
newArr.push(arr[i]);
}
}
return newArr;
}
arr = [1,3,2,3,1,2,5,5,4,2,7,2]
console.log(deleteArray(arr)) | true |
e54a6db07f523686e79759c8702bd941946f06e2 | JavaScript | mynatt/ziplist | /ziplist.js | UTF-8 | 437 | 3.609375 | 4 | [] | no_license | function zipList(arr1, arr2) {
if (arr1.length !== arr2.length) return null;
const { length } = arr1;
const newarr = [];
for (let i = 0; i < length; i++) {
newarr.push(arr1[i]);
newarr.push(arr2[i]);
}
return newarr;
}
function zipListTheSimpleWay(arr1, arr2) {
return _.flatten(_.zip(arr1, arr2))... | true |
f4532c2640ee97b779c9f5dded1a842e5fce8c84 | JavaScript | perluhin/tic_tac | /static/js/index.js | UTF-8 | 1,912 | 3.21875 | 3 | [] | no_license | function winning(board, player){
if (
(board[0] == player && board[1] == player && board[2] == player) ||
(board[3] == player && board[4] == player && board[5] == player) ||
(board[6] == player && board[7] == player && board[8] == player) ||
(board[0] == player && board[3] == player ... | true |
e856530cf553e2a8267b7f21446d6df45882ce5b | JavaScript | Alexlloydwhite/unit-testing | /server/test/server.test.js | UTF-8 | 852 | 2.703125 | 3 | [] | no_license | let app = require('../server');
let testServer = require('supertest');
describe('Test the user router, root path GET', () => {
test('when not logged in we get a 403 status', async () => {
const response = await testServer(app).get('/api/user');
expect( response.statusCode ).toBe(403);
});
... | true |
3d89b87871d40cac985c9b1d6238ea1709efbd31 | JavaScript | sebassarmiento/programadorWeb-2935 | /Clase 08/Alumno/Desafío/index.js | UTF-8 | 697 | 3.328125 | 3 | [] | no_license | console.log('Init app')
var student = {
firstName: 'Juan',
lastName: 'Peréz',
dni: 22999333,
email: 'juan@gmail.com'
}
var student2 = {
firstName: 'Marcos',
lastName: 'Gomez',
dni: '39876876',
email: 'marcosgomez@gmail.com'
}
function createStudentNode(studentObj) {
var mainList = document.getEleme... | true |
b11dbbbb9f364870eb352be3a20ff53eba284c5d | JavaScript | elves-project/agent | /public/js/agent.js | UTF-8 | 1,819 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | var dashboard = {};
dashboard.getGen = function () {
$.get("/stat/general", function (data) {
if (data.msg == "success") {
$("#agent-mode").text(data.data['Mode']);
if(data.data['Mode']=="DEVELOP"){
$("#agent-mode").addClass("label label-warning");
}el... | true |
ba6d1176ab333e421ce3ff079d8008e0a82be163 | JavaScript | annedaeunlee/dbDesignCourseRegistration | /src/main/webapp/services/movie-service.js | UTF-8 | 796 | 2.75 | 3 | [] | no_license | const FIND_ALL_MOVIES = "http://localhost:8080/findAllMovies"
const FIND_MOVIE_BY_ID = "http://localhost:8080/findMovieById"
const CREATE_MOVIE_URL = "http://localhost:8080/createMovie"
const DELETE_MOVIE_URL = "http://localhost:8080/deleteMovie"
const RENAME_MOVIE = "http://localhost:8080/renameMovie"
const findAllMo... | true |
68eec0f12b8559374e12848cd6da194df7c350f4 | JavaScript | sarahharding1/DataRep_Lab1 | /cars.js | UTF-8 | 809 | 3.6875 | 4 | [] | no_license | class Vehicle
{
constructor(make, model, year){
// arguments
this.make = make;
this.model = model;
this.year = year;
}
Information(){
console.log(`Make: ${this.make}`);
console.log(`Model: ${this.model}`);
console.log(`Year: ${this.year}`)... | true |
629b41ae920681aa3f2eacb67f4d64bc7432a5b7 | JavaScript | chuahou/miso | /js/collapse.js | UTF-8 | 1,584 | 3.46875 | 3 | [] | no_license | // SPDX-License-Identifier: MIT
// Copyright (c) 2021 Chua Hou
/**
* Collapses/expands the given header's contents.
*
* Sets display of all nodes between the given header and the next element of
* the same type to "none" if visible now, and "" otherwise.
*/
function collapse(header) {
const collapseClass = "coll... | true |
d78dbaeec6a425e660d0acfcea5263e97b7f3725 | JavaScript | jaylach/kale | /lib/engine.js | UTF-8 | 1,023 | 2.609375 | 3 | [
"MIT"
] | permissive | "use strict";
var actions = require('./actions');
// callAction()
var callAction = function callAction(action, param, args) {
var newArgs = [ param ];
newArgs = newArgs.concat(args);
var actionName = action;
if ( actions.hasAction(actionName) ) {
return actions[actionName].apply(this, newArgs);
}
re... | true |
a7dfc369f0ea483b5d9daf8457308979bf2a5c6f | JavaScript | FernandoMora02/Blog_Programas | /js/usuarios.js | UTF-8 | 1,841 | 2.921875 | 3 | [
"MIT"
] | permissive | usuarios = [{id:'1',usuario:'Fernando10b'},
{id:'2',usuario:'Camila32a'},
{id:'3',usuario:'Gloria13'}];
usroId = 3;
idaeliminar = 0;
idaeditar = 0;
actualizar();
console.log(mensajes);
function agregarUsuario(){
let usr = $("#usr").val();
usroId ++;
nuevoUS = {id: usroId,usuario:... | true |
541afbef8ecf14f53fd86ffbd5737a8b0276c0b0 | JavaScript | rahulapgm/esenchi-mobile-ecom | /main/utils/commonUtils.js | UTF-8 | 188 | 2.9375 | 3 | [] | no_license | export const createOptionList = (arrOfObj, mapKey, mapValue) => {
let options = [];
arrOfObj.map((item, index) => {
const key = index;
const value = item[`${mapKey}`];
})
}
| true |
e04bd588f42718952634444d8a2142258d58c679 | JavaScript | doriantaing/happy-moments | /src/components/Complete.js | UTF-8 | 2,581 | 2.875 | 3 | [] | no_license | import React, { Component } from 'react';
class Complete extends Component {
constructor(props) {
super(props);
this.state = {
subject: "",
verb: "",
object: "",
sentences: [],
error: false
}
}
async getDatas(event){
e... | true |
a3611ebe4cd21372e35086663d3d35e9479136aa | JavaScript | umanghome/mit-media-lab-di15 | /di_india_examples-master/tessel_blinky/blinky_server.js | UTF-8 | 859 | 2.765625 | 3 | [] | no_license | /**
* Created by tomerweller on 1/12/15.
*/
// Import the interface to Tessel hardware
var tessel = require('tessel');
var http = require("http");
var wifi = require('wifi-cc3000');
// Set the led pins as outputs with initial states
// Truthy initial state sets the pin high
// Falsy sets it low.
function startServ... | true |
25df94d0f4c57f4a9942c621f7bc2172fb61e138 | JavaScript | nbeers22/bookmarks-api | /test/bookmarks-endpoint.spec.js | UTF-8 | 7,898 | 2.765625 | 3 | [] | no_license | const knex = require('knex');
const app = require('../src/app.js');
const testBookmarks = require('./bookmarks.fixtures.js');
describe('Bookmarks Endpoint', () => {
let db;
const headers = {
Authorization: 'Bearer abcd12345'
}
before('make knex instance', () => {
db = knex({
client: 'pg',
... | true |
56d3e74e5cb98532ee802cbf6cf54d2890701487 | JavaScript | antiarcher/MERN-train | /routes/auth.routes.js | UTF-8 | 4,738 | 2.609375 | 3 | [] | no_license | const {Router} = require('express')
const bcrypt = require('bcryptjs')
const jwt = require('jsonwebtoken')
const config = require('config')
const User = require('../models/User')
const router = Router()
const {check, validationResult} = require('express-validator')
///api/auth/register
router.post(
'/register',
[... | true |
aaa976390a920371585bd8a0b91a37b2c9204a54 | JavaScript | SektorDV/Node.js_challenge_dzien_4 | /app/zadanieDnia2.js | UTF-8 | 416 | 2.90625 | 3 | [] | no_license | //Twój kod
const http = require('http');
const srv = http.createServer((request, response) => {
let userAgent = request.headers['user-agent'];
response.setHeader('Content-type', 'text/html; charset=utf-8');
response.end(`<p style="margin: 0 auto; display: block; text-align: center;">Hi.<br> You're using $... | true |
6855fc95030c5ab2bcb433cb99e98c4779e9ce90 | JavaScript | Swordfish90/fifteen | /qml/utils.js | UTF-8 | 832 | 3.578125 | 4 | [] | no_license | /**
* Shuffles array in place.
* @param {Array} a items An array containing the items.
*/
function shuffle(a) {
var j, x, i;
for (i = a.length - 1; i > 0; i--) {
j = Math.floor(Math.random() * (i + 1));
x = a[i];
a[i] = a[j];
a[j] = x;
}
return a;
}
function swap(arra... | true |
a9f9213c5172e465de944d00777dfd1e4a98405b | JavaScript | nakyoungan/konkukclub | /js/start.js | UTF-8 | 4,687 | 2.625 | 3 | [] | no_license | const footer = document.getElementById('footer');
const wrap = document.getElementById('wrap');
const qna = document.getElementById('qna');
const tabletMQL = window.matchMedia('all and (min-width: 768px)');
const pcMQL = window.matchMedia('all and (min-width: 1024px)');
const ENDPOINT = 8;
const select = [];
let qIdx ... | true |
c9d0b575cf1bb3d592a0da667ef1ccf6540be391 | JavaScript | shloch/TIC_TAC_TOE | /asset/gameboard.js | UTF-8 | 2,884 | 3.25 | 3 | [
"MIT"
] | permissive | "use strict";
var GameModule = (function() {
let gameboard = [];
let verifyGameWinner = function(isWinner, player) {
if (isWinner) {
mod.alert(`GAME OVER !!! --- ${player.getName()} WON`);
document.querySelector(".splash").innerHTML = `${player.getName()} WON`;
doc... | true |
32ae5d5d1d14204629562c12f543d9e6c8f9599b | JavaScript | pasiuta/codewars-javascript | /counting-sheep.js | UTF-8 | 424 | 4.1875 | 4 | [] | no_license | //Consider an array/list of sheep where some sheep may be missing from their place. We need a function that counts the number of sheep present in the array (true means present).
function countSheeps(arrayOfSheep) {
let count = [];
for(let i = 0; i < arrayOfSheep.length; i++)
if(arrayOfSheep[i] == true)
... | true |
dfb691cc100507dfcfa8e365358bebdd2a534fad | JavaScript | muntnd/pandemics_data | /scripts/04_pandemics.js | UTF-8 | 6,019 | 2.53125 | 3 | [] | no_license | //has all the shit we tried for date calculating
//and other functions just messy flyin around
const paper = Snap("#svgContainer");
const paperWidth = window.innerWidth;
const paperHeight = window.innerHeight;
var i, j = 0;
var xPos, yPos, radius = 0;
let dataCombined = [dataSars, dataSwine, dataEbola, dataC... | true |
1c7bf17f364f3264339350abb57bcc4cec628046 | JavaScript | Byantdzf/law-frontend | /xcx/client/utils/tools.js | UTF-8 | 2,068 | 3.3125 | 3 | [] | no_license | function formatTime(date) {
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var hour = date.getHours()
var minute = date.getMinutes()
var second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, secon... | true |
2c1d5a6cd54902bd6d2d38780de6f2362cee6517 | JavaScript | Shybert/givemesteamdeals | /main.js | UTF-8 | 5,981 | 2.609375 | 3 | [] | no_license | const express = require("express");
const hbs = require("hbs");
const path = require("path");
const misc = require("./modules/misc");
const db = require("./modules/db");
// Interesting IDs: 10680
// Setting up basics
const app = express();
app.set("port", 3000);
app.set("view engine", "hbs");
app.use(express.static(... | true |
e19f453c176ca28b9f62f3c1dcadece7eeb37b7e | JavaScript | yanqzsu/keyman169.github.io | /public/js/tile.js | UTF-8 | 1,539 | 3.21875 | 3 | [] | no_license | /**
* Created by YanQ on 2015/4/28.
*/
function Tile(position){
this.x = position.x;
this.y = position.y;
this.previousPosition = null;
}
Tile.prototype.savePosition = function () {
this.previousPosition = { x: this.x, y: this.y };
};
Tile.prototype.updatePosition = function (position) {
this.x ... | true |
d50c0860c38b8240a1d54c455842934e4271e02e | JavaScript | technologyarts/meep-engine | /view/tooltip/DomTooltipManager.js | UTF-8 | 3,992 | 2.984375 | 3 | [] | no_license | import { DomTooltipObserver } from "./DomTooltipObserver.js";
/**
*
*/
export class DomTooltipManager {
/**
*
* @param {TooltipManager} tipManager
*/
constructor(tipManager) {
/**
* @readonly
* @private
* @type {TooltipManager}
*/
this.tipMa... | true |
84008bb741e268cc6a2ef5fe903433c33722a72d | JavaScript | ajlopez/RskUtils | /procblocks/count.js | UTF-8 | 1,350 | 2.734375 | 3 | [
"MIT"
] | permissive |
const fs = require('fs');
const rlp = require('rlp');
const filename = process.argv[2];
const text = fs.readFileSync(filename).toString();
const lines = text.split('\n');
const nlines = lines.length;
let tsize = 0;
let nblocks = 0;
let ntransactions = 0;
let nuncles = 0;
let nunclessamem = 0;
for (let k = 0; k < n... | true |
6d9c7b0b4b9ac4a0b74e393c689ec1113b6b2a44 | JavaScript | mrb852/dn | /p2p/peer_old/src/kascade.js | UTF-8 | 1,930 | 2.75 | 3 | [] | no_license | var fs = require('fs');
var supportedFileFormats = ['json'];
var kascadeProperties = [
"blockhashes", "tracker", "filesize", "filehash", "filename"
];
function Kascade(file) {
if (!(this instanceof Kascade)) {
return new Kascade(file);
}
var self = this;
self.progress = 0.0;
self.peers = [];
getFi... | true |
d5cb4c1e6c9324fe69389085e7416f7637514e8f | JavaScript | tdorsey/maas-ui | /ui/src/app/preferences/selectors/token/token.js | UTF-8 | 1,528 | 2.6875 | 3 | [] | no_license | const token = {};
/**
* Returns a list of all authorisation tokens.
* @param {Object} state - The redux state.
* @returns {Array} A list of all state.token.items.
*/
token.all = state => state.token.items;
/**
* Whether the authorisation tokens are loading.
* @param {Object} state - The redux state.
* @returns... | true |
415ef9285dab1df651c39f3ccfaafb509cf156cb | JavaScript | Spadalow/Day18 | /ex02/src/index.js | UTF-8 | 689 | 3.578125 | 4 | [] | no_license | let fifteenArray = [];
function* myGenerator(){
yield* insideGenerator1();
yield* insideGenerator2();
yield* insideGenerator3();
}
function* insideGenerator1(){
let x = 0;
for(let i = 1; i <= 5; i++){
x = i;
yield x;
}
}
function* insideGenerator2(){
let x = 0;
for(l... | true |
d936f02d383ee8a7d2b16b83868061f40a8a16d6 | JavaScript | chaogao/CanvasSketch | /gameProject2/src/Objects/Enemy.js | GB18030 | 6,620 | 2.796875 | 3 | [] | no_license | Defence.Enemy = function(type, row, col, position, tileSize, gameInfo){
this.type = type;
this.row = row;
this.col = col;
this.position = position;
this.distination = position.clone();
this.tileSize = tileSize;
this.gameInfo = gameInfo;
this.getAttribute();
this.imageSource = this.getImage();
this.imageTiles... | true |
0f1b0ff7617dbcdfb0bda92b3c85fc98802c4215 | JavaScript | hironmoy05/Klasssy_cafe | /app/assets/scripts/modules/stickyHeader.js | UTF-8 | 475 | 2.796875 | 3 | [] | no_license | import throttle from 'lodash/throttle';
class StickyHeader {
constructor() {
this.siteHeader = document.querySelector('.header');
this.events();
}
events() {
window.addEventListener('scroll', throttle(() => this.runOnScroll(), 200))
}
runOnScroll() {
if (window.scrollY > 350) {
this.s... | true |
41383f239edf619cfedfd4f0573dab637a8d4c63 | JavaScript | CSS-Scripter/IPRWC | /backend/src/dao/product.dao.js | UTF-8 | 2,548 | 2.546875 | 3 | [] | no_license | const { openPool } = require('../database/db')
const getAllQuery = {text:
'SELECT * ' +
'FROM products ' +
'WHERE product_visibility = true;'
}
const getSingleQuery = {text:
'SELECT * ' +
'FROM products ' +
'WHERE product_id = $1;'
}
const createProductQuery = {text:
'INSER... | true |
4eaef2ca509730c02d0340b70e12a73259895bf3 | JavaScript | benjarier/absence | /sketch.js | UTF-8 | 6,579 | 2.546875 | 3 | [
"MIT"
] | permissive | let cameraAuthorized = true;
navigator.mediaDevices.getUserMedia({ audio: false, video: true })
.catch(function(err) {
// alert("Le site à besoin de l'accès à la webcam pour prendre une photo, vous pouvez quand même charger une image");
cameraAuthorized = false;
});
let bodypix;
let video;
let segmentation;
let img... | true |
3d62c78d4997ebb7df07f6bdfdeee5f6d71c0090 | JavaScript | karmapoint/AppAcademy_Homework | /w5d5/arguments/arguments.js | UTF-8 | 384 | 3.703125 | 4 | [] | no_license | function sum() {
// console.log(arguments);
let arr = Array.from(arguments);
let result = arr.reduce(function(acc, val) {
return acc + val;
}, 0);
return result;
}
// arr = [1,2,3]
console.log(sum(1,2,3));
const sum2 = (...args) => {
let result = args.reduce(function(acc, val) {
return acc + val;
... | true |
c56f50b7f7d0f10affdff853558beb48fb691c87 | JavaScript | UnJavaScripter/pixel-paint | /dist/color-picker.js | UTF-8 | 2,588 | 2.8125 | 3 | [
"MIT"
] | permissive | export class ColorPicker {
constructor() {
this.isPickerOpened = false;
this.pickerElem = document.createElement('div');
this.colorsList = [
'#ffffff',
'#000000',
'#C0C0C0',
'#808080',
'#FF0000',
'#00FF00',
'... | true |
0e0aa14d8e1acba8fda73f0fc94a1a0c8edb7f53 | JavaScript | srbtj/drag | /js/DragChild.js | UTF-8 | 656 | 2.515625 | 3 | [] | no_license | function DragChild(id){
Drag.call(this,id);
};
extend(DragChild.prototype,Drag.prototype);
DragChild.prototype.mouseMove = function(ev){
var L = ev.clientX - this.disX;
var T = ev.clientY - this.disY;
if(L < 0){ L = 0;}
else if(L > document.documentElement.clientWidth - this.obj.offsetWidth){
... | true |
8d3ccb5f0b1bc6c06f6c52bed30bdfda905a2138 | JavaScript | etongarcia/aula9 | /ex1.js | UTF-8 | 1,190 | 3.125 | 3 | [] | no_license | // Everton Garcia
function menu (prato, tempoInserido){
let tempoPadrao;
switch(prato){
case 'pipoca':
tempoPadrao = 10;
resposta (tempoPadrao, tempoInserido); // callback
break;
case 'macarrao':
case 'brigadeiro':
tempoPadrao = 8;
... | true |
b88ee772684e20b5fecd0d7ea64600a249759a15 | JavaScript | lets-code-vinay/projects-2019-21 | /React-greetings-with-live-time-master/greetingWdTime.js | UTF-8 | 968 | 2.984375 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
//to change manually
//let curDate = new Date(2020,4,8,22)
let curDate = new Date()
curDate = curDate.getHours()
let greetings = " ";
let title = " ";
let cssStyle= {};
if(curDate >= 1 && curDate <12){
greetings = "Good morning";
t... | true |
76f22b230130acbffd2070f2a3b176da92302e70 | JavaScript | maxim1006/node | /8-fs/streams/get-post-server-test/test-fsstat/fsstat.js | UTF-8 | 768 | 2.640625 | 3 | [] | no_license | "use strict";
const chai = require("chai");
const expect = chai.expect;
const fs = require('mz/fs');
const co = require("co");
const path = require("path");
describe("fsstat", () => {
it("if file exists return true", (done) => {
let stats;
co(function* () {
stats = yield fs.stat(path... | true |
008884c30d916201b244a582712d38dbd520539b | JavaScript | ohnx/stretto | /static/js/player/models.js | UTF-8 | 2,430 | 2.609375 | 3 | [
"MIT"
] | permissive | // this file contains the models/collections in needed by the player
/* global Backbone, socket, player, */
var PlaylistCollection = Backbone.Collection.extend({
comparator: function(playlist) {
return [playlist.get('editable'), playlist.get('title')];
},
fetch: function(options) {
socket.emit('fetch_pl... | true |
703c1d78e510ad4884747c6590b1293b1e3339f7 | JavaScript | candyvans/firstExam_TV | /js/index.js | UTF-8 | 5,394 | 3 | 3 | [] | no_license | window.onload = function() {
//设置bannerImg的宽度
var bannerImg = document.querySelector(".panel");
var imgArr = bannerImg.getElementsByTagName("img");
bannerImg.style.width = 1700 * imgArr.length + "px";
//默认显示图片的索引
var index = 1;
bannerImg.style.left = -1700 * index + "px";
//开启自动切换图片
... | true |
b3a8d375acecb16f494858c3d55e70c2864120b7 | JavaScript | stephenoreilly/XsAndOs | /main.js | UTF-8 | 1,461 | 3.984375 | 4 | [] | no_license | var grid = [[0, 0, " "], [0, 1, " "], [0, 2, " "], [1, 0, " "], [1, 1, " "], [1, 2, " "], [2, 0, " "], [2, 1, " "], [2, 2, " "]];
function placeValue(value){
if(checkForChanceOfWin()){
} else if(checkForChanceOfLoss()) {
} else {
placeInDiagonal(value);
}
}
function placeInDiagonal(value){
if(grid[0][2] == "... | true |
0bbb8a8505c22d02f9e2a3eebe8fb7c52f7d4cf5 | JavaScript | zhangxinyong12/essays- | /other/promise.js | UTF-8 | 1,380 | 3.421875 | 3 | [] | no_license | const p1 = new Promise((resolve, reject) => {
setTimeout(() => {
const n = Math.random();
if (n > 0.5) {
resolve("p1 resolve 结果:" + n);
} else {
reject("p1 reject 结果:" + n);
}
}, 900);
});
const p2 = new Promise((resolve, reject) => {
setTimeout(() => {
const n = Math.random();
... | true |