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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
236fb4086b6ba69e853ec4195a47e2a0e67161a7 | JavaScript | drlynb/BergunderCapstone | /static/js/charts3.js | UTF-8 | 3,219 | 2.6875 | 3 | [
"MIT"
] | permissive | "use strict";
/* global d3 */
/* global queue */
/* global location */
/* global crossfilter */
/* global MakeStolenYears */
/* global MakeTimeline */
/* global MakeAgeBars */
/* global MakeFilters */
/* global MakeCityBars */
/* global MakeMap */
/* global L */
/*
The queue() function makes sure that we have all the ... | true |
1aef60ead6e018f64676bdb37a019bc4b91e4152 | JavaScript | antonzaharia/algorithms | /JavaScript/isValidWalk.js | UTF-8 | 430 | 3.171875 | 3 | [] | no_license | function isValidWalk(walk) {
let n = 0,
s = 0,
e = 0,
w = 0;
walk.map((direction) => {
if (direction === "n") {
n += 1;
} else if (direction === "s") {
s += 1;
} else if (direction === "e") {
e += 1;
} else if (direction === "w") {
w += 1;
}
});
if (n === ... | true |
bd54b1657c3c0f796f72a29256f0e9e9a59848e6 | JavaScript | demonjoub/simple | /src/index.js | UTF-8 | 794 | 3.578125 | 4 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import App from './App'
ReactDOM.render(
<App />,
document.getElementById('root')
);
String.prototype.replaceToX = function () {
return this.replace(/[a-zA-Z0-9-.]/g, 'x')
}
// prototype array max
Array.prototype.max = function () {
return Math.max... | true |
a66eaad59defb66906233db5114731fac6ac941c | JavaScript | sunhochoi-kyperlab/soundHound | /src/js/utils/index.js | UTF-8 | 1,422 | 2.8125 | 3 | [] | no_license | export class Geo {
static getCurrentPosition (origin) {
return new Promise((resolve, reject) => {
if (origin === 'DUMMY') {
setTimeout(() => {
// 로댕 미술관 Musee Rodin
let position = {
coords: {
latitude: 48.8477949,
longitude: 2.3156545
... | true |
4f0175416e92e654854e6ed2cfa17a44d0ae6629 | JavaScript | Eric-S-Anderson/webTechProject | /Term_Project/public_html/js/input_mediator.js | UTF-8 | 4,172 | 2.890625 | 3 | [] | no_license | //Handle touch events
var diffX, diffY, startX, offsetX, startY, offsetY, movedX, movedY, tapped;
var el = $("body");
//Touch start (register location)
el[0].addEventListener('touchstart', function(e) {
e.preventDefault();
offsetX = ($(window).width()-el.outerWidth(true))/2;
startX = e.targetTouches[0].pageX - o... | true |
af993d1627f7804ab45b0f818e0850e161470d9d | JavaScript | jtak93/phaser-es6-webpack | /src/sprites/Player.js | UTF-8 | 2,471 | 2.703125 | 3 | [
"MIT"
] | permissive | import Phaser from 'phaser'
export default class extends Phaser.Sprite {
constructor ({ game, x, y, asset }) {
super(game, x, y, asset)
this.anchor.setTo(0.5, 0.5)
this.game.physics.enable(this, Phaser.Physics.ARCADE);
this.bulletTime = 0;
}
update () {
if (this.alive) {
// Reset th... | true |
a2397c32e3a74d7b5a2db169e272e30ec787c4fe | JavaScript | jmoics/Typescript | /8_Modules&Namespaces/1_namespacesExec.js | UTF-8 | 1,323 | 3.125 | 3 | [] | no_license | // En el ejemplo debajo estamos creando un namespace llamado Utility y agrupando una función MaxDiscountAllowed y un namespace anidado llamado payment dentro.
var Utility;
(function (Utility) {
var Payment;
(function (Payment) {
function CalculateAmount(price, quantity) {
return price * quan... | true |
c19d24642e688c4426eb0d99c78113884b713862 | JavaScript | nassersayeh/WebFandemantal | /HTML - CSS - JavaScript/Basic foundation 1/array odd/javascript.js | UTF-8 | 188 | 3.5625 | 4 | [] | no_license | var arr = [];
function oddArray(){
for(var i = 1 ; i<51 ; i++)
{
if(i%2 == 1)
{
arr.push(i);
}
}
return arr;
}
console.log(oddArray()); | true |
d5a14f81982fece6f610d264fbb386b46888645a | JavaScript | jecheverri92/NotasJS | /Ejercicios Algoritmos Javascript/js/psp-multiple-pointers-is-subsequence.js | UTF-8 | 939 | 4.40625 | 4 | [] | no_license |
/*
Write a function called isSubsstring which takes in two strings and checks whether the characters
in the first string form a subsequence of the characters in the second string.
In other words, the function should check whether the characters in the first string appear
somewhere in the second string, without... | true |
efaa864164123271655b3043434fac57d255c967 | JavaScript | gr0x0/cadastro_nutricionista | /js/filtra.js | UTF-8 | 1,205 | 3.546875 | 4 | [] | no_license | var campoFiltro = document.querySelector("#filtrar-tabela");
campoFiltro.addEventListener("input", function(){
var pacientes = document.querySelectorAll(".paciente");
if (this.value.length > 0){
for (var i = 0; i < pacientes.length; i++){
var paciente = pacientes[i];
var nome =... | true |
727b460628b8189006a64c5417cd11465d0a51c3 | JavaScript | hideInbush/LeetCode | /3.js | UTF-8 | 1,254 | 4.21875 | 4 | [] | no_license | /*
给定一个字符串,找出不含有重复字符的最长子串的长度。
示例:
给定 "abcabcbb" ,没有重复字符的最长子串是 "abc" ,那么长度就是3。
给定 "bbbbb" ,最长的子串就是 "b" ,长度是1。
给定 "pwwkew" ,最长子串是 "wke" ,长度是3。请注意答案必须是一个子串,"pwke" 是 子序列 而不是子串。
*/
/**
* @param {string} s
* @return {number}
*/
//暴力解法
var lengthOfLongestSubstring_1 = function(s) {
if (typeof s === 'string') {
let ... | true |
f5abd2b6415010d8e6cd9b37f5055f1effbbb8e5 | JavaScript | pvoisin/modelized | /source/Model.js | UTF-8 | 9,701 | 2.609375 | 3 | [
"MIT"
] | permissive | var $ = require("ytility");
var Aspect = require("./Aspect");
var Observable = require("./Observable");
var Registry = require("./Registry");
function Model(definition) {
// Let's give models the `id` property by default:
definition = Model.normalize($.merge({id: Number}, definition));
var constructor = this;
va... | true |
c2259ca3df220a69f4db72a8b92a494f7e4bf03e | JavaScript | HDRUK/gateway-web | /test/utils/localStorage.js | UTF-8 | 310 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | const setLocalStorage = (id, data) => {
window.localStorage.setItem(id, JSON.stringify(data));
};
const getLocalStorage = id => {
window.localStorage.getItem(id);
};
const resetLocalStorage = () => {
window.localStorage.clear();
};
export { getLocalStorage, setLocalStorage, resetLocalStorage };
| true |
146a03bdbd5cdb6902ef0d7d3177adba5800f652 | JavaScript | gururajmca/Algorithms | /reverseLinkedList.js | UTF-8 | 633 | 4.09375 | 4 | [] | no_license | class Node {
constructor(val) {
this.data = val;
this.next = null;
}
}
const a = new Node(10);
const b = new Node(20);
const c = new Node(30);
const d = new Node(40);
// Link
a.next = b;
b.next = c;
c.next = d;
console.log('Original linked list ', JSON.stringify(a));
const reverseLinkedList = (head)=> {... | true |
0e2d5e1528ea3f5304acad9fdc82a534eeaedd20 | JavaScript | mark92pap/mark92pap.github.io | /src/pages/Contact.js | UTF-8 | 2,447 | 2.65625 | 3 | [] | no_license | import React, { useState } from "react";
import emailjs from "emailjs-com";
import "./Contact.css";
const Contact = () => {
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [company, setCompany] = useState("");
const [message, setMessage] = useState("");
const SubmitMessa... | true |
fd5f621342b20362e8f1c45822434e743f9b9207 | JavaScript | f-krull/propairs-www | /js/dbclient.js | UTF-8 | 43,214 | 2.5625 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
//------------------------------------------------------------------------------
// helper functions
function assert(condition, message) {
if (!condition) {
throw message || "Assertion failed";
}
}
function getModelStr(p) {
var res = '';
if (p.length < 5) {
... | true |
e1451a8a40aeb6091a432c63a4aa8f7f16f18f54 | JavaScript | Mukulbaid63/CurrencyConverter | /app.js | UTF-8 | 1,183 | 3.40625 | 3 | [] | no_license | const api="https://api.exchangerate-api.com/v4/latest/USD"
var search=document.querySelector(".search-box");
var date=document.querySelector(".Date");
var from=document.querySelector(".from");
var to=document.querySelector(".to");
var resultFrom;
var resultTo;
from.addEventListener('change', (event) => {
resultFrom... | true |
52de1dfe6c9eebb767c0a48c9c21604a0aa4c547 | JavaScript | shehbazjafri/pomodoro-clock | /src/helpers.js | UTF-8 | 476 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | export function secondsToTime(seconds) {
if (seconds === 3600) {
return {
minutes: 60,
seconds: "00"
};
}
let divisor_for_minutes = seconds % (60 * 60);
let mm = Math.floor(divisor_for_minutes / 60);
let divisor_for_seconds = divisor_for_minutes % 60;
let ss = Math.ceil(divisor_for_seco... | true |
3d8f98a172efb4afee6cacd80198477dac08e376 | JavaScript | Blargian/ModernJavaScriptBootcamp | /basics/boolean.js | UTF-8 | 250 | 3.46875 | 3 | [] | no_license | //Challenge
let age = 80
console.log("Your age is: " + age )
//Check for discounts
//Child discount
if(age <= 7){
console.log("Children under 7 may enter for free")
}
//Senior discount
if(age >= 65){
console.log("Seniors get 50% off")
} | true |
e51ef7bfc335fbd1c61e9be5960d0beef94d25b8 | JavaScript | kishoriak/java_sept2021 | /myscript.js | UTF-8 | 2,019 | 3.125 | 3 | [] | no_license | // validate name
validatename=function(){
var name=document.getElementById("nm").value;
var ptag=document.getElementById("nmerr");
if(name.trim().length>0){
ptag.innerHTML="";
//alert(name);
return true;
}
ptag.innerHTML="name cannot be blank";
//alert("name ... | true |
a086a55ca1d91322685dd281b89282f2c8ea3d1c | JavaScript | SeverinGabriel/ZunftEnnetbuergen | /menue/menue_archiv.js | ISO-8859-1 | 2,278 | 2.578125 | 3 | [
"MIT"
] | permissive |
<!--
/******************************************************************/
/**** ACHTUNG: Nur die Werte zwischen den Sternen verndern!!! ****/
/******************************************************************/
/****************************************** created by P. Bschi **/
/***************************************... | true |
6d70315863079b4bfb5075e798b001feeb129e99 | JavaScript | ntaylorbishop/keychat | /js/vigenere.js | UTF-8 | 880 | 3.578125 | 4 | [] | no_license | /* Implementation of the Vigenere cipher, operating only on ASCII strings.
*
* This cipher is not secure. Please don't actually use it.
* See: http://en.wikipedia.org/wiki/Vigenere_cipher
*
* Written by Calvin Owens
*/
/* Obviously we don't need to do anything here */
function vigenere_expand_key(key)
{
return ... | true |
919207db1630fafbd6a3f47fdef051881b89adb1 | JavaScript | thinkful-c11/Wasteland- | /src/helperFn.js | UTF-8 | 9,427 | 3.015625 | 3 | [] | no_license | //Create Functions
function createImageButton(game, textOfImage,x,y,w,h) {
let button = game.add.image(x,y,'grass');
button.anchor.setTo(0.5,0.5);
button.width = w;
button.height = h;
button.scale.x = 0.5;
button.scale.y = 0.5;
button.tweenAnimation = game.add.tween(button.scale).to({x:... | true |
68a6baf6724c55bb0adf12f59b0086c93cb2e77c | JavaScript | FrantzMaisonneuve/FrantzMaisonneuve.github.io | /main.js | UTF-8 | 388 | 3.546875 | 4 | [] | no_license | var bonjour = document.getElementById("bonjour");
var contenu = document.getElementById("contenu2");
var input = document.getElementById("input-nom");
function handleInput(event) {
if (event.key === "Enter") {
var nom = input.value;
var text = `Bonjour ${nom}!`
bonjour.innerHTML = text;
contenu.inn... | true |
d44d445e201743170030a9f50339cf5a1d2a3549 | JavaScript | masudkaisar2019/project14 | /pro-tek/typing_test_final /script.js | UTF-8 | 3,220 | 3.296875 | 3 | [] | no_license | const testWrapper = document.querySelector(".test-wrapper").innerHTML;
var testArea = document.querySelector("#test-area");
var originText = document.querySelector("#origin-text p").innerHTML;
const resetButton = document.querySelector("#reset");
const theTimer = document.querySelector(".timer");
error=0;
// Add leadi... | true |
a9e7689b9e19d9a2b14c9b11a6d505ec8bcbd4da | JavaScript | andrewc2695/aaclasswork | /w10d1/src/index.js | UTF-8 | 428 | 2.53125 | 3 | [] | no_license | const DOMNodeCollection = require('./dom_node_collection');
window.$l = (arg) => {
if(arg instanceof HTMLElement) {
const domCollection = new DOMNodeCollection([arg]);
return domCollection;
} else{
const nodeList = document.querySelectorAll(arg);
const nodesArray = [...nodeLis... | true |
568cb6685f025a67407dd93392b9248d5f566aad | JavaScript | zedongQ/basic_v1 | /src/main/webapp/static/js/global/quoteChart/js/smallChart-ChLine.js | UTF-8 | 1,270 | 3.109375 | 3 | [
"MIT"
] | permissive | /**
* Created by BJ on 2016/7/5.
*/
function ChLine(canvas, width, height, beginPoint, endPoint) {
this.cans = canvas;
this.x1 = beginPoint.x;
this.y1 = beginPoint.y;
this.x2 = endPoint.x;
this.y2 = endPoint.y;
this.lineWidth = 1;
this.lineColor = "#506d99";
this.fillColor =... | true |
28bea67a3aac9574df32ad80427532b3a0ffaf2d | JavaScript | Viisheshjain05/All_Javascript_Projects | /Minor Projects/caculator/assets/scripts/app.js | UTF-8 | 2,886 | 3.734375 | 4 | [] | no_license | const defaultResult = 0;
let currentResult = defaultResult;
let trackOutput = defaultResult;
let logEntries = [];
//* USE TO ACTIVATE BUTTONS
function add() {
// trackOutput = `${currentResult} + ${userInput.value}`;
// currentResult = currentResult + parseInt(userInput.value);
// console.log("input", trac... | true |
be35c1ce25b5f10bd165cee12b894aa00e4ab2c4 | JavaScript | nopacak/Javascript | /SLEUTH/701 - Usual Suspects/3/sketch.js | UTF-8 | 4,495 | 3.1875 | 3 | [] | no_license | /*
Officer: 4335840
CaseNum: 701-2-38776371-4335840
Case 701 - Recognisable robber - stage 3
Kid you’re becoming a victim of your own success.
I just had a call from DI Max down at the precinct. He specifically requested your services.
They finally have a reliable witness for a robber who has been causing mayhem for... | true |
4ea71016ece54799a60ad376146e473266a6becd | JavaScript | TomatoSoup0126/leetcode-solution | /0027_RemoveElement.js | UTF-8 | 1,842 | 4.5625 | 5 | [] | no_license | // 27. Remove Element
// https://leetcode.com/problems/remove-element/
// Given an array nums and a value val, remove all instances of that value in -place and return the new length.
// Do not allocate extra space for another array, you must do this by modifying the input array in -place with O(1) extra memory.
// T... | true |
99ce1a37cb41875add670732fda76415656669cc | JavaScript | PrasanthReddy-Chittapu6683/React-HOOKS | /src/components/useEffect/UseEffectFuncComponent5.js | UTF-8 | 657 | 3.0625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
function UseEffectFuncComponent5() {
const [count, setCount] = useState(0)
const [name, setName] = useState('')
const countFunc = () => {
document.title = `Cliked ${count} times`
console.log(`Functinal Component - useEffect() triggering ... | true |
1844d6296bc289d88f2fd9718308fc16803630fc | JavaScript | kocubinski/nature-of-code | /js/2_Forces/repel.js | UTF-8 | 3,214 | 2.671875 | 3 | [] | no_license | /*global Sketch ui */
function Mover(mass, x, y, opts) {
opts = opts || {};
this.location = new Sketch.vector2(x, y);
this.velocity = new Sketch.vector2(0, 0);
this.acceleration = new Sketch.vector2(0, 0);
this.mass = mass;
this.size = mass;
this.color = opts.color || "gray";
}
Mover.proto... | true |
c8ba2868bb2ee0942c44fcb172e1cd15c9a3e1df | JavaScript | raimohanska/Monads | /examples/javascript/async.js | UTF-8 | 860 | 2.640625 | 3 | [] | no_license | Async = function(f) {
if (!(this instanceof Async)) return new Async(f)
this.run = f
}
Async.prototype.chain = function(f) {
var self = this
return Async(function(callback) {
self.run(function(value) {
var next = f(value)
next.run(callback)
})
})
}
Async.of = Async.prototype.of = function(... | true |
aee0fecf263cacc3aca4741d22413eaa1d59dfa1 | JavaScript | RolandoAndrade/piDay-2019 | /js/index.js | UTF-8 | 918 | 3.015625 | 3 | [] | no_license | let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d");
ctx.font = "30px Arial";
ctx.textAlign = "center";
let accuracy=4;
let background = new Rectangle(0,0,400,400,"#333333");
let b1 = new Ball(50,200,10,"#997eff",1);
let b2 = new Ball(250,200,40,"#ff8265",100**accuracy);
let collisio... | true |
06e8c98cb117bc281f8df06f8e241f0bd6c6d607 | JavaScript | deriandrian/Kahoot-FrontEnd | /Kahoot/get-quiz-by.js | UTF-8 | 1,169 | 2.796875 | 3 | [] | no_license | //=============//
// GET QUIZ BY //
//=============//
var url_string = window.location.href
var url = new URL(url_string);
var quiz_id = Number(url.searchParams.get("id"));
$.ajax({
url: `http://localhost:5000/getQuizBy/${quiz_id}`,
method: 'GET',
success: function(quizzes){
for (var i = 0; i < q... | true |
658db2cc9aadf5b5bd7b3b6eb1e4f2cecf48ebd1 | JavaScript | lakshmyps/dogbreed | /index.js | UTF-8 | 2,078 | 3.109375 | 3 | [] | no_license | function myFunction() { // onload function
var dogapi= new XMLHttpRequest();
dogapi.onload= addList;
dogapi.onerror= error;
dogapi.open("GET","https://dog.ceo/api/breeds/list/all");
dogapi.send();
}
var HttpClient = function() {
this.get = function(aUrl, aCallback) {
var anHttpRequest... | true |
ae8cc3dac30afeb5e7913e848b42f2d611ee2268 | JavaScript | masontmorrow/Sprint-Challenge--Testing | /index.spec.js | UTF-8 | 2,527 | 2.734375 | 3 | [] | no_license | const mongoose = require('mongoose');
const request = require('supertest');
const server = require('./api/server.js');
const Game = require('./games/Game');
const lord = {
title: 'Lord of the Rings',
genre: 'fantasy',
releaseDate: 'Nov-1-2001'
};
const finalfantasy = {
title: 'Final Fantasy',
genre: 'fantasy... | true |
4a744ec884f7a472e85dab941999702308bf1129 | JavaScript | tnsts/Coursework | /binomial.js | UTF-8 | 3,996 | 3.296875 | 3 | [] | no_license | 'use strict';
function Node(key, data) {
this.key = key;
this.data = data;
this.degree = 0;
this.parent = null;
this.child = null;
this.sibling = null;
}
const BinomialHeap = function() {
this.head = null;
};
BinomialHeap.prototype.clear = function() {
this.head = null;
};
BinomialHeap.prototype.isE... | true |
3515125bca88b4fb1c23913fa49323d4012a2a21 | JavaScript | SarahLKatz/senior-enrichment | /server/api/campuses.js | UTF-8 | 1,591 | 2.5625 | 3 | [] | no_license | const api = require('express').Router()
const db = require('../../db')
const { Campus } = require('../../db/models')
api.get('/', (req,res,next) => {
Campus.findAll({})
.then(campusData => res.json(campusData))
.catch(next);
})
api.get('/:campusId', (req,res,next) => {
const id = Number(req.params.campusId)
... | true |
853bca885a0780ba9305a59eb4b468e9c085d185 | JavaScript | gucong3000/postcss-unprefix | /lib/clearRule.js | UTF-8 | 690 | 2.640625 | 3 | [
"MIT"
] | permissive | "use strict";
const unprefixSelector = require("./unprefixSelector");
function clearRule (rule) {
let selector = unprefixSelector(rule.selector);
if (!selector.fixed) {
return;
}
const prefixedDecls = [];
let unprefixed;
selector = selector.toString();
const parent = rule.parent;
parent.walkRules((rule) => {... | true |
e3c8c9c3474c6c60f07df22b1d901aa79974b883 | JavaScript | ZTStory/wxmp_tools | /app/app.eventbus.js | UTF-8 | 1,554 | 2.515625 | 3 | [] | no_license | /**
* App事件管理中心
* 通过注册事件来监听回调
*
* 注意:page addObserve 后,需要在 onUnload 方法中 removeObserve,否则会出现泄漏
*/
export const AppEventBus = {
// __wxExparserNodeId__
observeMap: {},
/**
* 添加观察者监听事件
* @param {PageObj} observe this
* @param {String} notiName
* @param {Function} notiCallBack
... | true |
657673cf8cae5a14d20f49cae888a2041e8ae545 | JavaScript | steppjos/Omega | /site/omega/assets/js/header.js | UTF-8 | 2,595 | 2.984375 | 3 | [] | no_license | /**
* Created by Will on 1/3/14.
*/
jQuery(document).ready(function() {
//Wire up keyboard events
wireKeyboardEvents();
});
function wireKeyboardEvents()
{
jQuery('#txtHeaderSearch').keyup(function(){
if (this.value.length > 2)
{
lookupValue(this.value);
}
els... | true |
f1d93763446925dab2d0b2701f539426164a8c76 | JavaScript | Youngwellcool/ES6-jspang | /src/Set和WeakSet数据结构.js | UTF-8 | 3,446 | 4.1875 | 4 | [] | no_license | /**
* 1、Set数据结构
* 注意:set是数据结构,不是数据类型,也不是数组,只接受数组参数
* 特点:该数据结构不允许出现重复的值,会自动把重复的值删除掉
* size属性相当于数组的length属性
* add()方法,新增元素
* delete()方法,删除元素
* has()方法,查找是否有某元素
* clear()方法,删除所有元素
*/
let setArr = new Set(['Youngwell','yww','杨维维','Youngwell']);
console.log(setArr); // Set(3) {"Youngwell", "yww", "杨维维"} 自动去重
con... | true |
af32ccf5f42d2e23df788d4d96356a5da4f6e964 | JavaScript | twon1011/test4 | /index.js | UTF-8 | 3,041 | 3.015625 | 3 | [] | no_license | let createButton;
let mainContainer;
let cardsContainer;
let renderedMovie = [];
let progressMessage = document.createElement("p");
document.addEventListener("DOMContentLoaded", () => {
createButton = document.getElementById("createButton");
mainContainer = document.getElementById("mainContainer");
cardC... | true |
554e4e8b1c42d79e375c9af30e527e37d22cc0d7 | JavaScript | 137022316/base_demo | /jsSupper/2.js | UTF-8 | 733 | 4.65625 | 5 | [] | no_license | //构造函数继承
function SuperClass(current) {
this.courses = ["语文", "数学", "英语"];
this.current = current;
}
//父类声明原型方法
SuperClass.prototype.getCourses = function () {
console.log(this.courses);
};
//声明子类
function SubClass(current) {
SuperClass.call(this, current);
}
var instance1 = new SubClass("语文");
var instance... | true |
282b117a5800f3c93c4e085acd74b77e667b19a9 | JavaScript | MikaLaw/MikaLaw.github.io | /Grid/source/js/main.js | UTF-8 | 605 | 2.921875 | 3 | [] | no_license | (function () {
let footerYear = () => {
let year = new Date().getFullYear();
document.querySelector(".footer__copyright-year").innerHTML = year;
};
let pageScroll = () => {
let anchor = document.querySelectorAll('a[data-href^="#"]');
anchor.forEach((item) => {
item.addEventListener("click"... | true |
63789f028880b8601cf8438dc9f1c198c843cb57 | JavaScript | twhetzel/my-react-form | /src/ComponentLifecycleForm/index.js | UTF-8 | 3,192 | 2.53125 | 3 | [] | no_license | import './demo.css';
import React from 'react';
import { render } from 'react-dom';
import { withFormik } from 'formik';
import * as Yup from 'yup';
// Helper
import { DisplayFormikState } from './FormikExample';
const formikEnhancer = withFormik({
validationSchema: Yup.object().shape({
email: Yup.string(... | true |
4c3f1712134ace95c0a494614cf0d1fd58bc14a7 | JavaScript | Ronlin1/my-age-in-days-calculator | /age.js | UTF-8 | 555 | 3.46875 | 3 | [] | no_license |
let clickMe = document.getElementById('blue');
let removeMe = document.getElementById('red');
function myAge(){
let div = document.getElementById('box');
let para = document.createElement('p');
let inputYear = prompt('Enter Year;')
let ageInDays = (2020 - inputYear) *356;
let paratext =... | true |
eac20708d777ffb165b40d967b56e87ffa72f83f | JavaScript | nannz/learning-threeJS | /threejs-ch1-nan/script.js | UTF-8 | 4,308 | 2.8125 | 3 | [] | no_license | /**
* Created by zhaonan on 2018/2/8.
*/
var scene;
var camera;
var renderer;
function init(){
//cal & show fps at first!
var stats = initStats();
//the place to put threejs stuff
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(45,window.innerWidth/window.innerHeight,0.1,1000)
... | true |
c9cffbc199befdaf40ae3861ad4afc18571646d1 | JavaScript | leonkoech/Agiiza_Stores | /functions/index.js | UTF-8 | 1,638 | 2.53125 | 3 | [] | no_license | // The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');
// The Firebase Admin SDK to access Cloud Firestore.
const admin = require('firebase-admin');
admin.initializeApp();
// // Create and Deploy Your First Cloud Functions
// // https://fi... | true |
1293da5b4bc471f20dbdae9c85be1c32f9098b77 | JavaScript | AJarombek/jarombek-com | /test/client/CodeSnippet.test.js | UTF-8 | 695 | 2.625 | 3 | [] | no_license | /**
* Jest and Enzyme testing for the CodeSnippet React component
* @author Andrew Jarombek
* @since 5/8/2018
*/
import React from 'react';
import {mount} from 'enzyme';
import CodeSnippet from "../../src/client/CodeSnippet";
// We must use mount() here instead of shallow() because it works with
// refs and compo... | true |
1655a14a28230ff02616646ac5284eab3d766332 | JavaScript | rrodriguezsunol/fullstack-code-test | /webroot/static/code.js | UTF-8 | 2,118 | 2.875 | 3 | [] | no_license | const serviceListContainer = document.querySelector('#service-list');
let servicesRequest = new Request('/service');
fetch(servicesRequest)
.then(function (response) {
return response.json();
})
.then(function (serviceList) {
serviceList.forEach(service => {
let tableRow = docume... | true |
0f99218ad81e78b96789d232331fef467b11d9f5 | JavaScript | zallatt/spotify-challenge | /app/middleware/apiAuth.js | UTF-8 | 352 | 2.703125 | 3 | [] | no_license | /**
* @constant {string} AUTH_HEADER - API access token header key
*/
const AUTH_HEADER = 'x-api-access-token';
module.exports = (req, res, next) => {
const token = req.headers[AUTH_HEADER];
if (!token) {
return res.status(401).send();
}
const role = token === 'jedigrandmaster' ? 'admin' : 'user';
req.... | true |
ff676045250100881ff092837f090a6d3d176b4a | JavaScript | giancarvalho/ParrotCardGame | /scripts.js | UTF-8 | 6,281 | 3.515625 | 4 | [] | no_license | // global variables
const listTag = document.querySelector("ul");
const stopwatchHTML = document.querySelector(".stopwatch");
let numberOfCards;
let nTurns;
let stopwatchID;
let sec;
rankingRecord = [];
let parrotCards = [
`<img src="assets/bobrossparrot.gif" alt="" />`,
`<img src="assets/explodyparrot.gif" alt=""... | true |
771e282e2566759faad3a2c24d52d429e6e7174d | JavaScript | TishoAngelov/TelerikAcademy | /JavaScript/1. Fundamentals/04. Loops/Loops/02. PrintNumbersInRangeNotDivisibleByNum/index.js | UTF-8 | 269 | 3.171875 | 3 | [] | no_license | var numbersToPrint = 100,
firstDivider = 3,
secondDivider = 7,
numDivisibleAtSameTimeBy = firstDivider * secondDivider;
for (var i = 1; i <= numbersToPrint; i++) {
if (Math.floor(i % numDivisibleAtSameTimeBy) !== 0) {
console.log(i);
}
} | true |
ad459017b9a7f1063ad973d9bbb569c0cca58217 | JavaScript | jaxefoo/Week1.nodejs | /sync2.js | UTF-8 | 125 | 2.546875 | 3 | [] | no_license | var fs = require ('fs');
var data = readFileSync ("input.txt");
console.log(data.toString());
console.log("Program Finished") | true |
3baf6847593a5c9c8c2758ea1d9196329e430e24 | JavaScript | Yi1709/github | /code/src/main/resources/static/static/js/login/alert.js | UTF-8 | 1,796 | 3.046875 | 3 | [] | no_license | /**
* toast提示函数
* @param text 提示内容主题
* @param head 提示头 如果是数字,那就是icon 0=>success 1=>error 2=>info 3=>warning
* @param icon 图标 0=>success 1=>error 2=>info 3=>warning
* @param postition 定位
*/
function toast(text,head,icon,postition){
var ob = {text:text};
if(typeof head === "string"){
ob.heading = ... | true |
dd39ac5e61e3a3dcb7568779d7dd27fbeaed71c0 | JavaScript | darshanjag/React | /todo_list/src/components/TodoList.js | UTF-8 | 1,329 | 2.6875 | 3 | [] | no_license | import React, {Component} from 'react';
import NewTodoForm from './NewTodoForm';
import Todo from './Todo'
class TodoList extends Component {
constructor(props){
super(props)
this.state = {
task: [{task: 'do your homework', id: 1}]
}
this.addTask = this.addTa... | true |
81f691ab793ec1e4fb80cd8e9376046b38920468 | JavaScript | ricoymx/nod-vid-skal | /val1.js | UTF-8 | 465 | 3.15625 | 3 | [
"MIT"
] | permissive | function validate(parameters){
if((typeof parameters) !== 'object'){
process.stderr.write('* error *\n')
} else {
process.stdout.write('OK\n');
}
}
process.stdout.write('= Validation Tests =================\n');
validate();
validate(null);
validate(1);
validate('bravo');
validate("charlie");
validate([4... | true |
900dd901120aa7620ac071989150a21f60b40280 | JavaScript | harlamad/harlamad.github.io | /dash.js | UTF-8 | 2,398 | 2.953125 | 3 | [] | no_license | var game;
var car;
var dash;
var taco;
var tacos = [];
var MAXDASH = 5;
var dashes;
var MAXTIME = 20;
var timer;
var time;
var gui;
var score = 0;
function checkCollisions(indexCrash){
if (tTacos.collidesWith(dash[indexCrash])) {
dash[indexCrash].reset();
score += 10;
}
}
function check... | true |
b2ce52f6a351ce73d097bfedd66f35160735c6d5 | JavaScript | sadmanf/SadmansProjects | /reversi/src/reversi.js | UTF-8 | 6,105 | 3.703125 | 4 | [] | no_license | 'use strict'
function repeat(value, n) {
const arr = [];
for (let x = 0; x < n; x++){
arr.push(value);
}return arr;
}
function generateBoard (rows, columns, initialCellValue){
return repeat(initialCellValue, rows*columns);
}
function rowColToIndex(board, rowNumber, columnNumber){
const sideLength = Ma... | true |
7a26733a2f9223cd75d410d4354eb6b14d9835fb | JavaScript | muggezifter/khl4express | /khl4/chord.js | UTF-8 | 2,136 | 2.875 | 3 | [] | no_license | var geographicLib = require('geographiclib');
var geod = geographicLib.Geodesic.WGS84;
var mongoose = require( 'mongoose' );
var Grid = mongoose.model('Grid');
/**
* Compute the distances of the given lat/lon to the points defined in the points array.
* Order by distance, take the 3 closest ones, convert distance to... | true |
78f29ea9532ba35479c1e0fbaa84b6caed4718ca | JavaScript | AILINGANGEL/leetcode | /Math/isPalindrome.js | UTF-8 | 776 | 3.84375 | 4 | [] | no_license | var isPalindrome = function(x) {
if(x < 0) return false;
if(x < 10) return true;
let nums = [];
while(x !== 0) {
nums.push(x % 10);
x = Math.floor(x/10);
}
return nums.join('') === nums.reverse().join('');
};
var isPalindrome = function(x) {
if(x < 0 || (x !== 0 && x % 10... | true |
74e9f25555d35a24239ed9072d4e45cf9b5b9cde | JavaScript | giscrazier/ThemeRiver- | /src/script/Chart.js | UTF-8 | 14,481 | 2.578125 | 3 | [
"MIT"
] | permissive | /**
* 项目名称 - 版本号
* 类名称
* @author : lenovo
* 基础类
* @description : 请添加描述信息
* @date : 2017/3/24
*/
"use strict";
let d3 = require('d3');
import {Common} from './Common.js';
class Chart{
constructor(svg){
if(new.target !== Chart){
throw new Error("Chart 不是函数,请使用new来生成实例~~~");
}
... | true |
0d4f2a7dc13f87ccec211f6771e35f326eb6b5d0 | JavaScript | eudoal/programacion | /Comprobar Pares/js/comprobar_2_pares.js | UTF-8 | 449 | 3.78125 | 4 | [] | no_license | do {
var num1=prompt("Introduce el primer número");
var num2=prompt("Introduce el segundo número");
if ((num1%2!=0)&&(num2%2==0)) {
alert(num1+ " NO es un número par");}
if ((num1%2==0)&&(num2%2!=0)) {
alert(num2+ " NO es un número par");}
if ((num1%2!=0)&&(num2%2!=0)) {
alert("El número "+ num1+ " y el nú... | true |
466297cafa1361959394fb78bf613296cafb1876 | JavaScript | devsumanmdn/sse-chat | /site/redux/auth/authReducer.js | UTF-8 | 947 | 2.578125 | 3 | [] | no_license | import {
LOGIN_REQUEST,
LOGIN_FAILURE,
SIGNUP_REQUEST,
SIGNUP_FAILURE,
LOGOUT_REQUEST,
LOGOUT_FAILURE
} from './authActionTypes';
const exampleInitialState = {
auth: {
user: null,
isLoggedIn: false,
loggingIn: false,
signingUp: false,
loginError: '',
signupError: ''
}
};
const ... | true |
cebba719d511bb4fa857b894a1a1d93b56674d71 | JavaScript | Uplink03/solarcrusaders | /src/client/objects/sector/Ship/Damage.js | UTF-8 | 3,572 | 2.671875 | 3 | [] | no_license |
var engine = require('engine');
function Damage(ship) {
this.ship = ship;
this.game = ship.game;
this.glow = new engine.Sprite(this.game, 'texture-atlas', 'explosion-d.png');
this.glow.pivot.set(64, 64);
this.glow.scale.set(24.0, 24.0);
this.glow.blendMode = engine.BlendMode.ADD;
this.glow.tint = 0xff... | true |
b3f4ae9d34d97626920a396d8d68c6f3406aa616 | JavaScript | ibrahimmalii/ITI-Tasks | /JQuery/Lab2/js/crud.js | UTF-8 | 1,246 | 2.578125 | 3 | [] | no_license | $(function(){
var counter = 0;
$('#add').click(function(){
($('#name').val() == 0 || $('#age').val() == 0)?
alert('please insert your info and try again'):
$('tbody').append('<tr id='+(counter++)+'><td>'+$("#name").val()+'</td><td>'+$("#age").val()+'</td><td><button class="delet... | true |
812b7b65f29c5fa7f3e7d893b7fc0d1d25f1ecd0 | JavaScript | haltcase/stunsail | /src/defaults.js | UTF-8 | 730 | 2.75 | 3 | [
"MIT"
] | permissive | import isObject from "./is-object.js"
import isIterable from "./is-iterable.js"
import isPrimitive from "./is-primitive.js"
const isTraversable = v => isIterable(v) || isObject(v)
export default function defaults (object, extension) {
if (isPrimitive(object)) return object
return base(object, extension, (obj, ex... | true |
f5406fd313c106e048778639d597ccda0786d88c | JavaScript | Jeiji/spies_algo_hackerrank | /spies_random_with_diagonal.js | UTF-8 | 4,101 | 3 | 3 | [] | no_license | function printGrid( n ) {
let grid = [];
let row = [];
// Shifting Rows
for ( i = 0; i < n; i++ ) {
//Printing Columns
for ( j = 0; j < n; j++ ) {
row.push('| |');
}
grid.push( row );
row = [];
}
return grid
}
let points = [];
function spyFree( grid , row , col , points ) {
let mark = 0;
if ( row > 0 ) {
// con... | true |
9be1c5ca702104f9493d7d5f0524854e722e073b | JavaScript | sheweichun/lovee | /src/util/index.js | UTF-8 | 1,628 | 2.765625 | 3 | [] | no_license | 'use strict';
export const $ = (dom, parentDom = document) => {
return dom instanceof HTMLElement ? dom : parentDom.querySelector(dom);
};
export const $$ = (dom, parentDom = document) => {
return dom instanceof HTMLElement ? dom : parentDom.querySelectorAll(dom);
};
function normalAttributeName(name) {
ret... | true |
d5c59b7c9b66adbc2ccd32561c11cc9d1db9d740 | JavaScript | Maxwell-Han/minesweeper-js | /game.js | UTF-8 | 3,544 | 3.515625 | 4 | [] | no_license | class Tile {
constructor(game, coords, val) {
this.game = game;
this.coords = coords;
this.val = val;
this.revealed = false;
}
// click will grab tile from board[row][col] and tile will call .flipTile
getNeighbors() {
const neighbors = [];
let rowIdx = this.coords[0];
let colIdx = th... | true |
381f1129bad4ae6ee04e684f140b0bad35c41cc4 | JavaScript | Xieyusam/court-H5 | /src/util/common.js | UTF-8 | 2,506 | 2.921875 | 3 | [] | no_license | export function courtType(value){
value = parseInt(value)
const type = [
"",
"羽毛球",
"篮球",
"乒乓球",
"桌球",
"网球",
"排球"
]
return type[value]
}
export function orderTimeType(value){
value = parseInt(value)
const type = [
"9:00 - 10:00",
... | true |
aab3144b82a3ae11d3e01f4cb3f4643ae3d41ddd | JavaScript | Sap-Test/Class3Lab1 | /click.js | UTF-8 | 318 | 3.78125 | 4 | [] | no_license | let numberOfClicks = 0;
function click()
{
numberOfClicks++;
return numberOfClicks;
}
function totalClicks()
{
let finalCount = click();
return finalCount;
}
function printClicks()
{
let finalCount = totalClicks() ;
alert("You Clicked " + (finalCount-1) + " times")
numberOfClicks = 0;
} | true |
5e6925cdd7ad0a6e4b530a2f148f662c8f16d598 | JavaScript | PWhids/psim | /src/ParticleSystem.js | UTF-8 | 824 | 2.953125 | 3 | [] | no_license |
class ParticleSystem {
constructor() {
this.parts = [];
this.interactions = [];
}
addPart(part) {
this.parts.push(part);
}
addInteraction(inter) {
this.interactions.push(inter);
}
update() {
this.interactPairs();
for (let p of this.parts) ... | true |
a796b612e2bf9b0bc91b8ceb80aea391f96191b2 | JavaScript | KimberlyHansen/a3web | /script.js | UTF-8 | 1,016 | 3.40625 | 3 | [] | no_license | // added by Aaron Jutzi December 6, 2020
// toLocaleString() source: https://www.geeksforgeeks.org/how-to-convert-date-to-another-timezone-in-javascript/
// list of js timezone names: https://gist.github.com/rxaviers/8481876
// assigning timezones times to variables
var d = new Date();
var auw = d.toLocaleString("en-U... | true |
d1b02bbbf896f7bd904144db6256641cf0e77719 | JavaScript | davidchappy/sample-react-project | /src/utils/colorUtils.js | UTF-8 | 218 | 2.8125 | 3 | [] | no_license | // TEST THIS
export function rgbToHex(rgbArray) {
const r = Number(rgbArray[0])
const g = Number(rgbArray[1])
const b = Number(rgbArray[2])
return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
} | true |
ca697f4cdf6c72f60c8e5a5b608ee34f6fa3c242 | JavaScript | PeTeR0316/react-node.js-MySQL | /src/components/ReadBoard.js | UTF-8 | 3,208 | 2.5625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
import '../css/readBoard.css'
const ReadBoard = (props) => {
const { boardNo } = props.match.params;
const [boardInfo, setBoardInfo] = useState([]);
//const [writepassword, se... | true |
acbeefdf455ae701e9561892b3d95bfab99b377b | JavaScript | derekchan916/learn-new-things | /react-testing/widgets/tabs.jsx | UTF-8 | 1,149 | 2.578125 | 3 | [
"ISC"
] | permissive | var React = require('react');
var Headers = React.createClass({
render: function() {
var selected = this.props.selectedPane;
var that = this;
var headers = this.props.panes.map(function (pane, index) {
var title = pane.title;
var klass = ""
if (index === selected) {
klass = "act... | true |
98fb9d125e468763f09f0504c45cdd13e2ca89bf | JavaScript | Sasha95/timer | /src/UseNewTimer.js | UTF-8 | 349 | 2.890625 | 3 | [] | no_license | import { useEffect, useState } from 'react'
export const useNewTimer = (currentDate) => {
const [date, setDate] = useState(currentDate);
useEffect(() => {
const tick = () => {
setDate(new Date());
}
let id = setInterval(tick, 1000);
return () => clearInterval(id);
... | true |
018d41761284fd196dc1e146e3b44c438effa82d | JavaScript | M5150/algotraining | /lruCacheES6.js | UTF-8 | 2,606 | 3.515625 | 4 | [] | no_license | class LRUCache {
constructor (limit) {
this._hash = {};
this._limit = limit || 10;
this.size = 0;
this._list = new List();
};
setItem (key, value) {
if (this._hash[key]) {
const node = this._hash[key];
node.value = value;
node.moveToHead();
return node;
} else {
... | true |
f3a88ee9a9532e99f6b592ab799736cc9e119ac4 | JavaScript | ncase/remember | /sims/splash/Mouse.js | UTF-8 | 1,347 | 2.890625 | 3 | [
"CC0-1.0",
"CC-BY-4.0",
"LicenseRef-scancode-proprietary-license",
"CC-BY-NC-4.0",
"LicenseRef-scancode-public-domain"
] | permissive | (function(exports){
// Singleton
var Mouse = {
x: undefined,
y: undefined,
pressed: false,
update: function(){
if(Mouse.x!==undefined && Mouse.y!==undefined){
if(Mouse.lastX===undefined) Mouse.lastX=Mouse.x;
if(Mouse.lastY===undefined) Mouse.lastY=Mouse.y;
Mouse.velX = Mouse.x-Mouse.lastX;
... | true |
e7a232e2d4d5fdac589ea9c94c0ed0c3bbcc436e | JavaScript | slothmonster/currency-converter-module | /test/index.js | UTF-8 | 1,554 | 2.640625 | 3 | [] | no_license | var chai = require('chai');
var should = require('chai').should();
var expect = require('chai').expect();
var chaiAsPromised = require('chai-as-promised');
var path = require('path');
// var currency = require('../index')(); // ({currencyFile: path.join(__dirname, './testRates.txt')});
// var conversionRate = currency... | true |
10bdb134e2d4048c5d0383346f0ebef34e29d0f1 | JavaScript | WolneSady/WolneSady | /functions/index.js | UTF-8 | 3,240 | 2.546875 | 3 | [] | no_license | // The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');
// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');
let firebaseConfig = functions.config().firebase;
firebaseConfig.databaseAu... | true |
a9342dcfecea13deda06b8aaf3a95661f8e3df57 | JavaScript | ange47rm/JS_DOM-Notes | /dom_basics.js | UTF-8 | 2,849 | 4 | 4 | [] | no_license | // app.js is included in the script tag of the HTML document (usually placed in the HEAD but it doesn't have to be there)
// document is representng our HTML as a JS object
console.log('The app has loaded', document);
// listen for DOMContentLoaded EVENT being triggered by the browser (AUTOMATICALLY triggered once br... | true |
9863bc620b90f5af9709af3cfc9df44118a6d962 | JavaScript | linkedin-replica/front-end | /src/components/wrappers/GridView.js | UTF-8 | 2,447 | 2.71875 | 3 | [] | no_license | /**
* A grid adapter which is responsible for rendering all types of lists in a grid view
* takes input data and a single view, then renders a grid containing
* this view rendered for each data item
* It can also be split horizontally and vertically to have some spacing
* */
import React, { Component } from 'rea... | true |
80d4e44f9cbe78e7f8fb49504be4b175d43f44bc | JavaScript | belowrainsky/HSBleGather | /src/lib/parseBuffer.js | UTF-8 | 18,663 | 2.703125 | 3 | [] | no_license | import { Buffer } from 'buffer';
import aesjs from 'aes-js';
import {
Toast,
} from 'native-base';
let cacheBuffer = Buffer.alloc(0); // 暂存数据
const key = Buffer.from("Wesley2017-03-16");
const aes = new aesjs.AES(key);
function decryptData(encryptedBuffer) {
const array = Array.from(encryptedBuffer);
const c... | true |
5a2df6a5f694ab4efa1f7d4e954f51a94809ecc0 | JavaScript | eldh/jour | /src/DiaryHooks.bs.js | UTF-8 | 3,632 | 2.546875 | 3 | [] | no_license | // Generated by ReScript, PLEASE EDIT WITH CARE
import * as Curry from "rescript/lib/es6/curry.js";
import * as Hooks from "./Hooks.bs.js";
import * as React from "react";
import * as DateFns from "./DateFns.bs.js";
import * as DiaryFs from "./DiaryFs.bs.js";
import * as $$Promise from "reason-promise/src/js/promise.b... | true |
2a65d44e7149c9fe5cb6d42c3826c03dc74e58fb | JavaScript | Kulek-Kulek/zad2-UnitTests-24.5 | /calculateDistancePoints.js | UTF-8 | 677 | 3.421875 | 3 | [] | no_license | /**
HILLSIZES
1 - normal
2 - big
3 - superbig
*/
const calculateDistancePoints = (distance, hillSize, kPoint) => {
//Punkty "na start"
let points = 60;
//dla ulatwienia zakladam ze skocznia jest normalna
let pointDiff = 2;
//aktualizacja ustawien jesli skocznia jest duza
if(hillSize===2){
... | true |
df9e365b772c194682b7f383a5d86cbc613192c2 | JavaScript | adobnikar/sudoku-solver | /tests/test-004-solve-db.js | UTF-8 | 1,566 | 2.84375 | 3 | [] | no_license | 'use strict';
const fs = require('fs');
const path = require('path');
const walk = require('../helpers/fs-walk');
const { solve } = require('../index');
const { print } = require('../print');
const { parse, validateGrid, validateFullGrid, isSubGrid } = require('../validate');
const SUDOKU_DB_PATH = path.resolve(__dir... | true |
78e8329a85553e08a4e750e6940b8d3c9ad4202c | JavaScript | htmlacademy-nodejs/195662-typoteka-3 | /src/service/cli/filldb.js | UTF-8 | 3,020 | 2.5625 | 3 | [] | no_license | 'use strict';
const sequelize = require(`../lib/sequelize`);
const initDatabase = require(`../lib/init-db`);
const {getLogger} = require(`../lib/logger`);
const {readContent, getRandomInt, shuffle} = require(`../../utils`);
const {FileExtension} = require(`../../constants`);
const FILE_USERS_PATH = `./data/users.json... | true |
a31145697da0d5d4aa3a4722d9a302c4360b077c | JavaScript | hro-maker/codewars | /equal_sides_of_an_array/equal_sides_of_an_array.js | UTF-8 | 194 | 3.21875 | 3 | [] | no_license | const sum = xs => xs.reduce((a, b) => a + b, 0)
const findEvenIndex = xs => {
for (let i = 1; i < xs.length; i++)
if (sum(xs.slice(0, i)) === sum(xs.slice(i + 1))) return i
return -1
}
| true |
37667653d2ec88f78b44e0d6bdeffe79641fa69b | JavaScript | dalime/Met-Museum-Artwork | /client/src/App.js | UTF-8 | 3,269 | 2.84375 | 3 | [] | no_license | import React, { useState, useEffect, useRef } from 'react';
import Artwork from './components/Artwork';
import './App.css';
function App() {
// Component state
const [objectIDs, setObjectIDs] = useState([]);
const [currentObjectIndex, setCurrentObjectIndex] = useState(null);
const [pauseTimer, setPauseTimer] ... | true |
1adf83d2e3fbe40cc7597864d1978e25dbc42d75 | JavaScript | BOBKOVSERGEY/js-full | /localStorage/index.js | UTF-8 | 1,355 | 3.359375 | 3 | [] | no_license | // записываем данные
//localStorage.setItem('number','1');
// получаем данные по ключу
//console.log(localStorage.getItem('number'));
// удаляем о ключу
//localStorage.removeItem('number');
// очищаем полностью хранилище
//localStorage.clear();
window.addEventListener('DOMContentLoaded', function () {
let checkb... | true |
70dfeb2c2236b300e2880e671c0f618372537bfc | JavaScript | Sandy-Tran/Javascript-Exercices-Part1 | /Exo5/app.js | UTF-8 | 325 | 3.234375 | 3 | [] | no_license | function displayResult(){
var firstNumber = document.getElementById('first').value;
var secondNumber = document.getElementById('second').value;
result = firstNumber * secondNumber;
if(firstNumber && secondNumber){
alert ('Le resultat est :' + (result));
}else {
alert ('Faut remplir on a dit là!')
... | true |
ba4de8a7f2e50df17c3275c624dccfc64087d10e | JavaScript | nikolaitrifonov0/tvtracker | /utilities/errorHandler.js | UTF-8 | 238 | 2.546875 | 3 | [] | no_license | export default function handleError(e) {
const notif = document.querySelector('.error-notification');
notif.textContent = e.message;
notif.style.display = 'block';
setTimeout(() => {notif.style.display = 'none';}, 3000);
} | true |
48890f2fa39a094cb76a6bebe5312e94b37d6d56 | JavaScript | langliu/dsaj | /src/hash-map.js | UTF-8 | 2,330 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | import { LinkedList } from "./linked-list";
class HashMap {
constructor() {
this.map = [];
}
put(key, value) {
const position = HashMap.loseLoseHashMapCode(key);
this.map[position] = value;
}
remove(key) {
this.map[HashMap.loseLoseHashMapCode(key)] = undefined;
}
get(key) {
return ... | true |
c6c7574867e9ebe355f38e34b640789c42f0e09a | JavaScript | shukladolly/Synup-assignment | /react-synup-calendar/src/components/Events.js | UTF-8 | 1,961 | 2.703125 | 3 | [] | no_license | import React, { Component } from 'react';
import '../App.css'
class Events extends Component {
constructor() {
super();
this.state = {
name: "",
events: [{ name: "" }]
};
}
handleEventChane = idx => evt => {
const newEvents = this.state.events.map((... | true |
5452e4516bb602e30c501d0feaf472617d6bfa53 | JavaScript | sandeeprewa/waterbill | /src/main/webapp/js/loginjs/utility.js | UTF-8 | 1,499 | 2.75 | 3 | [] | no_license | /**
* New node file
*/
function animateToTop(){
$('html, body').animate({
scrollTop: $("#main").offset().top
}, 0);
}
function resetForm(id){
$('#'+id)[0].reset();
}
function equal(val1,val2){
return val1==val2;
}
function removeHTMLValue(id){
$("#"+id).html("");
}
function focusOn(id){
$("#"+id)... | true |
df2953640460f53d779c019f7f17e7884eed5959 | JavaScript | Shahman-Butt/Algorithm-Visualizer | /mainAlgo/static/mainAlgo/BST.js | UTF-8 | 13,750 | 3.03125 | 3 | [] | no_license | //Making the Visual Stuff here
var svgNS = "http://www.w3.org/2000/svg";
id = 0;
function additem(node, par, radius, firstitem,len) {
var svr = document.createElementNS(svgNS, "circle")
svr.setAttributeNS(null, 'id', 'circle' + node.id)
svr.setAttributeNS(null, 'cx', node.x);
svr.setAttributeNS(nu... | true |