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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
aa5a007e2c5bf794853686d2d61d7a0f93edf05b | JavaScript | Limanman507/cug-zonghe | /mall/target/classes/static/js/good_add.js | UTF-8 | 228 | 2.6875 | 3 | [] | no_license | //文件框选择图片时,图片标签自动切换
function showImg()
{
let f = new FileReader();
f.onload = function (ev)
{
img.src = ev.target.result;
}
f.readAsDataURL(file.files[0]);
} | true |
06760c738e00c7b7ae1907b04e604e66d6285bf0 | JavaScript | TripSurfing/extension-beta | /lib/get-persistent-visitor-id.js | UTF-8 | 1,548 | 2.90625 | 3 | [] | no_license | /*
* @getPersistentVisitorId: Generates a unique visitor ID that is persisted between visits.
*
* We assume we're in an iframe, so for Safari users we use localStorage,
* and for everyone we use local domain cookies.
*/
var getPersistentVisitorId = (function() {
var key = 'silp_visitorid';
var method =... | true |
f59245e5fc4f66f76218a1bb739800b3917febc6 | JavaScript | SirChristian6/PracticaSW | /PracticaSW/js/GetWeather.js | UTF-8 | 683 | 2.84375 | 3 | [] | no_license | function getWeather(lat, lon){
$.getJSON("https://api.openweathermap.org/data/2.5/weather?lat="+lat+"&lon="+lon+"&units=metric&APPID=265d48f61f4cee1ed62db6d95214792b", function(result){
$('#prev').html(result.weather[0].description);
var temp=result.main.temp;
$('#temp').html(temp.toFixed(2));
temp=re... | true |
f76af1a62793a735a99fbc6bc8ed9b761e6d5853 | JavaScript | phablo200/estudos-cod3r-react-next | /next-basico/src/pages/form.jsx | UTF-8 | 1,051 | 3.03125 | 3 | [] | no_license | import { useState } from 'react';
export default function Form() {
const [nome, setNome] = useState("");
const [idade, setIdade] = useState(0);
const [usuarios, setUsuarios] = useState([]);
const salvarUsuario = async () => {
await fetch('api/form', {
method: 'POST',
b... | true |
ff1eac5086510d8287f992f58d720881a217b76b | JavaScript | akhodas/spacewars | /src/modules/KeyTracker.js | UTF-8 | 311 | 3 | 3 | [] | no_license | export class KeyTracker {
constructor() {
this.keys = {};
window.addEventListener("keydown", event => {
this.keys[event.key] = true;
});
window.addEventListener("keyup", event => {
this.keys[event.key] = false;
});
}
isKeyPressed(key) {
return !!this.keys[key];
}
}
| true |
434f52c7ec5258ff672ca13e431c4ca7f47989b9 | JavaScript | ericvyc/JavaScriptProject | /webdev/src/main/webapp/object.js | UTF-8 | 492 | 2.8125 | 3 | [] | no_license | var emptyObj = {};
var curso = {
sigla : "K11",
nome : "Orientação a objetos em JavaScript"
};
var formacaoJava = {
cursos : [ {
sigla : "K11",
nome : "Orientação a objetos em JavaScript"
}, {
sigla : "K12",
nome : " Desenvolvimento Web com JSF2 e JPA2 "
}, ]
};
var sigla = "silgaaa";
... | true |
3decfe87209e2cf0780bdb9c8885b751516086c5 | JavaScript | ay-yang/angularUnitTesting | /e2e/spec.js | UTF-8 | 1,995 | 2.734375 | 3 | [] | no_license |
// e2e tests javascript
//NOTE:
// launch selenium web driver with: webdriver-manager start (can launch this command from any directory)
// then must launch heroes app: npm start
// then run this command to start e2e tests: protractor (path of)protractor.conf.js
describe('Protractor Demo App JS', function() { // just... | true |
a8768c91179bcd8a2ef0116f2390907c01e9ee0a | JavaScript | gmujica/md-respaldo | /MesaDinero.Web/obj/Release/Package/PackageTmp/Content/js/custom_checkbox_effect.js | UTF-8 | 579 | 3.015625 | 3 | [] | no_license | // Will make custom checkbox cheked and unchecked.
window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('custom-checkbox').forEach(chbx => {
const otherCheckboxes = chbx.parentElement.querySelectorAll('.custom-checkbox-content');
const content = chbx.querySelector('.custom-checkbox-content... | true |
3618ce0f44b3c4a7dcf6468bd320bc73f6b389bc | JavaScript | martinski74/SoftUni | /JS_Advanced/Classes_Members-Exercises/tickets.js | UTF-8 | 1,135 | 3.359375 | 3 | [] | no_license | function solve(description, sortingCriteria) {
class Ticket {
constructor(destination, price, status) {
this.destinatoin = destination;
this.price = price;
this.status = status;
}
static sortTicket(tickets, criteria) {
if (criteria === 'desti... | true |
6b0ad5cbb6fd7e378fa98107396d579a8398955e | JavaScript | leax1777/complete-javascript-course | /2-JS-basics/lecture-17/script.js | UTF-8 | 645 | 4.28125 | 4 | [] | no_license | /*---------------------------------------------------------
LECTURE 17 - TRUTHY AND FALSY VALUES AND EQUALITY OPERATORS
---------------------------------------------------------*/
Falsy values: undefined, null, 0, '', NaN. Will be converted to false when evaluated.
Truthy values: The values that are not falsy.
var he... | true |
f31194a0baab8f0727fe1aaf11e8928ce375f10c | JavaScript | isaiahgama/SpotifyAPIProj | /src/App.js | UTF-8 | 3,223 | 2.53125 | 3 | [] | no_license | import React, { Component } from "react";
import './App.css';
import Home from "./components/Home"
import About from "./components/About"
import Titlebar from "./components/Titlebar"
import Results from "./components/Results"
import SongRow from "./components/SongRow"
import hash from "./hash"
import { BrowserRouter as... | true |
97828cb398a6feebe2ecb1d6cdb61d5e5baa6659 | JavaScript | aevilesaguiar/planilha-de-dicas-ou-Cheat-Sheet- | /truthy-falsy.js | UTF-8 | 345 | 3.578125 | 4 | [] | no_license | // Todos são verdadeiros quando utilizados comparação fraca ==
console.log(100 == '100');
console.log(100 == [100]);
// Todos são falsos quando utilizamos o operador de igualdade restrita
console.log(100 === '100');
console.log(100 === [100]);
var produtoAtivo = false
if(!produtoAtivo){
console.log('Esse produto... | true |
e7b23a0ab958ff5a289bba283ec83e0f8758b2d4 | JavaScript | devanecondition/multiseq | /js/ms-lib/modules/audio-modules/lfo.js | UTF-8 | 2,837 | 2.6875 | 3 | [] | no_license | define([
'AudioModule',
'state',
'lodash'
], function(
AudioModule,
State,
_
) {
var Lfo = function( params ) {
AudioModule.call( this, params, {
waveType : params.settings.waveType || 'sine',
frequency : params.settings.frequency || 500
});
this.oscillator = this.context.createOscillator();... | true |
fccbc31795be41c5da897de435b69ba9b56ec32e | JavaScript | whithang/ecommerceAPI | /server/controllers.js | UTF-8 | 1,923 | 2.53125 | 3 | [] | no_license | var db = require('./../db/db');
var json2csv = require('json2csv');
var fs = require('fs');
exports.customerProductsSoldByCategory = function(req, res) {
db.customerProductsByCategory(function(err, result) {
if (err) {
res.send(err);
}
res.json(result);
});
};
exports.customerOrders = function(r... | true |
c00cb5150e8e1f7ce3f001aab4d4570e0c09f417 | JavaScript | cepharum/web-crypto-client | /server/crypto.js | UTF-8 | 5,344 | 2.875 | 3 | [
"MIT"
] | permissive | /**
* (c) 2018 cepharum GmbH, Berlin, http://cepharum.de
*
* The MIT License (MIT)
*
* Copyright (c) 2018 cepharum GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without rest... | true |
8f735643c81f3539c09e827078638150a247fc31 | JavaScript | Seid27/ReactTutorials | /03_reat_lifecycle/src/Topics/03_Lifecycle/ABoutFuncComp.jsx | UTF-8 | 716 | 2.5625 | 3 | [] | no_license | import React from 'react'
import AboutFuncCompTwo from './AboutFuncCompTwo'
export default function ABoutFuncComp() {
const greetings = "Hello functional component"
return (
<div>
<h2>{greetings}</h2>
<h4>{<HeadLine></HeadLine>}</h4>
<h4>{<GetInfo value={greetings}>... | true |
786c866173ca41ddc5d073d58b6c2bcf2760b413 | JavaScript | mfaiz-id/workshop-api | /helpers/file.js | UTF-8 | 954 | 2.640625 | 3 | [] | no_license | const fs = require("fs");
const shell = require("shelljs");
const createDir = (path) => {
if (!fs.existsSync(path)) {
shell.mkdir("-p", path);
}
};
const createFile = async (path, content) => {
let result;
try {
result = await new Promise((resolve, reject) => {
fs.writeFile(path, content, (err) ... | true |
2034c29526ed7826cfef9ce4442b2ae0ab0c6a3a | JavaScript | dalindev/LeetCode | /347__medium__top-k-frequent-elements.js | UTF-8 | 1,392 | 3.953125 | 4 | [] | no_license | /*
Given a non-empty array of integers, return the k most frequent elements.
Example 1:
Input: nums = [1,1,1,2,2,3], k = 2
Output: [1,2]
Example 2:
Input: nums = [1], k = 1
Output: [1]
Note:
You may assume k is always valid, 1 ≤ k ≤ number of unique elements.
Your algorithm'... | true |
443fa75ad6764e748b38c3820e2abdda2c1c3285 | JavaScript | Betelhem357/Betelhem357.github.io | /w2d5/constructor.js | UTF-8 | 1,567 | 4.0625 | 4 | [] | no_license | String.prototype.filter = function (strs) {
//console.log(strs.length);
let val = this.valueOf();// i got challenge on getting the exact value of the string
strs.forEach(element => {
if (this.includes(element)) {
val = val.replace(element, "");
}
});
return val;
}
//conso... | true |
f4ff41ebbded3ec5afeeff2e02747eff8c2502fd | JavaScript | jefferson-vieira/pocs | /design-patterns/fluent-interface-builder/test/fluentSQL.test.js | UTF-8 | 3,386 | 2.640625 | 3 | [] | no_license | import faker from 'faker';
import FluentSQLBuilder from '../src/fluentSQLBuilder';
import database from '../database/data.json';
describe('test suit for FluentSQLBuilder', () => {
describe('FluentSQLBuilder#getInstance', () => {
test('should return a FluentSQLBuilder instance', () => {
const received = F... | true |
4bac33a60598486196066da57e6165286d97cca2 | JavaScript | kamal336/javascript-practice | /API-Checklist/js/json.js | UTF-8 | 1,539 | 3.84375 | 4 | [] | no_license | // 1.fetch data from JSON Placeholder and console log
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(response => response.json())
.then(json => console.log(json))
// comment API fetch show the console log
const loadComment = () =>{
fetch('https://jsonplaceholder.typicode.com/comments')
.the... | true |
6a1f1a1e14d2471f9b06e8ff0db020a0811c4faa | JavaScript | ing670/vue-isomorphism-app | /server/utils/captcha.js | UTF-8 | 933 | 2.546875 | 3 | [] | no_license | /**
* Created by liuqingling on 16/6/1.
*/
var ccap = require('ccap');
var captcha = ccap({
width: 200,//set width,default is 256
height: 60,//set height,default is 60
offset: 50,//set text spacing,default is 40
quality: 100,//set pic quality,default is 50
fontsize: 57,//set font size,default is 5... | true |
ad242c7eb9528c2659d6198bbc3287be8feb3911 | JavaScript | nkcjs/oya | /lib/annotation.js | UTF-8 | 8,954 | 3.015625 | 3 | [] | no_license | const T_FUNCTION = /(\w+)(\s*)\((.*)\)/;// foo(){}
const T_PROPERTY = /(.*)\s*=\s*(.*)\n/;// foo = 'some variable'
const T_CLASS_DEFINITION = /(.*)class\s+(\w+)?\s+(extends\s+(\w+))?/;// class MyClass extends Parent
const T_CONSTRUCTOR_FUNCTION = /constructor\s*\((.*?)\)/;// constructor(){}
const attrPatterns = [
/^... | true |
566bad1e9b02fb0598ea0e7408cb11f1c65481bb | JavaScript | looeee/threejs-IDE | /src/IDE/Fetcher/utils/fetchFiles.js | UTF-8 | 524 | 2.703125 | 3 | [] | no_license | async function fetchFiles(urls, as = 'text', serverDirectory) {
const filePromises = [];
for (const url of urls) {
const serverURL = url.replace(/assets\//g, serverDirectory);
filePromises.push(fetch(serverURL));
}
const responses = await Promise.all(filePromises);
return await Promise.all(
res... | true |
159710a9e3f23d474f60ac3a3f5d387845667d30 | JavaScript | jpparent/js13k2018 | /src/js/engine/drawutils.js | UTF-8 | 321 | 2.6875 | 3 | [
"MIT"
] | permissive | _.Draw = {
clear: function() {
_.ctx.clearRect(0, 0, _.width, _.height);
},
circle: function(x, y, r, color){
_.ctx.beginPath();
_.ctx.arc(x, y, r, 0, Math.PI * 2);
_.ctx.fillStyle = color;
_.ctx.fill();
},
text: function(x, y, text, color){
_.ctx.fillStyle = color;
_.ctx.fillText(text, x, y);
}
}... | true |
a9541fa46669e26e433c9e27b954b177adcf80ab | JavaScript | cebesoyselim1/1.MovieSeat_JS | /script.js | UTF-8 | 4,749 | 3.296875 | 3 | [] | no_license | const seats = document.querySelector(".seats");
const getTicket = document.querySelector(".submit");
const movieSelectBox = document.querySelector(".movie-select-items");
const total = document.querySelector(".total");
function InitiateMoviesToLS(){
const movies = [
{name:"Movie 1", price:15},
{nam... | true |
afe424805c1a763a99b9b856107f6c1d2d9fd915 | JavaScript | elbow-jason/genalgo | /lib/genalgo-sequence.js | UTF-8 | 391 | 2.78125 | 3 | [
"MIT"
] | permissive | var Sequence = function() {
this.seq = [];
this.seqLength = 0;
this.seqName = "";
var convert = function(seq){
return seq.split("");
};
this.init = function(seq, seqName){
this.seq = convert(seq);
this.seqLength = this.seq.length;
this.seqName = seqName;
};
};
... | true |
384c0b3fd1b5be49834c67ff074ec2ceb9760a50 | JavaScript | nataliiakalinova/quizes | /app/js/Model.js | UTF-8 | 927 | 3.046875 | 3 | [] | no_license | var Model = (function(){
var questions;
// get questions from some source
(function() {
questions = quizData.questions;
})();
// shuffle array of questions
function shuffle(o){
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x)... | true |
af857984e3bd9e6c09bea7d34bf80b2c48820da2 | JavaScript | zckramer/richard-zack-frontend-api-mastery | /src/components/NewRecipeForm.jsx | UTF-8 | 2,647 | 2.828125 | 3 | [] | no_license | import React from 'react'
const BASE_URL = "http://localhost:8080/recipes"
export default function NewRecipeForm(props) {
const [ingredientFields, setIngredientFields] = React.useState([<input className="input__recipe-ingredient" name="ingredient" placeholder="Ingredient Name"></input>])
function handleAddIngred... | true |
57c8f807c88f882686f963729c42cae382dd3338 | JavaScript | HeshamAbdelalem/javascript-for-beginners | /4-control-flow/10- max-of-two-numbers/script.js | UTF-8 | 355 | 4.5625 | 5 | [] | no_license | // Write a function that takes two numbers and returns the maximum of the two
let maxNum = function(fir, sec) {
if (fir < sec) {
console.log(`${sec} is greater than: ${fir}`);
} else if (sec < fir) {
console.log(`${fir} is greater than: ${sec}`);
} else if (fir === sec) {
console.log('they are equal!... | true |
817e7e4aaa9816785b15e73cd984cbd158b9169e | JavaScript | proiect-tic/proiect-tic.github.io | /quiz/script.js | UTF-8 | 1,795 | 2.9375 | 3 | [] | no_license | function check() {
var question1 = document.quiz.question1.value;
var question2 = document.quiz.question2.value;
var question3 = document.quiz.question3.value;
var question4 = document.quiz.question4.value;
var question5 = document.quiz.question5.value;
var question6 = document.quiz.question6.va... | true |
7671283d332db7b4264db625e8998872db43dbe9 | JavaScript | manon-uniandes/parcial1 | /main.js | UTF-8 | 6,525 | 3.234375 | 3 | [] | no_license |
source =
"https://gist.githubusercontent.com/josejbocanegra/9a28c356416badb8f9173daf36d1460b/raw/5ea84b9d43ff494fcbf5c5186544a18b42812f09/restaurant.json";
let data;
var order = new Map();
let orderTotal = 0;
fetch(source)
.then((res) => res.json())
.then((res) => {
data = res;
showDishes(0);... | true |
9fabebf6bf2be564328b204fa1b0bf3c67c95262 | JavaScript | MariaFBastos/hyf-homework | /javascript/javascript1/week3/favorite-songs.js | UTF-8 | 1,035 | 3.75 | 4 | [] | no_license | var songDatabase = [];
function addSongToDatabase (song) {
var newSong = new Object;
newSong.songId = songDatabase.length + 1
newSong.title = song.title
newSong.artist = song.artist
songDatabase.push(newSong)
}
var songA = {title:"My baby", artist: "Soggy socks"};
var songB = {title:"3 nails in wood", art... | true |
9aa0b98b6bc477ac8b3ab89892cb248e30409744 | JavaScript | minakogirl12/public_api_request-v1 | /js/scripts.js | UTF-8 | 7,073 | 3.53125 | 4 | [] | no_license | //search button
document.querySelector('.search-container').innerHTML = `
<form action="#" method="get">
<input type="search" id="search-input" class="search-input" placeholder="Search...">
<input type="submit" value="🔍" id="search-submit" class="search-submit">
</form>
... | true |
4ae5452ddc4c34a20d5152cbd646ffb8e0b2c127 | JavaScript | beltranbot/codewars-solutions | /4kyu/parseint-reloaded/index.js | UTF-8 | 2,004 | 3.921875 | 4 | [] | no_license | // https://www.codewars.com/kata/parseint-reloaded
function parseInt(string) {
const VALUES = {
'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
'five': 5,
'six': 6,
'seven': 7,
'eight': 8,
'nine': 9,
'ten': 10,
'e... | true |
82b3feb54413e04c2c86e054aaffd180de4a1d9e | JavaScript | shivangsanghi/node-examples | /electronserver/server.js | UTF-8 | 4,653 | 2.53125 | 3 | [] | no_license | var app = require('http').createServer(handler);
var io = require('socket.io')(app);
var fs = require('fs');
app.listen(3000,function(){
console.log("listening on port "+app.address().port);
});
function handler (req, res) {
return;
}
var numUsers = 0,
DEFAULT_ROOM = "chat";
io.on('connection', function (socke... | true |
19e03440d95df81c07c74cdb206fb2d946261b03 | JavaScript | aegiven84/aegiven84.github.io | /js/nav.js | UTF-8 | 2,518 | 2.75 | 3 | [] | no_license | //Dynamically insert menu
var $target = document.querySelector('#menuHeader');
var $ul = document.createElement('ul');
var $li = document.createElement('li');
$ul.innerHTML = ('Home').setAttribute{"id": "menuHeader", "class": "home"};
$ul.innerHTML = ('Services');
$li.innerHTML = ('<a href="#">Individual Therapy></a... | true |
91886f92c9b5453b8dbcd7da3c42a7258ef7b76b | JavaScript | Mikeronomicon/PCS | /challenge2.js | UTF-8 | 136 | 3.828125 | 4 | [] | no_license | var x = 5;
var y = 7;
var difference = function(x, y) {
result = x - y;
};
difference(5, 7);
console.log("The answer is", + result);
| true |
42a96a16e5cd26541809348b80bd0c49763bfcf9 | JavaScript | Vadim-Vatrya/goit-react-hw-01-components- | /src/Components/Statistical/StatisticalUpload.jsx | UTF-8 | 717 | 2.609375 | 3 | [] | no_license | import React from "react";
import PropTypes from "prop-types";
import styles from "./styles.module.css";
function getColor() {
let color = "";
for (let i = 0; i < 3; i += 1) {
let sub = Math.floor(Math.random() * 256).toString(16);
color += sub.length === 1 ? "0" + sub : sub;
}
return `#${color}`;
}
... | true |
3efcfa3b2f694917feae0a1ebf2a645390830c59 | JavaScript | UXJera/Adv-WebDev-Bootcamp | /02 - Async Functions/findIndex/scripts.js | UTF-8 | 213 | 3.46875 | 3 | [] | no_license | let arr = [1,2,3,4,5,6];
findIndex(arr, function(num, index, array){
console.log(num === 4);
});
function findIndex(arr, callback) {
for (var i = 0; i < arr.length; i++){
callback(arr[i], i, arr);
}
}
| true |
83d8cc60c620c09ba4a0d009ca295ee16dd9e19a | JavaScript | markaidanthomas/yui-paragraph-cropper | /yui3/j/yui.widget.croppara.js | UTF-8 | 5,737 | 2.796875 | 3 | [] | no_license | /**
*
* CropPara class
* <p>Usage: new Y.CropPara(document.getElementsByTagName("p")[2], {
* nLines : 4,
* moreText : 'Read more',
* lessText : 'Read less',
* linkSpace : 30
* });</p>
* @class CropPara
* @namespace YAHOO.widget.CropPara
* @constructor
* @param {Object/Strin... | true |
811cc283963c2a116b0c7e2c43ed672da97a6656 | JavaScript | ArthurChome/DrJason | /app/router.js | UTF-8 | 14,301 | 3.21875 | 3 | [] | no_license | /*
This module contains all the GET, POST, PUT procedures
to answer to the requests of the user.
*/
module.exports = function (app) {
//Import the modules we will be using
var ontology = require('./ontology')
var database = require('./database')
// use sessions to be able to access username everyw... | true |
062b3b27b604994946bbaa85a6915897b3468727 | JavaScript | MozartLino/vote-no-filme | /src/main/webapp/js/iterator.js | UTF-8 | 237 | 2.703125 | 3 | [] | no_license | function Iterator(comparisons) {
var index = 0, data = comparisons;
return {
next : function() {
var element = data[index];
index += 1;
return element;
},
hasNext : function() {
return index < data.length;
}
};
}; | true |
3ebdb78dd1e8a0c330f043d269a04ddf4bb0aefa | JavaScript | Dennis-Mgba/vue_tda | /src/store/index.js | UTF-8 | 3,207 | 2.6875 | 3 | [] | no_license | import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
filter: 'all',
todos: [
{
'id': 1,
'title': 'Finish learning vue from a tutorial',
'completed': false,
'editing': false
... | true |
d0b541b3b450c550bd030863c88a572a3c6564d6 | JavaScript | joelverhagen/Knapcode.CommonLibrary.NET | /src/Tools/FluentTester/data/Combinators/Comb_Set.js | UTF-8 | 2,078 | 2.84375 | 3 | [
"JSON",
"MIT"
] | permissive | /* @hasexpects = true
<expects>
<expect name="res1" type="bool" value="true" />
<expect name="res2" type="bool" value="false" />
<expect name="res3" type="bool" value="true" />
<expect name="res3a" type="bool" value="true" />
<expect name="res3b" type="bool" value="false" />
<expect name="res3c" type="bool... | true |
dfee4a172be91681be5b4aa2744123610bcc1ce4 | JavaScript | muhyiabdulb/COVID-19 | /js/main.js | UTF-8 | 425 | 2.75 | 3 | [] | no_license | const positif = document.queryselector('#positif');
const sembuh = document.queryselector('#sembuh');
const meninggal = document.queryselector('#meninggal');
async function getData() {
const response = await fetch('https://api.kawalcorona.com/indonesia/');
const data = await response.json();
positif.innerText = dat... | true |
1501e4a36222cfccbd93d857d85c4e9dd7bb6de4 | JavaScript | beeknees/rect-wars | /js/objects/background.js | UTF-8 | 1,905 | 3.21875 | 3 | [] | no_license | cp.template.Background = cp.template.Entity.extend({
color: '#111',
stars: [],
starSpeed: 0.6, // Delay between generating new stars
starSpeedMax: 10, // Configure max range for random star generation delay
starSpeedMin: 1, // Configure min range for random star generation delay
starTimer: null,... | true |
f4351a3c9ef770af2e164b60fc672f740150602a | JavaScript | jakehein/Programming-Languages | /a4/a4.js | UTF-8 | 1,671 | 2.9375 | 3 | [] | no_license | /*************************************
CS 331 - A4
your name(s): Jacob Hein
Dan Kuphal
*************************************/
var fp = require('./fp');
if ( ! exports ) {
var exports = [ ];
}
var prune = function (ns) {
if (fp.isNull(ns)) {
return ns;
} else if (fp.isNull... | true |
12da4c3b93cad5afc19b04c624fb4f4eeb3d6f93 | JavaScript | bjrmatos/google-maps-examples | /app/js/main.js | UTF-8 | 465 | 2.65625 | 3 | [
"MIT"
] | permissive | /* global google */
(function() {
'use strict';
function initialize() {
var map, mapOptions;
// options for map
mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
// create the map with a reference of a DOM ... | true |
f5a09e5d4d686a1978ee4c6b328cfd3934280863 | JavaScript | facu142/cursoJS | /43-ejercitacion-async-await/main.js | UTF-8 | 1,015 | 3.4375 | 3 | [] | no_license | const $button = document.querySelector('#button');
const $input = document.querySelector('#id');
const getInfo = async (id) => {
try {
const user = await getUser(id);
return user;
} catch (error) {
console.log(error);
}
}
/*
const createOptions = () => {
const users = fetch('h... | true |
ecd6c4b274a3de044f4242e359b049f568048b91 | JavaScript | sttk/fav-prop | /test/enum-all-symbols.test.js | UTF-8 | 3,046 | 3.140625 | 3 | [
"MIT"
] | permissive | 'use strict';
var chai = require('chai');
var expect = chai.expect;
var fav = {}; fav.prop = require('..');
var enumAllSymbols = fav.prop.enumAllSymbols;
describe('fav.prop.enumAllSymbols', function() {
it('Should get all property symbols when the argument is a plain object',
function() {
if (typeof Symbol... | true |
ec2ff4f9b4e04955974195b66132fddefc4cc65a | JavaScript | wbadart/tempo | /tempo_api/server.js | UTF-8 | 1,600 | 2.59375 | 3 | [] | no_license | var http = require('http');
var server = http.createServer(function(request, response){
var form_response = function(msg){
response.setHeader("Access-Control-Allow-Origin", "*");
response.writeHead(200, {"Content-Type":"text/plain"});
response.write(msg);
response.end();
};
var is_valid = new RegExp("\}\]... | true |
87a778e53d2762f944b85d357d8353da49f4892c | JavaScript | benmoose/aws-sqs | /consumer.js | UTF-8 | 982 | 2.71875 | 3 | [] | no_license | const SQS = require('./sqs')
const uuid = require('uuid')
class Consumer {
constructor (queueName) {
this.queueName = queueName
this.id = uuid.v4()
// create service
this.sqs = new SQS()
console.log(`Consumer ${this.id} started`)
this.start = this.start.bind(this)
... | true |
878ef7888b7fb7fdc3c047147e16404e2a72b3d6 | JavaScript | WUHF02/brians-ostebiks | /src/js/getProducts.js | UTF-8 | 1,028 | 3.03125 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function() {
fetch("/data/products.json")
.then(response => response.json())
.then(function(data){
const cardTemplate = document.getElementById("cardTemplate");
const list = document.getElementsByClassName("cardList")[0];
... | true |
8bb34294d91d414e8141170baf13d6125113550b | JavaScript | ArminSheng/Algorithm-Playground | /js/reverse-pairs.js | UTF-8 | 5,027 | 3.609375 | 4 | [] | no_license | /**
* @param {number[]} nums
* @return {number[]}
*/
var reversePairs = function(nums) {
let count = 0;
const mergeSort = function (arr) {
const len = arr.length;
if (len < 2) return arr;
const mid = len >> 1;
const left = mergeSort(arr.slice(0, mid));
const right =... | true |
987b1f755acee3c269e4cf1d0c9e3a3fbe5dff83 | JavaScript | mariiaromaniuk/Leet-Code-Practice | /Linked_Lists/Merge_Two_Lists.js | UTF-8 | 1,474 | 4.4375 | 4 | [] | no_license | // Write a function that takes in the heads of two Singly Linked Lists that are in sorted order, respectively.
// The function should merge the lists in place (i.e., it shouldn't create a brand new list) and return
// the head of the merged list; the merged list should be in sorted order.
// Time: O(n), Space: O(1)
... | true |
84a12a29fa42a350710b95ac7414b6263fa79646 | JavaScript | Zac1164/learnMaze | /js/character.js | UTF-8 | 1,512 | 4.1875 | 4 | [
"MIT"
] | permissive | /**
* Main protagonist
* @class Character
*/
Character = function() {
//Default character image
this.sprite = "blue";
//Default x position
this.x = 0;
//Default y position
this.y = 0;
//Default alive status
this.alive = true;
};
/**
* Set character sprite
* @param {string} color Sprite's color
*/... | true |
265367b377f48af1547f051a51d6f16a8f4257da | JavaScript | LesterHoly/frontend | /src/redux/reducers/banner.js | UTF-8 | 519 | 2.640625 | 3 | [
"MIT"
] | permissive | import { SHOW_BANNER, CLEAR_BANNER } from "../actionTypes";
const initialState = {
show: false,
title: '',
body: '',
type: 'error'
};
export default function (state = initialState, action) {
switch (action.type) {
case SHOW_BANNER: {
return {
...state,
...action.payload,
sh... | true |
69e055e66ed968b3368ebbc0532f9ca6b6bafd97 | JavaScript | zeypo/Go_Mobility | /src/GoMobility/SiteBundle/Resources/public/js/slide.js | UTF-8 | 575 | 2.578125 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
var imgLength = $('.slide_phone ul li img').length;
var windowWidth = $(window).width(),
liWidth = 254,
widthImg = $('.slide_phone ul li img').width();
$('.slide_control ul').empty();
for (i = 0; i<imgLength; i++)
{
$('.slide_control ul').append('<li></li>')
};
$('.sli... | true |
a6561ddb5156770307184e232a5e0df942aea534 | JavaScript | pisarevdmitry/frontend-project-lvl1 | /src/games/prime.js | UTF-8 | 599 | 3.15625 | 3 | [] | no_license | import genRandom from '../helpers.js';
const msg = 'Answer "yes" if given number is prime. Otherwise answer "no".';
const isPrime = (number) => {
if (number < 2) return false;
const iter = (divisor) => {
if (divisor > number / 2) return true;
if (number % divisor === 0) return false;
return iter(divi... | true |
9148291636daca4fdd63dec6d5fccca8729aac81 | JavaScript | Latreth/Projet_WebDev | /version_22-03/server.js | UTF-8 | 2,255 | 2.703125 | 3 | [] | no_license | var websocket = require('ws'),
ent = require('ent'); // Permet de bloquer les caractères HTML (sécurité équivalente à htmlentities en PHP)
var ws = new websocket.Server({port: 80});
console.log("RUNNING ON PORT 80");
var client = {};
ws.on('connection', (socket, req) => {
let id = Random.Char(16);
client[id] = {};
... | true |
91d213a753bc3bba16c8c0bae095108e63a943d1 | JavaScript | longnguyen1997/adv_comp_photography | /problem_sets/ps6/js/ui.js | UTF-8 | 3,276 | 2.734375 | 3 | [
"MIT"
] | permissive | function getString() {
var S = "CorrespondencePair corresp[4] = {<br />";
var maxpointsN = Math.max(pointsN[0], pointsN[1]);
for (var i = 0; i < maxpointsN; i++) {
S = S + "CorrespondencePair( ";
if (i < pointsN[0]) {
S += points[0][i];
}
S += ", ";
if (i < pointsN[1]) {
S += poin... | true |
9e155e2e09632288f71cf0ce656e38e30ba8ce73 | JavaScript | edgarduran/playlist_planner | /app/assets/javascripts/makeRequest.js | UTF-8 | 2,108 | 2.53125 | 3 | [] | no_license | function requestSearch() {
$('.request-search').on('click', function() {
var query = $('#query').val();
if (query === "") {
alert("You must enter a name");
} else {
$.ajax({
type: 'GET',
url: '/requests',
data: { query: query},
success: function(songs) {
... | true |
86d81236ec4e8373860138255ac220aabfffdcdb | JavaScript | peteCarey/Kukri | /frontend-exercise/JavaScript/2/main.js | UTF-8 | 840 | 2.875 | 3 | [] | no_license | const names = [
{ firstname: "Jon", lastname: "Snow" },
{ firstname: "Eddard", lastname: "Stark" },
{ firstname: "Gregor", lastname: "Clegane" },
{ firstname: "Cersei", lastname: "Lannister" },
{ firstname: "Melisandre" },
{ firstname: "Daenerys", lastname: "Targaryen" },
{ firstname: "Drogo" },
{ first... | true |
c300681accf3ba69ee944e959556dd284fe0bf70 | JavaScript | jroelofsz/react_rodo | /src/components/Todos/TodoCreate.js | UTF-8 | 2,603 | 2.6875 | 3 | [] | no_license | import React, {useRef, useState} from 'react'
import {Form, Card, Button} from 'react-bootstrap'
import './todo.css'
export default function TodoCreate(props) {
const actionRef = useRef();
const doneRef = useRef();
const catRef = useRef();
const [valSummary, setValSummary] = useState('');
... | true |
a5b1023a9ce63e8653c356fc3b95ea12d1a20a5e | JavaScript | qiqiboy/Animation | /src/animation.js | UTF-8 | 5,949 | 2.625 | 3 | [] | no_license | /*
* Animation
* @author qiqiboy
* @github https://github.com/qiqiboy/animation
*/
;
(function(ROOT, struct, undefined){
"use strict";
var lastTime=0,
nextFrame=ROOT.requestAnimationFrame ||
ROOT.webkitRequestAnimationFrame ||
ROOT.mozRequestAnimat... | true |
8094eacc4d04f11bd217947e8abd8ae66233a765 | JavaScript | surma/surma.dev | /static/things/js-to-asc/binaryheap_js_bench.js | UTF-8 | 512 | 2.75 | 3 | [
"MIT"
] | permissive | import { benchmark } from "./bench.js";
import { BinaryHeap } from "./binaryheap.js";
const results = await benchmark({
async run() {
const heap = new BinaryHeap((v) => v);
for (let i = 0; i < 1000000; i++) {
heap.push(Math.random());
}
let last = Number.NEGATIVE_INFINITY;
let current;
... | true |
0822d3c92a223773df7ffffc6cd1c3ce17a1c05d | JavaScript | zpi2011asvis/asvis | /frontend/js/util.js | UTF-8 | 3,303 | 2.609375 | 3 | [] | no_license | this.util = {};
(function (exports, global) {
'use strict';
var requestAnimationFrame,
classy,
rad2Deg,
deg2Rad,
arrayUniq,
toQueryString;
(function () {
var superMerge = function superMerge(parent, child) {
var new_prop;
Object.keys(child).forEach(function (p) {
if (typeof child[p] === 'fun... | true |
15addcce450460ddee499daeebc2490be51dc04b | JavaScript | https-maxus-github-com/react-widgets | /test/journeys/lib/wait-for-promise.js | UTF-8 | 412 | 3.234375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /**
* Blocks control flow until the promise resolves. Throws if the promise rejects
* @param {Promise} promise
* @returns {mixed}
*/
export default function waitForPromise(promise) {
let err, res;
browser.waitUntil(() => promise
.then((r) => {
res = r;
return true;
})
.catch((r) => {
... | true |
9b9006d360ed1a10130c756b9ccaeff1b029e5d4 | JavaScript | dionyziz/Automata | /site/js/eventemitter.js | UTF-8 | 2,459 | 3.125 | 3 | [
"MIT"
] | permissive | /*global assert: false */
/**
* @class
* Abstract class for objects that fire events.
*
* Similar API to the node.js EventEmitter.
*
* @constructor
*/
function EventEmitter() {
this._events_ = [];
}
EventEmitter.prototype = {
constructor: EventEmitter,
/**
* Register listener to an event.
... | true |
24c2763be298cb3a144f8eb6216239b433f02c29 | JavaScript | FrankBishop/c0121-code-solutions | /string-manipulation-2/src/ransom-case.js | UTF-8 | 314 | 3.375 | 3 | [] | no_license | /* exported ransomCase */
function ransomCase(string) {
var result = '';
var i;
for (i = 0; i < string.length; i += 2) {
result += string[i].toLowerCase();
if (string[i + 1] === undefined) {
return result;
} else {
result += string[i + 1].toUpperCase();
}
}
return result;
}
| true |
5d47cc93002ac9ad4f3a7ed861370228ceef5af8 | JavaScript | gaycodegal/Liquiz3 | /assets/js/QuizEdit.js | UTF-8 | 48,475 | 2.640625 | 3 | [] | no_license | /*
* Quiz Editor
* author: Ying Zhao
*
* reorganized and refactored Dov Kruger and Asher Davidson 8/12/2015
* All parameters are now passed to build methods by storing them in this.
* Not so robust, but it streamlines the code
*/
console.log("bugs to fix - undefined-qc");
console.log("bugs to fix - newlines-qc"... | true |
9304a478e4cf34e6375b4ed2bb635b4aa18def5a | JavaScript | bernardw01/liribot | /liri.js | UTF-8 | 2,165 | 2.75 | 3 | [] | no_license | var fs = require("fs");
//var splash = require('./splash');
var utl = require('./liri_util');
var inq = require('inquirer');
var quit = false;
fs.readFile("random.txt", "utf8", function (error, data) {
// If the code experiences any errors it will log the error to the console.
if (error) {
return conso... | true |
c90596705f859e5cd2791c09e0fd399706cf710e | JavaScript | aikar/node-mysql2 | /test/integration/connection/test-insert-large-blob.js | UTF-8 | 2,798 | 2.53125 | 3 | [
"MIT"
] | permissive | if (0) {
var common = require('../../common');
var connection = common.createConnection();
/*
connection.query('SELECT repeat("a", 60000000) as qqq', function (err, res) {
console.log(err);
console.log(err, res[0].qqq.length);
connection.end();
});
return;
*/
var assert = require('assert');
... | true |
bd1adf36566bc0d0da3f37b3b1a3420c6a63ad66 | JavaScript | pashhha/frontend-project-lvl1 | /src/helpers.js | UTF-8 | 664 | 3.375 | 3 | [] | no_license | export const getRandomNumber = (min, max) => Math.round(Math.random() * (max - min) + min);
export const isNumberPrime = (num) => {
for (let i = 2; i <= Math.sqrt(num); i += 1) {
if (num % i === 0) {
return false;
}
}
return true;
};
export const getPrimeNumbers = (start, end) => {
const primes ... | true |
5f052f12374c89654a8c7affc04622508f1ecfc0 | JavaScript | DepetrisFe/forms | /src/Components/FormikFormWithValidation/index.js | UTF-8 | 2,769 | 2.859375 | 3 | [] | no_license | import { useFormik } from 'formik';
import './styles.css';
const validate = (values) => {
const errors = {}
if(!values.name){
errors.name = 'Campo requerido'
}else if (values.name.length < 5){
errors.name = 'Nombre muy corto'
}
if(!values.lastname){
errors.lastname = 'Campo... | true |
9b830e492838a55fa9b06a4edcb0b5c8e772e560 | JavaScript | xuannguyen1206/Rock-Paper-Scissors | /script.js | UTF-8 | 4,046 | 3.59375 | 4 | [] | no_license | function computerPlay(){
let computerChoice = Math.floor(Math.random()*3)+1;
if(computerChoice === 1){
computerChoice = "rock";
}
else if(computerChoice === 2){
computerChoice = "paper";
}
else{
computerChoice = "scissors";
}
return computerChoice;
}
function dec... | true |
3bb695c46b9d83e045d3a8619c1d933fa12eaf3d | JavaScript | Sergo-python/les1 | /JS/les2/les2.js | UTF-8 | 5,630 | 3.96875 | 4 | [] | no_license | /*1. const group = [0, 1, 2, 3, 4];
console.log(group);
const group1 = ['A', 'B', 'C', 'D', 'E'];
console.log(group1);
const group2 = ['String', false, true, 100, 10];
console.log(group2);
2. const group = [false, true, 100];
console.log(group[1]);
console.log(group[2]);
console.log(g... | true |
3fff5acc2cb6bf8121b196600893decd609784b0 | JavaScript | Reneecc/express-samples | /s-helloWorld.js | UTF-8 | 439 | 3.109375 | 3 | [] | no_license | //引入express模块
var express = require('express');
//使用 express() 方法创建变量 app ,该方法会返回一个请求处理函数闭包
var app = express();
app.use(function (req, res) {
res.send('hello world');
//res.end 终止止执行下面的语句,使 Web 服务器停止处理脚本并返回当前结果
// res.end('HELLO WORLD');
});
app.listen(3000, function () {
console.log('运行 3000')
});
... | true |
2af33b442fa8d0e6156ce27cd8bde9c67d8efff7 | JavaScript | sad-xu/2017-baidu | /qrcode/V7M.js | UTF-8 | 10,421 | 2.71875 | 3 | [] | no_license | /*二维码生成
*水平有限,仅 Version 7 M
*/
var input=document.getElementById("input");
var check=document.getElementById("check");
var drawing=document.getElementById("drawing");
var data=[];
var mask=[];
//纠错码部分
var _gfExp=new Array(512);
var _gfLog=new Array(256);
for (var i = 0; i < 512; i++) {
_gfExp[i]=0;
}
... | true |
cd740bd080324c9f601cb7db21d7e9d11786f90e | JavaScript | harsharay/3dp-invoice | /src/Components/FirebaseData/FirebaseData.jsx | UTF-8 | 1,675 | 2.546875 | 3 | [] | no_license | import React,{ useState, useEffect } from 'react'
import "./FirebaseData.styles.css"
import { firestore } from "../../Firebase/Firebase.utils"
function FirebaseData({ onClick }) {
const [data,setData] = useState([])
const getFirebaseData = async () => {
let response = await firestore.collection("in... | true |
4214ca9a39df1567826c960ccd143846e5599047 | JavaScript | rocknegi/MEAN-June130Batch | /Codes10/usemymodule/customevent.js | UTF-8 | 598 | 2.796875 | 3 | [] | no_license | const ev = require("events");
// Create an eventEmitter object
var eventEmitter = new ev.EventEmitter();
function dbConnectionOpen(){
console.log("Connection Created...");
}
// Bind event and even handler as follows
//openDoor();
eventEmitter.on('open', dbConnectionOpen);
// Fire an event
eventEmitter.emit('open'... | true |
0ba1e08dda21fbf1bbccd2d580d6f4192a3e7741 | JavaScript | sethborden/seed | /seedGroups.js | UTF-8 | 2,871 | 2.703125 | 3 | [
"MIT"
] | permissive | 'use strict';
var _ = require('lodash');
var seedVars = require('./seedInfo');
const properAdjectives = seedVars.properAdjectives;
const orgTypes = seedVars.orgTypes;
const description = seedVars.description;
let randomInt = function(min, max) {
return Math.floor(Math.random() * (max-min)) + min;
};
let makeOwne... | true |
c7dc21d7accbc75d0fae1709bb3dc4b58048e068 | JavaScript | MartyInFuture/goit-js-hw-07 | /js/task-4.js | UTF-8 | 415 | 3.53125 | 4 | [] | no_license | const incrementBtn = document.querySelector('[data-action="increment"]');
const decrementBtn = document.querySelector('[data-action="decrement"]');
const counter = document.querySelector('span#value');
let count = Number(counter.textContent);
incrementBtn.addEventListener('click', () => {
counter.innerHTML = count +... | true |
dc09852b999cd63486e89df921fb46361a36eefe | JavaScript | Patkloe/Linkedlist | /Linkedlist/Javascript/Recursive/linkedlist.js | UTF-8 | 1,090 | 4.03125 | 4 | [] | no_license |
/** Recursive **/
class Node{
constructor(element){
this.element = element;
this.next = null;
}
}
class Linkedlist{
constructor(){
this.head = null;
this.size = 0;
}
add(element){
var newnode = new Node(element);
var navigate;
if(this.head === null){
this.head = newnode;
... | true |
4576f29986e11436fa6becd891e5c612aebbef73 | JavaScript | BilSot/Calculator | /calcScript.js | UTF-8 | 6,331 | 2.8125 | 3 | [
"MIT"
] | permissive | var pressedNumber;
var operand1, operand2;
var memoryValue = 0;
var operator, decimal, display;
var hasResult = false;
var audio = new Audio('beep.mp3');
//var messageVar = 'This text should be alerted.\n\
//But it is not';
//alert("1"+2+3);
$(function () {
$("#calcScreen").val('0');
decimal = $("#decimalSign").html... | true |
7b0821d324ef042a2c7841821e536f57c616a3cd | JavaScript | pmoskovi/universal-client | /javascript/src/JavascriptUniversalClient.js | UTF-8 | 4,657 | 3.0625 | 3 | [] | no_license | /**
* Created by romans on 9/15/15.
*/
/**
* Kaazing JavaScript Universal Client facade that communicates with the gateway based on specified protocol. Script downloads necessary libraries except of JmsClient.js - that script has to be added to the <head> section.
* @param protocol Specifies protocol that should be... | true |
c5d27163e895e115f669d8842641e68cc628fcfd | JavaScript | jbakse/site_builder | /docs/music/sketches/midi_demo.js | UTF-8 | 1,952 | 2.8125 | 3 | [] | no_license | // require https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/p5.min.js
// require https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/addons/p5.sound.js
// require https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/addons/p5.dom.min.js
// require /music/SimpleSynth.js
// connects a midi keyboard to the MonoSynth, let... | true |
2e05eb8030b5248e5ef8260be710e65da18336a3 | JavaScript | Wayne-Bai/AST-normalize | /data/PBS-KIDS/Platypus/engine/components/logic-spawner.js | UTF-8 | 4,026 | 2.9375 | 3 | [] | no_license | /**
# COMPONENT **logic-spawner**
This component creates an entity and propels it away. This is useful for casting, firing, tossing, and related behaviors.
## Dependencies:
- [[handler-logic]] (on entity's parent) - This component listens for a logic tick message to determine whether it should be spawning or not.
## ... | true |
cde489d0f46605649416ad59705719c99ec58f6e | JavaScript | odedglas/linear-gradient-parser | /src/utils/calmpAngle/spec.js | UTF-8 | 421 | 2.5625 | 3 | [
"MIT"
] | permissive | import clampAngle from '.';
describe('utils / clampAngle', () => {
it('Keeps angle when in range', () => {
expect(clampAngle(10, 0 , 20)).toEqual(10);
});
it('Adds 360 to angle when smalled than min', () => {
expect(clampAngle(-60, 0, 360)).toEqual(300);
});
it('Reduce 360 from an... | true |
1e24f223a267cc06f61857cb26ced5a31a7519d9 | JavaScript | stammareddi/stammareddi.github.io | /index.js | UTF-8 | 4,910 | 3.296875 | 3 | [] | no_license | window.addEventListener('load', ()=> {// after page is loaded
const sounds = document.querySelectorAll(".sound") // when page load the sound is stored here
const pads = document.querySelectorAll(".pads div") // the pads from 1 to 6
const visual = document.querySelector(".visual");
const info = d... | true |
f229e97f54dfcbfb8657801d36aad65f9be326de | JavaScript | Bravelemming/bus-mall | /js/random.js | UTF-8 | 607 | 3.359375 | 3 | [
"MIT"
] | permissive | //JDK : library for random numbers of various types
/* eslint-disable no-unused-vars */
'use strict';
// from MDN
// inclusive range with uniform distribution
var getRandomInt = function(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
};
//gener... | true |
bb2d3c019e60e407ba9e8a24e01ab2a336077b7e | JavaScript | guyubin/baiduFE | /task023/task023.js | UTF-8 | 4,266 | 3.328125 | 3 | [] | no_license | var log = function() {
console.log.apply(console, arguments)
}
var NodeTraversalList = []
// timeH = setInterval(function(){
// //getData.next()每调用一次, 其值都会改变, 故设一个临时变量存储其值
// var temp = getData.next().value;
// if(temp!=undefined && temp!="ending"){
// showData(temp);
// ... | true |
a8912264029ce83a41e9c30f33caafd7357b67b5 | JavaScript | RobertKyuH/API-Restful-frontend | /src/components/sections/RegisterForm.js | UTF-8 | 2,504 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react'
import Form from 'react-bootstrap/Form'
import Button from 'react-bootstrap/Button'
class RegisterForm extends Component{
constructor(props){
super(props);
this.sign_up_code = "the_sport_association";
this.state ={
errors: "",
email: "",
... | true |
042ac9311a1ea1f8baadadc37c059fe48ed19b4f | JavaScript | dhimanaishwarya/fun-with-triangles | /js/istriangle.js | UTF-8 | 1,705 | 3.796875 | 4 | [] | no_license | let angles = document.querySelectorAll("input");
let submitButton = document.querySelector("#submit-button");
let outputText = document.querySelector("#output-text");
submitButton.addEventListener("click", submitButtonHandler);
function submitButtonHandler() {
let angle1 = Number(angles[0].value);
let angle... | true |
d657fa78fd1b1042e3687edf2be3892524456da1 | JavaScript | prodix01/movie_app2 | /src/App.js | UTF-8 | 919 | 3.140625 | 3 | [] | no_license | import React, {Component} from "react";
class App extends Component {
//상태값
state = {
count : 0
};
//함수
add = () => {
this.setState(current => ({count : current.count + 1}));
};
minus = () => {
this.setState(current => ({count : current.count - 1}));
};
... | true |
e3316634ce880f65aa12210042e057c6135d4026 | JavaScript | iisora/learn_frontend | /Vue/バリデーションチェック/js/test-vue/test-vue.js | UTF-8 | 967 | 2.578125 | 3 | [] | no_license | new Vue({
el: '#app',
data: {
errors: [],
name: null,
loginId: null,
password1: null,
password2: null,
email: null
},
methods: {
checkForm: function (e) {
if (this.name && this.loginId && password1 && password2 && email) {
return true;
}
thi... | true |
18101ca524dd0cc43cc95c9d54c6c2b194604114 | JavaScript | umgc/nasa.maestro.verifer | /app/model/Program.js | UTF-8 | 6,238 | 2.9375 | 3 | [
"MIT"
] | permissive | 'use strict';
const fs = require('fs');
const path = require('path');
const childProcess = require('child_process');
const packageJson = require('../../package.json');
const envHelper = require('../helpers/envHelper');
const noGitMessage = 'Git not available in browser';
/**
* Run a git command in the projectPath ... | true |
a708b2675a2c8bd903e410ed83148b23a499decf | JavaScript | impiaaa/SV-OSM | /scripts/expand.js | UTF-8 | 5,954 | 2.78125 | 3 | [] | no_license | var equatorialRadius = 6378137.0;
var polarRadius = 6356752.3;
var e = Math.sqrt(1.0 - (polarRadius*polarRadius)/(equatorialRadius*equatorialRadius));
function primeVerticalRadius(lat) {
var s = Math.sin(lat);
return equatorialRadius/Math.sqrt(1.0 - e*e*s*s);
}
function geoToECEF(geo) {
var l = geo.lon*Ma... | true |
59857fed61bbda0a5584803635e6edc4e17d92a0 | JavaScript | tjp9889/boilermaker | /src/line.js | UTF-8 | 416 | 2.53125 | 3 | [] | no_license |
var evalExpr = require('./evaluator.js').evalExpr;
function Line(contents)
{
this.contents = contents;
this.insert = function(evaluator) { }
this.execute = function(execContext)
{
function executor(str, p1)
{
return evalExpr(execContext, p1);
}
return this... | true |