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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1b6b67089e9fe3db53e915c5283a072fb9762b5e | JavaScript | Abiola-Farounbi/ecx-30days-of-code | /day18/app.js | UTF-8 | 10,725 | 3.046875 | 3 | [] | no_license | //button to search the for the news by category
var spinner= document.querySelector('.error')
var search1=document.querySelector('.business');
search1.addEventListener('click',getBusiness)
var search2=document.querySelector('.entertainment');
search2.addEventListener('click',getEntertainment)
var search3=do... | true |
8da483f97c8aab4461cdcfa695612d235b0796de | JavaScript | Rakon/JS | /loops/script.js | UTF-8 | 526 | 3.515625 | 4 | [] | no_license | /*
for (var i = 0; i < 10; i++) {
console.log(i);
}
*/
var names = ['Ellen', 'David', 'Prieel', 'Merlijn'];
for (var i = 0; i < names.length; i++){
console.log(names[i]);
}
for (var i = names.length -1; i >= 0 ; i--){
console.log(names[i]);
}
var i = 0;
while(i < names.length){
console.log(names[... | true |
aaa325e51fb22c802240b65c9c2fe8b6b7fb5fb9 | JavaScript | SimonDein/launch | /course_js210_computational_thinking_and_javascript_programming/lesson_3_practice_problems_logic_and_flow_control/gussing_the_password.js | UTF-8 | 652 | 4.28125 | 4 | [] | no_license | // Write a password guessing program that tracks how many times the user enters the wrong password
// If the user enters the password wrong three times, log 'You have been denied access
//' and terminate the program
// If the password is correct, log 'You have successfully logged in.' and end the program.
for(i = 3; i... | true |
2dec2e24e79cfe4ba859cba35b86397fc3242d0b | JavaScript | CaioOliveira793/Design-patterns-implementation | /creational/abstract-factory.js | UTF-8 | 1,180 | 4 | 4 | [
"MIT"
] | permissive | /*
* Objective: define a interface to create an object and everything is encapsulated.
* Applicability: creating families of related objects, without specifying concrete classes or constructors.
*/
function carFactory(model) {
class Wheel {
constructor(size) {
this.size = size;
}
build() {
console.log... | true |
57c7d77a440ddbaf4503d8badabb409b1c298fc1 | JavaScript | douglasscaini/foodfy | /public/scripts/admin.js | UTF-8 | 4,574 | 2.890625 | 3 | [] | no_license | // FORM DELETE RECIPES AND CHEFS ADMIN PAGE
const formDelete = document.querySelector("#form-delete");
if (formDelete) {
itemFormDelete(formDelete);
}
const usersFormDelete = document.querySelectorAll(".form-delete");
usersFormDelete.forEach((form) => itemFormDelete(form));
function itemFormDelete(formDelete) {
... | true |
e73b915d19aff0d12dc95901d8785b6205464757 | JavaScript | ccottap/SofMA | /sofma_coevolutivo/js/monitor/_attachments/SimplEA.js | UTF-8 | 2,111 | 3.0625 | 3 | [] | no_license | function get_pool_roulette_wheel (population, need ) {
var total_fitness = 0;
for ( var i in population ) {
total_fitness += population[i].value.fitness;
}
var wheel = new Array;
for ( var i in population ) {
wheel[i] = population[i].value.fitness/total_fitness;
}
var slots = spin( wheel,... | true |
e45642ec7539bbd0316f150cf6967276854f7264 | JavaScript | roureg/react-browserify | /js/ui-component/comments/comment-list.js | UTF-8 | 961 | 2.703125 | 3 | [] | no_license | /**
* Composant React pour l'affichage d'une liste de commentaires
*
* @jsx React.DOM
*/
"use strict";
var React = require("react/addons"),
Commentary = require("./commentary");
var CommentList = React.createClass({
getDefaultProps: function() {
return {
title: "All Comments"
... | true |
b9bffb42b7b771409eb6d190d39a079bb6e39d6d | JavaScript | ecman/walkitout | /test/lib/mocks.js | UTF-8 | 4,697 | 2.5625 | 3 | [] | no_license | var path = require('path');
/*
A tree data structure for use with the fs mock.
Used so fs mock can send errors to walkitout
on specified paths.
Sets up the following structure:
[-] .
[-] dir1/
[-] dir1/dirA/
[-] dir1/dirA/dirAA/
[x] dir1/dirA/dirAA/fileAA.txt
[x] dir1/dirA/dirAA/fileAB.txt
[x] dir1... | true |
732a56568ff8aadb6fb9cf4ffbac3747d26f6b79 | JavaScript | dulkifal/manhaj | /function.js | UTF-8 | 1,986 | 2.546875 | 3 | [] | no_license | let but = document.querySelector("#btn");
let inp = document.querySelector("#AddNum");
let contTable = document.querySelector(".content-table");
function tableTd(cont) {
let _ = document.createElement("th");
_.innerText = cont;
return _;
}
but.onclick = () => {
let id = inp.value;
fetch(
... | true |
047b039e178fcc10e6910c87a33835dac7c5c18c | JavaScript | nmorales1991/autofactback | /models/usuarios.js | UTF-8 | 689 | 2.625 | 3 | [] | no_license | const mongoose = require('mongoose')
let Schema = mongoose.Schema
let roles = {
values:['ADMIN', 'USER'],
message: '{VALUE} no es un rol válido'
}
let usuarioSchema = new Schema({
correo:{
type:String,
required: [true,'El correo es necesario'],
unique:true
},
clave:{
... | true |
129d5caab7fef5432192b1c0eb05bc7b6f04004b | JavaScript | amjadkhan91/redeemVueJs | /index.js | UTF-8 | 4,663 | 2.703125 | 3 | [] | no_license | var app = new Vue({
el : "#app",
data : {
showItems: true,
showCart: false,
items: [
{
name: "NMD_R1 SHOES",
price: 91,
},
{
name: "ULTRABOOST UNCAGED SHOES",
price: 126,
},
{
... | true |
e12bb4039323890ac3885f05466bae6d783a8aad | JavaScript | sbridewell/TestableReactHttpClient | /quote-client/src/Put.jsx | UTF-8 | 5,103 | 2.640625 | 3 | [] | no_license | import PropTypes from 'prop-types';
import React from 'react';
import {
ReactHttpClients,
} from 'sde-httpclient';
import {
Button,
NumericInput,
PropertyGrid,
} from 'sde-reactcomponents';
import QuoteResponse from './QuoteResponse';
import QuoteClient from './QuoteClient';
/** React component which... | true |
3645e2f3f721ac0064a149a4fb7c4b1c043d1834 | JavaScript | MaartenvanWilligen/webdriverioCrossBrowserTest | /test/page-objects/homePage.js | UTF-8 | 1,583 | 2.78125 | 3 | [
"MIT"
] | permissive | /**
* Created by maarten on 19-09-16.
*/
/**
* @desc page object homepage
* */
var Page = require("./page");
/**
* @desc constructor HomePage object
* set the identifiers of homepage elements in variables
* */
function Home() {
Page.call(this, "http://localhost:8000/website/index.html");
this.ctaButt... | true |
1d9fb12cbabf3327f63151b18d0aeb526994b5ee | JavaScript | glandon22/DS-and-Algos-JS | /data_structures/bst.js | UTF-8 | 5,176 | 3.390625 | 3 | [] | no_license | function bfs(tree) {
if (!tree) return null;
let q = [tree.root];
let vals = [];
while (q.length) {
//console.log('q', q)
let removed = q.shift();
vals.push(removed.value);
if (removed.left) {
q.push(removed.left);
}
if (removed.right) {
... | true |
14a8ff3e3771529dff1ab9548d38b165b7938d58 | JavaScript | Digvijay514/node-cosmosdb-docker-webapi | /data/databaseContext.js | UTF-8 | 1,622 | 2.703125 | 3 | [
"MIT"
] | permissive | // <createDatabaseAndContainer>
const config = require("../config");
const CosmosClient = require("@azure/cosmos").CosmosClient;
let _container;
/*
// This script ensures that the database is setup and populated correctly
*/
async function create(client, databaseId, containerId) {
const partitionKey = config.part... | true |
2c3f889213adebba6efa69cb645d9f4994a65279 | JavaScript | heliorrfreitas/css_border_radius_generator | /index.js | UTF-8 | 980 | 2.78125 | 3 | [] | no_license | var borderRadius = "0px";
function setBorderRadius(){
let topLeft = document.getElementById('borderRadiusTopLeft').value;
let topRight = document.getElementById('borderRadiusTopRight').value;
let bottomRight = document.getElementById('borderRadiusBottomRight').value;
let bottomLeft = document.getEleme... | true |
8d275939c7a85cbe26cb1f9ff0a1caa7107ff9f2 | JavaScript | gyanendra2058/algorithms | /cracking_coding_interview_problems/stacks_queues/3.1/Solution.js | UTF-8 | 1,721 | 3.34375 | 3 | [
"MIT"
] | permissive | class Solution {
constructor() {
this.storageArray = new Array(3000);
this.initializeStackIndexMap();
}
initializeStackIndexMap() {
this.stackIndexMap = new Map();
this.stackIndexMap.set('stack1', 0);
this.stackIndexMap.set('stack2', 0);
this.stackIndexMap.s... | true |
69144bdfd03e5ff0c1d3624554c2299c1e57237e | JavaScript | lishuna/ES6-study | /es6js/Object.js | UTF-8 | 971 | 3.359375 | 3 | [] | no_license | // Object.is
console.log(Object.is('a', 'a'));
console.log(Object.is(+0, -0));
console.log(Object.is(NaN, NaN));
console.log('dirname: ' + __dirname);
// Object.assign
function Animate() {
this.a = 1;
this.d = {
name: 'd',
child: {
name: 'sub child'
}
};
}
Animate.prototype = {
name: '动物',
... | true |
7c908ad45fa5861d4ec7ea35a6b953cf9e1a6bf2 | JavaScript | shengyugg/last | /fs.js | UTF-8 | 1,964 | 2.78125 | 3 | [] | no_license | // fs 文件系统
// 加载http模块
var http=require("http")
var fs=require("fs")
//服务器
http.createServer((req,res)=>{
if (req.url == "/favicon.ico") {
return
}
res.writeHead(200,{"Content-type":"text/html;charset=utf-8"})
// readFile 读文件
// fs.readFile("1.txt",(err,data)=>{
// if(err){
// throw err
// }
// cons... | true |
49c58ea4f5b47cb89c3e901e2ad1a12b56ccaede | JavaScript | uk-gov-mirror/companieshouse.forgerock-cloud-config | /config/am-scripts/scripts-content/ch-check-password-status.js | UTF-8 | 1,465 | 3.015625 | 3 | [
"MIT"
] | permissive | /*
** INPUT DATA
* SHARED STATE:
- '_id' : the user ID we are checking the password status of.
Password status is held on frIndexedString3 for users. Can be 'pending' or 'migrated' for CH migrated users, blank for users
added to FIDC directly
** OUTCOMES
- valid: passwo... | true |
4fdf7832cc8cd4d1ede72b2851bb9f9c4c0d5f91 | JavaScript | spudtrooper/userscripts | /src/gmailtitle.user.js | UTF-8 | 2,259 | 3.03125 | 3 | [] | no_license | // ==UserScript==
// @name Gmail Title
// @namespace http://jeffpalm.com/gmailtitle
// @description Makes the gmail title somewhat useful
// @include https://mail.google.com/mail/*
// ==/UserScript==
(function() {
const FUDGE_KEY = 'fudge.factor';
var ignoreNextChange = false;
/**
* Se... | true |
9e4c38984abe949a75f627456d4166167e2e2bc7 | JavaScript | leekeal/learn-threejs | /css3d/js/example.js | UTF-8 | 3,731 | 2.921875 | 3 | [] | no_license |
var Element = function ( num ) {
var dom = document.createElement( 'div' );
dom.style.width = '480px';
dom.style.height = '360px';
var image = document.createElement( 'img' );
image.style.position = 'absolute';
// image.style.width = '480px';
image.style.height = '480px';
image.src = 'img/'+num+'.png';
ima... | true |
0185adef982bdc22b90a6ccaa0bca7518a3a208f | JavaScript | dragosbucur2001/Departament_IT | /Dep_IT_Server/server.js | UTF-8 | 2,112 | 2.53125 | 3 | [] | no_license | var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var nodemailer = require('nodemailer');
var subjects = ["USO", "Mate 1", "Mate 2", "Metode Numerice"];
var entries = [
{
id: '1',
subject: "USO",
title: "Tema 2 ajutor"
},
{
... | true |
dd23b03934871a34db4fce915d3e44c24ede9760 | JavaScript | wan2jus1/championsclub | /resources/assets/js/divslot/Helpers/arrayHelper.js | UTF-8 | 1,953 | 4.03125 | 4 | [] | no_license | /**
* Get next number from given array
* @param {Array} array Array to get an item from
* @param {Number} item Current item
* @returns {Number} Next item
*/
export function getNextArrayItem(array, item) {
const currentIndex = array.indexOf(item);
const newIndex = (currentIndex === array.length - 1) ? 0 : c... | true |
1a6ff655095f7825ec25b43a8d8bbd2fcadd75de | JavaScript | Praveen94/imad-2016-app | /ui/main.js | UTF-8 | 8,490 | 2.9375 | 3 | [] | no_license | function loadLoginForm () {
var loginHtml = `
<div class="imgcontainer">
<img src="/ui/img_avatar3.png" alt="Avatar" class="avatar">
</div>
<div class="container">
<label><b>Username:</b></label>
<input type="text" id="username" placeholder="username" required />
<label><b>Password:</... | true |
8fbd38ec8572262fbc8ef8bbba0effc7b2bc2a86 | JavaScript | AntoninaMuravska/profit-filmoteka | /src/js/components/genre-transformator.js | UTF-8 | 1,574 | 3.140625 | 3 | [] | no_license | /*
* Функция трансформации жанров фильмов в читабельный вариант. В функцию передаеться 2 основных аргумента -
* объект фильмов для рендера и объект с жанрами. Для варианта с модалкой - необходимо передать еще 3 необязательный
* аргумент "all" для отображения больше 2 жанров.
*/
const genresTransformation = (dataOb... | true |
4560ce91691c727e1f4da7bb759f6d2cfad5ef2d | JavaScript | jamescockayne/leetcode-solutions | /724-FindPivotIndex.js | UTF-8 | 742 | 3.640625 | 4 | [] | no_license | /*
* Given an array of integers nums, calculate the pivot index of this array.
* The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right.
* @param {number[]} nums
* @return {number}
*/
var pivotIndex = fu... | true |
3ba8dcb9593c87b4b4f5f7fcfaa38b1bb29a74e4 | JavaScript | agdwm/lab-javascript-all-times-movies | /starter_code/src/movies.js | UTF-8 | 1,655 | 3.5 | 4 | [] | no_license | /* eslint no-restricted-globals: 'off' */
// Turn duration of the movies from hours to minutes
function turnHoursToMinutes(movies) {
if (movies.length !== 0) {
var moviesFormated = movies.map(function(e) {
var durationSplitted;
var duration = e.duration;
var clearHours;
var clearMinutes;
... | true |
39ade19b86e3b01c67fa5ef50b30e0a2f5d2d75e | JavaScript | tsyn4836/select-bar-with-search | /js/index.js | UTF-8 | 4,148 | 2.9375 | 3 | [] | no_license | (function (document, window) {
// 公共方法
$ = function (child, parent = document) {
return parent.querySelector(child);
}
$$ = function (child, parent = document) {
return parent.querySelectorAll(child);
}
class Select {
constructor({ options, optionsFrom, wrap, output }) {
this.options = options || this.... | true |
7898289bc72a5b7ecb7741cac32b65c05d5e9164 | JavaScript | Alexfd89/react-indecision-app | /src/person.js | UTF-8 | 155 | 2.53125 | 3 | [] | no_license |
const adult = (age) => age >= 18;
const canDrink = (age) => age >= 21;
const isSenior = (age) => age >= 65;
export {adult, canDrink, isSenior as default} | true |
d4fbe0492e8a97369d0d417f6484e98e8649b1c1 | JavaScript | gongrui1993/shoppingcart | /js/cart.js | UTF-8 | 2,145 | 2.609375 | 3 | [] | no_license | var wm = new Vue({
el:"#app",
data:{
totalMoney:0,
productList:[],
checkAllflag:false,
delFlag:false,
productNum:false
},
filters:{
formatMoney:function(value) {
return "¥"+value.toFixed(2);// body...
}
},
mounted:function(){
this.$nextTick(function(){
this.cartView();//则此时this.car... | true |
4e7efe0b384646d21828b4a02be1f0b7663dcc1b | JavaScript | ltruemccarthy/S16-6730-TRUEMCCARTHY | /exercise8/app.js | UTF-8 | 401 | 2.90625 | 3 | [] | no_license | var img;
function preLoad(){
img = loadImage("niceguy.jpg")
}
function setup() {
var c = createCanvas(236, 245)
c.parent('container')
img.loadPixels()
}
function draw() {
for (i = 0; i <= img.pixels.length; i = i + 4){
//img.pixels[i] = 180
img.pixels[i + 1] = 25
//img.pixels[i + 2] = 300
... | true |
c7a080588f44c1e4ffa5d56c3d6f0e47a377f015 | JavaScript | creaticjs/Retos_Victor_Olave | /Retos Pages/Reto 2/Ejercicio 4/calcularHipotenusa.js | UTF-8 | 444 | 3.125 | 3 | [] | no_license | var hipotenusa = document.getElementById("Hipotenusa");
boton = document.getElementById("Calcular").addEventListener("click", calcHipotenusa, false);
function calcHipotenusa(){
var catetoA = document.getElementById("catetoA").value;
var catetoB = document.getElementById("catetoB").value;
var h = Math.sq... | true |
baecba55bf02ebf7bc1785d89b119b74dbf03d4e | JavaScript | irmir/BookSharingWeb | /src/components/common/Rating.js | UTF-8 | 2,560 | 2.609375 | 3 | [] | no_license | import React from 'react'
import { Input } from '../common/Input'
import whiteStar from '../../image/star-white.svg'
import goldWhiteStar from '../../image/star-gold-white.svg'
import goldStar from '../../image/star-gold.svg'
export const Rating = ({ rank, bookId }) => {
const goldStars = []
const goldWhit... | true |
f5b2c95debf0e05949654ddfb681bc443820a6df | JavaScript | mdkhokonahmed/php-mixed | /ajex/js/main.js | UTF-8 | 720 | 2.546875 | 3 | [] | no_license | $(document).ready(function(){
$('#username').blur(function(){
var username = $(this).val();
$.ajax({
url:"check/checkuser.php",
method:"POST",
data:{username:username},
dataType:"text",
success:function(data){
$('#userstatus').html(data);
}
});
});
$("#li... | true |
0114da80be2b66f3b081912d1a350aeafd732683 | JavaScript | rlorenzini/JSFundamentals | /Basics/datatypes.js | UTF-8 | 2,837 | 4.8125 | 5 | [] | no_license | // JavaScript DataTypes
// When working with variables, understanding the DataTypes of the variables is important.
console.log(16 + "Cats"); // result = "16Cats"
console.log("Cats" + 16); // result = "Cats16"
// JS treats a number as a string if added in a sequence with a string
console.log(10 + 4 + "Cats"); // res... | true |
ab4f96d7b2d96330cac62ef27f12fc51fd546ae8 | JavaScript | MilenaSC/LP3_2019_2 | /agenda-api/controllers/ContatoController.js | UTF-8 | 870 | 3.109375 | 3 | [] | no_license | // Alunos: Milena de Souza e Raphael Valencio - TSI
const Contato = require('../models/Contato');
let contatos = [];
const controller = {
// Arrow function
recuperarTodos: (req, res) => res.json(contatos),
salvar: (req, res) => {
const nome = req.body.nome;
const telefone = req.body.telef... | true |
5debcafa2f17f6e823c2f62c5bd0248d5e2aff1f | JavaScript | nagineni/SmartHome-Demo | /gateway-webui/rules_engine.js | UTF-8 | 1,989 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | module.exports = {
createRulesEngine : function(jsonRulesConfig) {
return new Rules(jsonRulesConfig);
}
};
function Rules(jsonRulesConfig)
{
this.rules = JSON.parse(jsonRulesConfig);
var devices = this.rules;
//Iterate through all the devides, events and triggers and make condition a callable js function
/*fo... | true |
05442dea1f65e18ea56136378394042527c406e3 | JavaScript | xaliq2299/UFAZ-BSc | /L2/S1/DSA2/Quadtree/quadtree1.js | UTF-8 | 631 | 3.15625 | 3 | [] | no_license | class Point {
constructor(x,y){
this.x = x;
this.y = y;
this.divided = false;
}
}
class Rectangle {
constructor(x,y,w,h){
this.x = x;
this.y = y;
this.w = w;
this.h = h;
}
}
class Quadtree{
constructor(boundary, ){
this.boundary = boundary;
this.points = [];
this.capacity = n;
}
insert() {... | true |
087cedf1b4766ef9654bc4078024e5022bbecaf9 | JavaScript | cloudworkz/zmq-kms-sidecar | /node-client/zmqdr.js | UTF-8 | 2,334 | 2.65625 | 3 | [
"MIT"
] | permissive | "use strict";
const EventEmitter = require("events");
const ZMQ = require("zeromq");
const uuid = require("uuid");
const EMPTY_BUFFER = Buffer.from([]);
class ZMQDR extends EventEmitter {
/**
* Creates new instance of wrapper around zmq socket
* @param {string} conStr - e.g. "tcp://127.0.0.1:5560"
... | true |
7e6e2f9ef36b0f4395bd812c3a23005e1b3b5fd9 | JavaScript | rc1/W.js | /string/has-tld.js | UTF-8 | 164 | 2.59375 | 3 | [
"MIT"
] | permissive | /** String contains a top level domain */
var hasTld = function(str) { var result = str.match(/[a-z0-9.\-]+[.][a-z]{1,4}[\/:]?([\d]{1,5})?/m); return (!!result); }; | true |
d431236c80d7f3b2acaf162504d598323d7d9e1f | JavaScript | kjk7034/calendar | /js/calendar.js | UTF-8 | 9,454 | 3.15625 | 3 | [] | no_license | (function (window) {
const helper = {
date: {
getDayCount(y, m, d) {
const newdate = new Date(y, m - 1, d)
return newdate.getDay();
},
getMonthLastDay(y, m) {
return (new Date(y, m, 0).getDate())
},
getMonthDate(y, m, diff) {
var date = new Date(y, m - 1, 1);
date.setMonth(date.get... | true |
d63923a42a6039ea5c8cb9358f38c021c4647a3b | JavaScript | olistic/HAP-NodeJS | /accessories/Gate_accessory.js | UTF-8 | 3,536 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | require("console-stamp")(console, {
pattern: "yyyy-mm-dd HH:MM:ss.l",
label: false
});
const Accessory = require("../").Accessory;
const Service = require("../").Service;
const Characteristic = require("../").Characteristic;
const uuid = require("../").uuid;
const Gate = require("../controllers/Gate");
// Create ... | true |
07e7acf494c0749a94653da2a64a7d5abb997978 | JavaScript | PaulTrampert/flatitude | /doc_src/Typography.jsx | UTF-8 | 1,067 | 2.53125 | 3 | [] | no_license | import React from 'react';
function Typography() {
return (
<div>
<h1>Typography</h1>
<h2>Headers</h2>
<h1>h1</h1>
<h2>h2</h2>
<h3>h3</h3>
<h4>h4</h4>
<h5>h5</h5>
<h2>Paragraphs</h2>
<p>This is the style of a paragraph. Its font size is 14px, and it uses the ... | true |
d0cd2926d7dca5da0de2c46847553f3408034ce2 | JavaScript | Muhammedct/triviaQuizWeb | /src/App.js | UTF-8 | 4,232 | 3.171875 | 3 | [] | no_license | import React from "react";
import axios from 'axios';
let url = "https://opentdb.com/api.php?amount=10&category=9&difficulty=easy&type=multiple"
class App extends React.Component {
state = {
currentQuestion: 0,
questions: "",
myAnswer: null,
options: [],
score: 0,
isEnd: false,
isStart: ... | true |
d5d19a74c54eaab58199a501dc2c6dce9b727a05 | JavaScript | nikup/GiftOfTheSanctum | /src/main.js | UTF-8 | 1,961 | 2.6875 | 3 | [
"MIT"
] | permissive | var networking = require("./networking_objects.js");
var networkManager = require("./network_manager");
var Main = function() {
this.sockets = [];
this.rooms = {};
this.players = {};
this.masterSocket = null;
}
Main.prototype.firstFreeRoom = function() {
for(roomId in this.rooms) {
if(thi... | true |
23a011166de5dacf85f47764f077315776a66979 | JavaScript | tldrio/alert-scraper | /lib/HNFrontpageScraper.js | UTF-8 | 1,764 | 2.609375 | 3 | [] | no_license | var page = require('webpage').create()
, system = require('system')
// deep copy of args
, patterns = system.args.slice(0);
// Removes the script name from args to get only the patterns
patterns.shift();
// Add listener on the console.log event when evaluating code in the page
page.onConsoleMessage = function (... | true |
510b3c31efaacc7506a73141b6e08e3403105684 | JavaScript | KumudaPriya/Todo-api | /playground/variable-playground.js | UTF-8 | 339 | 3.578125 | 4 | [] | no_license | var person = {
name : 'kumuda',
age : 17
};
function updatePerson (obj) {
// obj = {
// name : 'kumuda',
// age : 18
// };
obj.age = 18;
}
updatePerson(person);
console.log(person);
var array = [18 , 19];
function updateArray( dummy ) {
//dummy = [18 , 19 , 20];
dummy.push(20);
}
updateArray(array);
c... | true |
d9108ae33c77c8135aa1307852a5d75d112b2608 | JavaScript | iambrianreich/rwc-wordpress-library | /RWC/js/rwc/features/post-location-admin.js | UTF-8 | 3,210 | 2.71875 | 3 | [] | no_license | (function($) {
$(function() {
// Initialize tooltips
$( document ).tooltip();
/**
* Instantiate the Google Map so the map object is visible
* to the rest of the code.
*/
var map = new google.maps.Map(document.getElementById('rwc-feature-postlocation-google-map'), {
center: {lat: -34.397, lng: ... | true |
751a1b6cf998ccb0fd11f149b7d563855353cf87 | JavaScript | Gulix/citizen-assemble | /builder/js/viewmodels/filterAlignmentVM.js | UTF-8 | 1,283 | 2.515625 | 3 | [
"MIT"
] | permissive | define(['knockout'], function(ko) {
function filterAlignmentVM(isHero, isVillain)
{
var self = this;
/*************************/
/* Variables Declaration */
/*************************/
self.isHeroes = isHero;
self.isVillains = isVillain;
self.isActive = ko.observable(true);
/*************/
/* Acces... | true |
14b0b1cc21e722754c7f327e960ed233f5dedc19 | JavaScript | DanL12186/JSAlgorithms | /strings.js | UTF-8 | 2,395 | 4.96875 | 5 | [] | no_license | // JavaScript Algorithm Samples -Strings
/* 1. String Repeat - Given a string return the repeated string a specified number of times.
a. create empty string
b. set loop to iterate until reach number
c. add string to new string
d. return new string */
const strRepeat = (str, num) => {
let newStr =... | true |
f94f9261b2e26c7cfe0b364d18fbf722387e010e | JavaScript | krilian88/todo-list | /src/App.js | UTF-8 | 2,324 | 2.515625 | 3 | [] | no_license | import React, { useState } from "react";
import { connect } from "react-redux";
import {
addTodo,
removeTodo,
completeTodo,
changeFilter,
} from "./actions/actionCreator";
import Title from "./components/title/Title";
import TodoInput from "./components/todo-input/TodoInput";
import TodoList from "./component... | true |
e6e8963994c94ef28e245b1c4230d81b5006c079 | JavaScript | aaronUleat/introProgra | /peso__y__estatura/script.js | UTF-8 | 1,237 | 3.6875 | 4 | [] | no_license | var peso__estatura = (function() {
var n = 0, personas = [], i = 0, ii = 0;
function peso_estat() {
n = parseInt(prompt("Solicite un numero", ''));
var int = Number.isInteger(n);
if (int == true) {
createArray(n)
} else {
alert("Solamente un numero entero es permitido");
peso_estat();
}
}
functi... | true |
dd440c79faeeee0fd6ab655b7d410ead460125ab | JavaScript | volfgam/SouthSystem | /js/site.js | UTF-8 | 219 | 2.875 | 3 | [] | no_license | function replaceAll(str, find, replace) {
return str.toString().replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
function escapeRegExp(str) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
| true |
386815d83b5f8c80b8ac1ad995a861f9ee9f4588 | JavaScript | adityabpradana/fancy-calendar | /web-apps/src/js/CalendarLogic.js | UTF-8 | 1,034 | 3.46875 | 3 | [] | no_license | const months = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];
let date = new Date();
let y = date.getFullYear();
let m = date.getMonth() + 1;
function getDateArray(month = m, year = y){
let previousLastDate = (new Date(year, month, 0)).... | true |
f1bbb389b07e37979e8e41c084deade005d41485 | JavaScript | Samiratalanchi/progress-bar | /workspace/Web projects/progress-bar/myjs.js | UTF-8 | 371 | 3.296875 | 3 | [] | no_license | let widthValue = 0 ;
let text ="";
window.setInterval(displayWidthPercent,500);
function displayWidthPercent() {
if (widthValue<100) {
widthValue += 10;
} else {
widthValue = 0;
}
text = widthValue + "%" ;
document.getElementById("progress-bar-animation").style.width= text;
do... | true |
163488cedb2c020e94c6897b078a1007df059acc | JavaScript | januariod/basic-javascript | /objetos.js | UTF-8 | 591 | 3.421875 | 3 | [] | no_license | // var album = {
// title: 'Depois da Guerra',
// released: '2007',
// showInfo: function() {
// console.log(`${this.title} foi lançado em: ${this.released}`)
// }
// }
// album.showInfo();
// console.log(album.title);
// console.log(album.released);
var dvd = new Object();
dvd.title ... | true |
41b0d455fa348a9934fad849d3ba8d42537283d9 | JavaScript | Dmytro-hoot/goit-js-hw-07 | /js/02-lightbox.js | UTF-8 | 1,135 | 2.765625 | 3 | [] | no_license | import { galleryItems } from './gallery-items.js';
// Change code below this line
// Створення розмітки галереї
// Створюємо елементи
const galleryBox = document.querySelector('.gallery');
const galleryCards = createCards(galleryItems);
// Створюємо розмітку
function createCards(galleryItems) {
return galleryItem... | true |
8921342fae2a43fce9dac9114bbe100af104848d | JavaScript | KimKeepLearning/LeetCode-with-JS | /199.二叉树的右视图.js | UTF-8 | 788 | 3.28125 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=199 lang=javascript
*
* [199] 二叉树的右视图
*/
// @lc code=start
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {number[]}
*/
var rightSideView = function(roo... | true |
b09fca29ea4443fc93875d20a1bfd6112e4a98ab | JavaScript | Abrio93/Pepi | /unidad_3/script5.js | ISO-8859-1 | 372 | 3.109375 | 3 | [] | no_license | numero=parseInt(prompt("Introduce un nmero"));
document.write("<table border='1' bgcolor='#ffe377'><tr><th colspan='2'><h2>Tabla de multiplicar del "+numero+"</h2></th></tr>");
for(var num=0;num<=10;num++){
document.write("<tr align='center'><td bgcolor='#ffe377'>"+numero+"*"+num+"</td><td bgcolor='#ffe377'>"+numer... | true |
d842890b46d718366bef0d8d652542de62c3a6ff | JavaScript | tgflet/RestfulAPI | /client/src/App.js | UTF-8 | 3,962 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import axios from 'axios';
import "react-router";
import {BrowserRouter,
Route,
Link
} from 'react-router-dom';
import List from './components/List';
class App extends Component {
constructor(props){
super(props);
this.state={
tas... | true |
6f91eef42fde9ce4756741b6a3938b1f251654d7 | JavaScript | pavelray/headlines-now | /src/store/reducers/news.reducer.js | UTF-8 | 638 | 2.75 | 3 | [] | no_license | import NewsActions from "../types/news.types";
const INITIAL_STATE = {
news: [],
articles: [],
totalResults: '',
totalPages: 1
};
const newsReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case NewsActions.GET_NEWS_SUCCESS:
const totalPages = Math.round(action.payload.totalRes... | true |
72a369371a7cec91bf825daabcd4cd85ce3110e2 | JavaScript | IngilevichV/js-1 | /convert.js | UTF-8 | 495 | 3.453125 | 3 | [] | no_license | function convert(obj) {
let result = [];
for (k in obj) {
result.push([k, obj[k]]);
}
return result;
}
//tests
function test() {
console.info("2. Test of function convert");
if (JSON.stringify(convert({name: 'Jeremy', age: 24, role: 'Software Engineer'})) === JSON.stringify([ [ 'name', ... | true |
b8865b27e6af0348d8325f806a9e62fa68fb560b | JavaScript | JesterIruka/fstore-vrp | /src/api.js | UTF-8 | 2,796 | 2.578125 | 3 | [] | no_license | const axios = require('axios').default;
const { formatDate } = require('./utils');
const { token, webhook:webhook_url } = require('./config');
const hasWebhook = webhook_url.toLowerCase().includes("discordapp.com/api/webhooks");
const endpoint = axios.create({
baseURL: `https://five-m.store/api/v2`,
headers: {
... | true |
dd7aed649fa81019d708adb36fba45ae8f99c436 | JavaScript | thmsdnnr/coterie | /static/assets/js/updateProfile.js | UTF-8 | 753 | 2.859375 | 3 | [
"MIT"
] | permissive | window.onload = function() {
let data=window.INITIAL_STATE.data;
let form=document.querySelector('form#uP');
let name=document.querySelector('input[name=fullName]');
let city=document.querySelector('input[name=city]');
let state=document.querySelector('input[name=state]');
(data.fullName!=='undefined') ? na... | true |
3a67981fbd919d75faa971ca0987749f130eb73f | JavaScript | MidasXIV/ArcFUN-surge | /lib/rank-algorithm.js | UTF-8 | 4,551 | 2.921875 | 3 | [] | no_license | import LevelModel from "../models/level-model";
import { parseDate } from "./date-time";
/**
* function takes in all users and levels
*/
export default function getRanks(users, levels) {
const HOUR = 60 * 60 * 1000;
const TIME_BLOCKS = {
HOURS_3: 3 * HOUR,
HOURS_9: 9 * HOUR,
HOURS_12: 12 * HOUR,
... | true |
8be3a8ec18a9a89db70ed88ee4b2347b38575da5 | JavaScript | Edxael/JS-Code-Wars | /07-Divide-and-Conquer.js | UTF-8 | 671 | 3.875 | 4 | [] | no_license | function search(array, value) {
var copis = array.slice(0);
for(x in array){
if(value === array[(Math.floor(array.length / 2))]){
return copis.indexOf(value);
}else{
if(value > array[(Math.floor(array.length / 2))]){
array.splice(0, (Math.floor(array.len... | true |
904061fdda8a0b0465d4f1ed126c9d08eefc4b2a | JavaScript | AmericaCampaign/javascript-workshops-jcheroske | /data-and-functions-3/src/functions/addProduct.test.js | UTF-8 | 2,052 | 3.171875 | 3 | [] | no_license | /* globals describe, expect, it */
import {cloneDeep, isPlainObject} from 'lodash'
import DATA from '../DATA'
import addProduct from './addProduct'
const getSampleProduct = () => ({
name: 'Sample Product',
price: 100
})
describe('addProduct', () => {
it(
'is a function',
() =>
expect(typeof addPro... | true |
5926c57d79638233e62280c315f38057c2415af7 | JavaScript | josimarrocha/layout-usando-rscss | /js/components/menu-mobile.js | UTF-8 | 527 | 2.859375 | 3 | [] | no_license | (function(){
'use strict';
const $menuHamburguer = document.querySelector('.menu');
const $closeMenu = document.querySelector('.main-menu .close');
const $listaMenu = document.querySelector('.main-menu .items')
$menuHamburguer.addEventListener('click', function (e) {
e.preventDefa... | true |
526970298eeb658f4c07414781a8e993f05fa302 | JavaScript | pwmcintyre/splunk-tester | /test/test-splunk.js | UTF-8 | 949 | 2.5625 | 3 | [] | no_license | var expect = require('chai').expect;
var splunktester = require('..');
describe('Basic searching', function() {
var template = "search index=_internal sourcetype={{sourcetype}} | head {{limit}}";
it('should return 1 result quickly', function() {
// create a query from template
var options = {
sourcetype:... | true |
28c6cd2560ff04ae968cee5cb981d9ddf19e0009 | JavaScript | avyadro/codicentro-js | /public_html/com.codicentro.Format.js | UTF-8 | 1,282 | 3.21875 | 3 | [] | no_license | /**
* Author: Alexander Villalobos Yadró
* E-Mail: avyadro@yahoo.com.mx
* Created on 10/08/2009, 03:16:38 PM
* Place: Monterrey, Nuevo León, México.
* Company: Codicentro
* Web: http://www.codicentro.com
* Class Name: Format.java
* Purpose:
* Revisions:
* Ver Date Author ... | true |
00e3e83202447f0d67a110da64bea4b5a28887e9 | JavaScript | Patrick-Duvall/tic-tac-toe | /game.js | UTF-8 | 1,957 | 3.140625 | 3 | [] | no_license | class Game {
constructor(playerOne, playerTwo) {
this.board = new Array('', '', '', '', '', '', '', '', '')
this.playerOne = playerOne
this.playerTwo = playerTwo
this.currentPlayer = this.setStartingPlayer() ? this.playerOne : this.playerTwo
this.isGameWon = false
}
setStartingPlayer() {
... | true |
a7f4a6966657836f70a47987b102c3fc7a9fb5db | JavaScript | polawat789/solution_essilor_test | /question2/sol3.js | UTF-8 | 339 | 3.59375 | 4 | [] | no_license | function range(begin,end) {
var arr = [];
while(begin<=end) {
arr.push(begin);
begin += 1;
}
return arr;
}
function sum(arr) {
var count = 0;
for(var i = 0;i < arr.length;i++) {
count += arr[i];
}
return count;
}
console.log(range(1,10))
console.lo... | true |
4a1e1a0b883cb5186e80fc857ff698c8fe3ea76c | JavaScript | aniledev/moviedex-api | /src/app.js | UTF-8 | 4,586 | 3.0625 | 3 | [] | no_license | // IMPORT REQUIRED LIBRARIES AND SECURITY PACKAGES
require("dotenv").config();
const express = require("express");
const morgan = require("morgan");
const helmet = require("helmet");
const cors = require("cors");
const winston = require("winston");
const { NODE_ENV, PORT } = require("./config");
const MOVIEDEX = requir... | true |
0ca0172f8e7fe9054790e7c7b512362936ad8eed | JavaScript | emmersive-io/client | /src/elements/userListItem.js | UTF-8 | 960 | 2.59375 | 3 | [] | no_license | import defaultUserImage from '../images/profile-red.png';
export default class UserListItem {
constructor(user, isPreview) {
this.user = user;
this.element = document.createElement('li');
if (isPreview === true) {
this.element.className = 'list-item--thumb';
this.el... | true |
382cde552e7b5478d7bd9395c618ecb63ab2ee06 | JavaScript | huiyuank/tapassignment | /client/src/components/DataTable.js | UTF-8 | 1,778 | 2.515625 | 3 | [] | no_license | import Table from "react-bootstrap/Table";
import {
PencilFill,
TrashFill,
SortUpAlt,
SortDown,
} from "react-bootstrap-icons";
const nonHeaders = ["_id", "__v"];
const DataTable = ({ employees, sortParams, handleSortClick }) => {
const renderTableHeaders = Object.keys(employees[0]).map((header, ... | true |
49567aa028eca23c44d54fbb39433ff60fb82914 | JavaScript | JohnALong/beer-me | /src/components/brewery/BreweryList.js | UTF-8 | 1,734 | 2.6875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import BreweryCard from './BreweryCard';
import BeerManager from '../../modules/BeerManager';
import { useLocation } from "react-router-dom";
const initialBreweryData = {
data: [],
currentPage: 1
}
const BreweryList = () => {
const [breweryData, setBrewe... | true |
3e3d0499f1f0229ea342529b23ac4d7388248629 | JavaScript | jwworth/survey-image | /src/App.js | UTF-8 | 6,748 | 2.5625 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react';
import { withFormik } from 'formik';
import './normalize.css';
import './skeleton.css';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
scoreTree: [
[1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, ... | true |
22708c37f4f8906d242de96798e1e9626aeea103 | JavaScript | guoyihan/JavaScript_fullstack | /vue-learn/vue-cli/vue-watch/watch.js | UTF-8 | 1,280 | 3.125 | 3 | [] | no_license | // 能独立监听某个数据的变化
// 提供可执行函数的场所
class watcher {
constructor (opts) {
this.$data = this.getBaseType(opts.data) === 'object' ? opts.data : {}
this.$watch = this.getBaseType(opts.data) === 'object' ? opts.data : {}
for(let key in opts.data) {
this.setData(key)
}
}
g... | true |
47be55e7002ac86240554ceb9da53709319d03f4 | JavaScript | ProDoser/fitness_calc | /mainscript.js | UTF-8 | 2,405 | 3.390625 | 3 | [] | no_license | //navigation scripts
//snow/hide elements and change page title
//Entered information/results stays on hidden pages
function home() {
document.getElementById('main').style.display = 'block';
document.getElementById('bmi_page').style.display = 'none';
document.getElementById('hrz_page').style.display = 'none... | true |
9f77557e1e0b5fb42ad416c3cf84c259bd179aa6 | JavaScript | hungfhp/hr-test | /server/seed/initAdmin.js | UTF-8 | 887 | 2.515625 | 3 | [] | no_license | import User from "../modules/user/userModel.js"
import config from "../config/index.js"
const admin = {
email: "admin@gmail.com",
password: "123456",
role: config.USER_ROLE.ADMIN,
name: "Admin"
}
const employee = {
email: "employee@gmail.com",
password: "123456",
role: config.USER_ROLE.EMPLOYEE,
name:... | true |
e34e086acf1819196cbab28ffc15280712330301 | JavaScript | simonarthur/chickenfoot | /src/tests/Test.js | UTF-8 | 6,149 | 3.28125 | 3 | [
"MIT"
] | permissive | /**
* Testing framework.
*
* Typical usage:
*
* var t = new Test();
*
* t.test(function() {
* // testing code with assertions: Test.assert(), Test.assertEquals(), etc.
* });
*
* // repeat t.test() with other tests
*
* // end testing and display summary of results
* t.close... | true |
87cedbc38866862102a62583d6a508d7f67c1e53 | JavaScript | macrometric/overview-service | /client/index.jsx | UTF-8 | 2,454 | 2.5625 | 3 | [] | no_license | import React from 'react';
import ReactDOM from 'react-dom';
import axios from 'axios';
import Title from './components/title.jsx';
import Rating from './components/rating.jsx';
import Description from './components/description.jsx';
import Price from './components/price.jsx';
import AddToCart from './components/addtoc... | true |
765f593efe0ba3e33807d81236f2083335df72d1 | JavaScript | JustinBogantes99/API_ProyectoDIS | /src/components/Visitor/VisitorClases.js | UTF-8 | 1,067 | 2.8125 | 3 | [] | no_license | import { Visitor } from "./Visitor"
class VisitorClases extends Visitor{
constructor(fecha){
super()
this.clases = []
this.fecha = fecha
}
//Getters
getClases(){
return this.clases
}
getFecha(){
return this.fecha
}
//Setters
setClases(clase... | true |
956ac41b6bb88b91d0b020b8615ca4981f4407de | JavaScript | js-lib-com/js-lib | /src/js/util/Strings.js | UTF-8 | 12,926 | 3.3125 | 3 | [
"Apache-2.0"
] | permissive | $package('js.util');
/**
* Handy methods for strings manipulations.
*
* @author Iulian Rotaru
* @since 1.0
*/
js.util.Strings = {
/**
* Remove white spaces from string extremities. Recognized white spaces are: <table>
* <tr>
* <td>space</td>
* <td> </td>
* </tr>
* <tr>
* <td>t... | true |
c94232248e63a50c0c7b28111e4fdd434c768552 | JavaScript | Hopiu/webapi-eca | /js/sandbox.js | UTF-8 | 942 | 2.65625 | 3 | [] | no_license | // Generated by CoffeeScript 1.7.1
(function() {
var app, express, fHandleEvent, fHandleEventGet;
express = require('express');
app = express();
app.post('/event', fHandleEvent);
app.get('/event', fHandleEventGet);
app.listen(8111);
fHandleEvent = function(req, resp) {
var body;
console.log(... | true |
7b1ab286deafa7e55835f1b3d93dfb5516d1c186 | JavaScript | lukman-bahar-ap/instaapp | /src/scripts/views/pages/home/component/viral-list.js | UTF-8 | 551 | 2.953125 | 3 | [] | no_license | import './viral-item';
class ViralList extends HTMLElement {
set virals(virals) {
this._virals = virals;
this.render();
}
renderError(message) {
this.innerHTML = `<h3>${message}</h3>`;
}
render() {
this.innerHTML = '';
this._virals.forEach((viral) => {
const viralItemElement = do... | true |
81068ed50cded2a2f47c086a9f20e396badfe280 | JavaScript | joshuasextondws2/SextonJoshuaDWS2 | /js/main.js | UTF-8 | 8,876 | 3.140625 | 3 | [] | no_license | //cache of inputs
const submit = document.querySelector('#complete')
const nameField = document.querySelector('#fullName')
const emailField = document.querySelector('#email')
const addressField = document.querySelector('#address')
const cityField = document.querySelector('#city')
const stateField = document.querySelec... | true |
c4a2df8685bee75430933eafa5c37b01d85c9d24 | JavaScript | Arkinsaal/inertialR | /src/client/Game/Objects/Boundary.js | UTF-8 | 1,420 | 2.75 | 3 | [
"MIT"
] | permissive | import texture from '../../../../rs/boundaryTexture.png';
import { drawAtPointsInArc } from 'Services/helpers';
export default class Boundary {
texture = null;
constructor(game, { radius, elasticity }) {
this.game = game;
this.left = 0;
this.top = 0;
this.radius = radius || 2000;
this.effectR... | true |
493f5a1760c443eb44773957a908bdb5d5162e75 | JavaScript | sislam16/Pantry-Party | /frontend/src/Components/recipes/NewRecipe.jsx | UTF-8 | 3,903 | 2.703125 | 3 | [] | no_license | import React, { useState } from 'react';
import { useHistory } from 'react-router-dom'
import axios from 'axios';
import { TextField, Button, Typography, Container } from '@material-ui/core'
import { recipeStyles } from '../styling/recipesStyling'
const NewRecipe = () => {
const history = useHistory()
const cl... | true |
139d61c7e6504b386eba0cd298a8fe0acfacfd8b | JavaScript | VonSwirl/Shift_Ninja_Web | /public/resources/js/shiftViewDatatable.js | UTF-8 | 1,931 | 2.84375 | 3 | [
"BSD-3-Clause",
"ICU",
"LicenseRef-scancode-unicode",
"ISC",
"Zlib",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"NTP",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-unknown-license-reference",
"Artistic-2.0",
"MIT",
"NAIST-2003"
] | permissive | /* Formatting function for row details - modify as you need */
function format(d) {
return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
'<tr>' +
'<td> Job Description: </td>' +
'<td>' + d.shiftRole + '</td>' +
'</tr>' +
'<tr>' +
'... | true |
168d0490be0f21b6739c82be648e8be5db2a7633 | JavaScript | caionakai/ASAI | /backend/src/app/routes/leadItemRouter.js | UTF-8 | 731 | 2.75 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const LeadItemController = require("../controllers/LeadItemController");
//List all leads
router.get('/', async (req, res) => {
const leads = await LeadItemController.listAll();
return res.json(leads);;
});
//Create new lead
router.post('/... | true |
95d50db5384636824d2864dbab088b83b5ee0f84 | JavaScript | iankim2280/algorithms_dataStructure | /Big-o-notation/space_complexity.js | UTF-8 | 536 | 4.34375 | 4 | [] | no_license | /*
Space Complexity
how much additional memory do we need to allocate in order to run the code in our algrithm?
*/
// 2 numbers total, i
const sum = (array) => {
let total = 0;
for (let i = 0; i < array.length; i++) {
total += array[i];
}
return total;
};
// let sumArray = [1, 2, 3, 7]
// console.log(sum(s... | true |
6898414a66c637f33b47159de88c4daa9e5c444a | JavaScript | kozko2001/roam-export | /export/index.js | UTF-8 | 2,017 | 2.609375 | 3 | [] | no_license | const puppeteer = require('puppeteer');
USERNAME = process.env.ROAM_USERNAME;
PASSWORD = process.env.ROAM_PASSWORD;
URL = 'https://roamresearch.com/#/app/' + process.env.ROAM_DATABASE;
const run = async () => {
const browser = await puppeteer.launch({
args: [
// Required for Docker version of Puppeteer
... | true |
a2c9f5bf8b405de1d356054c4e535665249c113a | JavaScript | azemel/itstep-js | /UI.Scroll/progress.js | UTF-8 | 2,524 | 2.921875 | 3 | [] | no_license |
const mock = () => {
let sections = createArray(index => [
$("h1", {}, "Header " + (index + 1)),
$("section", {
style: {
height: randomInt(500, 2000) + "px"
}
})
]) (7);
document.body.append(...sections.flat());
};
// 1. Прогесс бар
// 2. Дозагрузка контента
// 3. Паралакс
win... | true |
d0ff9bbf88fc75d5c3161f2c89b4738efd29375a | JavaScript | Azure-Samples/iot-edge-complementary-code | /node/shared/compression/test/compression-tests.js | UTF-8 | 1,590 | 2.609375 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | 'use strict';
const fs = require('fs');
const chai = require('chai');
const expect = chai.expect;
const compressor = require('../compress-message');
const emptyContentData = Buffer.from([]);
const compressedContentData = fs.readFileSync('test/1.xml.gz');
const decompressedContentData = fs.readFileSync('test/1.xml');
... | true |
ec373d1092ebef319335605d7f47dc07822cfd9d | JavaScript | egriffin2/MART220 | /p5/eco/test.js | UTF-8 | 1,042 | 3.0625 | 3 | [] | no_license | function Mover(x_,y_,size_) {
this.size = size_;
this.loc = createVector(x_,y_);
this.vel = createVector(0,0);
}
Mover.prototype.updatePos = function() {
var mouse = createVector(mouseX, mouseY);
this.acc = p5.Vector.sub(mouse, this.loc);
//this.acc = createVector(random(-1,1), random(-1,1));
//this.ac... | true |
089c3de3bc87aad9b620fb47172f7df2127664b8 | JavaScript | SolalDR/Ono-3D-Globe | /CircleProgress.js | UTF-8 | 4,274 | 2.703125 | 3 | [] | no_license |
function CircleProgress(value, config){
this.value = value;
this.content = config.content;
this.style = {};
this.setConfig(config);
this.gen();
}
CircleProgress.prototype.setConfig= function(config){
this.style.width = config.width? config.width : 30;
this.style.height = config.height? config.height : ... | true |
d11892c5cfc3281e0c9a818df7c06338fd16de78 | JavaScript | TYRONEMICHAEL/codility-algorithms | /07-stacks_and_queues/StoneWall.js | UTF-8 | 724 | 3.328125 | 3 | [] | no_license | // StoneWall
// Score: 100%
function solution(H) {
var len = H.length;
var numBlocks = 1;
var stack = [H[0]];
for (var i = 1; i < len; i++) {
var currentHeight = H[i];
for(var j = stack.length - 1; j >= 0; j--) {
var previousBlock = stack[j];
if(previousBlock < currentHeight) {
b... | true |
f806a86d2411e365a8897a6439b523a405927551 | JavaScript | assumecs/frontend_architect | /4_node/004/part1/4.req-attribute.js | UTF-8 | 480 | 2.734375 | 3 | [] | no_license | let express = require('express');
let app = express();
app.listen(3000);
// 想区分是查询一个还是查询所有 query.id
app.get('/user', (req, resp) => {
console.log(req.query.id); // express 扩展的
console.log(req.url); // 获取整个路径包括问号
console.log(req.path); // express 扩展的,获取路径不包括问号 /user
console.log(req.headers); // 请求头:所有都是... | true |