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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
772c35ab952ce9a63a0a55091f331dc42ec1d883 | JavaScript | vkmb/imad-app | /ui/dummy.js | UTF-8 | 828 | 2.53125 | 3 | [] | no_license | var name_list = [];
var sub_button = document.getElementById("submit");
var name_text = document.getElementById("name");
var ul = document.getElementById("p");
sub_button.onclick= function(){
var name = name_text.value;
var request = new XMLHttpRequest();
request.onreadystatechange = function(){
if... | true |
7002b898f44935401929b93c29bd5641a7f6e3c5 | JavaScript | yowlonglee/leetcode | /448.find-all-numbers-disappeared-in-an-array.js | UTF-8 | 550 | 3.734375 | 4 | [] | no_license | /*
* @lc app=leetcode id=448 lang=javascript
*
* [448] Find All Numbers Disappeared in an Array
*/
// @lc code=start
/**
* @param {number[]} nums
* @return {number[]}
*/
var findDisappearedNumbers = function(nums) {
// Create an empty array to hold results
const result = [];
// Count from 1 to nums.length... | true |
b4534c08fa8da97f106e13b18f65efa55e8cbf33 | JavaScript | BlindNerd/happeningApp | /public/scripts/client.js | UTF-8 | 200 | 2.5625 | 3 | [] | no_license | !function (){
'use strict';
window.addEventListener('DOMContentLoaded', () => {
console.log('Client JS is Connected');
});// end of window Loaded listener
}(); // end of iffy of IIFE
| true |
d6215ae8d48d2dbd0cd95657e02773528126724c | JavaScript | jvsm10/lfa.github.io | /simulfa/automatos/js/AFD.js | UTF-8 | 3,569 | 3.046875 | 3 | [
"MIT"
] | permissive | function AFD(useDefaults) {
"use strict";
this.transitions = {};
this.startState = useDefaults ? 'start' : null;
this.acceptStates = useDefaults ? ['accept'] : [];
this.processor = {
input: null,
inputLength: 0,
state: null,
inputIndex: 0,
status: null,
};
}
$(function() {
"use st... | true |
2428b668d0ad4c7edb2f57abc30655863e4a830d | JavaScript | veronika333/reactjs_sandbox | /4_task_form/src/App.js | UTF-8 | 1,525 | 2.9375 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
/*
class MyForm extends React.Component {
constructor(props) {
super(props);
this.state = { username: '' };
}
myChangeHandler = (event) => {
this.setState({username: event.target.value});
}*/
class App e... | true |
a799ae4ad8bc41ac3ed7734f5d1e395dab217e76 | JavaScript | htransteven/htransteven.github.io.old | /dev_site/scripts.js | UTF-8 | 4,002 | 3.15625 | 3 | [] | no_license | function init() {
loadKeys();
grid.loadPages();
grid.placePages();
grid.moveTo(0, 0);
}
function loadKeys() {
$(document).keydown(function(e) {
var site_x = grid.site_xpos;
var site_y = grid.site_ypos;
switch (e.keyCode) {
case 37: //LEFT
site_x--;
grid.moveTo(site_x, site_y);
... | true |
2d3308c8b04110588378264bbf70a562d94a8a7a | JavaScript | NARUTOne-note/JS | /ES6+/Proxy/demo/traceMethodCalls.js | UTF-8 | 1,412 | 3.875 | 4 | [
"BSD-3-Clause"
] | permissive | /**
* proxy 拦截方法 属性
*/
function tracePropAccess(obj, propKeys) {
const propKeySet = new Set(propKeys);
return new Proxy(obj, {
get(target, propKey, receiver) {
if (propKeySet.has(propKey)) {
console.log("GET " + propKey);
}
return Reflect.get(target, propKey, receiver);
... | true |
74d70edf69dc6fe89efe3b17d7e626687d6f7ea2 | JavaScript | rahul-sdei/nodejs.app1 | /server.js | UTF-8 | 1,376 | 2.625 | 3 | [] | no_license | var http = require('http');
var url = require('url');
var fs = require('fs');
var server = http.createServer(function(request, response){
console.log('Connection');
var path = url.parse(request.url).pathname;
switch(path){
case '/':
response.writeHead(200, {'Content-Type': 'text/html'});
response.writ... | true |
c244798b112e46a4a06e1713b25555d5835a66bb | JavaScript | aaronwhyte/plexode | /public_html/eval3-offline/js/dom.js | UTF-8 | 3,162 | 2.609375 | 3 | [] | no_license | // Copyright 2006 Aaron Whyte
// All Rights Reserved.
/**
* @fileoverview
*/
this.plex = this.plex || {};
plex.dom = {};
/**
* Gets element by ID.
* @param {String} id the element's ID
* @param {Document} opt_doc optional document object. If not specified,
* then this uses the global context's window.docum... | true |
8f0f1ac9ea247824a427f6ee51cd449772115e73 | JavaScript | jd-js-course/taujs2020 | /shirigordon/app.js | UTF-8 | 4,232 | 2.921875 | 3 | [
"MIT"
] | permissive | const createShip = () => {
var path = new Path([-10, -8], [10, 0], [-10, 8], [-8, 4], [-8, -4]);
path.closed = true;
var thrust = new Path([-8, -4], [-14, 0], [-8, 4]);
var group = new Group(path, thrust);
group.position = view.bounds.center;
group.strokeColor = "red";
group.vec = n... | true |
cd088b1a7f62c7addbe7ed8615b9fd791ed65545 | JavaScript | Janeshwaran/DS-and-ALGO-in-JS | /Recursion/Recursion/src/nestedEvenSum.js | UTF-8 | 436 | 4.125 | 4 | [] | no_license | function nestedEvenSum(obj) {
// Initialize variable for the sum
let sum = 0;
// Loop over the input object
for(let key in obj) {
// If current item is an object, make a recursve call
if(isObject(obj[key])) sum += nestedEvenSum(obj[key]);
// If current item is an even number, add it to the sum
... | true |
4c107587916d6288d65f6636086f433ff275e02b | JavaScript | pedroslopez/INTEC-ScheduleBuilder | /Schedule.js | UTF-8 | 4,826 | 2.921875 | 3 | [] | no_license | const oferta = require('./oferta.json')['oferta']; // oferta is auto generated by scraper
// format {
// CBF210: {
// name: "",
// schedule: {
// lunes: {
// desde: 0,
// hasta: 1
// }
// ...
// }
// }
// ...
// }
... | true |
90618ac8e923ea62f877aeafae1825e63ca81bd5 | JavaScript | sajeerbinsaleem/watson-ibm-speech-to-text-converter | /static/Api.js | UTF-8 | 5,497 | 2.921875 | 3 | [] | no_license | // The Api module is designed to handle all interactions with the server
var Api = (function() {
var requestPayload;
var responsePayload;
var messageEndpoint = '/api/message';
var sessionEndpoint = '/api/session';
var apikeyEndpoint = '/api/set_auth_key';
var getApikeyEndpoint = '/api/ge... | true |
5b206f8dc7368834666d06ddf2d85ecc1f563cf1 | JavaScript | clearhead/clearhead | /test/append-css.js | UTF-8 | 497 | 2.546875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import chai, { assert, expect } from 'chai';
import phantom from 'phantomjs'
import appendCss from '../src/append-css';
describe('#appendCss()', () => {
const css = 'body {color: red;}';
assert.typeOf(css, 'string');
appendCss(css);
setTimeout(function() {
it('has the right color', function () {
con... | true |
6d09aa603fa97175807a3db475b5db44a9e699e7 | JavaScript | Dmitriyx/grpc-starter | /service-methods.js | UTF-8 | 352 | 2.765625 | 3 | [] | no_license | function numberPlusFive({number}) {
console.log('in number plus five', number);
return {number: number + 5};
}
function numberToNumber(call, callback) {
console.log('inside of numberToNumber')
console.log('callback', callback)
console.log('call:', call)
callback(null, numberPlusFive(call.request));
};
m... | true |
47f0a5906ef652be5f82371fca4761e3ab8896a2 | JavaScript | nieyao/one_hundred_questions | /js/inherit.js | UTF-8 | 4,736 | 4.3125 | 4 | [
"MIT"
] | permissive | // 1. 原型链继承
// function Father() {
// this.name = "parent";
// this.friend = [];
// this.property = true;
// }
// Father.prototype.getName = function () {
// return this.name;
// };
// Father.prototype.getParentValue = function () {
// return this.property;
// };
// function Son(name, age) {
// this.name... | true |
9b4e7ad98cb1e5ba103972f794455449e7778e74 | JavaScript | raymondseah/raymondseah.github.io | /app3.js | UTF-8 | 4,043 | 3.21875 | 3 | [] | no_license | $(document).ready(function(){
var count = 0
var score = 0
startNextQuestion()
function startNextQuestion () {
//using ajax, random get a set of data, in our case is a question with alot of objects
$.ajax({
url:'https://opentdb.com/api.php?amount=1&category=9&diff... | true |
55226041d5f954f90c34f8cd9d7c8877055eb1ce | JavaScript | boyloe/Pet-rental-front-end | /pets/pets.js | UTF-8 | 2,764 | 3.046875 | 3 | [] | no_license | const userQueryParams = new URLSearchParams(window.location.search)
const userId = userQueryParams.get('user_id')
const hidden = document.querySelector('input[name="user_id"]')
hidden.value = userId
const speciesQueryParams = new URLSearchParams(window.location.search)
const species = speciesQueryParams.get("species")... | true |
a0ce257918bc602d2c32e35f043abdd485bb1d8c | JavaScript | lrochawl/cursoemvideo-html5 | /pacote-download/estudandoJS/script.js | UTF-8 | 1,177 | 3.40625 | 3 | [
"MIT"
] | permissive | function calcular(){
var txtV = document.querySelector("input#txtVel")
var resD = document.getElementById("res")
var vel = Number(txtV.value)
res.innerHTML = `Sua velocidade é de <strong> ${vel}Km/h. </strong> `
if(vel > 60){
res.innerHTML += `<br> *** Você Foi <strong>MULTADO</strong> por excesso de velocidade **... | true |
ff5766134c50ff183762950ac1e421e45884872a | JavaScript | pkevinklein/lab-p5-treasure-hunt | /src/player.js | UTF-8 | 627 | 3.40625 | 3 | [] | no_license | class Player {
constructor() {
this.row = 0;
this.column = 0;
this.image;
}
moveUp() {
this.row++
}
moveDown() {
this.row--
}
moveLeft() {
this.column--
}
moveRight() {
this.column++
}
draw() {
if (keyIsDown(38)... | true |
0db3176e5a450230067f378f174767ad9f40647f | JavaScript | lujiannt/testRequestJS | /src/main/webapp/js/app/testDefine.js | UTF-8 | 785 | 2.96875 | 3 | [] | no_license | //require 和 define的区别:require是仅仅引入js且无返回值,define是定义一个模块可以有返回值
define(["jquery", "jquery.alpha", "jquery.beta", "map"], function () {
//the jquery.alpha.js and jquery.beta.js plugins have been loaded.
$(function () {
//test 1 测试引用非AMD标准JS
var map = new Map();
var obj = {"name": "zhangsan"... | true |
05d4d27ce94fdce0c1778174dca5247b81849fa3 | JavaScript | nick-jarvie/minesweeper | /minesweeper.js | UTF-8 | 4,600 | 3.515625 | 4 | [] | no_license | document.addEventListener('DOMContentLoaded', startGame)
// Define your `board` object here!
var board = {
cells: [
{
row: 0,
col: 0,
isMine: randomMine(),
hidden: true,
},
{
row: 0,
col: 1,
isMine: randomMine(),
hidden: true,
},
{
row: 0,
... | true |
2b6cf5b031d5b26de66689bddf82301189ebec89 | JavaScript | Canvas04/TodoApp | /src/components/task/task.js | UTF-8 | 829 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import './task.css';
class Task extends Component {
state = {
done: false
}
onSpanClick = () => {
this.setState((state) => {
return {
done: !state.done
}
})
}
render() {
const { done } = this.state;
let classNames = 'description';... | true |
3d037f310d70296ef438de5640e634b44d5b7bcd | JavaScript | DanteWitcher/LikeTrello | /src/app/components/login/login.component.js | UTF-8 | 1,379 | 2.5625 | 3 | [] | no_license | import template from './login.template.html';
import './login.scss';
class LoginController {
constructor(AuthService) {
this.error = "";
this.goodResponse = '';
this.data = {};
this.auth = AuthService;
this.url = "https://cloudcalltodo.azurewebsites.net/api/users/... | true |
4484cbaf59765ba9b92e528842727d1576d7768c | JavaScript | ManuelReg/jquery-aim | /jquery.aim.js | UTF-8 | 6,745 | 2.515625 | 3 | [] | no_license | (function($) {
var elementList = [];
var v = {x: 0, y: 0, r: 0, t: 0}, p = {x: 0, y: 0}, vr = 0, t = 12, mouseX = 0, mouseY = 0,
DEBUG = false, trailblazer = null, tbSize = 50, tbRadius = 50, tbCenter = {x: 0, y: 0}, tbRect = {x0: 0, y0: 0, x1: tbSize, y1: tbSize}, tbRad = 1;
$.fn.aim = functi... | true |
22530efb9cd8698a788509c23125ad10d98e8131 | JavaScript | maximoviola/nuevo_repo | /clase5/ejercicio1.js | UTF-8 | 463 | 3.328125 | 3 | [] | no_license | console.clear()
let usuarios = [
{
nombre: 'Lucas',
edad: 27
},
{
nombre: 'maison',
edad:17
}
]
//dado un aray de usuarios, indicar si existe un usuario llamado lucas.
let estalucas = false;
for (let i = 0; i<usuarios.length; i++){
let u... | true |
3ddfc9eaa9195f5dd026aa9e05da037e23ecc901 | JavaScript | miantj/MeiZu | /meizu/js/login.js | UTF-8 | 6,340 | 2.5625 | 3 | [] | no_license | window.onload=function(){
var timer = setInterval(function(){
wid+=1;
pgs.style.width=wid+'%';
if( wid >=100){
setTimeout(function(){
pgs.style.display='none';
clearInterval(timer)
},500)
}
},30);
"use strict";
var divs=docu... | true |
2a673ef8806a25524970fd133655d976ca781593 | JavaScript | DevNitish/nitishGitRepo | /newWork/codeCunks.js | UTF-8 | 590 | 3.578125 | 4 | [] | no_license | function splitString(stringToSplit, separator) {
var arrayOfStrings = stringToSplit.split(separator);
console.log('The original string is: "' + stringToSplit + '"');
console.log('The separator is: "' + separator + '"');
console.log('The array has ' + arrayOfStrings.length + ' elements: ' + arrayOfStrings.join(... | true |
785e8a9142d8c999d1f1c44a349236a50b68f675 | JavaScript | mrm8488/rainbrow | /index.js | UTF-8 | 7,028 | 3.09375 | 3 | [] | no_license | let videoEl;
let currentStripe = 3;
let emoji = document.getElementsByClassName("emoji")[0];
let stripes = document.getElementsByTagName("main")[0].children;
let star, point;
let counter = 0;
let enemy;
const enemojis = ["💩", "🍔", "🦄", "🐼", "🤖", "🥁", "💾", "🧹", "🧬"];
let currentExpression, previousExpression;
... | true |
42473583cd680f4ae125fbe20e8c8b6468b58c08 | JavaScript | daymosik/mtg-card-holder | /src/ts/utils/create-image-bitmap.js | UTF-8 | 2,786 | 2.8125 | 3 | [] | no_license | /* eslint-disable */
/*
* Polyfill for createImageBitmap
* https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
*
* Supports CanvasImageSource (img, video, canvas) sources, Blobs, and ImageData.
*
* From:
* - https://dev.to/nektro/createimagebitmap-polyfill-for-safari-and... | true |
d8d679f86425521df65191920183cdeb444d7524 | JavaScript | thiagocassiolato/L-gica | /conversao_numeros.js | UTF-8 | 6,264 | 3.515625 | 4 | [] | no_license | /**
*
*/
//Função verifica campo numérico
function isNumeric(str, restricao)
{
//Loop para verificação de cada caracter digitado
for (var c = 0; c < str.length; c++)
{
//busca o caracter digitado
var chr = str.charAt(c);
//Se não for numérico
if (chr != '0' & chr != '1' & chr != '2' & chr != '... | true |
1baa5c7880decbb574538b46346b2a59dff0122a | JavaScript | gravity2146/portfolio | /wp-content/themes/jj/js/app/app-text.js | UTF-8 | 2,047 | 2.765625 | 3 | [] | no_license | app.text = {
init: function () {
$(".text-page h1").blast({
delimiter: "character",
tag: "span",
});
a = 0;
$(".text-page h1 .blast").each(function () {
var el = $(this);
setTimeout(function () {
el.addClass("animated bounceIn");
}, a);
a = a + 50;
}... | true |
8bea60ff27fb077e904914030f002dc9a28c526c | JavaScript | RSG-Group/RSG-Chess-API | /rsg-chess-api/test/index.js | UTF-8 | 1,333 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | import { Game, AI, Pieces, tools } from '../src/index'
// Pieces test
console.log('\nTesting the Pieces API... \nThese are all supported piece characters:')
console.log(Pieces.PIECE_CHARS)
if (Pieces.PIECE_CHARS.queen.black === '♚') {
console.log('The PIECE_CHARS test succeded.')
} else {
console.log('The PIECE_C... | true |
a8c88224f3638a7e84fae1ac1abda0c1fcd04e21 | JavaScript | andreaak/cs | /WebTest/WebTest/09_Node/06_db/MongoDB/005_DeleteData/main.js | UTF-8 | 1,460 | 2.703125 | 3 | [] | no_license | var MongoClient = require('mongodb').MongoClient;
var url = 'mongodb://localhost:27017/userCollectionDB';
// Для удаления объектов (документов) из коллекции используется используется несколько методов
// deleteMany() - удаляет все документы, которые соответствуют определенному критерию
// delete... | true |
95c6313b7bb599fdef0dc0f162a2e98ed6acaa26 | JavaScript | ChernenkoArtem/HW-7 | /Es 5/init.js | UTF-8 | 6,825 | 3.28125 | 3 | [] | no_license | const aList = new AList();
aList.clearList = function(){
this.collection = [];
this.length = 0;
};
aList.size = function () {
if(arguments.length > 0) return false;
return this.length;
};
aList.push = function (el) {
if(arguments.length > 1 || arguments.length < 1) return false;
this.collecti... | true |
8fa43cee26a444a93bc3aa1b6741771f2806bf76 | JavaScript | Pravallika241/JsAssignments | /Question2.js | UTF-8 | 125 | 3.078125 | 3 | [] | no_license | FormatString = (firstName,lastName) => {
return firstName[0] + lastName[0];
}
console.log(FormatString("Rogers","Wally"));
| true |
77bcd47555ec48f3fe335421fc81cf5387546502 | JavaScript | glenjamin/emojifight | /client/ChooseWarrior.js | UTF-8 | 1,247 | 2.59375 | 3 | [] | no_license | var React = require('react');
var Emoji = require('./Emoji');
require('./Choose.css');
var ChooseWarrior = React.createClass({
render() {
var warriors = this.props.warriors;
return (
<div>
<h1>Step {this.props.step}: Choose your warrior</h1>
<table className="Choose--table">
... | true |
9358f725631205c8bec848223529aa5bf4f3cd42 | JavaScript | lorenzosinisi/scrumex | /assets/js/team.js | UTF-8 | 1,146 | 3.09375 | 3 | [] | no_license | export class Team {
constructor () {
if (document.getElementById('app')) { return }
// Set up the "Add Entry" button on the page
this._setupAddMember()
// And set up the "Remove Entry" buttons on the page
this._setupRemoveMember()
}
_setupAddMember () {
// When add entry is clicked, clone ... | true |
f04e581572134516e9fc3abbd3d8e67f7cf15c50 | JavaScript | natalianavarrete/Proyecto-final | /js/scripts.js | UTF-8 | 1,549 | 2.5625 | 3 | [] | no_license |
////////////////////////////////////MAPA DE UBICACIÓN/////////////////////////////////////
// Creación de un mapa de Leaflet
var map = L.map("mapid");
// Centro del mapa y nivel de acercamiento
var guanacaste = L.latLng([10.557188, -85.372099]);
var zoomLevel = 9;
// Definición de la vista del mapa
map.set... | true |
1f088ffc0bae3e3c559d381300d309f939e00643 | JavaScript | sommerfe/Sommer-Flohmarkt | /u1.js | UTF-8 | 1,179 | 3.03125 | 3 | [] | no_license | //var currentShown = 0;
//
//window.onload = function (){
// document.getElementById("title").innerHTML = 'Image: ' + currentShown;
// console.log(title);
// document.getElementById("img0").classList.remove("hideImage");
//};
//
//
//function previousImage() {
// let currentImage = "img" + currentShown;
// ... | true |
00c771444381fb8a8682e2596dd0a76c083f319f | JavaScript | darkliquid/leader1 | /js/wiki.js | UTF-8 | 442 | 2.59375 | 3 | [
"MIT"
] | permissive | RegisterCommand("wiki", function(){
var args = this.event.message.split(" "),
source = this.event.args[0],
cmd = args.shift(),
nick = this.event.nick,
url = "http://www.wikipedia.org/wiki/" + encodeURIComponent(args.join("_"));
if(args.length > 0) {
IRC.Privmsg(source, nick+": Wikipedia - " + url);
} els... | true |
6ad5e720dc956de807c05faaed7125866ea11612 | JavaScript | vietnguyen3107/CORE | /CORE-Client/src/main/webapp/javascript/department.js | UTF-8 | 2,606 | 2.671875 | 3 | [] | no_license |
$(function() {
jQuery.noConflict();
});
function editRow(rowid){
var recentRow = jQuery("#"+rowid);
jQuery("tr").css('background-color', '#FFFFFF');
jQuery(".delete").attr('checked',false);
recentRow.css('background-color', '#FFFF99');
recentRow.find('input').attr('checked',true);
recentRow.find("td").ea... | true |
928ff7a3fd44535ab155e92c223fefea6fffe1fd | JavaScript | exmelendez/marctext-creator | /js/test.js | UTF-8 | 1,995 | 2.921875 | 3 | [] | no_license | //TODO: Ensure successful creation of manual/modal inputs/forms
// const formCreator = new FormManipulator();
// formCreator.createForm();
let book1 = new EntryBook(
"cat in hat",
"dr. seuss",
"english",
"Picture Book",
2007,
56473837
);
let book2 = new EntryBook(
"rainbow wigs",
"Kathy Weis",
"engl... | true |
c89a37d8516b233531236ec41db92c299aa14c0c | JavaScript | ManiSol9/testing | /public/js/datajs/other.js | UTF-8 | 2,366 | 2.6875 | 3 | [] | no_license | $(document).ready(function () {
const form = document.querySelector('form');
const name = document.getElementById('name');
const armtemplates = document.getElementById('armtemplates');
var entites = [
{
"entityName": "AitDrop",
"parameter1": "Height",
"... | true |
6a038ab9593da9e4db1759b376d4cc27c06daf95 | JavaScript | alanclarke/react-in-time | /src/lib/ensureDate.js | UTF-8 | 163 | 2.703125 | 3 | [] | no_license | export default function ensureDate (dateA, dateB) {
dateA.setDate(dateB.getDate())
dateA.setMonth(dateB.getMonth())
dateA.setFullYear(dateB.getFullYear())
}
| true |
5b35d5fd6e4b1e52da8ceaa16f63af7968c92ae0 | JavaScript | KylevanderWolf/Test-Driven-Development | /get-word-lengths.js | UTF-8 | 116 | 2.578125 | 3 | [] | no_license | const getWordLengths = (someWords) => {
return someWords.map(e => e.length)
};
module.exports = getWordLengths; | true |
af8a91eb11af8b87102155e3133186f86a0aca04 | JavaScript | sirbrillig/dotfiles | /phoenix.js | UTF-8 | 1,843 | 2.796875 | 3 | [] | no_license | /* globals api, Window */
/* jshint curly:false */
var debugMode = true;
function debug( message ) {
if ( debugMode ) api.alert( message );
}
/***********************************************
* BINDINGS
***********************************************/
debugMode = false;
var simpleMods = ['alt', 'cmd'];
var precis... | true |
af45c91017864483cccfcd33a4995da426b2fbf1 | JavaScript | 4m4n/LeetCode | /297 Serialize and Deserialize Binary Tree.js | UTF-8 | 1,385 | 3.875 | 4 | [] | no_license | /**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* Encodes a tree to a single string.
*
* @param {TreeNode} root
* @return {string}
*/
var serialize = function(root) {
if(!root)
return "";
var resul... | true |
aa0439214bb5d5141dd83fcee486cda946699066 | JavaScript | sdec-brasil/dashboard-emissor | /api/src/utils/listFilterSet/index.js | UTF-8 | 6,678 | 2.78125 | 3 | [
"MIT"
] | permissive | import models from '../../models';
const { Op } = models.Sequelize;
export default class ListFilterSet {
constructor() {
this.filterFields = [];
this.model = null;
this.filters = {};
}
/**
* @function setFilterFields
*
* @description used to set filterable fields on one ListFilterSet inst... | true |
e7f7e95e7b0f72244c27827a0075b03c7cd05583 | JavaScript | mikkolunatic/mikkolunatic.github.io | /js/main.js | UTF-8 | 334 | 2.53125 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
if($(window).width() > 767){
$("#main").css("margin-left", $(".wrapper-masthead").outerWidth());
}
});
$(window).resize(function(){
if($(window).width() > 767){
$("#main").css("margin-left", $(".wrapper-masthead").outerWidth());
}else{
$("#main").css("margin-left",... | true |
67c856df7c563c7806b6ea6d19ddc3c86366c7f8 | JavaScript | rk2040/ExamenIngreso-DivF | /tres.js | UTF-8 | 565 | 2.671875 | 3 | [] | no_license | function mostrar()
{
let nombre;
let obraSocial;
let edad;
let temperatura;
let sexo;
do{
nombre = prompt("Ingrese su nombre").toLowerCase();
obraSocial = prompt("Ingrese su obra social: PAMI/OSDE/otras").toLowerCase();
while (obraSocial != "pami" &&obraSociall != "osde" && obraSocial != "otras"){
... | true |
f45335ae553b676320d6dcccc5f266e6757b7f8f | JavaScript | blockfirm/pine-app | /__tests__/src/clients/api/info/get.test.js | UTF-8 | 1,881 | 2.78125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | import getInfo from '../../../../../src/clients/api/info/get';
global.fetch = jest.fn(() => Promise.resolve({
ok: true,
json: () => ({
network: '84a0681b-494a-4ac2-8298-2b888799f467'
})
}));
describe('get(options)', () => {
let options;
let returnValue;
beforeEach(() => {
fetch.mockClear();
... | true |
caf7fb61b6206c16ba914b7c4a4a9602000d637e | JavaScript | sparrow1w/BalticTalents | /uzduotis15/js15.js | UTF-8 | 1,700 | 3.09375 | 3 | [] | no_license | var x = [
['2017-07-06','AGO123',12482,650],
['2017-07-08','FBO329',15841,500],
['2017-07-09','AGO133',13334,600],
];
var myTable = "<table><tr><td>Data: </td>";
myTable += "<td>Valst. NR: </td>";
myTable += "<td>Atstumas (m.): </td>";
myTable += "<td>Laikas (s.): </td>";
myTable ... | true |
518d662fa84b6bfd5b86d9f7d2538ddbf1b78c8c | JavaScript | ck1406134023/jingdong | /js/function.js | UTF-8 | 13,757 | 3.09375 | 3 | [] | no_license | // 通过类名的方法获取元素
function getClass(classname,obj){
var obj=obj||document;
if(document.getElementsByClassName!=undefined){
return obj.getElementsByClassName(classname);
}else{
var arr=document.getElementsByTagName("*");
var arr=[];
... | true |
91115c820d1e2680bcdc336ffe910fea2678746a | JavaScript | felipeduart/UdemyJavaScript | /Exercicios/fundamentos/numerosAlgunsCuidados.js | UTF-8 | 382 | 3.125 | 3 | [] | no_license | console.log(7 /0)
console.log('10' / 2) // convertendo a string para number
console.log('10' + 2 ) // string teve preferencia e nao foi convertido para number
console.log('10' - 2 ) // converteu para number
console.log('Show' * 2)
console.log(0.1 + 0.7) // nao deu 8 // gera impressisao
//console.log (10.toString()) //... | true |
27618f6af6fa04fda8d2ff3dfa3cd3c04465d8c8 | JavaScript | SchoolOfCode/game-hackathon-zaid-arshi-theepicbraintrust | /js/classes/player2.js | UTF-8 | 976 | 2.9375 | 3 | [] | no_license | class Player2 extends Player {
constructor(health, { x, y, height, width }, imageSrc) {
super(
health,
{ x, y, height, width, changeInX: 10, changeInY: 10 },
imageSrc,
false
);
this.lastFiredAt = new Date().getTime();
}
moveBy(changeInX, changeInY) {
super.moveBy(changeInX,... | true |
f6c0296957324760556cc153faccf74c396a42b9 | JavaScript | pulley-aaron/awp-day-planner | /src/date-header.js | UTF-8 | 1,588 | 2.625 | 3 | [] | no_license | import React from 'react';
import moment from 'moment';
import Calendar from 'react-calendar';
class DateHeader extends React.Component {
constructor (props) {
super (props);
this.state = {
extended: 0
};
this.toggleCalendar = this.toggleCalendar.bind(t... | true |
ecab2ed0f8deb30bcf30796e3c971f7d92b0dea2 | JavaScript | yoksel/shop-admin-page | /src/components/Notification/index.js | UTF-8 | 1,332 | 2.734375 | 3 | [] | no_license | import './styles.scss';
const cls = {
elem: 'notification',
warning: 'notification--warning',
error: 'notification--error',
success: 'notification--success'
};
const second = 1000;
export default class Notification {
constructor ({ message, container, type }) {
this.message = message;
this.containe... | true |
aa6379408b8e814b858d28ca0126d10acd8a0cc9 | JavaScript | Sreekhar/Shopify-interview-tasks | /shopicruit.js | UTF-8 | 2,547 | 2.875 | 3 | [] | no_license | $(document).ready(function(){
$.getJSON("http://shopicruit.myshopify.com/products.json?page=1", function(json) {
while(json['products'].length != 0) {
var iPageNumber = 1;
var ComputerArray = [];
ComputerArray.push({
id : '',
grams : '',
price : ''
});
var KeyboardArray = [];
KeyboardArray... | true |
5b43d147831749c2e693471927f3a115ec89ee36 | JavaScript | joFolta/codeWars | /codewars/7-kyu/find-the-next-perfect-square.js | UTF-8 | 1,843 | 4.53125 | 5 | [] | no_license | /*
https://www.codewars.com/kata/56269eb78ad2e4ced1000013
7 kyu
Find the next perfect square!
You might know some pretty large perfect squares. But what about the NEXT one?
Complete the findNextSquare method that finds the next integral perfect square after the one passed as a parameter. Recall that an integral perf... | true |
e1aa0d4bdaf23127794d54cf12ced0462edf43a2 | JavaScript | stellarsailor/brittea-public | /redux/userInfo.js | UTF-8 | 2,007 | 2.71875 | 3 | [] | no_license | import serverUrl from '../constants/serverLocation';
//action types
const SIGNIN_TYPE = 'SIGNIN'
const LOGOUT_TYPE = 'LOGOUT'
const BOOKMARK_ADD_TYPE = 'BOOKMARK_ADD_TYPE'
const BOOKMARK_DELETE_TYPE = 'BOOKMARK_DELETE_TYPE'
//action create function
export const signInAction = (userInfo, bookmarks) => ({
type: SI... | true |
08bf2edc568e8ae3b14dd4567409e76d0ee2ff03 | JavaScript | ZadorozhkoNA/ra16-homeworks | /lifecycle-http/crud/homework/src/Crud.js | UTF-8 | 2,389 | 2.625 | 3 | [] | no_license | import React,{ useState } from 'react';
import Notes from './Notes';
import NoteModel from './NoteModel';
import {nanoid} from 'nanoid';
import Send from './send.png'
import Synchronized from './synchronized.png';
export default function Crud() {
const [notes, setNotes] = useState([])
const [form, setForm] = useSt... | true |
2f570a0f9d317b50f7dcf3510253c2b5e0a3c0c3 | JavaScript | littleFootDev/adopteTonPetitPied | /main.js | UTF-8 | 949 | 2.75 | 3 | [] | no_license | const btns = document.querySelectorAll(".action");
const texts = document.querySelectorAll(".card-text");
const btnCachers = document.querySelectorAll(".btn-red");
for (let i = 0; i < btns.length; i++) {
for (let j = 0; j < texts.length; j++) {
let btn = btns[i];
let text = texts[j];
btn.addEventListener... | true |
0c17cef87dbd3d3116df903c36161197cbb338db | JavaScript | OriBenZaken/TypeScript-School | /function_overloading.js | UTF-8 | 418 | 3.0625 | 3 | [] | no_license | "use strict";
exports.__esModule = true;
function Info(value1, value2) {
return value1 + " " + value2;
}
console.log(Info(1, 4));
console.log(Info(true, false));
console.log(Info("jhon", "ducket"));
// error: No overload matches this call.
// Info(1, "Hello");
function foo(x, y, z) {
if (y === void 0) { y = 5;... | true |
d4b5f9346e9c7247d3a99b1d481fb15a234c0f0e | JavaScript | eduardobravo/reactnoobs | /src/components/Avatar.js | UTF-8 | 585 | 2.625 | 3 | [
"MIT"
] | permissive | import React,{Fragment} from 'react'
import '../styles/avatar.scss'
class Avatar extends React.Component {
constructor(props){
super(props)
//Escribo mis estados
this.state = {user: undefined}
}
render() {
//Escribo mis propiedades
let { gender } = this.props
let userCut = () =>{
... | true |
a05de7c26c1f13eee60e2fc7688b7fdfe5a75b93 | JavaScript | apkretov/rp | /javascript/javascript_crash_course_for_beginners/0_22_55/main.js | UTF-8 | 129 | 2.921875 | 3 | [] | no_license | const s1 = 'Hello Wolrd!';
const s2 = 'technology, computers, it, code';
console.log(s1.split(''));
console.log(s2.split(', ')); | true |
dc937d13af543cda2f43882e9bd40f419ab7f73b | JavaScript | ICEI-PUC-Minas-PPLCC-TI/Grupo8-Fake-News | /src/scripts/darkmode.js | UTF-8 | 379 | 2.9375 | 3 | [] | no_license | const btn = document.getElementById("btn");
btn.addEventListener("change", (e) => {
document.body.classList.toggle("dark", e.target.checked);
if (document.cookie === "dark")
document.cookie = "light";
else
document.cookie = "dark";
})
function dark(){
var element = document.body;
if (document.cookie == "... | true |
2b9615c7c52991729b5ae7aac06181883f0a4eb4 | JavaScript | reyerfekaj/mirrormirror | /app_speech/static/speech/speech_synthesis.js | UTF-8 | 864 | 2.859375 | 3 | [
"MIT"
] | permissive | if (!('speechSynthesis' in window)) {
alert("Sorry, your Browser does not support the Speech API");
} else {
// Synthesis support. Make your web apps talk!
var msg = new SpeechSynthesisUtterance();
//var voices = window.speechSynthesis.getVoices();
//msg.voice = voices[10]; // Note: some voices don't support alte... | true |
514c01279dc00d964063d48e51fefeff272600ab | JavaScript | ButuzGOL/algorithms | /heavy-ball.js | UTF-8 | 962 | 4.0625 | 4 | [
"MIT"
] | permissive | /*
There are 8 balls numbered from 0 to 7. Seven of them have the same weight. One is heavier. Your task is to find it's number.
So where's the catch, you may ask. Well - the scales is very old. You can use it only 3 TIMES before the scale breaks.
*/
function findBall() {
var left = [0, 1, 2, 3];
var right = [4, 5... | true |
5945872b675a88fe5e028dbe1a478c885f89d281 | JavaScript | c0710/minipack | /src/index.js | UTF-8 | 2,310 | 2.796875 | 3 | [] | no_license | const fs = require('fs');
const path = require('path');
const parser = require('@babel/parser');
const traverse = require('@babel/traverse').default;
const babel = require('@babel/core');
function createGraph(filepath) {
if (!path.isAbsolute) {
filepath = path.resolve(__dirname, filepath);
}
const... | true |
183900d4022eaca2d4988b19729c3793ff6f2522 | JavaScript | jelenreifs/Modulo3_Fetch-React_Ejercicio_01 | /src/App.js | UTF-8 | 1,262 | 3.1875 | 3 | [] | no_license | import { useState, useEffect } from "react";
function App() {
const [data, setData] = useState([]);
const [isLoading, setIsloading] = useState(false);
const [url, setUrl] = useState(`https://rickandmortyapi.com/api/character/`);
const [prev, setPrev] = useState(``);
const [next, setNext] = useState(``);
f... | true |
bee662f0954b2299bf698b434f1211631c68a29b | JavaScript | kyoung-jnn/Algorithm-Study | /src/dohyun/5week/단어 변환.js | UTF-8 | 572 | 3.203125 | 3 | [] | no_license | function solution(begin, target, words) {
const q = [];
let cnt = 0;
if (words.indexOf(target) < 0) return 0;
q.push([begin, cnt]);
while (q.length !== 0) {
const word = q.shift();
cnt = word[1];
if (word[0] === target) return word[1];
for (const w of words) {
let differentCount = 0... | true |
b17581019f1692bba5f5f1fb73b5bb4ee1b24375 | JavaScript | nawwx3/flyMaster | /public/scripts/page2.js | UTF-8 | 7,268 | 3.296875 | 3 | [] | no_license | // Saves a new message on the Firebase DB.
function saveMessage(messageText) {
// Add a new message entry to the Firebase database.
window.alert('fart');
return firebase.firestore().collection('messages').add({
name: "finalTest",
text: "hopefully",
profilePicUrl: getProfilePicUrl(),
... | true |
6134cd69f6980f4fe5b74b641c1661a3a2e9db59 | JavaScript | iuiaoin/leetcode | /review/125.valid-palindrome.js | UTF-8 | 379 | 3.4375 | 3 | [
"MIT"
] | permissive | /*
* @lc app=leetcode id=125 lang=javascript
*
* [125] Valid Palindrome
*/
// @lc code=start
/**
* @param {string} s
* @return {boolean}
*/
var isPalindrome = function(s) {
s = s.toLowerCase().replace(/[^a-z|0-9]+/g, '');
let l = 0;
let r = s.length - 1;
while(l < r) {
if(s[l] !== s[r]) return false... | true |
7b8ca0924642407f71c1eb228b0d269443d2e013 | JavaScript | pbtrre95/chatroom | /index.js | UTF-8 | 4,372 | 2.640625 | 3 | [] | no_license | // express.js
var app = require('express')();
//server setup
var server = require('http').Server(app);
//socket.io
var io = require('socket.io')(server);
//port number
var port = 3000;
//zero users
var i = 0;
//default avatar
var avatars = 'https://image.flaticon.com/icons/svg/180/180644.svg';
//connection noted in co... | true |
16808463732ee7480a1e4ff963a448e8097e2faa | JavaScript | globocom/megadraft | /src/utils.js | UTF-8 | 4,599 | 2.65625 | 3 | [
"MIT",
"CC-BY-2.0",
"CC-BY-4.0",
"CC0-1.0"
] | permissive | /*
* Copyright (c) 2016, Globo.com (https://github.com/globocom)
* Copyright (c) 2016, Andrew Coelho <info@andrewcoelho.com>
*
* License: MIT
*/
import {
convertToRaw,
convertFromRaw,
EditorState,
getVisibleSelectionRect
} from "draft-js";
import defaultDecorator from "./decorators/defaultDecorator";
ex... | true |
3611c6ad77184bff2078dd89c1df7200e4bec680 | JavaScript | aweffr/my-react-starter | /discussion-on-chap7.js | UTF-8 | 1,151 | 3.234375 | 3 | [] | no_license | // MoCheng<深入浅出React和Redux>第七章,
// 关于使用原生fetch的例子:
const componentDidMount = () => {
const apiUrl = `/data/cityinfo/${cityCode}.html`;
fetch(apiUrl).then((response) => {
if (response.status !== 200) {
throw new Error('Fail to get response with status ' + response.status);
}
... | true |
50fad344a08ac48463df31aa664d278edeed636d | JavaScript | davelab6/Demos | /variable-fonts/scripts/var-fonts.js | UTF-8 | 13,376 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | /* eslint-env browser */
/* eslint-disable no-var, prefer-template, strict, prefer-arrow-callback, object-shorthand, no-continue, no-undefined, no-constant-condition */
/*globals event*/
/*
* VARIABLE FONTS SCRIPTS
* =============================================
*/
/*
* FONT LOADING POLYFILL
* ------------------... | true |
a210473e3305518b291e85c6ac291517e2d714ea | JavaScript | Randall-H/exam | /app/view/js/helpers/Validation.js | UTF-8 | 1,919 | 3.09375 | 3 | [] | no_license | /**
*
*
* @lv => N/A
* @params => N/A
* @notes => validation parser for form fields
**/
export default class InputValidation {
constructor() {
this.validate = this.validate.bind(this);
}
_handleEmail(email) {
//console.log('@class_InputValidation, @method__handleEmail(email)____', email);
/**
... | true |
61a179c1cff1297e047509b8435daea50cbbdad1 | JavaScript | ryanthemastercoder/JS-Sandbox | /homework.js | UTF-8 | 313 | 3.796875 | 4 | [] | no_license | // HOMEWORK 1
// use for loop to log
// hello
// hellohello
// hellohellohello
// hellohellohellohello
// hellohellohellohellohello
// to the console
const repeat = 10;
for (let j = 0; j < repeat; j++) {
let hello = '';
for (let i = 0; i < j; i++) {
hello = hello + 'hello';
}
console.log(hello);
}
| true |
eb3b32aec25b01f821805c30a83c955ab6d953af | JavaScript | leandro-lopes-dev/udemy-curso-web-completo-2018 | /functions/cidadaoPrimeiraClasse.js | UTF-8 | 735 | 4.78125 | 5 | [] | no_license | // Função em JS é First-Class Object ( Citizens )
// Higher-order function
// criar de forma literal
function fun () {}
// Armazenar em uma variável
const fun2 = function () {}
// Armazenar em um array
const array = [function (a,b) {return a + b}, fun1, fun2]
console.log(array[0] (2,3))
// Armazenar em um atribut... | true |
371ae2a08d9fc912ea7f86eea4a1cc79620e285a | JavaScript | Fatkiddh/Hangman-Game | /assets/javascript/game2.js | UTF-8 | 3,104 | 3.78125 | 4 | [] | no_license | //defined Variables
var TEAMS = ['BARCELONA', 'REALMADRID', 'ATLETICOMADRID', 'SEVILLA', 'VALENCIA'];
//holds place _ _ _ _ _ while user guesses letters
var guessForthisTeam= [];
//holds letters guessed by user that were not in the selected word
var incorrectLettersGuessed= [];
// number of guesses remaining
var guesse... | true |
02cb57a6bdedbc4812b40438e8e71a947e501af4 | JavaScript | harperbd/grocery-list | /src/GroceryForm.js | UTF-8 | 1,035 | 2.6875 | 3 | [] | no_license | import React, {Component} from 'react';
import CurrencyInput from 'react-currency-input';
class GroceryForm extends Component {
state = { word: '', price: '0.00'};
handleChange = (e) => {
const { name, value } = e.target;
this.setState({ [name]: value })
// alternative
// this.setState({ word: e.t... | true |
923031914336c8281580e3ace35683102a71aef3 | JavaScript | TavaresDev/ReactLab2 | /src/components/shared/FunFact/FunFact.jsx | UTF-8 | 1,446 | 2.578125 | 3 | [] | no_license | import React, { useState } from 'react';
import { Card, Container } from 'react-bootstrap';
import ActionButton from '../ActionButton/ActionButton';
import NavButton from '../NavButton/NavButton';
import Styles from './styles';
const FunFact = () => {
const [funFact, setFunFact] = useState([])
const [index, setInde... | true |
df52d6635523c6a95675be36c3c62deeb5f48753 | JavaScript | Ruholkin/front-end-lab-8 | /online/homework_07/js/task2.js | UTF-8 | 1,441 | 3.78125 | 4 | [] | no_license | /* spied algorithm from a github.com/rpavliv37 */
var maxPrize,
possiblePrize = 0,
randNumber,
maxNumber,
enterNumber,
totalPrize = 0,
result = true,
attemptsUsed,
attemptsLeft;
while(result){
result = confirm("Do you want to play a game?");
if(result == true){
maxNumber = 5;
maxPrize = 10;
attemptsUs... | true |
1781ca605f33ad365534655c2430536eab3d25f0 | JavaScript | shafeeralip/calculator-using-js | /cal.js | UTF-8 | 484 | 3.28125 | 3 | [] | no_license | function cal(c)
{
document.getElementById("screen").value+=c
}
function clearscreen()
{
document.getElementById("screen").value= " "
}
function equal()
{
var xt=document.getElementById("screen").value
var result=eval(xt)
document.getElementById("screen").value=result
}
... | true |
cec61ac0fe69c57159d9599a28da27de6b1d3a41 | JavaScript | Arowne/My_HUGO | /themes/my_gohugo-theme/static/js/agency.js | UTF-8 | 843 | 2.890625 | 3 | [
"MIT"
] | permissive | (function ($) {
"use strict"; // Start of use strict
let navBar = document.querySelector('.sidenav');
let triggerIndex = 0;
console.log(triggerIndex);
$('.menu-trigger').click(function () {
triggerIndex += 1;
if (triggerIndex % 2 != 0) {
navBar.classList.remove('d-none');
}
else {
... | true |
acd8ff8c0bb4d4c833a6cf6571841c60dbbca6d0 | JavaScript | ameibj/games | /animation.js | UTF-8 | 3,474 | 3 | 3 | [] | no_license | // 构造函数:定义每个对象,每次移动的属性和方法
function Task(obj, topStep, leftStep) {
this.obj = obj;
this.topStep = topStep;
this.leftStep = leftStep;
this.moveStep = function () {
var objCSS = getStyle(this.obj);
var top = parseInt(objCSS.top);
var left = parseInt(objCSS.left);
this.obj.st... | true |
ebf7e062661ae143083822d4ce60bdc53b7e7b2d | JavaScript | GrayFrost/writing-code | /react/chap1/react-dom/render.js | UTF-8 | 580 | 2.671875 | 3 | [] | no_license | import { setAttribute } from "./dom";
export function render(vnode, container) {
if (typeof vnode === "string") {
const textNode = document.createTextNode(vnode);
container.appendChild(textNode);
}
let dom = document.createElement(vnode.tag);
if (vnode.attrs) {
Object.keys(vnode.... | true |
fdae56ec5d0c72cd8c0451e21189c72def9b25c3 | JavaScript | abrar2008/SimplePromise | /index.js | UTF-8 | 904 | 2.8125 | 3 | [] | no_license |
console.log('hello')
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js').then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(function(err) {
// registration fai... | true |
4a71b2b598790d2c672a8fefb873de7e902d1c97 | JavaScript | isaaccodekill/opensky | /src/Components/Modal/Modal.js | UTF-8 | 5,638 | 2.8125 | 3 | [] | no_license | import React, {useState} from 'react'
import styles from './Modal.module.css'
import Modal from '@material-ui/core/Modal'
import Button from '@material-ui/core/Button';
import MenuItem from '@material-ui/core/MenuItem'
import Select from '@material-ui/core/Select'
import Loader from '../../Components/UI/Loader/Loader'
... | true |
895442ba54652bf018f5555238da6a8551914a93 | JavaScript | qwertyuu/binance_test | /src/userWallet.js | UTF-8 | 923 | 3.203125 | 3 | [] | no_license | /*
Used to represent a user's wallet and its balances.
Makes sure we get rid of empty balances when updating
Possible enhancements:
- Also deal with locked assets
- Support specifying some kind of user ID to have many instances of user wallets at once maybe
*/
class UserWallet {
constructor(initialBalances) {
... | true |
942d0375f2d0ad9e3d074a6b56a4112883192c32 | JavaScript | TIY-LR/2015-tower-fee | /app/components/game-time/component.js | UTF-8 | 831 | 2.515625 | 3 | [] | no_license | import Ember from 'ember';
import moment from 'moment';
export default Ember.Component.extend({
gameTime: {
month: 0,
date: 0,
year: 0,
minutes: 0,
hours: 0,
},
gameSpeed: 60 * 24,
updateGameTime() {
var startTime = this.getAttr('startTime');
var currentTime = moment();
var ti... | true |
207fc2677f865481fd07a2739b4562b55417d048 | JavaScript | ikentaro/javascript_library | /src/audio/viewer/state.js | UTF-8 | 472 | 2.609375 | 3 | [] | no_license | import context from '../context.js'
const state=(html)=>{
if( context.state==null ) html.innerHTML='未実装';
else{
if( html.tagName==='INPUT' ){
const set=()=>{
html.value=context.state;
window.requestAnimationFrame(set);
}
window.requestAnimationFrame(set);
}
else{
const set=()=>{
ht... | true |
02f53f5e429a604e63e3629bd145c201c0ccc648 | JavaScript | ajayg415/js-concepts | /Sortings/quicksort.js | UTF-8 | 357 | 3.21875 | 3 | [] | no_license |
const quickSort = list => {
if (list.length < 2)
return list;
let pivot = list[0];
let left = [];
let right = [];
for (let i = 1, total = list.length; i < total; i++){
if (list[i] < pivot)
left.push(list[i]);
else
right.push(list[i]);
}
return [
...quickSort(left),
pi... | true |
f6d86c3488d29fd30605bb2ea2571d65cacb3760 | JavaScript | SizzleSnap/JournalJay | /App/Classes.js | UTF-8 | 966 | 3.796875 | 4 | [] | no_license | // This is what makes the user profile objects.
class UserProfile {
constructor(name, password) {
this.name = name;
this.password = password;
}
}
// This class makes an array of users and can add a user and search the array using a username.
class UserList {
constructor() {
this.listArr = [];
}
... | true |
ea286abff81817056161601e479e4e734b8c1770 | JavaScript | it4anna/dp-045-ui-annav | /calc-ajax/js/ajax.js | UTF-8 | 1,061 | 2.765625 | 3 | [] | no_license | "use strict";
function Ajax () {
var dialogue = getAjax(),
operation = {
"add": "php/add.php",
"sub": "php/sub.php",
"mul": "php/mul.php",
"div": "php/div.php"
};
function getAjax() {
var ajax;
if(XMLHttpRequest) {
aja... | true |
d0affa5f8df4787c0cd4fe07e623864594bcd7d1 | JavaScript | dennism501/todo-MERN-app | /backend/src/middleware/logger.js | UTF-8 | 620 | 2.703125 | 3 | [] | no_license | /**
*
* @param {object} req Request Object
* @param {object} res Result Object
* @param {function} next middleware function
*/
function requestLogger(req, res, next) {
res.once("finish", () => {
const log = [req.method, req.path];
if (req.body && Object.keys(req.body).length > 0) {
log.push(JSON.s... | true |
526855ac43a87b4f41b43415f82effe32678b0b8 | JavaScript | Domuska/fullstack_open_part3_2019 | /mongo.js | UTF-8 | 1,185 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* Test file for trying out mongodb stuff
*/
const mongoose = require('mongoose');
if (process.argv.length < 3) {
console.log('give password as argument');
process.exit(1);
}
const [thisFile, curdir, password, personName, personNumber] = process.argv; // eslint-disable-line
const url = `mongodb+srv://test_... | true |
379e68d92f42dc08fc5d7551d99f1399d0da0906 | JavaScript | zulip/zulip-mobile | /src/immutableUtils.js | UTF-8 | 2,686 | 3.21875 | 3 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | permissive | /** General helpers to augment Immutable.js. */
// @flow strict-local
import Immutable from 'immutable';
// Like `Immutable.Map#update`, but prune returned values equal to `zero`.
export function updateAndPrune<K, V>(
map: Immutable.Map<K, V>,
zero: V,
key: K,
updater: (V | void) => V,
): Immutable.Map<K, V> ... | true |