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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
14795d93f0e7c2a8722d1809ae46798f2adddd14 | JavaScript | LexiTheGeek/RESTful-API | /lib/api/cache.js | UTF-8 | 2,240 | 2.671875 | 3 | [] | no_license | module.exports = function(p_config){
//Imports
var nodeCache = require( "node-cache" );
//Instance Variables
var g_config, g_cache, g_cacheSettings;
//Constructor
var _init = function(p_config){
//Set Instance Vars
g_config = p_config;
g_cacheSettings = {};
g_cache = {};
//Normalize Cache Se... | true |
fb91e7d83157ec86aa3e1b42dea2a7259adf250f | JavaScript | SimeonTrenev/SoftUniJS | /JS Basics/exams/EasterTrip-3 zad.js | UTF-8 | 1,247 | 3.234375 | 3 | [] | no_license | function solve(input){
let destination = input.shift();
let reservationDates = input.shift();
let numberOfnights = +input.shift();
let price = 0;
switch(destination){
case 'France':
if(reservationDates === '21-23'){
price = 30 * numberOfnights;
}else... | true |
430c5fed48ce1a98673522a02cd12db5b155e636 | JavaScript | GithubGuest1000/Windows100 | /js/fs.js | UTF-8 | 4,428 | 2.984375 | 3 | [] | no_license | /*
localStorage :
file:
[id] => F[content]
[id] => D<[name]=[id]><[name]=[id]>[...]
Source dir: id = '0'
*/
var $fs = {
getLocation(path) {
var dirs = this.trim(path).split('/');
if(dirs.length == 1 && dirs[0] == '') return '0';
if(dirs[0] != 'C:' && dirs[0] != 'c:') throw Error("Only C: drive avai... | true |
7102413da5d41baecda7920570e0a197e060bd82 | JavaScript | AbrahamEapen/M.I.P. | /templates/jsFiles/logic.js | UTF-8 | 6,720 | 2.84375 | 3 | [] | no_license | //Load in meteorite json
var queryUrl = "https://raw.githubusercontent.com/AbrahamEapen/Meteorite-Market/master/templates/meteorites.json"
d3.json(queryUrl, function(error, data) {
console.log(data)
//Path
svg.a... | true |
ba744474298a4ef8fa5675c07a94d74d1f982d5b | JavaScript | minhaz-bin-monib/es6-practice | /destructure.js | UTF-8 | 841 | 2.671875 | 3 | [] | no_license | const person = {name:'minhaz', phone:01703824551, address:'Baf base bbd', university:'Iubat', favoritePlace:['dhaka','barishal','etc']};
// console.log(person.address);
// console.log(person.address);
// console.log(person.address);
// console.log(person.address);
// const address = person.address;
// const university... | true |
82e76ea39afcef7d624ede219939288e51a7f8d5 | JavaScript | AkselDjun/JavaScript-intermediate | /Javascript-Course_4/Основы JavaScript/Функции/script.js | UTF-8 | 460 | 3.90625 | 4 | [] | no_license | var carName = "Ford";
var carYear = 2018;
var personYear = 1990;
function calculateAge(year) {
var currentYear = 2020;
var result = currentYear - year;
return result;
}
function checkAndLogAge(year) {
if (calculateAge(year) < 10) {
console.log("Возраст меньше 10-ти лет");
} else {
... | true |
f85b4408ac5d38acc9dba60784c7d43f5b6c1767 | JavaScript | whu-luojian/day-day-up | /src/2021-04-09/reduce.js | UTF-8 | 962 | 3.703125 | 4 | [] | no_license | /**
* 1. reduce 是数组原型上的方法,对数组的每一项进行reduce操作,将结果汇总为单个值返回
* 2. reduce 接收两个参数,第一个参数为一个函数
* 3. 第一个参数(函数)本身有四个参数:累计器、当前项的值、当前项索引、数组本身,返回值用于累计器
* 4. 第二个参数为可选值,作为第一次调用 callback 函数的初始值,如果没有提供初始值,则使用数组第一个元素作为初始值
* 5. 在没有提供初始值的空数组上调用 reduce 将报错
*/
Array.prototype.myReduce = function(cb, ...args) {
const arr = this
con... | true |
b600719b47e04a246b4b5df204e96e388b95c52f | JavaScript | ianfabs/se373 | /Assignment6/public/javascripts/copy.js | UTF-8 | 350 | 2.640625 | 3 | [] | no_license | let $ = document.querySelector.bind(document);
let $$ = document.querySelectorAll.bind(document);
let readOnlyInputs = $$("input:read-only");
const copyOnClick = event => {
const { target } = event;
target.select();
document.execCommand("copy");
}
for (let input of readOnlyInputs) {
input.addEventLis... | true |
d9f6dbbf5ad1119c7f9c7bb42027eed76b9ff2d3 | JavaScript | marcentusch/NodeJS-RPS-Multiplayer-Game | /testImport.js | UTF-8 | 315 | 3.296875 | 3 | [] | no_license | var ironicStrings = ["1", "2", "3"];
var testObject = {
testFunction: function(){
for (var i = 0; i < ironicStrings.length; i++) {
console.log(ironicStrings[i]);
}
}
}
module.exports = testObject;
// or
// module.exports.testFunction = function(){
// console.log("Hey i am also imported!");
// }
| true |
2f1bbd71cb9eb6111aa9df6178ba0c6bfa9768d9 | JavaScript | maliknur/angularFireChat | /app/js/controllers/chat.controller.js | UTF-8 | 554 | 2.546875 | 3 | [] | no_license | (function() {
'use strict';
angular.module('angularFireChat')
.controller('chatCtrl', chatController);
chatController.$inject = ['ChatService'];
function chatController(ChatService) {
var vm = this;
vm.title = 'Welcome to Angular Chat!!!';
vm.sendMessage = sendMessage;
vm.messages = ChatService.getMess... | true |
ac42c887f524327dde3f22dd014c613b96095341 | JavaScript | refola/schnorr-js | /params.js | UTF-8 | 858 | 3.109375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | // params.js
// process parameters
var inputIds = ['p', 'q', 'g', 'a', 'b'];
var spanIds = ['g-note', 'zk-a+b'];
// retrieve form input
function getInput() {
var input = {}
// get parameters by ID
for (var i in inputIds) {
var name = inputIds[i];
var val = get(name);
// convert to ... | true |
d9e353c908edb50094c60e81cd294f09a7fd1efb | JavaScript | Rinthm/phase-0 | /week-7/nums_commas.js | UTF-8 | 2,208 | 4.59375 | 5 | [
"MIT"
] | permissive |
// Separate Numbers with Commas in JavaScript **Pairing Challenge**
// I worked on this challenge with: Matt Harris.
// Pseudocode
// Input: An integer.
// Output: A string of the integer with appropriately places commas.
// Steps:
// Create an empty array
// Convert integer to string
// Iterate from last eleme... | true |
dd11bfced0f844d23809faf585737dd1599a55c8 | JavaScript | csshields/monkey | /src/js/steps/getData.js | UTF-8 | 1,681 | 2.671875 | 3 | [] | no_license | 'use strict';
var $ = require('jquery');
/**
* Gets the data from the server.
*
* @returns {object} (via promise) Object with a number of properties such as
* name and gender, and then a letters property containing
* information on the pages. Seriously, just use a debugger.
*... | true |
5a1bc929036ab17619ddd191437c4946b784815c | JavaScript | tonianner/lab-js-functions | /starter-code/functions.js | UTF-8 | 4,093 | 4.78125 | 5 | [] | no_license | // Question 1: Define a function maxOfTwoNumbers that takes two numbers as arguments and returns the largest of them. Use the if-then-else construct available in Javascript. Do some googling to figure this out if you forget how conditionals work.
function maxOfTwoNumbers(a,b) {
if (a > b){
console.log(a);
} else {
... | true |
63cce40ed66e98010add8ef193ba46b30dc4505f | JavaScript | brahadeeshdrvs/shoplane | /shoplane/productpage.js | UTF-8 | 4,671 | 2.625 | 3 | [] | no_license |
var productId = window.location.search.split('=')[1];
var xyz = new XMLHttpRequest();
xyz.open('GET','https://5d76bf96515d1a0014085cf9.mockapi.io/product/'+ productId,true);
xyz.onreadystatechange = function() {
if(this.readyState === 4){
var responseArr = JSON.parse(this.responseText)
var produ... | true |
d8fd5d995e74c6653f7717eb36396e877a45bf8e | JavaScript | wewesemsem/sorting | /mergesort.js | UTF-8 | 1,434 | 3.9375 | 4 | [] | no_license | function split(wholeArr) {
const half = Math.ceil(wholeArr.length / 2);
const firstHalf = wholeArr.slice(0, half);
const secondHalf = wholeArr.slice(half);
return [firstHalf, secondHalf];
}
function merge(arrayOne, arrayTwo) {
let mergedArr = [];
while (arrayOne.length > 0 || arrayTwo.length > 0) {
if... | true |
d287c8eaf6ca63243c9a7c701cae9bfd9d735329 | JavaScript | tuzz/new-turing-omnibus | /47-storing-images/bin/application.js | UTF-8 | 23,469 | 2.53125 | 3 | [] | no_license | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.ex... | true |
8109a1985adf57c4d0338f4bce16059f0bd973f1 | JavaScript | kasliwalshreyas/HackOverflow | /Spotify-Lyrics/client/src/components/Lyrics.js | UTF-8 | 1,408 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | import React, { useEffect, useState } from 'react'
import './style.css'
const Lyrics = (props) => {
const apiURL = 'https://api.lyrics.ovh';
const [songObj, setsongObj] = useState({});
const [lyrics, setlyrics] = useState("");
const searchSongs = async (s) => {
const res = await fetch(`${apiURL... | true |
57bb619041d9c4e1a5fe17b117b119b28c96d601 | JavaScript | Ignaciosc/FSWD | /ignacio-santacruz/Javascript/clase-2/array.js | UTF-8 | 173 | 3.265625 | 3 | [] | no_license | var numeros = [0, 1, 2, 3, 4, 6, 7, 8, 9, 10];
var numeros2 = numeros.filter(function(numero) {
return (numero % 2 === 0);
});
console.log(numeros);
console.log(numeros2);
| true |
02473991c3bf4eef28769201fae05a06bfe19e0d | JavaScript | sundarideas2it/Javascript | /includes/js/onloadscript.js | UTF-8 | 2,444 | 3.46875 | 3 | [] | no_license | /*** JavaScript v1.0 */
window.onload = function() {
/**** Date function **/
var odate = new Date();
var date = odate.getDate();
var month = odate.getMonth()+1;
var year = odate.getFullYear();
var format = document.getElementsByName('format');
for (var i = 0; i < format.length; i++) {
var dformat = ... | true |
bd647f99677629c1762579e4ecdd4b1cd44e6e82 | JavaScript | mmalkov1/javascript | /module-9/js/scripts.js | UTF-8 | 3,181 | 3.078125 | 3 | [] | no_license |
class Timer {
constructor (container) {
this.createTimer(container);
}
createTimer (container) {
createDOM (container);
let timerBox = document.querySelector(`${container} .js-time`);
let startButton = document.querySelector(`${container} .js-start`);
let resetButton = document.querySelector(`${containe... | true |
a0d9d6ca859eaa0c2c79a81f39a55babec89fc52 | JavaScript | maartenbrakkee/eleventy-plugin-seo | /test/Tags/PageTitleTest.js | UTF-8 | 2,519 | 2.734375 | 3 | [
"MIT"
] | permissive | import test from "ava";
import Config from "../../src/Config";
import PageTitle from "../../src/Tags/PageTitle";
test.beforeEach(t => {
t.context.config = new Config({ title: "Site title" });
});
test("A provided title should be used", t => {
const pageTitle = new PageTitle(t.context.config);
let title = pageTi... | true |
bdedbae2a8ed5db66491000d83383e9e179fe337 | JavaScript | joneill129/project-1-assessment | /js/main.js | UTF-8 | 603 | 3.546875 | 4 | [] | no_license |
//--CACHED ELEMENT REFERENCES--
const mathResult = document.getElementById('mathResult')
const plusSign = document.getElementById('plus')
const minusSign = document.getElementById('minus')
const inputNum = document.getElementById('inputNum')
//--EVENT LISTENERS--
plusSign.addEventListener('click', additionBtn)
min... | true |
2a99ee82c6335d3ba98a18d5c68a4e457cdd54e5 | JavaScript | gilsonpcf/algoritmos | /fundamentais/javascript/somatorio.js | UTF-8 | 536 | 4.25 | 4 | [] | no_license | // Algoritmo Fundamental Nº 3
// Descrição : Soma de um conjunto de números
// Problema : Dado um conjunto de n números, calcular a soma desses números.
// Assumir que n é maior ou igual a zero.
// Aplicações: Cálculos de média, cálculos de variância e mínimos quadrados.
var n = prompt("Quantidade d... | true |
212a21a9de82169e72638386026c3f42275bbc50 | JavaScript | abatth/github-profile-viewer | /src/App.js | UTF-8 | 3,270 | 2.71875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import "./App.css";
function App() {
const [name, setName] = useState("");
const [userName, setUsername] = useState("");
const [followers, setFollowers] = useState("");
const [following, setFollowing] = useState("");
const [repos, setRepos] = useState("");
... | true |
ab7be6764f321e13afc82f00e6738fa596473d97 | JavaScript | nurhayatmubaroq/quran-api-id | /data/scripts/tafsirTxtToJson.js | UTF-8 | 996 | 2.703125 | 3 | [
"MIT"
] | permissive | const fs = require("fs");
const { pathToData } = require("../../utils/utility");
const pathToTmp = (fileName) => pathToData("tmp", fileName);
const readFileAndToString = (path) => fs.readFileSync(path).toString();
const splitByNewLine = (value) => value.split("\n");
const transformLinesToObj = (lines) => {
const tm... | true |
0b18a236385217a7c64d49cf5f4a6a819c54e9b4 | JavaScript | wiktorglowacki/exilibrium | /app/components/inputs/ExccInput.js | UTF-8 | 2,977 | 2.5625 | 3 | [
"ISC"
] | permissive | import FloatInput from "./FloatInput";
import IntegerInput from "./IntegerInput";
import { strToExccExels } from "helpers/strings";
import balanceConnector from "connectors/balance";
/**
* FixedExccInput is a simple numeric input that is assumed to **always** hold
* a floating point number representing a EXCC amount... | true |
3611bb9870277c5ef719f3756e5c5dd72e394497 | JavaScript | konstantinCepas/Javascript-Exercises | /HumanVsOrc/main.js | UTF-8 | 468 | 3.234375 | 3 | [] | no_license | function fight() {
let human = new Combatan("Human", 550, 10);
let orc = new Combatan("Orc", 550, 10);
while (human.health > 0 && orc.health > 0) {
human.health = human.attack(orc.damage);
orc.health = orc.attack(human.damage);
}
if (orc.health <= 0) {
console.log("The huma... | true |
15f0d43656c68c55428259f090ffe1170683e6cd | JavaScript | TanyaTheresaBastian/Zen_Class | /29_07_2020_Day07/findPerimeter.js | UTF-8 | 477 | 3.234375 | 3 | [] | no_license | const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var nums = userInput[0].split(" ");
var height = +nums[0];
var width = +nums[1];
var peri;
function fi... | true |
190cee83267681988fc17e495319d82140ce8930 | JavaScript | DaanDD/redux-todo | /src/AddTodo.js | UTF-8 | 827 | 2.6875 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
class AddTodo extends Component {
constructor(props) {
super(props);
this.state = {
value: '',
};
this.onChange = this.onChange.bind(this);
this.onKeyDown = this.onKeyDown.bind(this);
}
onChange(event) {
... | true |
50c74444107a8fc582f9543f5fd54556a407af1d | JavaScript | BlackstormLabs/hk | /frontend/devkit-core/timestep/src/platforms/browser/doc.js | UTF-8 | 5,303 | 2.609375 | 3 | [] | no_license | /**
* @license
* This file is part of the Game Closure SDK.
*
* The Game Closure SDK is free software: you can redistribute it and/or modify
* it under the terms of the Mozilla Public License v. 2.0 as published by Mozilla.
* The Game Closure SDK is distributed in the hope that it will be useful,
* but WITHOUT ... | true |
433461fc439fc4bc6b96a7c04006a177ed2b2587 | JavaScript | mishimachan/react-todo | /src/App.jsx | UTF-8 | 2,970 | 2.984375 | 3 | [] | no_license | import React, { useState } from "react";
import "./styles.css";
// import { Input } from "./components/Input";
import { Complete } from "./components/Complete";
export const App = () => {
const [todoText, setTodoText] = useState("");
const [incompleteTodos, setIncompleteTodos] = useState([]);
const [completeTo... | true |
459ea390c3da5b47db960adc92b1315224e2d50f | JavaScript | TimPhoeniX/MyUJ | /WebGL2/Exercises/Z2-p2/scripts/main.js | UTF-8 | 3,815 | 2.9375 | 3 | [] | no_license | "use strict";
var gl;
function init()
{
// inicjalizacja webg2
try {
let canvas = document.querySelector("#glcanvas");
gl = canvas.getContext("webgl2");
}
catch(e) {
}
if (!gl)
{
alert("Unable to initialize WebGL.");
return;
}
gl.clearColor(0.0, 0... | true |
d64d26b8a98acaa16dd595cc35f2ded1227a809f | JavaScript | front-end-by-rimantas/15-grupe-portfolio-martin | /js/components/portfolio.js | UTF-8 | 5,358 | 3.078125 | 3 | [
"MIT"
] | permissive | class Picture {
constructor(link, tags){
this.link = link;
this.tags = tags;
this.visible = false;
}
spawn(element, id){
//create HTML outline
const HTML = `
<div class="image" data-index=${id}>
<img src="${this.link}">
<div class="info... | true |
7cfd8ac47614de83e678091bcf5eb59a51f466b4 | JavaScript | srinivasGokarla/unit-3 | /sprint-3/Dsa/permutation.js | UTF-8 | 1,099 | 3.34375 | 3 | [] | no_license | function runProgram(input) {
input = input.trim().split("\n")
var N = Number(input[0])
var arr = input[1].trim().split(" ").map(Number)
Permutation(N,arr,0)
arr2.sort((a,b) => (a-b))
var str = "";
for(var i = 0; i < arr2.length; i++){
console.log(arr2[i].toString().split("").join(" "))
}
}
var ar... | true |
d387b4fd3da6ac4eeff99e8f3be95c27f6a382ca | JavaScript | nodefony/nodefony | /src/nodefony/result.es6 | UTF-8 | 1,978 | 2.921875 | 3 | [
"CECILL-B",
"MIT",
"LicenseRef-scancode-cecill-b-en"
] | permissive | class Result extends Array {
constructor(res) {
if (res) {
if (res instanceof Array) {
super();
for (let i = 0; i < res.length; i++) {
this.push(res[i]);
}
if (res instanceof Result) {
//this.concat(res);
res.clean();
}
} else {
... | true |
148f2ba19c29f2dd1321c7cd408c12848bf1327a | JavaScript | lgants/ThatJSDude | /javascript_part_4/04_doubly_linked_list.js | UTF-8 | 880 | 3.5 | 4 | [] | no_license | function DoublyLinkedList(){
this.head = null;
}
DoublyLinkedList.prototype.push = function(val){
// var node = {
// val: val,
// previous: null,
// next: null,
// }
// if (!this.head){
// this.head = node;
// } else {
// current = this.head;
// while (current.next){
// current ... | true |
6f7d896ca0ce596146ffb2e12981a5402233a976 | JavaScript | briandmpls/prime_solo_jq_assessment | /script.js | UTF-8 | 1,108 | 2.9375 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
event.preventDefault();
var clickCounter = 0;
$(".generateButton").on("click", function(){
clickCounter ++;
// add div
$( "body" ).append("<div class = newClass> </div>");
//create line counter text to append to HTML
var $newText = $("<p> Line # " ... | true |
71c6773e2ec459b7352e97e6636908ecbf5fcfbe | JavaScript | jcstang/recipe_box_app | /assets/javascript/app.js | UTF-8 | 15,073 | 2.5625 | 3 | [] | no_license | // ======================================================================================
// doc ready
// ======================================================================================
$(document).ready(function () {
var config = {
apiKey: "AIzaSyAggh_9HPrLN-IokUfsrCz2bCP_4ABUd4Y",
authDoma... | true |
11e0c98675207f0246b85fcf1de41dc9a24ae48f | JavaScript | aaaYaaa2/Algorithm | /Sum/Array/pascaltriagnle2.js | UTF-8 | 819 | 3.859375 | 4 | [] | no_license | /**
* @param {number} rowIndex
* @return {number[]}
*/
var getRow = function(rowIndex) {
var result = [];
// initialize the first element to 1
result[0] = 1;
for(var i=1; i<=rowIndex; i++){
var tmp = [];
tmp[0] = 1;
for(var j=1; j<i-1; j++){
tmp[j] = result[j-1] + result[j];
}
// the l... | true |
4ed49ab2b6939c80e7eaea2071818e4ee623a550 | JavaScript | saraemedevelopment/ironFlappy | /main.js | UTF-8 | 2,300 | 3.234375 | 3 | [] | no_license | var myObstacles = [];
var player;
var myGameArea;
$( document ).ready(function() {
//Ejecuta todo el codigo , fijense paso a paso el flujo
myGameArea = new GameArea();
myGameArea.start();
player = new Obstacle(30, 30, "red", 0, 110);
});
function updateGameArea() {
for (i = 0; i < myObstacles.le... | true |
afa9ac576981697d2dd10203104a768ee267fb75 | JavaScript | chtzou/Slug-Academic-Organizer | /client/src/components/ClassInput.js | UTF-8 | 7,292 | 2.6875 | 3 | [] | no_license | import React, { Component } from "react";
import "../styles/ClassInput.css";
import { Alert } from "reactstrap";
class ClassInput extends Component {
constructor(props) {
super(props);
this.state = {
response: "", // Server response
class: "", // Class value from form
quarter: 1, // 1: fall... | true |
eac84781bd0772ec7bfb9d81170f2d758eac87d3 | JavaScript | FoadAlhsnat/reacr-exercises | /src/components/countres/countries.jsx | UTF-8 | 1,116 | 2.828125 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
import axios from 'axios'
export default function Countries() {
const [data, setData] = useState([])
const [filter, setFilter] = useState([])
const [term, setTerm] = useState('');
useEffect(() => {
const seatch = async () => {
const res = await axios.... | true |
f0e7cab257d40bebf113419d1c3366a9b0c8669d | JavaScript | bapillai/non-linear-data-structures-javascript | /nArrayTree.js | UTF-8 | 2,027 | 4.40625 | 4 | [] | no_license | //N-Array Tree
class Tree {
constructor(value) {
this.value = value;
this.children = [];
}
insertChild(value) {
const newTree = new Tree(value);
this.children.push(newTree);
return newTree;
}
// Uses a Depth-First Traversal
static traverse(tree) {
tree.chil... | true |
c3573a14c97d76c5dd449cdf07219820787ae2e3 | JavaScript | Recokioshi/italy-holiday-counter | /src/getTimeDifference.js | UTF-8 | 673 | 2.609375 | 3 | [] | no_license | const positiveOrZero = (number) => number >=0 ? number : 0;
export default (departureDate, header) => (now) => {
const daysLeft = positiveOrZero(departureDate.diff(now, "days"));
const hoursLeft = positiveOrZero(departureDate.diff(now, "hours"));
const minutesLeft = positiveOrZero(departureDate.diff(now, "minute... | true |
d2509a60aaabffceb6966bcabdbfb7fa84a3b639 | JavaScript | MarioGogogo/OneHundred-DayPlan-01 | /LeetCode_JS/图/有效的数字.js | UTF-8 | 661 | 3.390625 | 3 | [] | no_license | /**
* 65.有效的数字
* 有效数字(按顺序)可以分成以下几个部分:
一个 小数 或者 整数
(可选)一个 'e' 或 'E' ,后面跟着一个 整数
小数(按顺序)可以分成以下几个部分:
(可选)一个符号字符('+' 或 '-')
下述格式之一:
至少一位数字,后面跟着一个点 '.'
至少一位数字,后面跟着一个点 '.' ,后面再跟着至少一位数字
一个点 '.' ,后面跟着至少一位数字
整数(按顺序)可以分成以下几个部分:
(可选)一个符号字符('+' 或 '-')
至少一位数字
*/
// 有点懵😭
var isNumber = function (s) {};
| true |
f432610767060e733658394719bd48562e700d5e | JavaScript | 793530/APCS | /Labs/art/sketch.js | UTF-8 | 1,196 | 3.453125 | 3 | [] | no_license |
/*
** PaddleBall Game //Sketch
** Kalpa Yakupitiyage
** October 17, 2018
*/
// Global variables
var paddle;
var balls = [];
var b1;
// put setup code here
function setup() {
var cnv = createCanvas(800, 800);
cnv.position((windowWidth-width)/2, 30);
background(20,20,20);
var loc = createVector(random(width)... | true |
4db0675d4f20d32eb3d58991debc09a17b37c119 | JavaScript | Lidemy/mentor-program-4th-impala8012 | /homeworks/week7/hw1/index.js | UTF-8 | 1,832 | 3.140625 | 3 | [] | no_license | /* eslint-disable no-alert */
/* eslint-disable no-plusplus */
const form = document.querySelector('form');
form.addEventListener('submit', (e) => {
e.preventDefault();
const requiredInput = document.querySelectorAll(
".required + input[type='text']",
);
const inputs = document.querySelectorAll('input');
... | true |
40ff6b753043a99b75217f14bca6a6466c1cd03f | JavaScript | carolinarozo/calculadora | /assets/index.js | UTF-8 | 2,520 | 3.609375 | 4 | [] | no_license | document.getElementById("btnSumar").addEventListener("click", function (e) {
e.preventDefault();
var inputA = document.getElementById("numeroA").value;
var inputB = document.getElementById("numeroB").value;
var resultado = 0
var labelelement = document.getElementById("resultado")
if (inputA ==... | true |
ec8adbe6102779f687400f613b3c9be8010f052b | JavaScript | xinx1n/demos | /cloudmusic/js/index.js | UTF-8 | 7,772 | 2.53125 | 3 | [] | no_license | $(function () {
function initData(url,cb) {
$.ajax({
url: url,
type: 'GET',
dataType: 'json',
})
.done(function(data) {
cb.call(undefined,data)
})
.fail(function (error) {
console.log(error)
})
}
function latstestmusiccb(data){
var elStr = ''
$.each(data,function (index,item)... | true |
79ab24f5c0cb38c124857015891bd27ce902abfc | JavaScript | loxf/jingyiweb | /src/js/utils/urlOperation.js | UTF-8 | 1,104 | 2.765625 | 3 | [] | no_license | /**
* Created by 小敏哥 on 2017/5/5.
*/
class UrlOperation{
constructor(){
this.urlInformation={
protocol:window.location.protocol,//协议
host:window.location.host,//主机部分
port:window.location.port,//端口
pathname:window.location.pathname,//文件地址
search: ... | true |
c43fd792418e287d7827a6ee4a23367c77ca5c14 | JavaScript | otarim/lab | /gif/public/js/progress.js | UTF-8 | 3,018 | 2.625 | 3 | [
"MIT"
] | permissive | ;(function(exports){
// todo direction
// todo add step
// todo add resize
// Progress({
// direction: string,
// max: num,
// min: num,
// value: num,
// className: string,
// target: object,
// callback: function(){}
// })
var CONFIG = {
max: 100,
min: 0,
value: 0
}
var Progress = f... | true |
160163f3a7ba74f9b40942a923435353176bb05c | JavaScript | olsonjeffery/z2l60 | /src/tests/expr-tests.js | UTF-8 | 847 | 2.796875 | 3 | [
"BSD-3-Clause",
"CC-BY-3.0",
"BSD-2-Clause"
] | permissive | define(['chai', 'src/expr', 'src/parse'], function(chai, expr, parse) {
var should = chai.should();
suite('expr:newAtom', function() {
test('newAtom() takes "42" and decides that it is a Numeric atom', function() {
var result = expr.newAtom('42');
expr.isNumeric(result).should.equal(true);
});
test... | true |
7cbe9cbcd799a6c9a00d8c21f0fa56802d499c56 | JavaScript | GeoffSelby/react-houston | /src/index.js | UTF-8 | 1,939 | 2.734375 | 3 | [
"MIT"
] | permissive | import React, { Fragment, useEffect, useState } from 'react'
import PropTypes from 'prop-types'
const Countdown = ({ endDate }) => {
const [timeLeft, setTimeLeft] = useState(null)
endDate = endDate.getTime()
let interval
useEffect(() => {
interval = setInterval(caluculateTimeRemaining, 1000)
}, [])
... | true |
da0b9a5af12b8ddfa6072404fd706c6f46d46120 | JavaScript | mariadebawi/firstAppReactJs | /burger/src/store/reducers/BurgerBuilders.js | UTF-8 | 2,070 | 2.765625 | 3 | [] | no_license | import * as actionType from '../actions/actionTypes';
import { updateObject } from '../utility'
const initialState = {
ingredients: null,
totalPrice: 4,
errors: false
};
const PRICE_INGREDEINT = {
salad: 1.4,
bacon: 0.6,
cheese: 1.4,
meat: 0.5
}
const addIngredient = (state, action)... | true |
35f53c7200e8350510918dd9e069b2b4748ac105 | JavaScript | bipro-b/m-35-Advance-js-obj | /object-compare.js | UTF-8 | 538 | 4.0625 | 4 | [] | no_license |
// advanced Compare objects , referntial integrity
const first = { a: 1, b: 2 };
const second = { a: 'g', b: 2 };
// if (first === second) {
// // console.log('Equal');
// }
// else
// //console.log('Not Equal');
function compareObjects(obj1, obj2) {
if (Object.keys(obj1).length !== Object.keys(obj2).len... | true |
c114f2481902af7fd1c42a909dd8325e72e3db03 | JavaScript | alan9518/nativePokedex | /app/components/detailsHeader/DetailsHeader.js | UTF-8 | 3,527 | 2.5625 | 3 | [] | no_license | /* ==========================================================================
** Details Page Header Component
** 16/10/2020
** Alan Medina Silva
** ========================================================================== */
// --------------------------------------
// Imports
// -----------------------------------... | true |
ba191f0ecbe378dd716e82a6f25f4ad344e7feea | JavaScript | Mordechai818/JS-Final-project-WS-Ecommerce | /JS/cart.js | UTF-8 | 1,705 | 3.296875 | 3 | [] | no_license |
var mycart = [
{id:5 , name:"Joker", price:30 , description: "Lorem ipsum dolor." , Images:["../images/MOVIES/1-Joker.jpg"] , categories:"movie" },
{id:4 , name:"Nobody", price:20 , description: "Lorem ipsum dolor." , Images:["../images/MOVIES/1-Nobody.jpg"] , categories:"... | true |
34461875a3c4c0eb5722a794ececd20a993999d4 | JavaScript | cmhaddox/CPI101-Assignments | /CPI 101/Assignment2/game.js | UTF-8 | 3,263 | 3.625 | 4 | [] | no_license | var cpuChoices = ["Rock", "Paper", "Scissors"];
var playCount = 1;
var rockCt = 0;
var paperCt = 0;
var scissorsCt = 0;
var winCount = 0;
var lossCount = 0;
var tieCount = 0;
/*
* USER SELECT HANDLING
*/
function rockToSelect() {
document.getElementById('userSelection').innerHTML = cpuChoices[0];
}... | true |
72a83ad915be23b9f8eff64b8aa170fb469fd811 | JavaScript | CGJurado/googleMapDrawing | /qunit/tests.js | UTF-8 | 3,330 | 2.734375 | 3 | [] | no_license |
// Tests here
//-1291.5822596890494
QUnit.test('createBusiness', function (assert) {
assert.deepEqual(App.createBusiness(18.4682315, -69.9353514), {
map: 'map',
animation: 'google.maps.Animation.DROP',
draggable: false,
position: {lat... | true |
296d30cafc1b96d156cc896e6223590f57940972 | JavaScript | NicolasMartinSaldivar/23660javascript | /main.js | UTF-8 | 1,858 | 3.71875 | 4 | [] | no_license | //Simulador interactivo
// let total = 0;
// function agregarAlCarrito(){
// do{
// let producto = prompt("¿Queres comprar cadenita, anillo o ambos?", "Ej: ambos")
// let cantidad = parseInt(prompt("Cuanto queres comprar?",0));
// let precio = 0;
// switch(producto){
// case "caden... | true |
1d02fb1993043c2b5646a43f2e046a5bf225dc51 | JavaScript | userJulia/training-js | /tasks/5-8-charging-mark-not-reading.js | UTF-8 | 360 | 2.84375 | 3 | [
"MIT"
] | permissive | 'use strict';
let messages = [
{text: "Hello", from: "John"},
{text: "How goes?", from: "John"},
{text: "See you soon", from: "Alice"}
];
let readMessage = new WeakSet();
readMessage.add(messages[1]);
console.log(readMessage.has(messages[0]));//false
console.log(readMessage.has(messages[1]));//true
console.lo... | true |
38d3f5cd291113362624580ac9268aef62150d63 | JavaScript | Rahul218691/Mern-BooksStore | /client/src/components/PdfViewer.js | UTF-8 | 2,647 | 2.515625 | 3 | [] | no_license | import React,{useState,useEffect,useRef} from 'react'
import './styles/PdfViewer.css';
import throttle from 'lodash/throttle';
import { Document, Page } from 'react-pdf';
import { pdfjs } from 'react-pdf';
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.js`... | true |
ebfb3b5a3f4e52569647037484bec5cecb7f3ba9 | JavaScript | tanyatym/EditorQuestions | /Model.js | UTF-8 | 4,994 | 3.265625 | 3 | [] | no_license | // QUESTION
function Question( data ){
this.struct = {
type: 'question',
text: '',
answerType: 'text',
answerStruct: new AnswerStructList().struct,
hasUserAnswer: false,
}
this.update = function( newData ){
if( typeof newData !== "object" ) return
newData.type = this.struct.type
this.setFromData( ne... | true |
776a04e100b87e0c82f73096e0d327cb28bf0ab3 | JavaScript | chenli120/fed-e-task-02-02 | /code/ESM/05-esm-suport/module.mjs | UTF-8 | 527 | 2.5625 | 3 | [] | no_license |
import { foo, bar } from './index.mjs'
console.log(foo, bar)
// import fs from 'fs'
// fs.writeFileSync('./foo.txt','es module working')
// 系统内置的模块,官方都做了兼容===内置模块兼容两人 ESM 的提取成员
import { writeFileSync } from 'fs'
writeFileSync('./foo.txt','es module working')
// import _ from 'lodash'
// console.log(_.camelCase('E... | true |
65c145a4a018277123b49c0cac69109ad5c5d00a | JavaScript | scolapicchioni/esnext20210708 | /js/ch03.js | UTF-8 | 150 | 3.296875 | 3 | [] | no_license | let s1 = "it's something";
let s2 = 'he said "hi" to me';
let s3 = `the string s1 contains ${s1} and the string s2 contains ${s2.toUpperCase()}`;
| true |
ba38201e7e291dea672f2a6386456e04d7ea2e0b | JavaScript | adarmanto/amazsell | /server/controllers/tag-ctrl.js | UTF-8 | 2,256 | 2.796875 | 3 | [] | no_license | const Tag = require('../models/tag-model')
createTag = (req, res) => {
const body = req.body
if (!body) {
return res.status(400).json({
success: false,
error: 'You must provide a tag',
})
}
const tag = new Tag(body)
if (!tag) {
return res.status(400).json({ success: false, error: e... | true |
8b69eeb52cda62985ee533d80022091656c871f2 | JavaScript | Qix-/hue-fun | /test.js | UTF-8 | 1,100 | 2.671875 | 3 | [] | no_license | var ELEMENTS = [
"Ac", "Ag", "Al", "Am", "Ar", "As", "At", "Au",
"B", "Ba", "Be", "Bh", "Bi", "Bk", "Br", "C",
"Ca", "Cd", "Ce", "Cf", "Cl", "Cm", "Cn", "Co",
"Cr", "Cs", "Cu", "Db", "Ds", "Dy", "Er", "Es",
"Eu", "F", "Fe", "Fl", "Fm", "Fr", "Ga", "Gd",
"Ge", "H", "He", "Hf", "Hg", "Ho"... | true |
1de145e0a61474a7f82fbd228457839cc56b0eb3 | JavaScript | Monster-2019/leetcode | /topic/1281.js | UTF-8 | 322 | 3.296875 | 3 | [] | no_license | /**
* @param {number} n
* @return {number}
*/
var subtractProductAndSum = function (n) {
let numList = String(n).split('')
return numList.reduce((res, num) => res * Number(num), 1) - numList.reduce((res, num) => res + Number(num), 0)
};
console.log(subtractProductAndSum(4421))
// 76ms 90.39%; 37.7mb 85.21... | true |
e9d6f6f7d4c1ed53b1da6e89357732be5ccc214c | JavaScript | EnderLorenz/website | /physics/mfp/forrest.js | UTF-8 | 384 | 2.8125 | 3 | [] | no_license | function Forrest(nTrees, size) {
this.trees = [];
for (var i = 0; i < nTrees; i++) {
tmp = new Tree(0, size);
this.trees.push(tmp);
}
this.trees.sort(function(a, b) {
return a.dist - b.dist;
});
this.forrest = function() {
}
this.show = function(graph) {
... | true |
992a0d22154caa6ca294e68931e42b81337ffad7 | JavaScript | zmorton8057/TongueTied | /app/public/js/main.js | UTF-8 | 12,352 | 2.984375 | 3 | [] | no_license |
$('#spinner').hide();
$('#submit-button').hide()
//variable for base64 images
var baseCode;
//incrementation variable
var n = 0;
//arr of requests
var requestArr = [];
//hash array
var hashArr = [];
//seo array
var seoArr = [];
//constructor for new request object to be passed into google vision
function addReq... | true |
1b8f4b1191c981a82e2c43de1699947fa73c6b48 | JavaScript | lucabecci/users-mern | /frontend/src/components/NotesList.js | UTF-8 | 1,524 | 2.625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
import axios from 'axios'
import {format} from 'timeago.js'
export const NotesList = () => {
const [notes, setNotes] = useState([])
useEffect(() => {
async function getData(){
const resp = await axios.get('http://localhost:4000/api/notes')... | true |
2a1c0aca31afb0895de1606f2a0e7eb96f62bb1f | JavaScript | lyyh/algorithm | /leetcode/144.二叉树的前序遍历.js | UTF-8 | 1,080 | 3.421875 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=144 lang=javascript
*
* [144] 二叉树的前序遍历
*/
// @lc code=start
/**
* Definition for a binary tree node.
* function TreeNode(val, left, right) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null ... | true |
a2510d39add0ab6cabda351c79aad1d7e1b3d8ed | JavaScript | jlock64/petfinder | /public/js/main.js | UTF-8 | 1,423 | 3 | 3 | [] | no_license |
// You need to run this cUrl command to get the Bearer token that's good for 24 hours
// curl -d "grant_type=client_credentials&client_id=6lgm3bsUbm0tPGAxqQ6IYARPFlSYO3zYHlvaIEY4RLMir1YoL7&client_secret=CQlaQsiUtIQ1wMfqpHEy0KSiNoDbnVhEeAlwm4LF" https://api.petfinder.com/v2/oauth2/token
function getDogs() {
axios.ge... | true |
caf0ad8f1e75603ef38ac87da55781b58d8a43ab | JavaScript | daisty/common-demo | /ts-study/step3/class/class1.js | UTF-8 | 283 | 3.25 | 3 | [] | no_license | // TypeScript 可以使用三种访问修饰符(Access Modifiers),分别是 public、private 和 protected
var Animal = /** @class */ (function () {
function Animal(name) {
this.name = name;
}
return Animal;
}());
var a = new Animal('dog');
a.name = 'cat';
| true |
95d38fb44772f02d4b10ebb4e0fd90934ebc7339 | JavaScript | GrahamClement/toyotamiria | /fuel.js | UTF-8 | 1,107 | 2.765625 | 3 | [] | no_license | var ourRequest = new XMLHttpRequest();
ourRequest.open('GET', 'https://developer.nrel.gov/api/alt-fuel-stations/v1.json?fuel_type=HY&state=CA&api_key=fOdssRUb3dAiA4HfN6ReEWAPISrbh6FCMjZtPinW&format=JSON');
ourRequest.onload = function(){
var ourData = JSON.parse(ourRequest.responseText);
//for (var i = 0; ... | true |
7438ff7d343d0bf52005454d1f90ec15b7c28509 | JavaScript | GabriStucchi/Spicer | /js/Controller/midiManagement.js | UTF-8 | 3,653 | 2.71875 | 3 | [
"MIT"
] | permissive | //MIDI
const default_duration = 123456789;
let activeNotes = [];
navigator.requestMIDIAccess().then(onMIDISuccess, onMIDIFailure);
function onMIDIFailure() {
console.log("Could not access your MIDI devices.");
}
function onMIDISuccess(midiAccess) {
for (var input of midiAccess.inputs.values()) {
input.onmid... | true |
55a006a23830a9dadcc78e53296d9e2783448576 | JavaScript | okrymus/okrymus-aframe | /client/app/components/PeriodicTable/interface/Item.js | UTF-8 | 4,521 | 2.578125 | 3 | [
"MIT"
] | permissive | AFRAME.registerComponent("table-item", {
schema: {
selected: {
default: false,
type: "boolean"
},
atomic_number: {
type: "number"
},
symbol: {
type: "string"
},
name: {
type: "string"
},
atomic_weight: {
type: "number"
},
boiling_point: {... | true |
b459d819f0b1ce27181a316e4ca9eb2133f16d92 | JavaScript | tdharris/qninja2 | /server/public/src/qninja.js | UTF-8 | 288 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | // Add Active Navigation Class Based on URL
(function() {
aObj = document.getElementById('nav').getElementsByTagName('a');
console.log(aObj);
for(i=0; i < aObj.length; i++) {
if(document.location.href.indexOf(aObj[i].href) >= 0)
aObj[i].className='active';
}
})(); | true |
11fd5e37f9e42825911ad13eda0664f19d8d8f5a | JavaScript | NKhan21/datalab | /assets/js/colleges-and-universities/investmentOverview.js | UTF-8 | 3,273 | 3.125 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*
--------------------------------------------------------------------------------------------------------------------
* Local Declarations
*--------------------------------------------------------------------------------------------------------------------
*/
const contractsGranphBar = document.getElementById('to... | true |
7e677ffa86585daa62a8010174be2ec20f4e19ae | JavaScript | barbazul/dominion-AIrena | /src/cards/card.js | UTF-8 | 2,456 | 3.25 | 3 | [] | no_license |
/**
* Base card class to be extended by all other cards
*/
export default class Card {
constructor () {
this.name = this.constructor.name;
// Cards may have multiple types.
this.types = [];
// Defines the base cost. To get the actual cost use the getCost method.
this.cost = 0;
// These p... | true |
79a4a08e613921a5f0fcb1fa8ae646c1718d5bc2 | JavaScript | FraidyJacoby/ReactPeopleTable | /ReactPeopleTable/ClientApp/src/components/PersonForm.js | UTF-8 | 850 | 2.578125 | 3 | [] | no_license | import React from 'react';
class PersonForm extends React.Component {
render() {
return (
<div className="row">
<input type="text" className="form-control col-md-3" value={this.props.firstNameValue} onChange={this.props.onFirstNameChange} />
<input type="text" c... | true |
7d1e8e747a7de5dcd985a56eca5287d8fa106d22 | JavaScript | Gekocius/prevence-ma-smysl-team01 | /backend/src/modules/diagnosis/diagnosisController.js | UTF-8 | 2,181 | 2.5625 | 3 | [] | no_license | import db from '../database/model/';
export const newDiagController = async (req, res) => {
db.Diagnosis.build({
Name: req.body.Name,
Description: req.body.Description,
})
.save()
.then(newDiagnosis => {
const diagID = newDiagnosis.IDDiagnosis;
const exams = req.body.ExamID;
for (... | true |
7b56a9f15d7cfbabddb5a2949a8903ebd732d86f | JavaScript | MouseZero/algo-practice | /tools/linkList.js | UTF-8 | 505 | 3.296875 | 3 | [] | no_license | function ListNode(val) {
this.val = val;
this.next = null;
}
function linkListFromArray(array) {
let previous = undefined
let node
for (let i=array.length-1; i>=0; i--) {
node = new ListNode(array[i])
node.next = previous
previous = node
}
return node
}
function listToArray(head) {
le... | true |
23941f05bb1f05a31e63bbe438a48f829fa12598 | JavaScript | nate-hunter/redex-practice-got-01 | /src/Redux/reducer.js | UTF-8 | 1,649 | 2.84375 | 3 | [] | no_license | // The point of redux is to take this information ('contestants' below), and insert into whatever component needs the information.
const initialState = {
contestants: {
1: {
id: 1,
name: "Cersei Lannister",
votes: 0,
allies: 0,
image: "http://images6.fanpop.com/image/photos/38300000/... | true |
4fd76d89ba0f5048b75f16e14679cb62e8a06f4c | JavaScript | tourn/wed3-react-testat | /src/components/AllTransactions.js | UTF-8 | 2,913 | 2.515625 | 3 | [] | no_license | // @flow
import React from 'react'
import Select from 'react-select';
import 'react-select/dist/react-select.css';
import {Container, Header} from "semantic-ui-react";
import MovementTable from "./MovementTable";
import {getTransactions} from "../api"
import type {User} from '../api'
import '../react-select/react-sel... | true |
c0eda1a2dc91912ae846726770b32eb0b39c6787 | JavaScript | fabianschmauder/appsync-example | /frontend/src/components/PostForm.js | UTF-8 | 1,035 | 2.59375 | 3 | [] | no_license | import React, {Component} from "react";
export default class PostForm extends Component {
constructor(props) {
super(props);
this.state = {name: '', text: ''};
}
render() {
return (<form className="input-area">
<div>
<label htmlFor="name">name:</... | true |
6416075a129acb8742e74feb6ef610dac302868f | JavaScript | aditya1rawat/Hack-Quarantine-2020-Project | /jsAppFiles/covidData.js | UTF-8 | 7,280 | 3.078125 | 3 | [
"CC-BY-4.0",
"CC-BY-3.0"
] | permissive | //Need JQuery
//Data variables
var countryList = [];
var currentCountryTodayData;
var currentCountryTotal;
var currentCountryData = [];
var currentGlobalCases;
var currentGlobalDeaths;
var currentGlobalRecover;
//Date variables
var date = new Date();
var year = date.getFullYear();
var month = (date.getMonth()+1).toSt... | true |
09a56ca825391fe67c17676e5105768acdd655d3 | JavaScript | xchinaskix/tic-tac-toe | /src/App.js | UTF-8 | 4,458 | 2.875 | 3 | [] | no_license | import React, { Component } from 'react';
import Board from './components/Board';
import logo from './logo.svg';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
squares: [
[{val: '', win: false}, {val: '', win: false}, {val: '', win: false}],
... | true |
82aed003c630fe70301863370fa15072c39aaa96 | JavaScript | GreenFour/pencil-knight | /entities/flames.js | UTF-8 | 934 | 2.59375 | 3 | [
"MIT"
] | permissive | define([
'actor',
'animation',
],function(
Actor,
Animation,
){
class Flames extends Actor {
constructor(game, x, y, img = null, ctx = null, scale = 3, spriteWidth = 20, spriteHeight = 40) {
super(game, x, y, img, ctx);
this.movementSpeed = 1;
this.scal... | true |
1a8edf548361157b655fcb43ea6abeffe074346b | JavaScript | anacsanchez/Binary-Tree-Visualization | /js/arrayVisual.js | UTF-8 | 1,569 | 2.953125 | 3 | [] | no_license | import { fillColor, textColor, addHighlight, addTextAttrs } from "./node.js";
import { createContainer } from "./utils.js";
export function ArrayVisual(arr, ySpacing) {
this.data = arr;
this.container = null;
this.create = function (x, y, width, height) {
this.container = createContainer("array-visual", this.data... | true |
bb23d0cbf4d75a9a8d14b6c321ba27c86a5a1210 | JavaScript | ShaiaBak/PotSmash | /examples/build01/js/Game.js | UTF-8 | 1,968 | 3 | 3 | [] | no_license | var map;
var bgLayer;
var blockedLayer;
var objectLayer;
var Game = {
create: function() {
this.map = this.game.add.tilemap('level1');
//the first parameter is the tileset name as specified in Tiled, the second is the key to the asset
this.map.addTilesetImage('tileset-placeholder2', 'gameTiles');
t... | true |
1f6f554ba9e7d1e82826c2568db7ce9a73152688 | JavaScript | sujed/json-front | /index.js | UTF-8 | 2,393 | 2.65625 | 3 | [
"MIT"
] | permissive | export const get = (url, headers) => {
return _send({ method: "GET", url, headers });
};
export const post = (url, data, headers) => {
if (!data) {
throw Error(`No data to send`);
}
return _send({ method: "POST", url, toSend: data, headers });
};
export const put = (url, data, headers) => {
... | true |
70dfd2850dfff9f98cb56702e06da78b4759a5dc | JavaScript | HAYNEZ/twitter-timeline-boilerplate | /search-bar.js | UTF-8 | 438 | 2.625 | 3 | [] | no_license | (function($) {
function submitForm(event){
event.preventDefault();
var searchType = $("#dropdown").val();
var searchTerm = $("#search-input").val();
if (searchType == "Username") {
$("#tweets").twitterTimeline(searchTerm);
}
else if (searchType == "Hashtag"){
$("#tweets").twitterTerm(searchTerm... | true |
fa61b4fb9cd655ef18d9b54989bcb908902c5f7d | JavaScript | Davehan185/Week-2-Reusable-Code | /jslib.js | UTF-8 | 830 | 3.4375 | 3 | [] | no_license | function validateForm(id1, id2){
validateNotBlank(id2);
validateNotBlank(id1);
validateNumber(id1);
}
function validateNotBlank(elementId) {
let x = elementId.value;
let id = elementId.id;
if (x == "") {
alert(id + " must be filled out");
document.getElementById(id).style.borderColo... | true |
095313a9730ef2d596b36d75e548780adc153ba5 | JavaScript | kilchevskii/Js_Learn | /js_task41/main.js | UTF-8 | 945 | 4.09375 | 4 | [] | no_license | // Напишите функцию, которая возвращает сумму таким образом:
// f(1)(2)(3) - 6
// f(1)(2)..(n) - 1 + 2 + ...+ n
// const infiniteCurry = (fn, seed) => {
// const reduceValue = (args, seedValue) =>
// args.reduce((acc, a) => {
// return fn.call(fn, acc, a);
// }, seedValue);
// const next = (...args)... | true |
71336cf51c3750e82e40a1fb5e10aeb671971b8c | JavaScript | TheNuttyMaker/ng-akmart | /src/app/cart.service.js | UTF-8 | 16,237 | 2.5625 | 3 | [] | no_license | (function() {
'use strict';
angular
.module('app')
.factory('Cart', function Auth(SERVERURL, Auth, APPNAME) {
function ShoppingCart(cartName) {
this.cartName = cartName;
this.clearCart = false;
this.checkoutParameters = {};
... | true |
c5a73617a7134e3c15476971470f0804c0778cc3 | JavaScript | alexli1973/react-weather | /src/dropdown-page/Dropdown.js | UTF-8 | 2,715 | 2.59375 | 3 | [] | no_license | import React, {Component} from 'react';
import DropdownDisplay from "./DropdownDisplay";
const techCompanies = [
{ label: "Apple", value: 1 },
{ label: "Facebook", value: 2 },
{ label: "Netflix", value: 3 },
{ label: "Tesla", value: 4 },
{ label: "Amazon", value: 5 },
{ label: "Alphabet", val... | true |
437591655c304158537e056dcb8cd1903a9563f9 | JavaScript | CodeWithSouma/Learn-JavaScript | /basic-js/garbage-collection.js | UTF-8 | 490 | 3.15625 | 3 | [] | no_license | // In low level programming like c,c++ we need to dealocate after use object/structure
// but in the case of javascript the memory will automatically dealocate after use object
// for example
const obj = {};
console.log(obj);
//the javascript engin have a garbeg collector it finds veriable or object that are
// alread... | true |
411cae7f2a6633ec1e5161a31128bbacf3cae3d2 | JavaScript | neuekit/utilities | /lib/vanilla/niceType/test.js | UTF-8 | 575 | 2.765625 | 3 | [
"MIT"
] | permissive | /* Imports */
import { test } from 'uvu'
import * as assert from 'uvu/assert'
import niceType from './index.js'
/* Setup */
const sentence =
"constantly seek criticism.\fa WELL THOUGHT out critique\nof what you're doing is\nas valuable as gold"
const title = 'elon musk'
/* Test */
test('niceType', () => {
asser... | true |