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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
2dcbc0965135c044f822224dc6c156cbbed2eae5 | JavaScript | lk-architecture/lh-worker | /test/steps/exec-lambdafile.js | UTF-8 | 11,258 | 2.5625 | 3 | [
"MIT"
] | permissive | import chai, {expect} from "chai";
import {range} from "ramda";
import sinon from "sinon";
import sinonChai from "sinon-chai";
import execLambdafileModule from "steps/exec-lambdafile";
chai.use(sinonChai);
describe("getRunCommands", () => {
const getRunCommands = execLambdafileModule.__GetDependency__("getRunCo... | true |
34ab38bd9494a07d79f1fe58d251193c6313f010 | JavaScript | Hossamshin/hyf-homework | /javascript/javascript1/week1/ez-namey.js | UTF-8 | 682 | 3.65625 | 4 | [] | no_license | // ******* Ez Namey *******
const firstWords = ["Easy", "Awsome", "Evolutionary", "Approachable", "Creative", "Authentic", "Trustworthy", "Motivated", "Professional", "Reliable"];
const secondWords = ["Company", "Innovation", "Factory", "Corporation", "World", "House", "Future", "Future Planners", "Dream", "Business"]... | true |
40bfea84ca67d80a38b1b7f573afd22556af86d4 | JavaScript | ujjawal30/covid19-tracker-india | /static/js/search.js | UTF-8 | 5,081 | 3.015625 | 3 | [
"MIT"
] | permissive | var states = [];
var statesDOM = document.getElementsByClassName("state-name");
for (i = 0; i < statesDOM.length; i++) {
states.push(statesDOM[i].textContent);
}
String.prototype.toTitleCase = function () {
return this.replace(/\w\S*/g, function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLow... | true |
dab59822a53b6ccea967136f782fdb6f5a690a4e | JavaScript | klingeroliveira/curso_rocketseat | /launchbase/module_05/src/app/models/members.js | UTF-8 | 4,067 | 2.6875 | 3 | [] | no_license | const db = require('../../config/db')
const { date } = require('../../lib/utils')
module.exports = {
all(callback){
db.query(`SELECT * FROM members ORDER BY name`, function(err, results){
if (err) throw(`Erro ao buscar dados! ${err}`)
callback(results.rows)
})
},
... | true |
9ef69dcbb231da3a747318c181e8e3d2bd26ad5e | JavaScript | jimzhe842/launch-school | /JS101/lesson_3/easy1/1-7.js | UTF-8 | 461 | 4 | 4 | [] | no_license | // question 7
// let str1 =
// "Few things in life are as important as house training your pet dinosaur.";
// let str2 = "Fred and Wilma have a pet dinosaur named Dino.";
// console.log(str1.includes("Dino")); // false
// console.log(str2.includes("Dino")); // true
// alternative solutions:
// str1.match('Dino') !... | true |
757df024e4069304e86bb4a64251b96e2d525ef6 | JavaScript | WaZhen/vwLib | /src/FileSystem/VwFile.js | UTF-8 | 3,899 | 2.984375 | 3 | [
"MIT"
] | permissive | import generaLogError from '../Debug/VwErrorLog'
/**
* @classdesc
* Utilidades para gestionar ficheros
* @hideconstructor
*/
export default class VwFile {
/**
* Leer una línea de un fichero en texto plano
* @param {string} filePath Ruta del fichero
* @param {int} position Posición del cursor
... | true |
4743f53b48c82ffd78b580b276de2b96ca7d1338 | JavaScript | sanjeevuideveloper/React_Redux | /assignments/30_04_21/Part 1/Lodash_Random.js | UTF-8 | 213 | 2.71875 | 3 | [] | no_license | const _ = require("lodash")
console.log('The _.random function produces random values between the inclusive lower and upper bounds.');
let r = _.random(10);
console.log(r);
r = _.random(5, 10);
console.log(r);
| true |
c9f7859b34b9136224b899edbec7356e150fd702 | JavaScript | nguyenlan13/toolset-frontend | /src/components/Login/LoginForm.js | UTF-8 | 901 | 2.71875 | 3 | [] | no_license | import React, { useState } from "react";
const LoginForm = (props) => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const handleSubmit = event => {
event.preventDefault();
// send the inputs to the login thing
console.log(email, password);
setEmail("");
... | true |
aa637cfc5d914c304dcc5f776b44f13e732abd5c | JavaScript | techinnovationlabs/react-flexible-image-grid | /src/App.js | UTF-8 | 2,572 | 2.53125 | 3 | [] | no_license | import React from 'react';
import './App.css';
function App() {
const [pictures, setPictures] = React.useState([
"https://s3-ap-southeast-2.amazonaws.com/images.getjarvis.com.au/9068b2bd089c037a144fc847b9967ee83dce0fe5299261a884adc3241a33604b.jpeg",
"https://homepages.cae.wisc.edu/~ece533/images/airplane.png... | true |
8fc955e908af00577c559436a880855c1c5b0dba | JavaScript | cuponomia/dojo | /slackbot-2022-05-13/index.js | UTF-8 | 2,204 | 2.65625 | 3 | [] | no_license | // init project
var express = require("express");
var bodyParser = require("body-parser");
var app = express();
var url = String(process.env.HOSTNAME).split("-");
var postImage = require("./postImage.js");
const fetch = require("node-fetch");
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true ... | true |
16cd55d1103d1ab372bd3e8acfadcc3bc82673c0 | JavaScript | ironhack-labs/lab-react-ironnutrition | /style-guide/AddFoodForm.example.js | UTF-8 | 780 | 2.65625 | 3 | [] | no_license | // Style Guide:
// In this file you can find a reference example of the structure
// and content that the component should render.
// Remember to import Ant Design components before using them.
import { Divider, Input } from 'antd';
// Iteration 4
function AddFoodForm(props) {
return (
<form>
<Divider>Add ... | true |
563f33578e4f104214c404ce251d7308dd007621 | JavaScript | b3b3r/game1 | /src/Components/Random.jsx | UTF-8 | 1,363 | 2.84375 | 3 | [] | no_license | import React, { Component } from 'react';
import Card from './Card';
import './Random.css';
class Random extends Component {
constructor(props) {
super(props);
this.state = {
cards: [],
random: [],
deck: []
}
}
componentDidMount() {
fetch... | true |
faed06d83462c577efe00ac4b1c0fc929add1d43 | JavaScript | lucasspeixoto/cursojs | /objeto/heranca4.js | UTF-8 | 1,348 | 4.15625 | 4 | [] | no_license | function MeuObjeto() {}
console.log(MeuObjeto.prototype)
const obj1 = new MeuObjeto
const obj2 = new MeuObjeto
/* obj1 e obj2 vão apontar para object.prototype ou para MeuObjeto.prototype ? */
console.log(obj1.__proto__ === obj2.__proto__)
/* Todos os objetos criados a partir da mesma função construtora
apo... | true |
d3d5bc808ec3aa84a0b6d0073221c599505d92da | JavaScript | katymccloskey/phase-0-tracks | /web_dev/client_side_js/script.js | UTF-8 | 339 | 2.796875 | 3 | [] | no_license | console.log("The script is running!");
function addBorder(event) {
console.log(event);
event.target.style.border = "10px dashed green";
}
var els = document.getElementsByTagName("h1");
var el = els[0]
el.addEventListener("click", addBorder);
var photo = document.getElementById("cauliflower");
photo.style.border... | true |
f26413adbf5684ccc6dbfdaa8283afb8d2a8795d | JavaScript | tomasotosolini/p0002 | /assets/javascripts/form3.js | UTF-8 | 2,618 | 2.53125 | 3 | [
"MIT"
] | permissive |
function toggle_explaincheck(check, explain){
var c = $(check);
var e = $(explain);
if( c.checked ){
e.style.display = 'block';
}
else {
e.style.display = 'none';
}
}
function toggle_checkcontrolleditem(check, controlleditem){
var c = $(check);
var ci = $(controlleditem);
if( c.checked ){
ci.styl... | true |
138ed30bc7a0a01b7048346d6fd09bb58852d447 | JavaScript | adrianshep/learnyoureact | /state.js | UTF-8 | 6,269 | 3.234375 | 3 | [] | no_license |
/*
Here's the official solution in case you want to compare notes:
────────────────────────────────────────────────────────────────────────────────
solution.js:
var express = require('express');
var app = express();
app.set('port', (process.argv[2] || 3000));
app.set('view engine', 'jsx');
ap... | true |
7fcb8bcb81b894e2e0b0b032e4516188fca26a7f | JavaScript | PaulinaGomez/project1 | /assets/scripts/youtube.js | UTF-8 | 2,872 | 2.546875 | 3 | [] | no_license | var config = {
apiKey: "AIzaSyBTUty_2eQIF51UpzBShEe0XvRUwsdtEzc",
authDomain: "weightloss-c69df.firebaseapp.com",
databaseURL: "https://weightloss-c69df.firebaseio.com",
projectId: "weightloss-c69df",
storageBucket: "weightloss-c69df.appspot.com",
messagingSenderId: "360811521364"
};
firebase.in... | true |
476a5604ace18fb079d8e8f9c988d4d65f56c6a6 | JavaScript | emilianobovetti/brockman | /src/utils/storage.web.js | UTF-8 | 1,656 | 2.53125 | 3 | [] | no_license | /* From: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB */
const indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
if (indexedDB == null) {
throw new Error('IndexedDB not supported');
}
const deferredRequest = dbRequest => new Promis... | true |
eb3260b43abb2cbdda0bbf6af121715c52db6502 | JavaScript | luongtrongq/BaiTapJSBuoi9-10 | /js/main.js | UTF-8 | 8,056 | 3 | 3 | [
"MIT"
] | permissive | // DOM
document.getElementById("btnThemNV").addEventListener("click",themNV);
//Bước 5: viết hàm delete dựa vào khái niệm event bubbling;
document.getElementById("tableDanhSach").addEventListener("click",deleteNV);
// Bước 1:Tạo ra lớp đối tượng nhân viên gồm các thuộc tính;
document.getElementById("btnCapNhat").addEv... | true |
425679c1437a1f4b9bd4517c92e868a9e61b40dd | JavaScript | keshav2421/project-24 | /sketch.js | UTF-8 | 690 | 2.703125 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var engine,world
var paper
var lside
var bottom
var rside
var land
function setup() {
createCanvas(800, 400);
engine = Engine.create();
world = engine.world;
Engine.run(engine);
land=createSpr... | true |
2810479b755eca7eae05804a2ac27bd0401255f0 | JavaScript | jdrichardstech/Tools | /algo/noRepeatLetters.js | UTF-8 | 278 | 3.15625 | 3 | [] | no_license | // wirte a function that accepts a string as its input, and returns the same string just with duplicate letter removed
function noRepeat(str) {
let x = new Set();
let arr = str.split('').map(item => x.add(item));
return Array.from(x).join('');
}
noRepeat('Mississippi');
| true |
c8030a737fc97be99beff7ba332f7ba916e085dd | JavaScript | mrspeaker/basicinstinct | /src/logic/sensors/Random.js | UTF-8 | 393 | 2.859375 | 3 | [] | no_license | const Sensor = require('./Sensor');
class Random extends Sensor {
constructor (oneIn = 20, delay = 0) {
super();
this.oneIn = oneIn;
this.delay = delay;
this.ticks = 0;
}
update () {
if (this.ticks++ < this.delay) {
return;
}
const val = Math.random() * this.oneIn | 0;
if... | true |
30e6f4a0fd6a5ff139015e3c50d3f96470727174 | JavaScript | Gioo9le/bang_api | /routes/index.js | UTF-8 | 420 | 2.78125 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min; //Il max è escluso e il min è incluso
}
/* GET home page. */
router.get('/', function(req, res, next) {
let randC... | true |
153f65eff5f693a4bf7e9e9c0aaf26b53f83dd2d | JavaScript | jasminsaromo/bb_election_starter_code | /bbelection/static/js/main.js | UTF-8 | 510 | 3.078125 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", function() {
axios.get('https://bb-election-api.herokuapp.com/')
.then(response => {
let data = response.data.candidates;
var list = document.getElementById('candidates');
data.forEach(candidate => {
let liTag... | true |
325494bde788833ec1f04193414435d6b27ecf83 | JavaScript | pforro/ChessPro | /static/js/chess/game_control.js | UTF-8 | 3,239 | 2.734375 | 3 | [] | no_license | import {socketEvents} from "./socket_events.js";
import {queen} from "./pieces/queen.js";
import {king} from "./pieces/king.js";
import {rook} from "./pieces/rook.js";
import {bishop} from "./pieces/bishop.js";
import {knight} from "./pieces/knight.js";
import {pawn} from "./pieces/pawn.js";
import {timer} from "./time... | true |
15576b1839e65d74922b9e99c8d5ca998cfdb4ad | JavaScript | matthewbdaly/JSBasicShell | /static/js/shell.js | UTF-8 | 5,030 | 3.25 | 3 | [] | no_license | function ShellSession() {
'use strict';
// Define the loading message
this.loadmessage = "JS Basic 1.0";
// Define the prompt
this.prompt = '> ';
// Create the history stack
this.history = [];
// Create a pointer for the history
this.pointer = null;
}
ShellSession.prototype.ente... | true |
c438104bb4b6482a12a9da273165ad2fb3b12001 | JavaScript | lsudigitalart/2019-2210-hw6-samblaeser | /sketch.js | UTF-8 | 2,832 | 2.5625 | 3 | [] | no_license | var pic1;
var flying;
var ipod;
var pic2;
var pic3;
var pic4;
var pic5;
var pic6;
var pic7;
var pic8;
var pic9;
var pic10;
var pic11;
var pic12;
var pic13;
var bgpic;
var pic14;
var pic15;
var pic16;
var pic17;
var s = 10;
var s2 = 10;
var s3 = 10;
var s4 = 10;
var s5 = 10;
var s6 = 10;
var s7 = 10;
var s8 = 10;
var s9... | true |
977a7dbef1e739188f12fcf5f096a10c1e11b393 | JavaScript | nightnei/t-shaped.org | /js/main.js | UTF-8 | 3,352 | 2.75 | 3 | [] | no_license | $(window).on('load', function(){
if($(window).width() < 768) return;
$('.mainMenu ul li a').on('click', function(e){
var hash = e.originalEvent.currentTarget.hash;
if(!hash) return;
e.originalEvent.preventDefault();
$('html, body').animate({
scrollTop: $(hash).offset().top - 70
}, 600, 'linea... | true |
e25362c9518c4fb49975371841f903006f0b5f20 | JavaScript | sergioatf17/actividad2_DOM_BOOSTRAP | /javascript.js | UTF-8 | 940 | 3.046875 | 3 | [] | no_license |
const formEl = document.querySelector("form"); //Se utilizo el queryselector para cada elemento y no el queryselectorall
const tbodyEl = document.querySelector("tbody");
const tableEl = document.querySelector("table");
function onAddtxt(e) {
e.preventDefault();
const price = doc... | true |
14630667a21e8d6ff5705fdfd2a86e7171e3c546 | JavaScript | Alexandruus/some-more-python-js-modules | /Eriksson_Alexander_Uppgift4/index.js | UTF-8 | 2,698 | 2.875 | 3 | [] | no_license | //Alexander Eriksson, 19940902-5971
//WEBPROG, Uppgift 4
//macOS
//För for-loopen i validateBic() samarbetade jag med kurskamrat Björn Malmborg
function validateEmail() { //Funktion för att validera email-input
var universitet = document.getElementById("universitet"); //a... | true |
725e243780c78f4503609bf5a0886c16570c2ac6 | JavaScript | vkefallinos/fallingrain-scraper-desktop-app | /src/scraper.js | UTF-8 | 4,768 | 2.578125 | 3 | [] | no_license | const fs = require("fs")
const tokml = require("tokml")
const cheerio = require('cheerio')
const url = require('url')
const request = require("request")
const { ipcMain } = require('electron');
function asyncRequest(url){
return new Promise((resolve, reject)=>{
request(url, function (error, response, html) {
... | true |
947a2820f2710ff362b48c431b4f2a59440b8b87 | JavaScript | josedejesusAmaya/REST-API-Challenge | /src/routes/covid.js | UTF-8 | 1,349 | 2.6875 | 3 | [
"MIT"
] | permissive | const express = require('express');
const router = express.Router();
const fetch = require('node-fetch');
// Hello, World
router.get('/', (req, res) => {
res.send('Hello, World');
})
// Info about Covid19 in Mexico
router.get('/info', async (req, res) => {
const info = {
'confirmed': 0,
'suspe... | true |
e2ffb768aceec71b7460582ef7f1a387af50baff | JavaScript | tiboitel/vault | /src/main.mjs | UTF-8 | 373 | 2.5625 | 3 | [] | no_license | import Vault from "./vault.mjs";
async function main()
{
let vault = new Vault();
try
{
await vault.start().then((resolve) =>
{
console.log("-- Vault application started. --");
});
await vault.close().then((resolve) =>
{
console.log("-- Vault application closed. --");
});
} catch (err)
{
cons... | true |
c45c491ffd295c5762976f109615e09623af294e | JavaScript | alejobenghi/frontendtest2021 | /frontend/src/Items/services/index.js | UTF-8 | 1,069 | 2.609375 | 3 | [] | no_license | import axios from 'axios'
const baseUrl = process.env.REACT_APP_BASE_URL
//Obtiene Resultado de Items de API Endpoint de BACKEND
export async function getItemsFront(searchText){
try {
const response = await axios({
url: `${baseUrl}/items?q=${searchText}`,
method: 'GET'
})
... | true |
ef7ed90eddeeeb11f90e1cdb312b3baf047d2a01 | JavaScript | ArmanOmmid/Lab6_Starter | /assets/scripts/RecipeCard.js | UTF-8 | 12,321 | 3.03125 | 3 | [] | no_license | class RecipeCard extends HTMLElement {
constructor() {
super();
const shadowRoot = this.attachShadow({mode: 'open'});
// You'll want to attach the shadow DOM here
}
set data(data) {
// This is the CSS that you'll use for your recipe cards
const styleElem = document.createElement('style');
... | true |
da7cb72ec2e54589fe6ee2d05cc6647d30dfdd5d | JavaScript | AntonioMA/simpleHTTPServer | /index.js | UTF-8 | 6,270 | 2.609375 | 3 | [] | no_license | // Very Simple HTTP server.
// It doesn't keep anything persistent, everything goes the way of the dodo
// when the server is shut down. Tough luck.
function Logger(name, initialValue) {
var _enabled = initialValue;
function log() {
if (_enabled) {
var args = Array.prototype.slice.call(arguments);
... | true |
f514cd61b10ddf0146317dc397558748210933a1 | JavaScript | hao-wang/Montage | /js-test-suite/testsuite/f63bfb8a65d72ebf2df355701c028a5c.js | UTF-8 | 444 | 2.78125 | 3 | [
"MIT"
] | permissive | function test() {
var msg = {};
({
name: msg.name,
"parameters": [msg.callback, ...msg["parameters"]],
0: msg[0]
} = {
name: "test",
parameters: [function cb() { return "test"; }, "a", "b", "c"],
"0": NaN
});
return msg.name === "test" && msg[0] !== ms... | true |
dd355566665ac0a1dfe0d57759dc5b69029b9da8 | JavaScript | Benneee/Project-Sopuru | /main.js | UTF-8 | 2,711 | 3.125 | 3 | [] | no_license | function date() {
let date = document.getElementById("date");
date.innerHTML = Date();
}
//Event for welcome!
let body = document.querySelector("body");
//This is a mouseenter event
//There is a defined boundary, if the mouse enters this boundary, an alert pops up
body.addEventListener("onloadstart", onloadstart);... | true |
6fdfaa47c319719f3fbd97730d76650d28c85913 | JavaScript | ship-components/ceres-framework | /src/render/Pipeline.js | UTF-8 | 2,047 | 2.96875 | 3 | [
"MIT"
] | permissive | /** *****************************************************************************
* Pipeline
*
* @author Isaac Suttell <isaac_suttell@playstation.sony.com>
* @file Render Workflow to help ensure we consistently produce the
* same results across each page and prints
********************... | true |
2577c643939b45d2eeb67fc9d6461f73f0e4aa58 | JavaScript | Val-Assistant/Val-Core | /Front-End/js/main.js | UTF-8 | 446 | 2.96875 | 3 | [
"MIT"
] | permissive | var capturando = "";
var nova_div = document.createElement("div");
function capturar() {
var mbox = document.querySelector(".return");
var capturando = document.getElementById('name');
var textCap = capturando.textContent;
var msg = document.createElement("p");
msg.textContent = "Você: " + te... | true |
755aa991a6127ec3c62f543c4b2ef49661b8bfce | JavaScript | gabebravo/useContext-useReducer-boilerplate | /src/index.js | UTF-8 | 1,137 | 2.609375 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
// default state
const DEFAULT_STATE = { theme: 'light' };
/// _____ GLOBAL CONTEXT FOR REDUCER ____________________
export const GlobalContext = React.createContext(DEFAULT_STATE);
/// __________________ GLOBAL REDUCER ___________... | true |
5bc83fd59f2766023526f605b9dc16a22560788f | JavaScript | shepherdwind/joycss | /lib/css/slice.js | UTF-8 | 1,154 | 2.671875 | 3 | [] | no_license | /**!
* 获得css中所有需要处理的区块,计算图片信息
*
* Copyright(c) Eward.song Limited.
* MIT Licensed
*
* Authors:
* Eward <eward.song@gmail.com> (http://shepherdwind.com)
*/
'use strict';
var util = require('util');
var walk = require('./walk');
function slice(asts){
return walk(asts, collect);
}
/**
* 收集所有需要处理的图片
*
*... | true |
60d600e437efc837c113972c25ca47fe4d1fe7ad | JavaScript | TheMagicalAubster/randomNumbers | /randomNumbers.js | UTF-8 | 974 | 4.375 | 4 | [] | no_license | // Generates an array of 10,000 numbers in random order each time it is run.
// Each number in the list must be unique and be between 1 and 10,000 (inclusive).
// constraints:
// numbers do not repeat
// currently numbers are presented as array
// currently array prints to console
// test output by running randomTest... | true |
4ae4c27167498db65c07b64abe4929c6a81723eb | JavaScript | EduDeLeon21/HTML-JS-CSS | /Eventos JS/js/actions.js | UTF-8 | 3,638 | 3.078125 | 3 | [] | no_license | function onblurButton()
{
alert("has hecho un onblur");
}
function onblurText()
{
var texto = document.getElementById("myTexto");
texto.value = texto.value.toUpperCase();
}
function onblurSelect()
{
var evento = window.event;
switch(evento.type)
{
case "blur":
alert ("onblur")
break;
}
var texto ... | true |
3804fc48c83d1cfec7f8e5892df445379d315ff3 | JavaScript | DanielLiberti/Exercicios | /Lista 1/exe7.js | UTF-8 | 537 | 3.9375 | 4 | [] | no_license | function main(){
//declaração de variaveis
var nro
var soma = 0
var media = 0
var cont = 0
//entrada de dados
while (nro != 0) {
nro = Number(prompt(`Informe um número, e quando quiser parar, aperte 0:`))
soma = soma + nro
cont = cont + 1
}
//operando os da... | true |
5b85a11df29037c16dca3fd713afbce4896af9ed | JavaScript | GemmaBeferull/Promesas | /src/server.js | UTF-8 | 2,600 | 2.78125 | 3 | [
"MIT"
] | permissive | const express = require('express');
const app = express();
// CONFIGURATION:
app.use(express.static('src'));
app.set('view engine', 'pug');
app.set('views', 'views');
// ROUTES:
app.get('/', (req, res) => {
res.render('index', {'variable': 'valor'});
});
app.get('/api/questions', (request, response) => {
let... | true |
57f0471a30e0b07d175577e0113eadc9bbf26818 | JavaScript | martinst93/JS-Advanced | /Sharpening JS skills ( Exercises )/Exercise 1/app.js | UTF-8 | 323 | 3.359375 | 3 | [] | no_license | let unorderedList = document.getElementById('u-l');
let btn = document.getElementById('btn');
let array = ["Martin","Darko","Hristijan","Marija","Anita"];
btn.addEventListener('click',function(){
for(let i = 0 ; i < array.length ; i++){
unorderedList.innerHTML += `<li>${array[i]}</li>`;
}
});... | true |
ce0238764f6c2ae6491b68622ef4feeab71cdf64 | JavaScript | rbrancher/codility-js | /1-time_complexity/TapeEquilibrium.js | UTF-8 | 555 | 2.9375 | 3 | [] | no_license | function solution(A) {
var n = A.length,
left = A[0],
right = A.slice(1).reduce(function (sum, v) { return sum + v; }, 0),
min = Math.abs(left - right);
for (var i = 1; i < n - 1; i++) {
left += A[i];
right -= A[i];
min = Math.min(min, Math.abs(left - right));
... | true |
9055c8f517bf20d10a3b3ec289afc6f357494ea5 | JavaScript | BigBigWen/myBlong | /刷票.js | UTF-8 | 562 | 2.8125 | 3 | [] | no_license | function brushVotes () { // 刷票函数
var t = setInterval(function () {
var three_num = $('#person3>p>span').text() // three票数
var two_num = $('#person2>p>span').text() // two票数
console.info(two_num + ' ' + three_num)
if (two_num - three_num < 5) { // 要保持领先5票的优势
$('#person2>button').click().... | true |
6c7210341f920584ade9e5754046ab07f3a232ed | JavaScript | Sunyy320/onexplorer | /Public/Js/zutuanfatie.js | UTF-8 | 3,198 | 2.78125 | 3 | [] | no_license |
function myFunction1(y)
{
var str=y.value;
var patt=new RegExp(/[0-9][0-9][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]/);
var result=patt.test(str);
if(result){}
else
{
y.value="";
alert("请注意日期的格式或者还没有填写");
}
}
function myFunction2(y)
{
var str=y.value;
var patt=new RegExp(/[amp][m][0-9][0-9]\:[0-9][0-9]... | true |
db8ede629adad419ba5902d901fe5fbc00cde41d | JavaScript | xOtetsuo/JS-Course | /basic_javascript_projects/project5_comparisons_type_coercion/js/main.js | UTF-8 | 1,413 | 3.703125 | 4 | [] | no_license | function Nottrue() {
document.getElementById("NotT").innerHTML = !(5 > 10); //
}
function Notfalse() {
document.getElementById("NotF").innerHTML = !(10 > 5); //
}
const value1 = 400;
const value2 = 20;
X = 10;
Y = 10;
C = 82;
B = "82";
document.write(X + B);
document.write("<br>");
document.write(value1 + val... | true |
148d9a3d120d74262987739c887fda8b0248eae8 | JavaScript | Navdeep1971/project-28 | /js/launcher.js | UTF-8 | 368 | 2.65625 | 3 | [] | no_license | class launcher{
fly()
{
this.launcher.bodyA = null;
this.launcher.bodyB = null;
}
display(){
if(this.launcher.bodyA){
var pointA = this.launcher.bodyA.position;
var pointB = this.bodyB;
strokeWeight(4);
line(pointA.x, poi... | true |
beb86acb25719382cf7a540e89c1bd891415b2cd | JavaScript | h4r1m4u/freecodecamp-solutions | /Front End Development Certification/04 - basic-javascript/Waypoint - 55 - Stand in Line.js | UTF-8 | 318 | 3.796875 | 4 | [] | no_license | // Setup
var myArr = [1,2,3,4,5];
function queue(arr, item) {
// Your code here
arr.push(item);
return arr.shift(); // Change this line
}
// Display Code
console.log("Before: " + JSON.stringify(myArr));
console.log(queue(myArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(myArr));
| true |
608f7c4dcbc8f196bb49d5a72d4245a82e7c1849 | JavaScript | SuperIntuitive/Ele | /Ele.js | UTF-8 | 3,367 | 3.15625 | 3 | [
"MIT"
] | permissive | Ele = function (tag, attrs, log) {
log = typeof log !== 'undefined' ? log : false; //silly IE can't handle defaults
if (typeof tag === 'undefined') { //if the tag is packed in the object for some reason.
if (typeof attrs.tag === 'undefined') {
console.warn("Error tag name is missing. data:")... | true |
ddacb924346cab03beffa153520326baf28e23d8 | JavaScript | chul39/node-design-pattern | /Observer/index.js | UTF-8 | 598 | 2.53125 | 3 | [] | no_license | var Store = require('./Store');
var Subscriber = require('./Subscriber');
var ShoppingMall = require('./ShoppingMall');
var store1 = new Store('Store 1');
var store2 = new Store('Store 2');
var personA = new Subscriber('Mr.A');
var personB = new Subscriber('Miss B');
var personC = new Subscriber('Mr.C');
var personD ... | true |
55461e97a7f9294bc5776a5ff6cc56e567ac75b5 | JavaScript | therealjampers/jwe-ez | /test/tests.js | UTF-8 | 6,225 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | 'use strict'
const it = require('tape')
const config = require('./example_config')
const developmentKeyId = 'JWE-EZ_DEVELOPMENT'
const je = require('../')(config, developmentKeyId)
const E = (message) => new Error(message)
it('API', (t) => {
t.equal('object', typeof je)
t.equal('function', typeof je.createJWE)... | true |
e63c537e4aa447f6a6768fb28eb623bdc353bbcf | JavaScript | clement-greg/cs313-php | /web/week08/fs-async.js | UTF-8 | 157 | 2.71875 | 3 | [] | no_license | var fs = require('fs');
fs.readFile(process.argv[2],(err, buffer)=> {
var lines = buffer.toString().split('\n');
console.log(lines.length - 1);
});
| true |
25f117b9d6e52e2d36e7cac974b8ab06585b4a23 | JavaScript | james-work-account/vue-frontend | /src/auth/store.js | UTF-8 | 604 | 2.515625 | 3 | [] | no_license | const defaults = {
isLoggedIn: false,
user: {
name: '',
id: ''
}
}
const auth = {
namespaced: true,
state: Object.assign({}, defaults),
mutations: {
login (state, data) {
state.user.name = data.name;
state.user.id = data.id;
state.isLoggedIn... | true |
b9eae3455ee9a65125b6bb6b458ab629360d2bde | JavaScript | EHyang/Algorithm | /Programmers/[2022 KAKAO BLIND] 주차 요금 계산.js | UTF-8 | 1,122 | 3.390625 | 3 | [] | no_license | /**
* 문제 - https://school.programmers.co.kr/learn/courses/30/lessons/92341
*
* 조금 더 js 스럽게
*/
const records = ["05:34 5961 IN", "06:00 0000 IN", "06:34 0000 OUT", "07:59 5961 OUT", "07:59 0148 IN", "18:59 0000 IN", "19:09 0148 OUT", "22:59 5961 IN", "23:00 5961 OUT"];
const fees = [180, 5000, 10, 600];
function... | true |
2ece565b6ff60641c1b319e9ce830905dd6091ce | JavaScript | ShanoBueno/employerbot | /server.js | UTF-8 | 8,169 | 3.09375 | 3 | [] | no_license | const db = require("./db");
const { prompt } = require("inquirer");
const { inherits } = require("util");
require("console.table")
init();
function init(){
QuestionList();
}
function QuestionList() {
prompt([
{
type: "list",
name: "choice",
message: "Select an option",
choices: [
... | true |
102b9a8f68f4163dfe3d34b503c29b039b07a208 | JavaScript | gztomas/interviews | /merge-sort.js | UTF-8 | 1,045 | 3.515625 | 4 | [] | no_license | function merge(left, right) {
let result = [],
il = 0,
ir = 0;
while (il < left.length && ir < right.length) {
if (left[il] < right[ir]) {
result.push(left[il++]);
} else {
result.push(right[ir++]);
}
}
return result.concat(left.slice(il)).concat(right.slice(ir));
}
function m... | true |
e6ca34dd5f3a2a42d138996b781fbca95c29fdd2 | JavaScript | Nandini-Chouhan/test | /Hello_Nodejs.js | UTF-8 | 239 | 3.078125 | 3 | [] | no_license | async function hello(){
let promise = new Promise(function(resolve,reject){
setTimeout(() => {resolve("Hello GitHub... I am Nandini 💜 ");},2000);
});
promise.then(function(value){
console.log(value);
});
}
hello();
| true |
313c112e1984182eb1535dfb2a72ded7651dc98a | JavaScript | Anshu221995/ReactProject | /src/About.js | UTF-8 | 1,512 | 2.515625 | 3 | [] | no_license | // import React from 'react';
// import styled from 'styled-components';
// const GridWrapper = styled.div`
// display: grid;
// grid-gap: 10px;
// margin-top: 1em;
// margin-left: 6em;
// margin-right: 6em;
// grid-template-columns: repeat(12, 1fr);
// grid-auto-rows: minmax(25px, auto);
// `;
// export... | true |
84f018f839eeca7f947a6cd6e1b09f7560fd2ba3 | JavaScript | midnight-sl/feed-test-app | /src/server/api/index.js | UTF-8 | 2,050 | 2.78125 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const axios = require('axios');
const parser = require('fast-xml-parser');
router.post('/login', loginUser);
router.post('/load-standart', loadStandartFeed);
router.get('/load-nasa', loadNasaFeed);
router.post('/create', createFeed);
router.delete('/... | true |
fcdc1d80f4376535278baffb16f603cda92d6e18 | JavaScript | bartoszmaleta/ticTacToe | /public/js/ticTacToe2.js | UTF-8 | 6,859 | 3.078125 | 3 | [] | no_license | const X_CLASS = 'x';
const CIRCLE_CLASS = 'circle';
const WINNING_COMBINATIONS = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
];
const cellElements = document.querySelectorAll('[data-cell');
const board = document.getElementById('board');
cons... | true |
69e1215e15b9064f78bf6b1e3dedb0cf0187d705 | JavaScript | michalszynkiewicz/wfswarm-cache | /greeting-service/src/main/webapp/script.js | UTF-8 | 903 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | setInterval(function() {
$.ajax({
url: '/api/cached',
type: 'GET',
dataType: 'json',
success: function(result) {
$('#state').text(result.cached ? "Filled" : "Empty")
}
})
}, 100); // every 100 ms
var greet = function() {
$('.result').hide();
$('.reque... | true |
a4e45ed46d9081aa9d024c80f0a546692da34609 | JavaScript | Akashh1996/Skylab-Bootcmamp-2020 | /Eric-Sanz/unit-testing-codewars/lowest-product.js | UTF-8 | 421 | 3.3125 | 3 | [] | no_license | function lowestProduct(input) {
let array = input.split('').map(number => parseInt(number));
let lowest = [];
if (input.length < 4) {
return 'Number is too small';
} else {
for (let i = 0; i < array.length; i++) {
lowest.push(array[i] * array[i+1] * array[i+2] * array[i+3]);
... | true |
f1c2322e026924f9aff1159e642a542e98d2ff08 | JavaScript | mrgrotts/es6-practice-accelerated | /template-literals.js | UTF-8 | 389 | 3.8125 | 4 | [] | no_license | let name = 'Joe';
// template strings can be multi line without throwing an error for syntax
// template literal can contain calculations as long as it returns a string
let description = `
hello, I'm ${name + '!'}
`;
console.log(description);
// avoid calling a template literal like so
let name = 'Joe';
let descri... | true |
6abacf7fdc36e076e12d799778f57c1c700f0dff | JavaScript | Yevhenko/ma-nodejs-2020 | /homework-02/src/task/task1.js | UTF-8 | 350 | 3.015625 | 3 | [] | no_license | /* eslint-disable no-constant-condition */
/* eslint-disable no-shadow */
/* eslint-disable no-unused-vars */
/* eslint-disable camelcase */
const my_number = -1;
let myNumber = 0;
let number = 3;
if (true) {
const my_number = 1;
myNumber = 2;
number = 6;
}
function sum() {
return my_number + myNumber + numbe... | true |
c8f072405586fd325b8c6147c04929e7e780bade | JavaScript | PeculiarE/todo-user | /services/user.js | UTF-8 | 916 | 2.5625 | 3 | [] | no_license | const { userArray } = require("../models");
const { v4: uuidv4 } = require("uuid");
const addNewUser = (data) => {
userArray.push({
...data,
id: uuidv4()
});
};
const getSingleUserById = (id) => userArray.find((el) => el.id === id);
const getSingleUserByEmail = (email) => userArray.find((el) ... | true |
30fe31ea85446fec967a0fdc6ac8bf6429a17daf | JavaScript | Yuri-Predborskiy/photo_organizer | /app.js | UTF-8 | 2,199 | 2.796875 | 3 | [] | no_license | 'use strict';
const helper = require('./helper');
// todo: read params from external file
// todo: add readme, .example for json parameter file
let params = {
sources: [ // list of folders to collect images from, with optional parameters
{ path: 'test/in/camera', timeShift: (-60 + 9)*60*1000 }, // -1 hour... | true |
b7eaeca68253f5bdae2422f17368a059f8316c94 | JavaScript | mumoc/curso-jquery | /js/resources/tasks.js | UTF-8 | 1,680 | 2.6875 | 3 | [
"MIT"
] | permissive | window.Course || (window.Course = {})
Course.Resources = {}
Course.Resources.Tasks = (function(){
function Tasks(options) {
_this = this;
options = options || {};
this.taskList = options.list || $('#tasks');
this.Handler = new Course.Utils.RequestHandler('tasks');
}
Tasks.prototype.index = func... | true |
962527657fe1d450e4ce8fbf16066623e64ef3b6 | JavaScript | lopeben/platypush | /platypush/backend/http/static/js/plugins/music.mpd/utils.js | UTF-8 | 667 | 2.828125 | 3 | [
"MIT"
] | permissive | var utils = {
methods: {
convertTime: function(time) {
time = parseFloat(time); // Normalize strings
var t = {};
t.h = '' + parseInt(time/3600);
t.m = '' + parseInt(time/60 - t.h*60);
t.s = '' + parseInt(time - (t.h*3600 + t.m*60));
... | true |
c24d2d331f74dc652c3c984583f4370a98cac15e | JavaScript | bklaing2/Lyric-Writing-App | /src/pages/editSong/editor/Editor.js | UTF-8 | 1,806 | 2.5625 | 3 | [] | no_license | import React from 'react';
import { useSelector, useDispatch } from 'react-redux';
import {
updateSong,
deleteSong,
addSection,
selectSong,
} from '../../../state/songSlice';
import styles from './Editor.module.css';
import Section from './section/Section.js';
export default function Editor() {
const s... | true |
6efce2f3052efc99a05f68e2908d954b90f2d3f2 | JavaScript | CaliZam/skylab-bootcamp-202004 | /staff/pau-atienza/web-components/my-app/components/Landing.js | UTF-8 | 583 | 2.625 | 3 | [] | no_license | class Landing extends Component{
constructor(goRegister, goLogin) {
super(`<section class="landing">
<h1>Welcome</h1>
<a href="" >Register</a>
<a href="" >Login</a>
</section>`)
const [register, login] = this.container.querySelectorAll('a')... | true |
88f8a94fb58b5bf3aac3aee7441e08e4d96f0eb5 | JavaScript | Slider7/laravel | /resources/js/components/Selector.js | UTF-8 | 1,433 | 2.640625 | 3 | [
"MIT"
] | permissive | import React from 'react';
import './filter.css';
class Selector extends React.Component {
constructor(props) {
super(props);
this.selRef = React.createRef();
}
fillOptions = list => {
const sel = this.selRef.current;
const option = document.createElement('option');
option.value = 'none';
... | true |
8eff5657be6f6e941ef780343383e634b46edce2 | JavaScript | Dybovsky/Saas-web-site | /js/Marquee.js | UTF-8 | 2,197 | 3.3125 | 3 | [] | no_license | class Marquee {
constructor(element) {
this.element = element;
this.url = `https://stock-exchange-dot-full-stack-course-services.ew.r.appspot.com/api/v3/stock/actives`;
this.createMarquee();
}
createMarquee() {
let h3 = document.createElement("h3");
h3.id = "marquee1";
let img = document.c... | true |
06d4f86c8aedbbfcdc832200219cac6d56f78733 | JavaScript | 73VW/DichotomyMethod | /AN_Labo2_EquipeB1.js | UTF-8 | 8,231 | 3.75 | 4 | [
"MIT"
] | permissive | /***********************************************************/
/* Authors : Axel Rieben, Maël Pedretti, Quentin Vaucher */
/* Date : 28 March 2017 */
/***********************************************************/
/*******************************************************/
/* Tools : E... | true |
8b67b53eed3b2f8866bb9583b6f40f8e660f8627 | JavaScript | Carmen-ramos/series-browser | /src/js/05-handle.js | UTF-8 | 916 | 2.75 | 3 | [
"MIT"
] | permissive | // handle for Show List
function handleShow(ev) {
const clickedShowID = parseInt(ev.currentTarget.id);
const showObjClicked = showsList.find((item) => {
return item.id === clickedShowID;
});
const favoritesFound = favoritesList.findIndex((favorite) => {
return favorite.id === clickedShowID;
})... | true |
ee6c6d4ac790a67068a8ccb085f61f032261ce36 | JavaScript | ridarafisyed/blockchain-assignments | /assignment4/task3/task3.js | UTF-8 | 886 | 3.515625 | 4 | [] | no_license | // task 3
var pwd = prompt("Please enter the password."," ");
var isPwdOk = false;
// loop until the user enter the correct password.
do {
var code = pwd.charCodeAt(0);
if(pwd.length>= 8){
if(!(code >=48 && code <= 57)){
for(var i= 0; i < pwd.length;i++){
code = pwd.ch... | true |
53844725e4cf552d09cf9e5e8603291579b67a14 | JavaScript | y695287173/newYearCard | /js/script.js | UTF-8 | 2,524 | 2.859375 | 3 | [] | no_license |
window.onload = function(){
console.log("网页可见宽度:"+ document.body.clientWidth);
console.log("网页可见高度:"+ document.body.clientHeight);
console.log("网页可见区域宽度(包括边线宽度):"+ document.body.offsetWidth);
console.log("网页可见区域高度(包括边线宽度):"+ document.body.offsetHeight);
console.log("网页正文全文宽:"+ document.body.scrollWidth);
console... | true |
be14f1d882e3e7185c5c75319614866574d72476 | JavaScript | AlexeyAbretov/ible-components-react | /src/.UI/AppBase/AppBase.jsx | UTF-8 | 1,015 | 2.53125 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
export class AppBase extends React.Component {
constructor(props) {
super(props);
this.state = {
hasError: false,
error: null,
info: null
};
}
componentDidCatch(error, info) {
const err = {
hasError: true,
... | true |
a032bf0f8398226eb19735949537781cc48ebfb9 | JavaScript | nicolahcm/react-router-snippets | /src/4UseMatch.jsx | UTF-8 | 1,408 | 2.84375 | 3 | [] | no_license | import React from 'react';
import { BrowserRouter as Router, Route, Switch, Link, useRouteMatch } from 'react-router-dom';
// Here we use RouteMatch, which is similar to the useParams
// What are the differences???? TO TEST IT IN FUTURE!
// 1) Constraint: Router and useRouteMatch cannot be in the same component!
le... | true |
c53dcbfe36afca967354e3e604ff6325831ad97a | JavaScript | rookiefly/oktools | /src/main/resources/static/js/websocket.js | UTF-8 | 2,484 | 3.046875 | 3 | [
"MIT"
] | permissive | const dateFormat = 'yyyy-MM-dd hh:mm:ss';
Date.prototype.format = function (fmt) {
let o = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
... | true |
b271827c548b598928fbf5c8d89d81710b634fca | JavaScript | efhjones/zap-phrase | /client/src/JoinGame/index.js | UTF-8 | 3,962 | 2.515625 | 3 | [] | no_license | // @flow
import React, { Component } from "react";
import Loading from "../common/Loading";
import Button from "../common/Button/Button";
import AsyncButton from "../common/Button/AsyncButton";
import ZapPhraseTitle from "./ZapPhraseTitle";
import Teams from "./Teams.js";
import Categories from "./Categories";
import... | true |
c98b2ef0c7fcf767e76d5709d3665126c32b914f | JavaScript | ArthurUezu/xadrez | /js/logic.js | UTF-8 | 6,772 | 3.40625 | 3 | [] | no_license | const size = 8;
let gameTurn = 0;
let roundText = document.getElementById("turno");
let i,j;
// creating a matrix of 8 by 8
let aux = document.getElementsByClassName("tile");
let board = [];
for(i=0;i<size;i++){
board[i] = new Array();
for(j=0;j<size;j++){
board[i][j] = aux[i*size+j];
board[i][j... | true |
d585894a5ff272fb7ea98141c39c20fe249a052c | JavaScript | Yashi002/Javascript | /age.js | UTF-8 | 412 | 4.8125 | 5 | [] | no_license |
//Using comparison operators to print the result
const age = 24;
console.log (age >= 18);
// Output the result of age < 18
console.log (age < 18);
// When the value of age is 18 or greater, output "I am 18 or older"
if (age >= 18) {
console.log("I am 18 or older");
}
const age = 24;
// Adding an if statement wit... | true |
868226c9c9032b9007edf95f9c6f6277c4455dad | JavaScript | symunona/hash-code-toolkit | /tesla/solvers/polski.js | UTF-8 | 5,576 | 2.796875 | 3 | [] | no_license | // Solve the problem within this file.
const _ = require('underscore')
const mrMath = require('../../mr-math')
const loading = require('../../loading')
// Takes the car amount of first rides.
module.exports = function (d, magic) {
let cars = initCars(d.carCount)
// get the first car number of rides
... | true |
e6e839bd688d52ac43268e6ba8c10275018a3a0a | JavaScript | arnavdesk/Hunt_The_Superhero | /scripts/favourite-script.js | UTF-8 | 5,184 | 3.296875 | 3 | [] | no_license | (function () {
// fetch all the required dom elements.
const superHeroContainer = document.getElementById("main-2");
const containerEmptyDiv = document.getElementById("nothing-here");
let localArrayIds = []; //array used for localStorage
// listFavHero is the local storage key
// localStorage.s... | true |
5f1ac7acddcd3569d65e98a5f8ba79c1d002b4f9 | JavaScript | noelyas/sorting_hat | /js/functions.js | UTF-8 | 11,497 | 3.59375 | 4 | [] | no_license | /* Funciones */
// Función que muestra el test y oculta la portada
const showTest = () => {
const cover = document.getElementById('cover');
cover.classList.add('d-none');
const test = document.getElementById('test');
test.classList.remove('d-none');
}
// Función que recibe un array de n preguntas ... | true |
6d1d4c82d9b1e07b2f6290506f6721b3fe521ec5 | JavaScript | joaovictorps/Arbyte-Atividades | /turma-2/joaovictorps/Lista_16/Map_1.js | UTF-8 | 106 | 2.703125 | 3 | [] | no_license | const array = [{}, {}, {}, {}, {}]
array.map((object, i) => {
object.number = i
})
console.log(array) | true |
7a0b4ff181794fff4be686c86b858804e75336bd | JavaScript | mohsininayatkhan/pie | /public/js/followers.js | UTF-8 | 1,752 | 2.546875 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
var on_hover_follow = false;
$('body').on('click', '.follow-btn', function(e) {
var user = $(this).attr('id');
var request = $.ajax({
url: base_url+"/follow-user/" + user,
type: 'GET',
async: false,
data... | true |
8f9bc395a96c54cfcb88725a936757751865ed20 | JavaScript | santhoshkumarjs/Manohar | /M-tutor-web/assets/scripts/modules/ContactForm.js | UTF-8 | 6,040 | 2.515625 | 3 | [
"MIT"
] | permissive | /* jshint esnext: true */
import AbstractModule from './AbstractModule'
export default class extends AbstractModule {
constructor(options) {
super(options);
this.$inputs = this.$el.find(':input');
this.inputSelectors = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel],... | true |
b1621409352fa4f5e181b82c9dc1eedf87c7c2a3 | JavaScript | AmericanCoinAMC/walletapi | /src/Database.js | UTF-8 | 2,438 | 2.546875 | 3 | [] | no_license | /**
* Created by jessdotjs on 15/07/17.
*/
"use strict";
var firebase = require("firebase");
function Database() {
this.config = {
apiKey: "AIzaSyDkbUvURJTxHHc8nAw9Hifis_L9VWjZkAM",
authDomain: "americancoin-47230.firebaseapp.com",
databaseURL: "https://americancoin-47230.firebaseio.com"... | true |
dd301840ffcbcff0e6eb7f9a97e3c049428d5685 | JavaScript | atbeta/js-leetcode | /stack/1021-Remove Outermost Parentheses.js | UTF-8 | 940 | 3.65625 | 4 | [] | no_license | /**
* @param {string} S
* @return {string}
*/
var removeOuterParentheses = function(S) {
// 栈每次清空都说明找到了一个原语,当读到右括号进行匹配时,如果发现要匹配的左括号是栈中最后一个元素,就直接将这一对括号丢弃
// 另外,为了打印结果,增加一个 result 数组
let stack = []
let removeMap = new Map() // 记录哪些位置应该被删除
removeMap.set(0, true)
let p = 0
while (p < S.length) {
let cu... | true |
0da5bf7bf7dfddf4e23f9d71cf53b08bf1e91712 | JavaScript | 0xc14m1z/express-pagination | /test/pagination.test.js | UTF-8 | 8,949 | 2.53125 | 3 | [
"MIT"
] | permissive | const expect = require('chai').expect
const sinon = require('sinon')
const pagination = require('../src')
module.exports = function () {
it('should be a function', function () {
expect(pagination).to.be.a('function')
})
it('should return the middleware generator function', function () {
expect(paginat... | true |
139929f3509dc576817f57ea7055f36bc4498537 | JavaScript | Milleree/yw_game | /src/utils/index.js | UTF-8 | 1,543 | 3.1875 | 3 | [] | no_license | function formatNumber (n) {
const str = n.toString()
return str[1] ? str : `0${str}`
}
export function formatTime (date) {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getS... | true |
969bc84dbb74f0bf20f3e467a6af3ea9fc9f5aab | JavaScript | MarkKu7/celebrity-dating-quiz | /js/scripts.js | UTF-8 | 955 | 2.578125 | 3 | [] | no_license | $(document).ready(function() {
$("#quiz").submit(function(event) {
event.preventDefault();
const Input1 = parseInt($("input:radio[name=pet]:checked").val());
const Input2 = parseInt($("input:radio[name=drink]:checked").val());
const Input3 = parseInt($("input:radio[name=hobby]:checked").val());
co... | true |
e19d038730ae82c02e7419709020e6803495d9a0 | JavaScript | Parasgr7/ReactNews | /src/js/util/pluralize.js | UTF-8 | 163 | 2.546875 | 3 | [
"MIT"
] | permissive | 'use strict';
export default function pluralize(n: number, value: string): string {
if (n === 1) { return '1 ' + value; }
return n + ' ' + value + 's';
}
| true |
17da207da977db122b0de48153dcd1cb7d6319e5 | JavaScript | Beriu/reactivity | /example2/reactive.js | UTF-8 | 1,130 | 3.375 | 3 | [] | no_license | const stateBase = {};
const subscribers = [];
const notify = (state) => {
if (subscribers.length > 0) {
subscribers.forEach(subscriber => subscriber.render(state));
}
console.info('Updated state', state);
};
class ListElement {
constructor(selector) {
this.container = document.getElem... | true |