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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
09a9063ad21525992976cf87ac6b1cd433fbf9a7 | JavaScript | Bhoos/native | /packages/stage/src/stateChanged.js | UTF-8 | 461 | 2.875 | 3 | [
"MIT"
] | permissive | // @flow
function is(x, y) {
return x === y;
}
export default function stateChanged(update, prevState) {
if (is(update, prevState)) return false;
if (typeof update !== 'object' || update === null) {
return false;
}
const keys = Object.keys(update);
if (keys.length === 0) {
return false;
}
fo... | true |
284d8307e560e3d594fb0fd02b853d5498fa6551 | JavaScript | jeongY-Cho/streamer | /public/js/Syncronizer.js | UTF-8 | 2,864 | 2.5625 | 3 | [] | no_license | class SyncedPlayer extends Hls {
isInit = false;
async init() {
if (!this.isInit) {
this.ping = await this.getAvgPing();
this.serverOffset = await this.getServerOffSet();
this.isInit = true;
} else {
throw new Error("Already Initialized");
}
}
async resync() {
this.isIn... | true |
3bf8978b8923a9a3f58c95d048337990a4a989f4 | JavaScript | Baptouuuu/Sy | /dist/storage.js | UTF-8 | 166,216 | 3.453125 | 3 | [
"MIT"
] | permissive | /*! sy#1.2.0 - 2015-01-13 */
/**
* Transform a dotted string to a multi level object.
* String like "Foo.Bar.Baz" is like doing window.Foo = {Bar: {Baz: {}}}.
* If object exists it is not transformed.
* You can modify the root object by doing namespace.call(rootObject, nsString).
*
* @param {string} ns
*
* @ret... | true |
77303d90a16c80c434f8769b631deb94719acb9f | JavaScript | nsc-yukik-yamada/ito-kanri | /js/controllers/ItoController.js | UTF-8 | 2,097 | 3.140625 | 3 | [] | no_license | class ItoController {
// 入力した値を受け取る
constructor() {
let selector = document.querySelector.bind(document);
this._inputColor = selector("#color");
this._inputBrand = selector("#brand");
this._inputHinban = selector("#hinban");
this._itoList = new ItoList();
this._itoListView = new ItoListView... | true |
75f0d39424a2b326c2921e551c4ff4fb69e708f4 | JavaScript | carlospcalvo/CursoIngresoJS | /9-Parciales/2018_1Cuatri_Parcial_fuentes/siete.js | UTF-8 | 1,659 | 4.34375 | 4 | [] | no_license | /*Realizar el algoritmo que permita el ingreso por prompt de las notas (validar entre 0 y 10) ,
el sexo (validar el sexo “f” o “m”) de 5 alumnos, informar por alert:
a) El promedio de las notas totales.
b) La nota más baja y el sexo de esa persona.
c) La cantidad de varones que su nota haya sido mayor o igual a 6.
... | true |
d6db12e4c0b2fc9311c7cea7ef5097ab891eb49e | JavaScript | nemodaattila/BookWebShop-With-CustomFramework-old | /core/javascript/core/javascript/core/EventSubscriptionHandler.js | UTF-8 | 3,106 | 3.203125 | 3 | [] | no_license | /**
* eseményfeliratkozáskezelő osztály
* fel lehet iratkozni bizonyos kulcsszavakra, amiket az események küldhetnek
* !! a lehetséges kulcsszavak nincsenek mentve !!
*/
class EventSubscriptionHandler
{
/**
* feliratkozások tömbje
* @type {[]}
*/
static subscriptions = [];
... | true |
b7e5a502f820c3623e1d3aeaa375e31b3bcb6fad | JavaScript | Kusshalsureka/pro-34-m | /sketch.js | UTF-8 | 799 | 3.34375 | 3 | [] | no_license | //Create variables here
var dog;
var happyDog;
var database;
var food;
var foodStock;
function preload()
{
//load images here
dogImg=loadImage("images/dogImg.png")
happyDogImg=loadImage("images/dogImg1.png");
}
function setup() {
createCanvas(500,500);
database=firebase.database();
dog=new dog(200,200,1... | true |
e2b824c8c501450489b1c952d453c728af3108cd | JavaScript | svanhesteren/codevaluate-ui | /src/randomStudent.js | UTF-8 | 2,818 | 3.75 | 4 | [] | no_license |
const convertWeight = (code) => {
switch(code){
case "Green":
return 21
case "Yellow":
return 32
case "Red":
return 47
default:
return 0
}
}
const sumAllWeights = (evaluations) => {
var allWeights = 0
evaluations.forEach((evaluation) => {
allWeights += convertWei... | true |
fed90f198c4d7026464f1c6c26960b7c8c7ac9cc | JavaScript | semlak/fcc_voting_app_flux | /js/containers/NavbarContainer.jsx | UTF-8 | 2,427 | 2.515625 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | 'use strict';
/*
components/Navbar.jsx
*/
import React from 'react';
import Navbar from '../components/Navbar';
import UserStore from '../stores/UserStore';
import UserActionCreators from '../actions/UserActionCreators';
import ModalActionCreators from '../actions/ModalActionCreators';
import UIStore from '../stor... | true |
854045e1e14eb6d3066214e22787b4314762d3eb | JavaScript | AlexandraBeautyman/hopper-hours | /arrays-and-strings/zeroMatrix.js | UTF-8 | 1,004 | 3.859375 | 4 | [] | no_license | // ZERO MATRIX
// This is problem 1.8 from Cracking the Coding Interview. The prompt: Write an algorithm such that if an element in an M x N matrix is zero, it's entire row and column are set to zero.
function zeroifyMatrix(matrix) {
let zeroRows = {}
let zeroCols = {}
for (let i = 0; i < matrix.length;... | true |
5cdbac417293333787e04892471539961e9f5ce9 | JavaScript | mrajamreddy/dev-contactless-delivery | /src/d3Files/d3VerticalAlignment.js | UTF-8 | 8,794 | 2.703125 | 3 | [] | no_license | // import * as d3 from "d3";
import * as d3 from "d3";
import './d3.css'
export default class HorozontalTree {
constructor() {
this._margin = {
top: 20,
right: 20,
bottom: 20,
left: 20
};
this.svg = null;
this.duration = 750;
... | true |
26dd0f84246fdb136effb14523cf226604a51294 | JavaScript | KemalAltwlkany/bluetooth-microbit-mqtt | /a1_mag_callbacks.js | UTF-8 | 5,494 | 3.21875 | 3 | [] | no_license | //We need to import the main project because it contains
//objects that we require here as well. We also
//need the FileSystem library to work with files
var a1 = require('./a1_main.js');
var fs = require('fs');
//EXTRA
//We'll be constantly logging the MAG data into this file.
//For this to work properly on any PC, t... | true |
9e1826f25c9ced2e94479d848943251687762109 | JavaScript | Beingyo/node-Vue-webSocket-serialPort | /node-serialPort-webSocket-demo/service/websocket/wsConnect.js | UTF-8 | 1,177 | 2.75 | 3 | [] | no_license | export async function wsConnect(getPortName, baudRate, dataBits, stopBits, parity) {
var SerialPort = require('serialport')
// 设置串口属性
let getSerialPort = setPort(getPortName, baudRate, dataBits, stopBits, parity)
// 开启串口
await startPort(getSerialPort, getPortName);
// 开启串口方法
function startPo... | true |
1c342fc18740f266933c8042246f414ad9787428 | JavaScript | tpakeman/project_time_tracking | /src/Tracking/common/utils.js | UTF-8 | 558 | 2.546875 | 3 | [] | no_license | import { DAYS } from './constants'
export const convertToNearestHour = (n, precision = 4) => {
let msHour = 60 * 60 * 1000;
return Math.round((n / msHour) * precision) / precision;
};
export const convertForExport = (data) => {
let readyData = [];
let ix = 0;
Object.values(data).forEach((p) => {
let row... | true |
a8ec894aac868938575c6ffe3af54dd645f563b6 | JavaScript | js-tasks-ru/jsbasic-20210201_valechka1t | /3-module/4-task/index.js | UTF-8 | 271 | 3.015625 | 3 | [] | no_license | function showSalary(users, age) {
let salaryFilter = [];
for (let i = 0; i < users.length; i++) {
if (users[i].age <= age) {
salaryFilter.push(users[i].name, ", ", users[i].balance, "\n")
}
}
let str = salaryFilter.join('');
return str.trim();
}
| true |
bad0675c688a4abf7b4f5b0b8d6a2aff6429640d | JavaScript | NaViSlmc/team1-LLS | /chengrui/个人中心教师端/personal.js | UTF-8 | 3,337 | 2.875 | 3 | [] | no_license | //导航栏切换
var navs = document.getElementsByClassName('subject_nav')[0].querySelectorAll('div');
// console.log(navs);
var contents = document.querySelectorAll('#subject_content>div');
// console.log(contents);
for(var i=0;i<navs.length;i++){
navs[i].index = i;
// console.log(i);
navs[i].onclick = function(){
... | true |
d71c82803952c4c3b508a2c4b2d10f5163cdae2d | JavaScript | ganesh2583/Google-Drive-API-Example | /ui/src/js/components/HomeComponent.jsx | UTF-8 | 931 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import { getAllFiles, downloadFile } from "./../services/googleDriveService";
import { Link } from "react-router-dom";
import TableComponent from "./TableComponent";
class HomeComponent extends Component {
state = {
listOfFiles: []
};
componentDidMount() {
getAl... | true |
b34f097463550b3bd2f221298d0e715a6e975ab6 | JavaScript | broken1451/cursodemyfull | /video 119 Calendario/video 51 Funciones de reemplazo/js/funcionesdereemplazo.js | UTF-8 | 349 | 3.53125 | 4 | [] | no_license | "use strict";
var numero = 14;
var texto = " Hola estoy en el curso de js de victor robles js ";
var texto1 = "Hola mundo";
console.log(texto.replace("js","laravel"));
console.log(texto.slice(14,22));//cortar un string
console.log(texto.split(" "));//separador
console.log(texto... | true |
86bbcd9eeadf137b07840c0772c799808c18d672 | JavaScript | redw/dsq | /bin-debug/lib/utils/ArrayUtil.js | UTF-8 | 5,079 | 3.359375 | 3 | [] | no_license | /**
* 数组工具
*
* Created by hh on 2017/10/17.
*/
var ArrayUtil;
(function (ArrayUtil) {
/**
* 从数组中随机得到一个元素
* @param arr
* @param startIndex
* @param length
* @returns {null}
*/
function getRandomItem(arr, startIndex, length) {
if (arr) {
if (startIndex === und... | true |
6e8b5bccf05d6c2651c77c98da68953cab5019f6 | JavaScript | allenchannn/crawler | /crawler.js | UTF-8 | 1,890 | 2.5625 | 3 | [] | no_license | var request = require('request');
var fs = require('fs');
var cheerio = require('cheerio');
var jsonfile = require('jsonfile')
// request.get('https://juejin.im/')
// //.auth('15889666430', 'chenruilin1', false)
// .on('response',function (response){
// console.log('done:',response)
// })
// .on('error', functio... | true |
cd0fc53791d5ca097ea83e2586a938b4cc483e60 | JavaScript | Jess-White/hill_of_beans_react_app | /src/Components/RateMovie.js | UTF-8 | 4,092 | 2.65625 | 3 | [] | no_license | import React, {Component} from 'react';
import { addFilm, updateFilm } from '../Services/RailsDB.js';
import Card from 'react-bootstrap/Card';
import Button from 'react-bootstrap/Button';
import ButtonGroup from 'react-bootstrap/ButtonGroup'
import DuplicateRating from './DuplicateRating'
import { FontAwesomeIcon } ... | true |
f8ed663fe9d974054a72fcc4613c2dd4ae45bdec | JavaScript | EmreCihanbeyoglu/JavaScriptPractices | /Arrays/MergingArrays.js | UTF-8 | 208 | 3.25 | 3 | [] | no_license |
var arr1 = [1,2,3,4]
var arr2 = [5,6,7,8]
var newArr = arr1.concat(arr2) // iki array'i tek array haline getirir. Ilk sirada ilk belirtilen gelir.
var arr3 = [9,10]
var newArr3 = arr1.concat(arr2, arr3) | true |
3032f8583e6e797250b654c4767897a61f8a74fa | JavaScript | piomacho/radiowave-propagation | /my-app/src/components/Stations/StationsFuture.jsx | UTF-8 | 1,263 | 2.671875 | 3 | [] | no_license | import * as React from 'react';
import { observer } from 'mobx-react-lite';
import { observable } from 'mobx';
import { useEffect } from 'react';
import Select from 'react-select';
class StationsState {
@observable programs;
@observable selected;
constructor() {
this.programs = [];
this.s... | true |
82ebaa8a30f6a8fd93cc93134a85b6c2a37ebea1 | JavaScript | annikahannig/meteme | /backend/client/assets/js/reducers/stats.js | UTF-8 | 1,022 | 2.609375 | 3 | [] | no_license |
import { REQUEST_STATS, RECEIVE_STATS } from '../actions/stats'
import { API_ERROR } from '../actions/api'
// Default state:
var initialState = {
isFetching: false,
};
// Create Stats Reducer
export default function statsReducer(state = initialState, action) {
switch (action.type) {
case REQUEST_STATS:
... | true |
e0556136fdc9b91c914e87cec3235646158a1f62 | JavaScript | baluragala/for-susan | /scope.js | UTF-8 | 188 | 2.90625 | 3 | [] | no_license | var _loop_1 = function(i) {
setTimeout(function () {
console.log(i);
}, 0);
};
for (var i = 1; i <= 10; i++) {
_loop_1(i);
}
var a = 10;
a = 20;
var b = 20;
//b = 20;
| true |
ac0a7b718e4c352a34b4cc176df689e1cdd130bf | JavaScript | newnag/bightHotel | /src/js/functions.js | UTF-8 | 127 | 2.578125 | 3 | [] | no_license | function checkIsNumber(val){
if(val.match(/^-{0,1}\d+$/)){
return true
}
else{
return false
}
} | true |
d4ca3bdc5256addedabb4f367bc2509ccee2304d | JavaScript | Earth-Power-Games/simple-dimple-build | /tool/js/Helper.js | UTF-8 | 1,300 | 3.265625 | 3 | [] | no_license | class Helper {
/**
*
* @param {string} name
* @param {string} content
*/
static downloadTextAsFile(name, content) {
const a = document.createElement("a");
// ! `data:text/plain;charset=utf-8, ${encodeURIComponent(content)}`
a.href = URL.createObjectURL(new Blob([content]));
a.download... | true |
590973850f77793f30b5b66e12c556aaba6c4738 | JavaScript | itclanCode/vue-Project-Demo | /tax-collect/src/common/js/util.js | UTF-8 | 2,158 | 2.84375 | 3 | [] | no_license | let util = {
storage (...args) {
let len = args.length;
if (len === 1) {
return localStorage.getItem && JSON.parse(localStorage.getItem(args[0]));
}
if (len >= 2) {
localStorage.setItem(args[0], JSON.stringify(args[1]));
}
},
removeStorge (name) {
localStorage.removeItem(name)
... | true |
14663cdb6ef7e7dbd501fc87e1c0c4f8ea2b33df | JavaScript | Danieltda/day17 | /express-handlebars/app.js | UTF-8 | 815 | 2.71875 | 3 | [] | no_license | const express = require("express");
const app = express();
// SET IS VERY VERY SPECIFIC TO EXPRESS (WE DONT USE IT A LOT BESIDES FOR VIEW ENGINE)
app.set("view engine", "hbs");
// USE is used in other frameworks as well, but its not a web standard. Use basically defines that we are dealing with a 'middleware'
app.us... | true |
1e90108795e1af9b6361153362ab242eb66a1115 | JavaScript | kelseyguerra/Pig-Latin | /js/scripts.js | UTF-8 | 980 | 3.109375 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
$("#translator").submit(function(event) {
event.preventDefault();
});
});
function englishToPigLatin(englishWord) {
if (isVowel(englishWord.charAt(0))) {
return englishWord + 'ay';
} else {
return englishWord.slice(1) + englishWord.charAt(0) + 'ay';
... | true |
dcd2492fba25522fce74a0bafd885273f14045f4 | JavaScript | Michael-Choi/sum-all-number-in-array-test-js | /index.js | UTF-8 | 414 | 3.859375 | 4 | [] | no_license | let sumItems = arr => {
let total = 0;
arr.forEach(subArr => {
if (Array.isArray(subArr)) {
total += sumItems(subArr);
} else {
total += subArr;
}
});
return total;
};
/**
if its not array return its value upwards
Array.isArray(input)==false{
return input
}
*/
// Sum all the numbers i... | true |
5bbe9fb685a9d7f3aa0e2d01d15498fd1708515b | JavaScript | straysh/tc | /async-javascript/asyncFunction.js | UTF-8 | 194 | 3.171875 | 3 | [] | no_license | function asyncFunction(callback){
setTimeout(callback, 1000);
}
var functionHasResurned = false;
asyncFunction(function(){
console.assert(functionHasResurned);
});
functionHasResurned = true; | true |
8141e559476a2adb2b48709e03971002e2586d9b | JavaScript | green-fox-academy/hondahmd | /week-01/day-02/10.js | UTF-8 | 403 | 3.046875 | 3 | [] | no_license | 'use strict'
const lineCount = 6;
let side = '';
for (let i = 0; i < lineCount; i++) {
side += '%';
}
console.log(side);
for (let i = 1; i < lineCount - 1; i++) {
let line = '%';
for (let j = 1; j < lineCount - 1; j++) {
if (i === j) {
line += '%';
} else {
line +=... | true |
e5f8a416aeaf1a9b5d2a485903e1f8f87376bba6 | JavaScript | omiprakash/leetCode | /reverseStringOnly.js | UTF-8 | 519 | 3.328125 | 3 | [] | no_license | // String reverse without changing the special character place.
let x = "Test1ng-Leet=code-Q!";
let letters = /^[a-zA-Z]+$/;
let inputArray = x.split('');
let i =0;
let j = inputArray.length-1;
while(i<j){
if(!inputArray[i].match(letters)){
i++;
}
else if(!inputArray[j].match(letters)){
j--;... | true |
780066abb075d142d33ce25574d5bafc54442c64 | JavaScript | frzkhan/sse-test | /index.js | UTF-8 | 867 | 2.515625 | 3 | [] | no_license | const path = require('path')
const fastify = require('fastify')({
logger: true
})
fastify.register(require('fastify-static'), {
root: path.join(__dirname, 'public'),
prefix: '/public/'
})
// Declare a route
fastify.get('/', function (request, reply) {
reply.sendFile('index.html')
})
function countdown(reply, co... | true |
8e3f3ddd0c8190d4b15037bfd1a5c7899fa28bed | JavaScript | sujitb368/leacon | /js/faq.js | UTF-8 | 1,374 | 3.03125 | 3 | [] | no_license | const faq = document.querySelectorAll(".question");
const removes = (element, cls) =>{
element.classList.remove(`${cls}`)
}
const adds = (element, cls) =>{
element.classList.add(`${cls}`)
}
let pre_icon = null;
faq.forEach((icon, i) => {
const icon_plus = icon.querySelector(".icon_plus");
const ico... | true |
195d862990c4113d9b75156ae155d53175a7affc | JavaScript | lovecn/programming-notes | /js_array_unique.js | UTF-8 | 2,912 | 3.625 | 4 | [] | no_license | //数组去重
var isFunction = function (fn) {
return Object.prototype.toString.call(fn) === '[object Function]';
}
Array.prototype.distinct = function (keyThunk) {
var arr = this;
var dic = {};
var result = [];
keyThunk = isFunction(keyThunk) ? keyThunk : function (val) {
return typeof (val) +... | true |
7b5187784ca0ec4a6fb2ddb76595101533ddf746 | JavaScript | TIzkon/Ejercicios | /arrays.js | UTF-8 | 1,577 | 3.765625 | 4 | [] | no_license | 'use strcit'
//Arrays,arreglos,matrices
//Es una coleccion de datos agrupados
//entre corchetes para sacar el dato en ese indice,estos empiezan por el 0
var nombre = "Tizkon"
var nombres = ["Tizkon", "Gomez" , "##" , 234 ,true ,false];
var lenguajes = new Array("php", "JS" , "GO")
/*console.log(... | true |
b57fdc114d312969c78132222e1cbf67d1346a0b | JavaScript | rodrigoteruel/Web-Moderno-com-javaScript-2018 | /fundamentos/variaveisEConstantes.js | UTF-8 | 224 | 3.765625 | 4 | [] | no_license | var a = 3
let b = 4
//let não pode ser declarado novamente, mas var pode
var a = 30
b = 40
console.log(a, b)
a = 300
b = 400
console.log(a, b)
// não pode atribuir outro valor após declarado
const c = 5
console.log(c) | true |
bd5c1066a309980d0da7153e0909681fb6867c59 | JavaScript | haemin9014/Comp | /Comp 484/Final/Website-master/Website-master/public/game/pacman/js/sprites/Pacman.js | UTF-8 | 4,792 | 2.96875 | 3 | [] | no_license | var assetsDir = '../pacman/assets';
export default class Pacman {
constructor() {
this.speed = 150;
this.threshold = 3;
this.marker = new Phaser.Point();
this.turnPoint = new Phaser.Point();
this.directions = [ null, null, null, null, null ];
this.opposites = [ Phas... | true |
216de457069bdd8bda775314c5ca6b5e30133016 | JavaScript | 1000hg/PianoJS | /piano.js | UTF-8 | 4,911 | 2.84375 | 3 | [] | no_license | const startBtn = document.getElementById('start-btn');
const stopBtn = document.getElementById('stop-btn');
const resetBtn = document.getElementById('reset-btn');
const playBtn = document.getElementById('play-btn');
document.addEventListener('keydown', playing);
var MEDIA_ELEMENT_NODES = new WeakMap();
var context ... | true |
262829634fe132ae1fcc53bd4156ad3adad4bba2 | JavaScript | ModelCatalogue/modelcatalogue-browser | /web-app/js/forms/form_model.js | UTF-8 | 4,164 | 2.546875 | 3 | [
"MIT"
] | permissive | var question1 = {
id : 'question1',
label: "First Name",
style: "",
cardinality: 1,
rule: "",
type: "Text_Field",
defaultValue : "",
maximumCharacterQuantity : "",
unitOfMeasure : "",
datatype : {},
format : ""
}
var question2 = {
id : 'question2',
label: "Last Name",
style: "",
cardinal... | true |
671fbf96d31dac37a05cc3d8fd86182e7c9b984d | JavaScript | mirchaemanuel/ciffi-js | /packages/ciffi/core/Dependencies.js | UTF-8 | 2,271 | 2.546875 | 3 | [
"MIT"
] | permissive | const chalk = require('chalk')
const Loading = require('./Loading')
const ProcessManager = require('./ProcessManager')
class Dependencies {
constructor(config, callback) {
let process = 'npm install --no-progress'
this.startDownload(process, callback)
}
startDownload(process, successCallback, failCallb... | true |
a6bdb8bda3dc25c327d3b3ba7f9f7b5907c98508 | JavaScript | ananya52singh/Project-32 | /Question.js | UTF-8 | 1,775 | 3.484375 | 3 | [] | no_license | class Question {
constructor() {
this.title = createElement('h1')
this.title2 = createElement('h2')
this.title3 = createElement('h3')
this.title4 = createElement('h3')
this.title5 = createElement('h3')
this.title6 = createElement('h3')
this.input1 = createInput("Enter Your Name Here....")... | true |
0714dbe9b108e8db4b25ea2a43e3842e65233d97 | JavaScript | irinaaZ/js-practice | /hw-lesson3/task2.js | UTF-8 | 1,319 | 4.9375 | 5 | [] | no_license | /*
We have an object storing salaries of our team:
let salaries = { John: 250, Ann: 250, Peter: 500 }
Write the function to sum all salaries and return it.
Should be 1000 in the example above.
If salaries is empty, then the result must be 0.
2.1) We have an object storing salaries of our team:
let salaries = { John: ... | true |
acaecaacae55ae83fcf738b1e1f173838d9b9170 | JavaScript | DIdaniel/coding-training | /3-countLetters/main.js | UTF-8 | 532 | 3.546875 | 4 | [] | no_license | "use strict";
const body = document.querySelector("body");
const inputName = document.querySelectorAll(".name");
const number = document.querySelector(".number");
let globalPromptValue;
function enterfunc(e) {
if (e.keyCode === 13) {
globalPromptValue = prompt("Enter the String!");
}
for (let i = 0; i < i... | true |
1e6354a231808c14496bc087398cbe11505931d3 | JavaScript | re-cyclebin/server | /subServer/models/user.js | UTF-8 | 1,262 | 2.546875 | 3 | [] | no_license | const { model, Schema } = require('mongoose'),
{ hash } = require('../helpers'),
{ hashPassword } = hash,
UserSchema = new Schema({
username: { type: String, required: [true, 'username is required'], unique: true },
password: { type: String, required: [true, 'password is required'], minlength: [5, 'passw... | true |
ed06d0b62e40d919f42b20878489ee0f5a7e8ca6 | JavaScript | freebookstudy/nodejs-book-study | /ch3/3.6/fsDelete.js | UTF-8 | 939 | 3.1875 | 3 | [] | no_license | const fs = require('fs')
// (경로, 콜백) 폴더 안의 내용물을 확인할 수 있음. 배열 안에 내부 파일과 폴더명이 나옴
fs.readdir('./folder', (err, dir) => {
if(err){
throw err;
}
console.log('폴더 내용 확인', dir);
// (경로, 콜백) 파일을 지울 수 있음. 파일이 없다면 에러가 발생하므로 먼저 파일이 있는지를 꼭 확인해야 함
fs.unlink('./folder/newFile.js', (err) => { //파일삭제
... | true |
738db2297bfa9016d346240df24925bf645cc3ec | JavaScript | dropbeardan/mock-api-server | /server/src/helpers/tests/randomize.string.test.js | UTF-8 | 704 | 3.59375 | 4 | [] | no_license | const randomize = require('../randomize');
test('Zero length should return empty string.', () => {
let result = randomize.string(0);
expect(typeof (result)).toEqual('string');
expect(result).toEqual('');
});
test('N length should return n-length string of uppercase letters and numbers.', () => {
let ... | true |
84eac6c631409e10eeb492c0cdf304cc3e15b91d | JavaScript | tinaandric/Scarlxrd-projekt | /src/Components/Login.js | UTF-8 | 1,537 | 2.5625 | 3 | [] | no_license | import "../App.css";
import React, { Component } from 'react';
export class Login extends Component{
state = {
name:"",
surname:"",
email:"",
password:"",
}
onSubmit=e=>{e.preventDefault(); document.getElementById("poruka").innerHTML="Welcxme "+this.state.name+" "+this.state... | true |
0745a40a3c5d739f57e660d8eec9193d88181746 | JavaScript | 836292315/leetcode | /301_400/394.js | UTF-8 | 874 | 3.65625 | 4 | [] | no_license | /**
* @param {string} s
* @return {string}
*/
var decodeString = function (s) {
let stack = [];
for (let i = 0; i < s.length; i++) {
if (s[i] !== ']') {
stack.push(s[i]);
} else {
let temp = '';
while (stack[stack.length - 1] !== '[') {
temp... | true |
8363a338c4674642441c42ac5f3eb46e198dab33 | JavaScript | ruiwanguk/js-design-pattern | /essentials/open-brace.js | UTF-8 | 240 | 3.140625 | 3 | [] | no_license | // Javascript has automatic semicolon insertion mechanism
function func() {
return
{
name : "Batman"
};
}
console.log(func());
// correct
function correctFunc() {
return {
name : "Batman"
};
}
console.log(correctFunc());
| true |
5ad94ae202a8622e9b4ac5ca22f600c26e99bef2 | JavaScript | brian7346/Think-Bigger | /functions/validation/emptyString.js | UTF-8 | 146 | 2.671875 | 3 | [] | no_license | const emptyString = string => {
if (string.trim() === "") {
return true;
} else {
return false;
}
};
module.exports = emptyString;
| true |
a3515c04e9a081b1d549f78f81cadd09cf9adff3 | JavaScript | marko-js/marko | /packages/marko/test/components-browser/fixtures/onInput/component.js | UTF-8 | 451 | 2.640625 | 3 | [
"MIT"
] | permissive | var expect = require("chai").expect;
module.exports = {
onInput: function (input) {
expect(input.name).to.eql("Frank");
this.state = { count: 0 };
this.setUpTest();
},
onMount: function () {
expect(this.state.count).to.eql(0);
expect(this.foo).to.eql("bar");
expect(this.array).to.eql([1,... | true |
3085c68c6599987e5179e902e59f033f23d2929a | JavaScript | drolon1126/Sprint-Challenge-React-Wars | /starwars/src/App.js | UTF-8 | 1,834 | 2.9375 | 3 | [] | no_license | import React, {useState,useEffect} from 'react';
import './App.css';
import axios from 'axios';
import PersonCard from './components/personCard.js';
import { makeStyles } from '@material-ui/core/styles';
import Grid from '@material-ui/core/Grid';
const useStyles = makeStyles(theme => ({
root: {
flexGrow: 1,
... | true |
a2b84685ad1818930a4900f2f0f957297d2d5312 | JavaScript | Akashh1996/Skylab-Bootcmamp-2020 | /Aleix_Moya/Challenge-ToH-Backend/server-project/routes/pokeRoutes.js | UTF-8 | 1,213 | 2.734375 | 3 | [] | no_license | const express = require('express');
const axios = require('axios');
const pokeRouter = express.Router();
const endpoint = require('../../api/heroes.json')
function routes() {
pokeRouter
.route('/')
.get(async (req, res) => {
try {
const pokemons = await axios(endpoint);
res.status(200);
res.send(po... | true |
58dc10cd5ca109857cbd7d8b7ee661925749b30d | JavaScript | Shubham-Gawade/Typescript-Course | /11-Typecasting/typecasting.js | UTF-8 | 160 | 2.796875 | 3 | [] | no_license | var x = parseInt(prompt("Enter a value"));
console.log(x + 3);
var y = parseFloat(prompt("Enter a value"));
console.log(y + 3);
console.log("---------------");
| true |
d21c98f90d00b4482fd049b608cb5197d47a8351 | JavaScript | DavidARivkin/usco-ply-parser | /ply-parser.js | UTF-8 | 5,994 | 2.6875 | 3 | [
"MIT"
] | permissive | /**
* @author Wei Meng / http://about.me/menway
* @author kaosat-dev
* Description: A THREE parser for PLY ASCII files (known as the Polygon File Format or the Stanford Triangle Format).
*
*
* Limitations: ASCII decoding assumes file is UTF-8.
*
* Usage:
* var loader = new PLYParser();
* loader.addEventListen... | true |
3fde91652041b3ec350f52a9100c6e741a9c3f2a | JavaScript | HaryNovalRamadhan/FoodAvailable | /src/script/component/food-list.js | UTF-8 | 488 | 2.984375 | 3 | [] | no_license | import './food-item.js';
class FoodList extends HTMLElement{
set foods(foods){
this._foods = foods;
this.render();
}
renderError(message){
alert(message);
}
render(){
this.innerHTML = '';
this._foods.forEach((food) => {
const foodItem = document... | true |
fceac9f269919fd67fc6d8d4c6f749b4f873f82e | JavaScript | benjaco/fast-tvguide | /pwa/src/es6/eventHooks/Program.js | UTF-8 | 4,430 | 2.84375 | 3 | [] | no_license | /**
* Created by Benjamin on 16-05-2017.
*/
class Program {
constructor() {
this.open = false;
this._programInfoEl = document.querySelector(".program_info_outer");
this.close = this.close.bind(this);
this.show = this.show.bind(this);
this.openPopup = this.openPopup.bin... | true |
0a3a8087521ddf33a2cdbf6ed5e0678c18b0b80c | JavaScript | engahmed10/javascript-objects-lab-bootcamp-prep-000 | /index.js | UTF-8 | 408 | 3 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function updateObjectWithKeyAndValue(object, key, value)
{
return Object.assign({},object,{[key]:value})
}
function destructivelyUpdateObjectWithKeyAndValue(object, key, value)
{
object[key]=value
return object
}
function deleteFromObjectByKey(object, key)
{
return Object.assign(delete object.key)
}
function... | true |
a9f5c1c0b8afd4f108f51068573aa56b0e3fc9da | JavaScript | groveld/discord-watchdog | /src/commands/debug/eval.js | UTF-8 | 880 | 3.4375 | 3 | [
"ISC"
] | permissive | /**
* eval.js
*
* The EVAL command will execute **ANY** arbitrary javascript code given to it.
* THIS IS PERMISSION LEVEL 10 FOR A REASON! It's perm level 10 because eval
* can be used to do **anything** on your machine, from stealing information to
* purging the hard drive. DO NOT LET ANYONE ELSE USE THIS
*
* ... | true |
0ca0dc895184ab377a1d960c58a0b08953a94130 | JavaScript | noordeep-p/lotide | /test/tailTest.js | UTF-8 | 870 | 3.3125 | 3 | [] | no_license | const tail = require('./../tail');
const assert = require('chai').assert;
describe("#tail", function() {
it('should return [2,3] for inputs [1,2,3]', function() {
let result = tail([1, 2, 3]);
assert.deepEqual(result, [2, 3]);
});
it('should return ["my name is", "noor"] for inputs ["hi","my name is","no... | true |
cde7e620ffd5e729a7af4146a6593b2839a32f7c | JavaScript | punisher89/Flame | /src/commands/general/EmbedCommand.js | UTF-8 | 965 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | const FlameCommand = require('../../structures/FlameCommand');
const { getHelp } = require('../../utils/Functions');
class EmbedCommand extends FlameCommand {
constructor() {
super('embed', {
description: 'Отправить embed-сообщение от лица бота.',
category: 'general',
usage: 'embed <Структура>'... | true |
8a4b7648ba35a6579c0057e3784eb8f30e3430c7 | JavaScript | YassineOmrani/LoginRegisterWebsite | /Assets/js/main.js | UTF-8 | 1,224 | 2.921875 | 3 | [] | no_license | $(document)
.on("submit","form.js-register",function (event) {
event.preventDefault();
var _form = $(this);
var _error = $(".js-error", _form);
var dataObj = {
name: $("input[type='name']", _form).val(),
email: $("input[type='emai... | true |
14e8d6e9d0bc85f866acb87b9d483d64a06fff7d | JavaScript | SynBioHub/synbiohub | /lib/config.js | UTF-8 | 1,619 | 2.71875 | 3 | [
"BSD-2-Clause"
] | permissive |
var fs = require('fs')
var extend = require('xtend')
var deepmerge = require('deepmerge')
var path = 'config.json'
var localPath = 'config.local.json'
var config = JSON.parse(fs.readFileSync(path) + '')
var localConfig = fs.existsSync(localPath)
? JSON.parse(fs.readFileSync(localPath) + '') : {}
var mergedConfig... | true |
f973878203ac1586a4b33c10e352b36ad40ca17e | JavaScript | jasocox/ngit | /ngit.js | UTF-8 | 10,928 | 2.609375 | 3 | [] | no_license | #!/usr/local/bin/node
var stdio = require('stdio'),
fs = require('fs'),
jf = require('jsonfile'),
sync = require('execSync'),
_ = require('underscore'),
colors = require('colors');
var VERSION = "0.1.2",
BRANCHES ... | true |
f4f354343e7c6ba26eaa39a013bf5dfe637cd171 | JavaScript | Johnson4996/ScubaLog | /src/components/wishlist/WishListForm.js | UTF-8 | 1,592 | 2.84375 | 3 | [] | no_license |
//Handles creation of new wish list item by the user
import React, { useContext, useRef } from "react"
import {WishContext} from "./WishlistProvider"
export const WishListForm = (props)=> {
const {addWish} = useContext(WishContext)
const location = useRef("")
const constructNewWish = () =>{
if(... | true |
cdbabfaf048444a45a1fa85875102baf296d8272 | JavaScript | arozkrut/pracaInzynierska | /source/createForm.gs | UTF-8 | 3,771 | 3.25 | 3 | [] | no_license | /*Plik zawiera implementację metod służących do generowania formularzy.
*/
//Metoda checkBox dodaje do formularza 'form' pytanie typu 'checkBox'
function checkBox(form, question){
var item ;
if(question.tex){
image(form, question.text);
item = form.addCheckboxItem();
}
else {
item = form.addCheckb... | true |
0dfdbb6321cf87d5087d41600f1e7abe95718d5d | JavaScript | matiasart10/CintaRojaFinal | /public/js/bit.js | UTF-8 | 269 | 2.625 | 3 | [] | no_license | $.getJSON( "https://api.coindesk.com/v1/bpi/currentprice/usd.json", function( data) {
var amountInBtc = 0.005; //convert 0.005 btc to usd
var exchangeRate = parseInt(data.bpi.USD.rate_float);
var amount = amountInBtc * exchangeRate;
console.log(amount);
}); | true |
8e271cbc65b0c90ff3ba590b531b0eba7353442f | JavaScript | js-tasks-ru/jsbasic-20210621_natalie-iv | /5-module/3-task/index.js | UTF-8 | 1,331 | 2.9375 | 3 | [] | no_license | function initCarousel() {
let arrowLeft = document.getElementsByClassName('carousel__arrow_left')[0];
arrowLeft.style.display = 'none';
let arrowRight = document.getElementsByClassName('carousel__arrow_right')[0];
arrowRight.style.display = '';
const sliderWrapper = document.getElementsByClassName('carousel__... | true |
d87e2dbb9dddda3800d648ac54cb2eec6cf9d903 | JavaScript | CKPOON0619/aya | /aya/src/App.js | UTF-8 | 2,996 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import DropFile from './components/DropFile'
import ClickButton from './components/ClickButton'
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.handleInputSelect = this.handleInputSelect.bind(this);
this.handlePredicti... | true |
bc4eeb8d6a754b377125ecdb7ea8f340197f89c9 | JavaScript | mut0u/emacs.d | /site-lisp/webkit/reverse_color.js | UTF-8 | 738 | 2.734375 | 3 | [] | no_license | function load_script(src, callback) {
var s = document.createElement('script');
s.src=src;
s.onload=callback;
document.getElementsByTagName('head')[0].appendChild(s);
}
function invertColors(){
var colorProperties = ['color', 'background-color'];
$('*').each(function() {
var color = null;
for(var prop in col... | true |
608b2aff454c98475207df27732405bcb8ee5c16 | JavaScript | Izzyharvin/Node.js-MySQL | /bamazonCustomer.js | UTF-8 | 2,163 | 2.640625 | 3 | [] | no_license | var mysql = require("mysql");
var inquirer = require("inquirer");
var connection = mysql.createConnection({
host: 'localhost',
port: 3306,
user: 'root',
password: 'root',
database: 'bamazon_db',
});
connection.connect(function (error) {
if (error) {
console.log(error);
}
else... | true |
54cb19a0828c1edfa2b28276814bd9811efb7a03 | JavaScript | siyonli/jiexin | /src/assets/js/mixin.js | UTF-8 | 5,662 | 2.59375 | 3 | [] | no_license | var sha1 = require('sha1');
let mixin = {
methods: {
/**
* 获取浏览器环境信息
* @return isWechat {Boolean} 是否在微信浏览器环境中
* @return isApp {Boolean} 是否在APP中
*/
getBroswerInfo() {
var ua = navigator.userAgent.toLowerCase();
return {
isWechat: ua.match(/MicroMessenger/i) == "micromessenger",
... | true |
b9507b544f448ab2b9dba71b91c0ff409edb80c0 | JavaScript | lsandathara/AF-project | /backend/routes/student.server.route.js | UTF-8 | 2,744 | 2.78125 | 3 | [] | no_license | const express = require('express');
const studentRoute = express.Router();
// Require Business model in our routes module
let Student = require('../../backend/models/Student');
// Defined store route
studentRoute.route('/Insert').post(function (req, res) {
let student = new Student(req.body);
student.save()
... | true |
0f172a0856fd1443f79748840a6637a42cbdd3f5 | JavaScript | alikahwaji/express-projects | /todoList/app.js | UTF-8 | 811 | 2.515625 | 3 | [
"MIT"
] | permissive | const express = require('express')
const path = require('path')
const bodyParser = require('body-parser')
//Setup port
const port = 3000
// init app
const app = express()
const MongoClient = require ('mongodb').MongoClient
const url = 'mongodb://localhost:27017/todoapp'
// body parser middleware
app.use(bodyPar... | true |
2d92283870e3affc5e98b96f2d63090796877885 | JavaScript | info-shoestring/shoestring-dev | /models/signupAdminSchema.js | UTF-8 | 1,541 | 2.6875 | 3 | [
"MIT"
] | permissive | const bcrypt = require('bcrypt');
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const adminSchema = new Schema({
name: { type: String, required: true },
phone: { type: String, required: true },
email: {type: String, unique: true, match: [/.+@.+\..+/, "Please enter a valid e-mail address"... | true |
906a7c9701fccd6e7624f2e7b269b29fd8ae1b99 | JavaScript | karmats/aoc | /2021/day10-syntax-scoring.js | UTF-8 | 1,646 | 3.390625 | 3 | [] | no_license | const { fileToPuzzle } = require("./util");
const START_CHARS = "([{<";
const MATCHING_CHARS = ["()", "[]", "{}", "<>"];
const getFirstIllegalOrMissing = (chunk) => {
const startChars = [];
for (let i = 0; i < chunk.length; i++) {
const char = chunk[i];
if (START_CHARS.indexOf(char) >= 0) {
startCha... | true |
6d87074a32a9bc1a68c45cc5a3d600446e3890d4 | JavaScript | goccult/typescript-test | /dist/shape.js | UTF-8 | 2,484 | 2.984375 | 3 | [] | no_license | "use strict";
var Shape = /** @class */ (function () {
function Shape(canvasId, location) {
this.move = false; // 判断是否处于移动状态
this.offsetY = 0; // 记录鼠标按下形状时鼠标在形状X轴方向的偏移量
this.offsetX = 0; // 记录鼠标按下形状时鼠标在形状Y轴方向的偏移量
this.canvasOffsetLeft = 0; // 记录画布相对于整个浏览器视口区域X轴方向的偏移量
this.can... | true |
078d39009021e98eea3c4557dc5a1ebe5bb3b18f | JavaScript | kailIII/almacenbjs | /Almbjs/www-dev/app/views/ListBooksView.js | UTF-8 | 2,099 | 2.578125 | 3 | [] | no_license | define([ "underscore", "Backbone", "jquery", "BookCollectionRest", "text!templates/listBooksTemplate.html" ],
function(_, Backbone, $, BookCollection, listBooksTemplate) {
var HomeView = Backbone.View.extend({
el : $("#content"),
template : _.template(listBooksTemplate),
events: {
"click #addBook" : ... | true |
f2c41dcbb10045c8d2c49af19215d8557cb70c69 | JavaScript | Kannoken/NoteService | /static/js/main.js | UTF-8 | 3,202 | 2.65625 | 3 | [] | no_license | $(document).ready(function () {
$('#form1').submit(function () {
$.ajax({
data: $(this).serialize(),
type: $(this).attr('method'),
url: "/newNote/",
});
return false;
});
$('.delete-note').click(function () {
let self = this;
$.ajax... | true |
48245b03c36548fd654b5d077039978e63f7d67e | JavaScript | NingLuo/ModernForm | /js/script.js | UTF-8 | 2,632 | 2.5625 | 3 | [] | no_license | $(document).ready(function() {
$("#acount-creation").validate({
rules: {
name: "required",
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 5
}
}... | true |
2007c8de63d1455eef48c174b2cd8a6afe412e85 | JavaScript | ninjaboynaru/experiments-polyhash-collisions | /hashTable.js | UTF-8 | 673 | 3.296875 | 3 | [] | no_license |
function compressHash(hash, tableSize) {
return hash % tableSize;
}
module.exports = function hashTable(tableSize) {
const table = [];
return {
/**
* Add a value to the hash table. Returns true if a collision occures.
* Uses simple modulo division and chaining to resolve collisions
*/
add: function add... | true |
f9029bc17018b9f1ff58182c11e8d81c8be685ac | JavaScript | node-opcua/node-opcua | /test_thenify.js | UTF-8 | 657 | 2.796875 | 3 | [
"MIT"
] | permissive |
var thenify = require("thenify");
function MyClass()
{
}
MyClass.prototype.open = function open(endpoint,callback)
{
setTimeout(function() {
console.log("opening",endpoint);
callback(null,42);
},1000);
};
MyClass.prototype.open = thenify.withCallback(MyClass.prototype.open);
function test() ... | true |
b2ee89cdc655623b9ae0b4d6f6f3ea4ed10f82ec | JavaScript | kriswep/circlesell | /lib/schema.js | UTF-8 | 1,072 | 2.5625 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
// This example demonstrates a simple server with some
// relational data: Posts and Authors. You can get the
// posts for a particular author, and vice-versa
// Read the complete docs for graphql-tools here:
// http://dev.apollodata.com/t... | true |
0433e422423af0c9d831cbc6ff0d52c5f3fa70e6 | JavaScript | Thaelin/assignment-gis | /backend/components/database/database.js | UTF-8 | 7,976 | 2.53125 | 3 | [] | no_license | const { Pool } = require('pg');
const config = require('../../config.json');
class Database {
constructor(logger) {
this.logger = logger;
try {
this.pool = new Pool(config.db);
this.version();
}
catch (error) {
this.logger.error('Database pool co... | true |
c7cbca390a638a92cf7d7611408aa2f395b5f584 | JavaScript | zacwillmington/react-events-in-detail-lab-v-000 | /src/components/CoordinatesButton.js | UTF-8 | 452 | 2.546875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import React, { Component } from 'react';
export default class CoordinatesButton extends Component {
constructor(){
super()
}
handleOnClick = (event) => {
const coors = [event.clientX, event.clientY]
this.props.onReceiveCoordinates(coors)
}
render(){
... | true |
91f218efdf3531683f41005594bf4cb0b985f887 | JavaScript | developmentseed/overtask | /lib/tm2.js | UTF-8 | 1,696 | 2.53125 | 3 | [
"MIT"
] | permissive | const rp = require('request-promise-native')
const from = require('from2')
/**
* Methods to grab data from tasking manager version 2
*/
class TM2API {
constructor (url, api_url, opts) {
this.url = url
this.api_url = api_url
this.opts = opts || {}
}
getUrlForProject (id) {
return `${this.url}/p... | true |
c9e93a24da53c146c1cb18339790080375ca2b1d | JavaScript | JayZhu173655/directhire | /src/redux/reducers.js | UTF-8 | 2,988 | 2.78125 | 3 | [
"MIT"
] | permissive | /*
* 包含所有reducer函数,根据action的Type来改变state(即根据旧的state和新的action下挂在的数据,返回一个新的state)
*/
import {combineReducers} from 'redux';
import {getRedirectTo} from '../utils';
import {
AUTH_SUCCESS,
ERROR_MSG,
RECEIVE_USER,
RESET_USER,
RECEIVE_USER_LIST,
RECEIVE_MSG_LIST,
RECEIVE_MSG,
MSG_READ
} fro... | true |
6f98b6888e41fe96c60edc5e29d998ee99c5a8f6 | JavaScript | achingbrain/jvm.js | /src/main/javascript/ui/ui/Console.js | UTF-8 | 2,122 | 2.59375 | 3 | [] | no_license | jjvm.ui.Console = function(element) {
$(element).find("button#button_console_clear").click(_.bind(function(event) {
event.preventDefault();
this.clear();
}, this));
var LEVELS = {
"ERROR": 4,
"WARN": 3,
"INFO": 2,
"DEBUG": 1
};
if(!window.localStorage.jvm_log_level) {
window.localStorage.jvm_log_le... | true |
83d84aaf7160b743ceff9d1d53ee3e2477ae34c5 | JavaScript | aadil058/Hackernews-Server | /routes/HelperPromises.js | UTF-8 | 2,875 | 2.546875 | 3 | [] | no_license | var Promise = require('bluebird');
var mongoose = require('mongoose');
var Post = mongoose.model('Post');
var Comment = mongoose.model('Comment');
function error(status, message) {
const error = new Error();
error.status = status;
error.message = message;
return error;
}
module.exports = {
FindP... | true |
f5621eee3b2654192b4df3b133bd0c4a3bc45495 | JavaScript | gramirezc143/IP_CAL | /IPCAL/main.js | UTF-8 | 7,629 | 3.03125 | 3 | [] | no_license | function validateIp() {
var divData = document.getElementById("tableData").innerHTML = "";
var ip_address = document.getElementById("ipvalidation").value;
console.info(ip_address);
if (ip_address == "") {
alert("Name must be filled out");
return false;
}
var ip = ip_address.spli... | true |
91a3948a09eb26ed744dacbb373e511d7e8c431c | JavaScript | leon196/NaturallyUndead | /scripts/entities/elements/moss.js | UTF-8 | 1,436 | 2.765625 | 3 | [] | no_license |
function Moss (mesh, leafSize)
{
var points = [];
var step = 1;
for (var i = 0; i < mesh.position.data.length; i += 3 * step) {
var point = { x: mesh.position.data[i], y: mesh.position.data[i+1], z: mesh.position.data[i+2] };
point.normal = { x: mesh.normal.data[i], y: mesh.normal.data[i+1], z: mesh.normal.da... | true |
9c542b8b90275834cf4ceb1b40a4702e59619389 | JavaScript | Persey15/pirple_tasks | /ifstatement.js | UTF-8 | 269 | 3.65625 | 4 | [] | no_license |
// all men are mortal
function men(name){
this.name=name;
this.isMortal= true;
};
//Socrates is a man
const man= new men("Socrates");
if(man instanceof men && man.isMortal && man.name==="Socrates"){
console.log("Socrates is mortal");
} | true |
4ec70493f6de64b51c86a88a257d938902bbdaab | JavaScript | davidsng/sailsTut | /assets/js/main.js | UTF-8 | 1,148 | 3.140625 | 3 | [] | no_license | /**
* Created by naor on 12/7/15.
*/
(function () {
const userList = document.querySelector('#userList');
const userMap = {};
const userDataMap = {};
io.socket.get('/user', list => {
list.forEach(addUserEl);
});
io.socket.on('user', change => {
console.log('change', change);
const userData ... | true |
7e619713b18ee6f7b340fc723638b30093eb93d4 | JavaScript | alexyu132/quick-file | /public/scripts/receive.js | UTF-8 | 677 | 2.765625 | 3 | [] | no_license | var socket = io.connect();
socket.on("id", function(id) {
document.getElementById("identifier").innerHTML = id;
});
socket.on("file", function(name, url) {
var li = document.createElement("li");
li.innerHTML = name + " " + "<a href=\"" + url + "\" target=\"_blank\" download>Download</a>";
document.ge... | true |
f724bc654c9be39e883f0eff2a8f38ad9d9bdcea | JavaScript | Ekymos/getcookievalue | /src/index.test.js | UTF-8 | 564 | 2.609375 | 3 | [
"MIT"
] | permissive | /**
* @jest-environment jsdom
*/
/* eslint-disable import/no-unresolved */
import '@testing-library/jest-dom';
import { init } from "./index.js";
document.cookie = '_gaTest=GA1.2.232085608.1631272249';
document.body.innerHTML = `
<input id="ele" type="hidden" data-get-cookie="true" data-get-cookie-key="_gaTest" va... | true |
553047c12f97c90f76b5deb5378e8bce2acdc618 | JavaScript | wadecoufal/10-000-Hours | /javascripts/button_util.js | UTF-8 | 1,896 | 3.390625 | 3 | [] | no_license | export const toggleTimeButton = (e, timer) => {
const text = e.target.innerHTML;
if (text === "Start") {
e.target.innerHTML = "Pause";
timer.startTimer();
} else if (text === "Pause") {
e.target.innerHTML = "Resume";
timer.pauseTimer();
} else if (text === "Resume") {
e.target.innerHTML = "... | true |
ac6c12ca4600a6ba145ab3f073df30c987bd3cf4 | JavaScript | dominictarr/obv | /test/trigger.js | UTF-8 | 2,676 | 2.828125 | 3 | [
"MIT"
] | permissive | var tape = require('tape')
module.exports = function (observable) {
tape('set listener and trigger', function (t) {
var o = observable()
var value = Math.random(), checked = 0
var rm = o(function (_value) {
checked ++
t.equal(_value, value)
})
t.equal(checked, 0)
o.set(value)
... | true |