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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f62acc3fbc2cefeccb03bbd3d79e8ca9e90ac9cf | JavaScript | crogcrog24/TourdeGlobe | /middleware.js | UTF-8 | 1,641 | 2.53125 | 3 | [] | no_license | const {DestinationSchema,reviewSchema}=require('./schemas.js');
const expressError=require('./utils/expressError');
const Destination=require('./models/destination');
const Review = require('./models/review');
module.exports.isLoggedIn = (req, res, next) => {
if (!req.isAuthenticated()) {
req.session.retu... | true |
5d89ed7f587898156c55ad8735c5703976ec589e | JavaScript | sheel-d/sheel-d | /demoJS/photo.js | UTF-8 | 2,056 | 2.625 | 3 | [] | no_license |
import $ from 'jquery';
import {photoData} from './photoData.js';
export function note(){
var cDivPh = document.getElementsByClassName('photo');
var data = photoData;
console.log($('.wrap').width(),$('.wrap').height());
var $heightNum = Math.floor(parseInt($('.wrap').height())/160);
var $widt... | true |
ccac2555089f313c349bba0e567411a30b90bb6f | JavaScript | SebGadzinski/Food2ForkAPITesting | /public/js/script.js | UTF-8 | 2,625 | 3.453125 | 3 | [] | no_license | //This function uses the index.html and changes what foods there are based on ingredients
function getRecipes() {
//get input values and spaces
let foodName = document.getElementById('food').value
let foodDiv = document.getElementById('foodIngredient')
foodDiv.innerHTML = ''
//gather the query value... | true |
72b0534d3c557a04394f6f5b71f93221206b5f5f | JavaScript | trombonecot/master-role-helper | /app/api/eventApi.js | UTF-8 | 973 | 2.59375 | 3 | [] | no_license | define([ "./../models/eventObject",
"./../models/locationObject",
"./mocked-data"],
function(EventObject, LocationObject, MockedData) {
var timeIndex = {};
return {
init: function(initialTime){
var mockedData = MockedData.getAll();
... | true |
f8b9c1ff9334e07dad444de31a6bcbc06413d2a3 | JavaScript | suhailgupta03/twingly-client | /es5-build/http.js | UTF-8 | 3,514 | 2.71875 | 3 | [] | no_license | 'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.definePrope... | true |
7134c15571080e0d0bbbc2b0983d65c4fafbfcb6 | JavaScript | breadoliveoilsalt/practice-algorithms-various | /ransome-note.js | UTF-8 | 2,620 | 3.921875 | 4 | [] | no_license | ////////////////////////////////////////////////////////////////////////////////
// Random note problem practice:
function checkMagazine(magazine, note) {
let wordCount = {}
// assumes no punctuation
// editor will not accept .split() for some reason
let wordArr = turnStringToArray(magazine)
let ... | true |
ad94b4b83448e14fbcbb36a23bcf4ebcb78d20fb | JavaScript | JunYuHuang/fmc-todo-app | /src/components/CreateTodoForm.js | UTF-8 | 1,635 | 2.53125 | 3 | [] | no_license | import { useState } from "react";
import { useDispatch } from "react-redux";
import { createTodo } from "../redux/todosSlice";
export default function CreateTodoForm() {
const [todoText, setTodoText] = useState("");
const dispatch = useDispatch();
const handleCreateTodoForm = (e) => {
e.preventDefault();
... | true |
2c9b44ce8e84eefb34d02d31454ee010f16d5548 | JavaScript | natwebb/lectures | /2014-01-10-js.tutorial/public/js/main.js | UTF-8 | 1,536 | 3.71875 | 4 | [] | no_license | console.log('hello from javascript');
console.log('Nat Webb');
//debugger
var a = 10;
var b = 20;
var c = a + b;
var d = c * b;
var e = d * (b - a);
var power = Math.pow(2, 8);
console.log('e is ' + e);
console.log('2 to the 8th power is ' + power);
var len = 8;
var wid = 12;
var area = len * wid;
console.log('th... | true |
42137525763df688c8fdf78dd957134db6382175 | JavaScript | riccardogiorato/meilisearch-react-demo | /src/App.js | UTF-8 | 3,476 | 2.5625 | 3 | [
"MIT"
] | permissive | import React, { useState, useEffect } from "react";
import MeiliSearch from "meilisearch";
const client = new MeiliSearch({
host: "http://127.0.0.1:7700/",
});
const index = client.getIndex("decathlon");
function App() {
const [searchedWord, setSearch] = useState("");
const [resultSearch, setResults] = useSta... | true |
576713d9b55357d545f7142cb39fa1a761118c85 | JavaScript | pcalulo/lugsched | /static/scripts/linkedlist.js | UTF-8 | 3,747 | 3.6875 | 4 | [] | no_license |
/*
* A linked list implementation intended for use in clicklists
*/
function LinkedListNode(data) {
this.data = data;
this.next = null;
}
function LinkedList() {
this.first = null;
this.last = null;
this.sortFunc = null;
this.length = 0;
}
LinkedList.prototype.isEmpty = function() {
re... | true |
455512a3f0575465c784f70126555a3e2722d3db | JavaScript | kathryneh/flyingburrito | /update.js | UTF-8 | 1,125 | 3.65625 | 4 | [] | no_license | /* Status
* Models status updates added by users to recount their daily tasks.
* Provides information about the date it was made, the person who made
* the update, as well as the text of the actual update.
*/
var Status = function(date, author, text){
//go ahead and assign it to the current date.
this.date = n... | true |
040c9be3288c59859b3d1ce2e43d7e191c73c767 | JavaScript | mockingbot/dom-snapshot | /source/fetch.js | UTF-8 | 1,735 | 2.65625 | 3 | [
"MIT"
] | permissive | const { fetch, FileReader, URL } = window
const dataUrlToBlobUrl = async (dataUrl) => {
const response = await fetch(dataUrl)
const blob = await response.blob()
return URL.createObjectURL(blob)
}
const blobToDataUrl = (blob) => new Promise((resolve) => {
const reader = new FileReader()
reader.addEventListen... | true |
1067ea53ba8b647e487525839a957745985e15be | JavaScript | MarcoMruz/code-wars-exercises | /twiceLinear.js | UTF-8 | 142 | 2.90625 | 3 | [] | no_license | "use strict";
function dblLinear(n) {
let u = [1],
x = 0,
y = 0;
for (let i = 1; i <= n; i++) {}
}
console.log(dblLinear(20));
| true |
7dc2a552b32ee471b8e067213b65b1c1ef0f6f24 | JavaScript | micoongkeko/batch8-activities | /bankingapp/newuserapp.js | UTF-8 | 2,422 | 2.84375 | 3 | [] | no_license |
class User {
constructor (name, email, password, balance) {
this.name = name;
this.email = email;
this.password = password;
this.balance = balance;
}
}
let createNewAccBtn = document.getElementById('createNewAcc');
createNewAccBtn.addEventListener('click', (e) =>... | true |
a2a4377db2dd9776bfbfb5f0643ab3613759288f | JavaScript | turingschool-examples/co-workers-api | /server.js | UTF-8 | 1,579 | 2.59375 | 3 | [] | no_license | const express = require('express');
const cors = require('express-cors');
const bodyParser = require('body-parser');
const port = process.env.PORT || 3001;
const app = express();
const { coWorkers } = require('./co-workers.js');
app.locals.title = 'Co-Workers API';
app.locals.coWorkers = coWorkers
app.use(cors({
al... | true |
c03fe6dd28d3ee27b2ed1a5a2da6d5977adc834a | JavaScript | michiang/toy-problems | /sumArray.js | UTF-8 | 414 | 3.3125 | 3 | [] | no_license | function sumArray(array){
var maxSum = Number.NEGATIVE_INFINITY;
var current = 0;
for (var i = 0; i < array.length; i++) {
current = current + array[i];
maxSum = Math.max(maxSum, current);
if (current < 0) {
current = 0;
}
}
return maxSum;
};
//O: Integer
//I: Array of integers
//C: non... | true |
d0f9dac93e8dd8a7a52fac0e938d7ccfe72b7c3a | JavaScript | coopdojo/tdd-kata | /api/api.js | UTF-8 | 4,081 | 2.859375 | 3 | [
"MIT"
] | permissive | 'use strict';
const MEMBERS_TO_GENERATE = 10;
const MAX_TRANSACTION_COST = 150;
const MIN_TRANSACTION_COST = 1;
const MAX_TRANSACTION_HISTORY = 10;
const PAST_YEAR_PURCHASE_DATA = 10;
let faker = require('faker');
function seedRandomMemberData(members){
for (var i = 0; i < MEMBERS_TO_GENERATE; i++) {
mem... | true |
bd8b5d862a3e08434ed3307264706b4bd861b9d5 | JavaScript | mykeels/tic-tac-toe | /models/pivot.js | UTF-8 | 732 | 2.921875 | 3 | [
"MIT"
] | permissive | const Board = require("./board");
const BoardState = require("./board-state");
const Tile = require("./tile")
const Pivot = function (x, y) {
this.x = x || 0;
this.y = y || 0;
}
Pivot.getPivots = (board) => {
let pivots = [];
for(let x = 1; x < board.length - 1; x++) {
for(let y = 1; y < board... | true |
ec082afa447e628401853a84463d968dab810365 | JavaScript | Fun-d-6th-Stock-King/Firebase-kakao-auth-server | /functions/index.js | UTF-8 | 7,901 | 2.6875 | 3 | [] | no_license | 'use strict';
const functions = require('firebase-functions');
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
//
// exports.helloWorld = functions.https.onRequest((request, response) => {
// functions.logger.info("Hello logs!", {structure... | true |
baa6f9cc210636e30760fb4c18463aa5836fbd19 | JavaScript | GricenkoAlexandr/ProCode | /ProJS2/js/script.js | UTF-8 | 505 | 2.875 | 3 | [] | no_license | `use strict`;
let outfn=document.querySelector('.out1');
let outmn=document.querySelector('.out2');
let outln=document.querySelector('.out3');
const form=document.querySelector('.input_block');
form.addEventListener('submit', (ev)=>{
ev.preventDefault();
let inpf1=document.querySelector('.inp1').value;
le... | true |
e153c67cc15ea23ab4c10d9e1d7b9bba3eb85f8a | JavaScript | fossabot/gdmod | /Loader/patchUtils/patcher.js | UTF-8 | 1,231 | 2.515625 | 3 | [
"MIT"
] | permissive | const patchUtil = require('jsondiffpatch');
const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
/**
* Applies all the patches to the engine files
* @param {string} directory Path to the files to be patched.
* @param {string} [additionalPatchesDir] Path to additional Patches to a... | true |
95c8bff64dce3538abab7301dbae7a8ac87d5503 | JavaScript | hongtw/learnyounode | /12.letterUpperCase_server.js | UTF-8 | 695 | 3.21875 | 3 | [] | no_license | /*
# 學習 NODE.JS 贏得更多
## HTTP 回傳大寫字體 (練習題 12 之 13)
撰寫一個只能接收 POST 請求的 HTTP 伺服器,這個伺服器會把收到的 POST
內容字元轉換成大寫,並回應給客戶端。
您的伺服器應該監聽在第一個參數所給予的 port 上。
*/
const http = require('http')
const server = http.createServer(function (req, res) {
if (req.method === 'POST') {
let body = ''
req.on('data', (data) => {... | true |
4e173b4ce0b58f6d1198332b66e4caeb720fe336 | JavaScript | derek3191/photo-timelapse | /movieCreator.js | UTF-8 | 5,169 | 2.765625 | 3 | [] | no_license | const FileDetail = require('./fileDetail');
const fs = require('fs');
const util = require('util');
const videoshow = require('videoshow');
const sharp = require('sharp');
const readdir = util.promisify(fs.readdir);
const copyFile = util.promisify(fs.copyFile);
(async () => {
getJpgFilenames(`${__dirname}/img`)
... | true |
ab35279da48b9f728755f8e10257d4b02bdfcfee | JavaScript | jormaechea/open-api-mocker | /lib/tags/parser.js | UTF-8 | 797 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
const Tag = require('./tag');
const TagsStruct = require('./structs');
const extractExtensions = require('../utils/extract-extensions');
const enhanceStructValidationError = require('../utils/enhance-struct-validation-error');
class Parser {
parse(schema) {
const { tags } = schema;
this.validate... | true |
4862d799dcc778a68f6179398806851b9ae6e901 | JavaScript | andersonbellini/contador-de-voltas | /src/MostraTempo.js | UTF-8 | 446 | 2.5625 | 3 | [
"MIT"
] | permissive | import React from 'react'
const MostraTempo = (props) => {
const tempo = props.tempo
const minutos = Math.ceil(tempo / 60)
const segundos = tempo % 60
const minutoStr = minutos < 10 ? '0' + minutos : minutos
const segundosStr = segundos < 10 ? '0' + segundos : segundos
return (
<p className='tempo'>
... | true |
2974c402a082dabf50d546fca47ad29c81603788 | JavaScript | luisfer7192/react-native-example-alltalk | /server/server.js | UTF-8 | 2,641 | 2.53125 | 3 | [] | no_license | const fs = require('fs')
const path = require('path')
const express = require('express')
const app = express()
const bodyParser = require('body-parser')
const DATABASE = require('./db')
console.log(DATABASE)
app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())
app.use('/static', express.stat... | true |
5b1b037ad73131064ad4fc84ba1f5a128f5643e0 | JavaScript | PetiaTsigomareva/JS-Advanced | /05.JS Object Composition/Exercises/tests/TestTask5.js | UTF-8 | 2,476 | 3.578125 | 4 | [] | no_license | const expect = require('chai').expect;
(function stringExtension() {
String.prototype.ensureStart = function (str) {
let result = this.toString();
let index = result.search(str);
if (index < 0) {
result = str + result;
}
return result;
};
String.prototype.ensureEnd = function (str) {
... | true |
5d3b88ee088e9e71295d3f2dd9da1d09d9d950ab | JavaScript | william-oliveira-da-silva/LP3_2019_2 | /Aula01/app.test.js | UTF-8 | 2,488 | 3.328125 | 3 | [] | no_license | const requesicao = require('supertest');
const app = require('./app');
describe('Testa o serviço de inversão de strings', () => {
test('Deve restornar a string original de forma invertida', async () => {
let str = 'animal';
/**
* Realiza uma requisição de inversão de string, passando a pal... | true |
64e911b7687e6df9d809ad57d96964a616e77728 | JavaScript | opencollective/hyron | /core/ServicesManager/configParser.js | UTF-8 | 3,219 | 2.640625 | 3 | [
"MIT"
] | permissive | const {
checkMethod
} = require("./supportedMethod");
const chalk = require("chalk");
function prepareMethod(data, method, funcPath) {
if (method == null) return;
if (typeof method == "string") {
var standardMethod = method.toUpperCase();
checkMethod(standardMethod, funcPath);
dat... | true |
419e3f61a8281621a3c92e0c339e60d23ec3e05c | JavaScript | taylor12138/weather | /pages/index/index.js | UTF-8 | 775 | 2.59375 | 3 | [] | no_license | // pages/index/index.js
Page({
/**
* 页面的初始数据
*/
data: {
region:['广东省','东莞市','道滘镇'],
now:''
},
changeRegion:function(e){
this.setData({
region:e.detail.value
})
this.GetWeather();//更新天气
},
GetWeather:function(){
var that=this;//this 不可以再wxAPI函数内部使用
wx.request({
... | true |
d2b60adae29240dfbab0973c540e7e0b7aaf62d7 | JavaScript | RRChristenson/GymPanion | /platforms/browser/www/js/login.js | UTF-8 | 539 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | function sendLogin(){
let user = Document.getElementById("username-field").value;
let pass = Document.getElementById("password-field").value;
$.ajax({
type : "POST",
url : "http://fitpanion.com/login",
dataType : 'json',
username: user,
... | true |
174c921481fc632ad4056c06408df73e2698b9ed | JavaScript | altcoda/Softuni-JS-Advanced | /15._Classes/04._pointDistance.js | UTF-8 | 262 | 3.34375 | 3 | [] | no_license | class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
static distance(pointA, pointB) {
let xDiff = pointA.x - pointB.x;
let yDiff = pointA.y - pointB.y;
return Math.sqrt(xDiff * xDiff + yDiff * yDiff);
}
}
| true |
968aa25e9ff14f83131ea077d3f009b37833874e | JavaScript | Syugen/utop-server-node | /assets/scripts/dashboard.js | UTF-8 | 1,574 | 2.515625 | 3 | [
"MIT"
] | permissive | 'use strict';
var dashboard = {};
//append search result at search.html by using res.render() , using template
//need to specify the template of search.html
dashboard.init = function() {
$("#info-form").submit(function(event) {
event.preventDefault();
let json_info = $(this).serializeArray(), js... | true |
edfcd6abd40d1d3a0f2f7fe98da9022e4e9c5efd | JavaScript | abregre/akroatis | /index.js | UTF-8 | 4,138 | 2.90625 | 3 | [] | no_license | require('dotenv').config();
const Discord = require("discord.js");
const prefix = '?';
const token = process.env.TOKEN_KEY;
const ytdl = require("ytdl-core");
const bot = new Discord.Client();
const queue = new Map();
//Console logs for dev
bot.on("ready", () => {
console.log("Bot running!");
});
bot.on("reconnec... | true |
0936220158986f275a6d941a01990707bfa177bc | JavaScript | Ahmed199764/SQL-Lab9 | /movie.js | UTF-8 | 891 | 2.84375 | 3 | [] | no_license | 'use strict';
function movieHandler(request, response) {
const values = request.query.values;
superagent(
`https://api.themoviedb.org/3/search/movie?api_key=${process.env.MOVIE_API_KEY}&query=${request.query.search_query}`
)
.then((trailRes1) => {
const movieData = trailRes1.bod... | true |
b05640f6e22e22e4ec34cb45530796fe043a27dc | JavaScript | emege93/APIMarvelJSSimple | /app.js | UTF-8 | 970 | 2.734375 | 3 | [] | no_license | const marvel = {
render:() => {
const urlAPI = 'https://gateway.marvel.com:443/v1/public/events?ts=1&apikey=7a223801639512aa33a05f17b668c180&hash=0cb41251b618902745425a61f26205e4';
const container = document.querySelector('#marvel-row');
let contentHTML = '';
fetch(urlAPI)
... | true |
e34fc241880b3f81640822ae37fc18b0a4dae1d8 | JavaScript | RenzoSartore/Helios | /www/js/app.js | UTF-8 | 2,257 | 2.59375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | angular
.module('myApp', [])
.factory("tasks", ["$firebaseArray",
function($firebaseArray) {
// create a reference to the database location where we will store our data
var ref = firebase.database().ref().child('tasks');
// this uses AngularFire to create the synchronized array
return $firebaseArray(... | true |
4982e2d158c1cb3a85745db7a8d91c07a0675aa1 | JavaScript | b96705008/mongoose-api-query | /test/test.js | UTF-8 | 14,815 | 3.015625 | 3 | [
"MIT"
] | permissive | var expect = require("expect.js")
, Browser = require("zombie")
, browser = new Browser();
var hasMonster = function (name) {
expect(browser.text()).to.contain('"' + name + '"');
};
var hasMonsterCount = function (num) {
var json = JSON.parse(browser.text());
expect(json.length).to.equal(num);
};
var hasMo... | true |
0e0024f728018b22dd898005e33ae143182d1954 | JavaScript | wzhkobe2408/zhufeng-public | /前端监控monitor/monitor/performance.js | UTF-8 | 1,864 | 2.53125 | 3 | [] | no_license |
// 专门用来写页面性能监控的逻辑
let processData = (p) => {
let data = {
prevPage:p.fetchStart - p.navigationStart, // 上一个页面到这个页面的时长
redirect:p.redirectEnd - p.redirectStart, // 重定向的时长
dns:p.domainLookupEnd - p.domainLookupStart, // dns解析的时长
connect:p.connectEnd - p.connectStart, // tcp连接的时长
// 从请求到响应的时长
s... | true |
991f538906bb8cbb1ec52d7009f9fa58e4368938 | JavaScript | iCodeIN/coding-problems | /Sorting/largest-number-form.js | UTF-8 | 845 | 4.25 | 4 | [] | no_license | /*Largest Number
Given a array A of non negative integers, arrange them such that they form the largest number.
Note: The result may be very large, so you need to return a string instead of an integer.
Return a string representing the largest number.
A = [3, 30, 34, 5, 9]
o/p: "9534330"
Date: 13/07/21
*/
module.e... | true |
d716b3838006a0fc987b82b2b7581c62cb88e2c3 | JavaScript | simonwong/leet-code-algorithms | /medium/two-pointers/longestOnes.js | UTF-8 | 788 | 3.8125 | 4 | [] | no_license | // 1004. 最大连续1的个数 III
// https://leetcode-cn.com/problems/max-consecutive-ones-iii/
// 思路
// 双指针,初始化 left = right = 0,[left, right)
// 不断 right + 1,遇到 0 ,count++
// 当 count > k ,满足当前的窗口条件,
// 不断 left + 1,如果遇到 0 且 k < 初始k,count--,回去重复 上述步骤
/**
* @param {number[]} A
* @param {number} K
* @return {number}
*/
var lon... | true |
4e4963a9f166864cdf8a363d6145657a9f469c5c | JavaScript | mwaehner/SIMPLE_RSS | /static/js/main.js | UTF-8 | 6,183 | 2.5625 | 3 | [] | no_license | function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
// Does this cookie string begin with the name we w... | true |
807884350a08fc45d5bd3394e59c7654f8a1b6ad | JavaScript | quiquex222333/LittleDemo | /src/app/app.js | UTF-8 | 2,353 | 2.703125 | 3 | [] | no_license | const express = require("express");
const faker = require("faker");
const fs = require("fs");
const app = express();
const port = 3000;
app.get("/", (req, res) => {
res.send("Hello World!");
});
app.get("/users", function (req, res) {
let users = [];
for (let index = 0; index < 100; index++) {
const newUser... | true |
adf2fc1930c3585d330405b83d4c22f4ab7f5807 | JavaScript | DeliSauce/Assessment_5_Prep | /in_progress/looping.js | UTF-8 | 1,806 | 4.5625 | 5 | [] | no_license |
// fizzBuzz
// Takes an array returns a new array of every number in the array
// that is divisible by either 3 or 5, but not both.
function fizzBuzz(array) {
let finalArr = [];
array.forEach( (el) => {
if (el % 3 === 0 ^ el % 5 === 0) finalArr.push(el);
});
return finalArr;
}
console.log(fizzBuzz([12,... | true |
747ed881d376dae7d4eef06fccc393d6d864a45d | JavaScript | AdrianJazowski/cardGame | /src/components/gameLogic/GameSetup.js | UTF-8 | 1,724 | 2.75 | 3 | [] | no_license | /** @format */
import axios from "axios";
import React from "react";
import { connect } from "react-redux";
import {
pullCardFromDeckForMyHand,
pullCardFromDeckForCroupierHand,
} from "../../actions";
const GameSetup = ({
deckId,
pullCardFromDeckForMyHand,
pullCardFromDeckForCroupierHand,
}) => {
const pu... | true |
9b915ca09efa8bc58aed94ad28c0db674995d052 | JavaScript | yangkuo1993/es6 | /chapter5/index.js | UTF-8 | 2,741 | 3.71875 | 4 | [
"MIT"
] | permissive | /*
* 函数的扩展
* */
// function log(x, y = 'world') {
// console.log(x,y)
// }
//
// log('hello')
// log('hello', 'yangkuo')
// function demo(x, x, y) {
//
// }
// function demo(x, x, y = 0) {
//
// }
// let x = 99;
// function add(p = x + 1) {
// console.log(p)
// }
// add()g
// x = 100
// add()
// var x= 1;
... | true |
cf58154213fed307ef310343dccdae3901546592 | JavaScript | daonguyendev/learn-reactjs-redux | /06_component_life_cycle/src/AppContent.js | UTF-8 | 1,012 | 2.765625 | 3 | [] | no_license | import React, { Component } from 'react';
class AppContent extends Component {
//--- Updation -> with props
componentWillReceiveProps(nextProps) {
console.log('componentWillReceiveProps of AppContent.js is running! ' + nextProps.name);
}
shouldComponentUpdate(nextProps, nextState) {
... | true |
59cd72605d05adf275159a4f23e0c2a45ff1c3cd | JavaScript | edonejunior/semanaOmnistack10 | /backend/src/controllers/SearchController.js | UTF-8 | 1,243 | 2.65625 | 3 | [] | no_license | const Dev = require('../models/Dev');
const parseStringAsArray = require ('../utils/parseStringAsArray')
module.exports = {
async index(request, response){
//buscar devs raio de 10km e filtrar por techs
//To pegando da query request as informações
const {latitude, longitude, techs} = reques... | true |
53e17ff98a0ec95970c15fc80436741dff381be3 | JavaScript | josh-tf/cbv-roster | /server/routes/VolUserRouter.js | UTF-8 | 1,606 | 2.640625 | 3 | [
"MIT"
] | permissive | // VolUserRouter.js
const express = require('express');
const app = express();
const VolUserRouter = express.Router();
const VolUser = require('../models/VolUser');
VolUserRouter.route('/add').post(function (req, res) {
const voluser = new VolUser(req.body);
voluser.save()
.then(voluser => {
res.json... | true |
b9455d7e1f9dae386fb8e9d489ace12fea40b70f | JavaScript | eumerics/falcon-parser | /test/data/native/expressions/binary.js | UTF-8 | 960 | 2.765625 | 3 | [
"MIT"
] | permissive | /// multiplicative operators
1 * 2; //? <+>
1 / 2; //? <+>
1 % 2; //? <+>
/// additive operators
1 + 2; //? <+>
1 - 2; //? <+>
/// shift operators
1 << 2; //? <+>
1 >> 2; //? <+>
-1 >>> 2; //? <+>
/// relational operators
1 < 2; //? <+>
1 > 2; //? <+>
1 <= 2; //? <+>
1 >= 2; //? <+>
[] instanceof ... | true |
b084742883cfe2f950bc16e5ebd853f037aa1d74 | JavaScript | micage/game | /src/Structures/ObjectTree.es6 | UTF-8 | 2,047 | 2.796875 | 3 | [] | no_license | "use strict";
import * as __ from "../Util/ParamCheck";
const NodePrinter = (node) => {
let tabs = Array.from({ length: node.depth-1 }, () => ". ").join("");
let str = "";
if (!__.checkObject(node.data) && !__.checkArray(node.data)) {
str = ": " + JSON.stringify(node.data);
}
console.log(... | true |
a6f117a4017375d71cea560e38690192e251a037 | JavaScript | Kan-T/react-auto-layout | /samples/sampleItems/components/useCount.js | UTF-8 | 452 | 3.078125 | 3 | [
"MIT"
] | permissive | import { useState, useEffect } from "react";
function useCount(initValue) {
// Declare a new state variable, which we'll call "count"
const [count, setCount] = useState(initValue);
const [x10, setX10] = useState(count*10);
useEffect(() => {
setX10(count * 10);
});
const countPlus = () => setCount(cou... | true |
b0f27e57396a6fa7f1097a040026bffcaee8eb50 | JavaScript | Indraacan/oopjs | /index.js | UTF-8 | 842 | 3.078125 | 3 | [] | no_license | class Coffee {
constructor (obj = {}){
this.bean = obj.bean,
this.method = obj.method,
this.category = obj.category
}
}
//class extend
class Cafe extends Coffee {
constructor (obj = {}){
super(obj)
this.name= obj.name
}
}
const detailCAfe = new Cafe ({
bean ... | true |
d0717fc79f61527252028c255fefc51013d0a443 | JavaScript | miriamwest/coding | /math/assets/js/app.js | UTF-8 | 1,822 | 3.28125 | 3 | [] | no_license | var Miriam = 0;
var Victoria = 0;
var weapons = ['rock' , 'paper', 'scissors'];
while (Miriam < 3 && Victoria < 3)
var weaponOfchoice1 = weapons[parseInt(Math.random()*weapons.length) %3];
var weaponOfchoice2 = weapons[parseInt(Math.random()*weapons.length) %3];
if (miriam=weaponofchoice1) && (Victoria=weaponofcho... | true |
07526bd60b2d8aef21a779e8f3a7435021136fff | JavaScript | pipesjs/core | /test/utils.js | UTF-8 | 1,494 | 2.53125 | 3 | [
"MIT"
] | permissive | import Events from "events";
import { ReadableStream, TransformStream, WritableStream } from "../src/streams";
export const broker = new Events;
export function till ( time, value=null ) {
return new Promise( resolve => setTimeout( resolve.bind( null, value ), time ) );
}
export function createTestReadable (data) ... | true |
94ea65ccbd5648b4b230539d3d77cf4b17b3c5e7 | JavaScript | marielapg/International-School-Social-Worker-3-backend | /students/students-router.js | UTF-8 | 1,522 | 2.65625 | 3 | [
"MIT"
] | permissive | const router = require('express').Router();
const Students = require('./students-model.js');
router.get('/', (req, res) => {
Students.find()
.then(users => {
res.status(200).json(users);
})
.catch(err => {
res.status(404).json(err);
});
});
router.get('/:id', (req, res) => {
const { i... | true |
a6798d4382e6f1e54b31f6ea1c6578997a0ee881 | JavaScript | foratlanta/foratlanta.github.io | /js/jam.js | UTF-8 | 5,319 | 2.875 | 3 | [] | no_license | /**
* Jam
* @return {Array}
*
* Return an array
*/
var Jam = (function() {
var has = function(obj, target) {
return _.any(obj, function(value) {
return _.isEqual(value, target);
});
};
var keys = function(data, field) {
return _.reduce(data, function(memo, item) {
... | true |
b7b459b4e97abf3842b1b137eede685554a82b3a | JavaScript | arthurcode/arthurcode | /catalogue/templates/catalogue.js | UTF-8 | 1,071 | 2.984375 | 3 | [] | no_license | // roll up long lists of filters
var to_roll = Y.all('ul.roll');
var max_allowed = 4;
function roll(ul) {
var items = ul.all('li');
if (items.size() > max_allowed + 1) {
// roll it up!
var to_hide = items.slice(max_allowed);
to_hide.each(function(li) {
li.addClass('hidden');... | true |
fd1badad729efdbc427ed0af1041f0815b48c4f1 | JavaScript | lsummusl/okfocus.github.io | /js/mx/mx.texturedBox.js | UTF-8 | 4,563 | 2.609375 | 3 | [] | no_license | // Creates a box using a given texture image.
// Uses a texture image like this:
//
// ---------- ----------
// | | |
// | top | bottom |
// | | |
// ---------- ---------- ---------- ----------
// | | | |... | true |
364516092b439230ebb7e4efa0da8f9643e6cfc5 | JavaScript | wwyao/shnng | /js/common.js | UTF-8 | 547 | 2.921875 | 3 | [] | no_license | //导航栏点击事件
function navClick(){
var menu = document.querySelector('.menu');
menu.isOpen = false;
var ul = document.querySelector('#nav ul');
var lis = document.querySelector('#nav ul li');
menu.onclick = function(){
if(!this.isOpen){
this.isOpen = true;
menu.src = 'img/menu2.png';
ul.style.display = "blo... | true |
13f441dec6a78223d4bfc3eacad5f9bc4161ca06 | JavaScript | danielxli/guessing-game | /js/game.js | UTF-8 | 4,816 | 3.484375 | 3 | [] | no_license | var ans1 = document.getElementById('a1');
var ans2 = document.getElementById('a2');
var ans3 = document.getElementById('a3');
var ans4 = document.getElementById('a4');
var ans5 = document.getElementById('a5');
var ans6 = document.getElementById('a6');
var results = [ans1, ans2, ans3, ans4, ans5, ans6];
var introPic = ... | true |
399b58ebbb03a256f602b2dc817b4fb8286b5de6 | JavaScript | Elise1544/Amata | /js/script.js | UTF-8 | 430 | 2.6875 | 3 | [] | no_license | 'use strict';
(function () {
const name = document.querySelectorAll('.items__name:not(.name)');
const modal = document.querySelectorAll('.modal');
for (let i = 0; i < name.length; i++) {
name[i].addEventListener('mouseover', function() {
modal[i].classList.add('modal--active');
});
name[i].ad... | true |
c107234c0ddd7974721985f33d56d5cf17a70b1b | JavaScript | PippoGit/DistributedHashBreaker | /DHBServer/src/main/webapp/js/BucketAllocationChart.js | UTF-8 | 1,902 | 2.875 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
var BucketAllocationChart = function(ctx){
this._ctx = document.getElementById(ctx).getContext('2d');
this._chart = {};
t... | true |
4889721eec3fdcbdbbb07827f20f233a761445f2 | JavaScript | Aakashdeveloper/July_JavaScript_Eveng | /eleven.js | UTF-8 | 651 | 3.921875 | 4 | [] | no_license | for multiple condition and multiple output if/else
for one condition and multiple output switch case
for only one condition we use ternory
var name = "aakash";
switch(name){
case 'aakash':
console.log("You are user")
break;
case 'John':
console.log("You are admin");
break;
... | true |
16638a5841070170b42235b98be4af82ddd1130f | JavaScript | henryrico1808/exerciseCoderByte | /First_Reverse.js | UTF-8 | 322 | 3.578125 | 4 | [] | no_license | function FirstReverse(str) {
var revers = "";
for (var i = str.length -1 ; i>=0; i--){
revers = revers + str.charAt(i);
}
// code goes here
return revers;
}
// keep this function call here
console.log(FirstReverse("Hola"));
... | true |
2a1b334b48f0954a81932c8299a0bfb63e330329 | JavaScript | mazenabdul/RestaurantSearch | /src/hooks/useResults.js | UTF-8 | 883 | 2.875 | 3 | [] | no_license | import {useState, useEffect} from 'react'
import yelp from '../api/yelp'
export default () => {
//State to store the fetched businesses
const [results, setResults] = useState([])
//State to manage error logs
const [errors, setErrors] = useState('')
//Function to request the Yelp API with the entered ... | true |
98c7ae93f8d88771d1ae21f87db6ce59596b722d | JavaScript | zenanz/graingerfolk | /website/static/js/discussion.js | UTF-8 | 1,571 | 2.578125 | 3 | [] | no_license | var csrftoken = Cookies.get('csrftoken');
$('#commentModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget); // Button that triggered the modal
var recipient = button.data('username');// Extract info from data-* attributes
var cid = button.data('cid');// Extract info from data-*... | true |
0e54e2d60831b4ee4f7abfbb43e29f4662df97ff | JavaScript | carlosvinici/Portifolio | /Script/homeAside.js | UTF-8 | 1,337 | 2.75 | 3 | [] | no_license | const buttonCurriculo = document.getElementById("buttonCurriculo");
const buttonCurriculoMobile = document.getElementById("buttonCurriculoMobile");
function trasicaoParaCurriculo(event){
if(event.type === 'touchstart') event.preventDefault();
const sectCurriculo = document.getElementById('sectCurriculo');
... | true |
1abe4bea1ae94bca5dc1d3ff11468a421c83317f | JavaScript | ravendb/docs | /Documentation/5.2/Samples/nodejs/ClientApi/Session/Querying/TextSearch/exactMatch.js | UTF-8 | 1,313 | 2.625 | 3 | [] | no_license | import { DocumentStore } from "ravendb";
const documentStore = new DocumentStore();
const session = documentStore.openSession();
async function exactMatch() {
{
//region exact_1
const employees = await session
// Make a dynamic query on 'Employees' collection
.query({ ... | true |
7a69b328acfa3e8a8a50672b5f9e5d59df4f19f9 | JavaScript | bonham000/cs-algorithms | /algorithms/outco/matrix-spiral.js | UTF-8 | 1,435 | 3.734375 | 4 | [] | no_license | function matrixSpiral(M) {
var top = 0;
var right = M[0].length - 1;
var bottom = M.length - 1;
var left = 0;
var spiral = [];
while (top < (bottom + 1) && left < (right + 1)) {
for (var a = left; a <= right; a++) spiral.push(M[top][a]);
top++;
for (var b = top; b <= bottom; b++) spiral.pu... | true |
11e45c7b4833aa2668b5b5f934c68a42296b19ec | JavaScript | strawbee/ta-401d23 | /05-linked-list/src/lib/sll.js | UTF-8 | 1,982 | 3.046875 | 3 | [] | no_license | 'use strict';
const SLLNode = require('./sll-node');
module.exports = class SLL { // eslint-disable-line
constructor(head = null) {
this.head = head;
}
shift(value) {
this.head = new SLLNode(value, this.head);
return this;
}
push(value) {
const node = new SLLNode(value);
if (!this.head... | true |
d4ba82fa85719fefc323f2c53502121c8b1b85b4 | JavaScript | truecuozzo98/mc_javascript | /1. Introduzione Javascript/ex4.js | UTF-8 | 340 | 3.671875 | 4 | [] | no_license | const c1 = 45, c2 = 20
var divisori_c1 = []
for (let i=1 ; i<=c1 ; i++){
if(c1 % i == 0){
divisori_c1.push(i)
}
}
var flag = false
for (let a of divisori_c1) {
if(a==c2){
flag = true
}
}
if(flag){
console.log(c2 + " è un divisore di "+c1)
} else {
console.log(c2 + " NON è un d... | true |
276abdfc8594ada94650399f37cbbdfbc340f8cb | JavaScript | 101sachin/biz2credit-server-demo | /customers.js | UTF-8 | 979 | 2.609375 | 3 | [] | no_license | const fs = require("fs");
const { once, EventEmitter } = require("events");
const readline = require("readline");
async function readFile(path) {
const customers = [];
console.log(path);
try {
const readInterface = readline.createInterface({
input: fs.createReadStream(path),
//output: process.std... | true |
175c7b57e56b110e5f7290ea14676cbb905aaca5 | JavaScript | lukekingA/starWarsMvcApi | /app/models/starships.js | UTF-8 | 785 | 2.546875 | 3 | [] | no_license | export default class StarShips {
constructor(data) {
this.name = data.name
this.cargo_capacity = data.cargo_capacity
this.crew = data.crew
this.hyperdrive_rating = data.hyperdrive_rating
this.cost = data.cost
this.starship_class = data.starship_class
this.url = data.url
}
get Template... | true |
8038d88f5aa389602093b96192ceb13b21006c5c | JavaScript | FatB0YY/other-lessons-js | /codewars/Set a + b sort.js | UTF-8 | 1,086 | 4.28125 | 4 | [] | no_license | 'use strict'
const a = 'xabc'
const b = 'abgc'
function longest(s1, s2) {
let c = ''
for (let i = 0; i < s1.length; i++) {
if (!c.includes(s1[i])) {
c += s1[i]
}
}
for (let i = 0; i < s2.length; i++) {
if (!c.includes(s2[i])) {
c += s2[i]
}
... | true |
0d0f5d29951c89657c2803035f651138be58fe8c | JavaScript | craigsdennis/function-templates | /voice-client-javascript/functions/client-voice-twiml-app.js | UTF-8 | 954 | 2.84375 | 3 | [
"MIT"
] | permissive | /**
* Checks if the given value is valid as phone number
* @param {Number|String} number
* @return {Boolean}
*/
function isAValidPhoneNumber(number) {
return /^[\d\+\-\(\) ]+$/.test(number);
}
exports.handler = function (context, event, callback) {
const twiml = new Twilio.twiml.VoiceResponse();
// PhoneNu... | true |
ed8c83315092754654f19659eaf8af824e56e1e2 | JavaScript | fossabot/Guiding-Lanterns | /cmds/Util/speedtest.js | UTF-8 | 2,251 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | const Discord = require('discord.js')
const shell = require('shelljs')
function speedtest(message, client, prefix, logchannel, dbl){
if (message.content.startsWith(prefix + "speedtest")) {
try{
dbl.hasVoted(message.author.id).then(voted => {
if (voted) {
mess... | true |
4e4569cd61675dac6eb49505c9db7ca5caabcdd6 | JavaScript | SophiaL1024/lotide | /test/tailTest.js | UTF-8 | 632 | 3.359375 | 3 | [] | no_license | /* const assertEqual=require('../assertEqual')
const tail=require('../tail');
// Test Case: Check the original array
const words = ["Yo Yo", "Lighthouse", "Labs"];
tail(words); // no need to capture the return value since we are not checking it
assertEqual(tail(words).length, 2); // original array should still have 3 ... | true |
68d159aab890d072f04ab91be336b41a48a392e4 | JavaScript | BickySamal/newwebpage | /index.js | UTF-8 | 199 | 2.578125 | 3 | [] | no_license | const navlinks = document.getElementById('navlink');
function showMenu(){
navlinks.style.right="0";
console.log("working");
}
function hideMenu(){
navlinks.style.right="-230px"
} | true |
baad1b90775fc418eeacfe1d7ac6a7a7674f209b | JavaScript | duanlizhi/base | /base/src/main/webapp/resources/web/js/forbid_mouse_rightkey.js | UTF-8 | 1,825 | 2.609375 | 3 | [
"MIT"
] | permissive |
function temp(window){
//*** 屏蔽右键 ***
function click(e) {
if (window.document.all) {
if (window.event.button == 1 || window.event.button == 2 || window.event.button == 3) {
try {
for (var i = 0; i < imgs.size(); i++) {
window.d... | true |
3190b413c001f840e2e96f8b8c3523ab344c4005 | JavaScript | pfokin92/bhj_homeworks | /client-state/text-editor/task.js | UTF-8 | 248 | 2.875 | 3 | [] | no_license |
let editor = document.getElementById('editor');
window.onload = () => {
editor.value = localStorage.getItem('value');
};
editor.oninput = () => {
let valueText = editor.value;
localStorage.setItem('value', valueText);
}
| true |
c15ba36895da8648e900c6b191d9d1631d5a6003 | JavaScript | thomaslaurie/StreamJockey | /source/shared/utility/deferred.js | UTF-8 | 2,055 | 3.28125 | 3 | [] | no_license | // Custom promise that can be resolve, rejected, and cancelled outside its executor.
// May be called without an executor, upon which it will never resolve.
import define from './object/define.js';
import wait from './time/wait.js';
export default class Deferred extends Promise {
constructor(executor = () => {}) {... | true |
6e0e5a02ca0a2bb388c722adad95a037a4fb0ca0 | JavaScript | JLJones91/CPT-238 | /Assignment 2/Assignment2.js | UTF-8 | 341 | 3 | 3 | [] | no_license | function area(height,width)
{
var area = height * width
return area;
}
var alphabet = new Array();
for (var i = 0; i != 26; ++i)
{
alphabet.push
(
String.fromCharCode(i + 65)
);
}
$(document).ready(function() {
$("#letters") .addClass("Christmas");
});
$(document).ready(function() {
$("#calculation") .ad... | true |
55fe799cae91a2e7704cb815c0ec517884344cc6 | JavaScript | yellong/javaScriptGameKata | /Vector2d/Vector2d.js | UTF-8 | 952 | 3.3125 | 3 | [
"MIT"
] | permissive | function Vector2d(x,y){
var vec ={
vx:x,
vy:y,
scale: function(s){
vec.vx *= s;
vec.vy *= s;
},
add: function(vec2){
vec.vx += vec2.vx;
vec.vy += vec2.vy;
},
sub: function(vec2){
vec.vx -= vec2.vx;
vec.vy -= vec2.vy;
},
negate: function(){
vec.vx = -vec.vx;
vec.vy = -vec.... | true |
65a424bee9d3a7086f69740c66600e9f48ccd2ec | JavaScript | JJ/nodeo-data | /app/pool-rest.js | UTF-8 | 1,385 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
var fs= require('fs'),
express= require('express');
var app=express();
var port = process.argv[2] || 5000;
// console.log(conf);
var log = [];
var chromosomes = {};
// API Definitions
app.get('/random', function(req, res){
if (Object.keys(chromosomes ).length > 0) {
var keys = Object.key... | true |
c15400f48c68029a57d079374b2dbfdba3589ba0 | JavaScript | NikolayMantchev/JS-Advanced | /05. DOM-Exercise/07. Number-Convertor/solution.js | UTF-8 | 811 | 3.03125 | 3 | [
"MIT"
] | permissive | function solve() {
const num = document.getElementById("input");
const connvertTo = document.getElementById("selectMenuTo");
const option1 = document.createElement("option");
option1.innerHTML = "binary";
connvertTo.appendChild(option1);
const option2 = document.createElement("option");
... | true |
8a0204a85a206b53052f84014fee63a18c1e9087 | JavaScript | ardelato/ToyTrader | /backend/passport/passport-config.js | UTF-8 | 1,132 | 2.5625 | 3 | [] | no_license | const LocalStrategy = require("passport-local").Strategy;
const User = require("../../models/users");
// Define the local strategy for passport to use in order to authenticate users
const strategy = new LocalStrategy(
{
usernameField: "email" //Passport usernameField will be mapped by user's email
},
// fun... | true |
03a489f1c5e61bd837c62bb0a48934bd06f483ed | JavaScript | daliusd/salary-data | /buildindex.js | UTF-8 | 565 | 2.640625 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const path = require('path');
if (process.argv.length < 3) {
console.log('node buildindex.js working_directory');
process.exit(-1);
}
let workDir = process.argv[2];
let filenames = fs.readdirSync(workDir);
let months = [];
for (const filename of filenames) {
if (filename.endsW... | true |
aeda67c71f5c20c919b5390c11286df4f89b61f0 | JavaScript | belalahmedhamed/JS_Repo | /script.js | UTF-8 | 2,921 | 3.125 | 3 | [] | no_license | var input_num;
function EnterNumber(num) {
var input_num = document.getElementsByClassName('btn').value;
var txt = document.getElementById('Formula');
switch (num) {
case '0':
input_num = '0';
txt.value +=input_num;
break;
case '1':
input_num = '1';
txt.va... | true |
25da4268a30eb147b3b97328aa88f379cdb7716a | JavaScript | mvcrft/NOC_AE | /2-Chapter_2-Forces/2-3.jsx | UTF-8 | 3,408 | 2.53125 | 3 | [] | no_license | /*
Let's let gravity account for mass.
*/
#include VectorLib.jsx
r = new function(){
this.randomVal = function(max){return Math.abs(Math.random())*max;};
this.randomRange = function(min,max){return Math.random()*(max-min) + min;};
}
var comp = 3;
var myComp = app.project.item(comp);
var movers = [];
... | true |
3329ddf9739048320f438fab34ff79b39ff9dbc2 | JavaScript | ahmadfh/express-telemetry | /src/machine-load.js | UTF-8 | 1,453 | 2.71875 | 3 | [] | no_license | import machineInfo from './utils/machine-info'
/*
* LOAD THRESHOLD
* --------------
* When we divide the load average for the last minute,
* and the load average for the last 5 minutes, by the
* number of processors in the machine, this threshold is
* the number at which we consider the load being excessive,
* i... | true |
7cb20425a965f61d515e26bfdf9883445d79c1cc | JavaScript | Byhako/Platzy | /fundamentosJS/clases.js | UTF-8 | 360 | 3.640625 | 4 | [] | no_license | class Punto{
constructor(x, y){
this.x = x
this.y = y
}
moverX(dx){
return this.x += dx
}
moverY(dy){
return this.y += dy
}
static distancia(a, b){
var dx = a.x - b.x
var dy = a.y - b.y
return Math.sqrt(dx*dx + dy*dy)
}
}
var p1 = new Punto(0,4)
var p2 = new Punto(1,-... | true |
5f6bd71daa601afbcd899c25907f77b30eb1a536 | JavaScript | girlycoder/mean-exercises | /javascript-exercises/fibonacci/myfib.js | UTF-8 | 181 | 3.6875 | 4 | [] | no_license | var array = [0, 1];
var MAX = 10;
for (var i = array.length - 1; array.length < MAX; i++) {
var newValue = array[i] + array[i-1];
array.push(newValue);
}
console.log(array);
| true |
6d1c582df5dc10189ace17025389928a88cf6454 | JavaScript | emagdaeh/toy-problems | /Find_Numbers_with_Even_Number_of_Digits.js | UTF-8 | 1,106 | 4.15625 | 4 | [] | no_license | /*
* @param {number[]} nums
* @return {number}
Given an array nums of integers, return how many of them contain an even number of digits.
Example 1:
Input: nums = [12,345,2,6,7896]
Output: 2
Explanation:
12 contains 2 digits (even number of digits).
345 contains 3 digits (odd number of digits).
2 contains 1 digit (o... | true |
74d31fdc6dcedfdeeb571b563823fbd67341d84f | JavaScript | tokiumcoins/tokium-sdk | /src/libs/tools.js | UTF-8 | 1,354 | 2.515625 | 3 | [] | no_license | import { firestore } from '../utils/services.js';
import Asset from './asset.js';
function getAssetsList(uid) {
return new Promise(function(resolve, reject) {
var queryRef = uid ? firestore.collection('assets').where('owner', '==', uid) : firestore.collection('assets');
queryRef.get().then(querySn... | true |
5e181cadee939fe23a04d2d5423f5ed57c51b732 | JavaScript | nicolasances/toto-web-money | /src/comp/MonthNavigator.js | UTF-8 | 1,750 | 2.71875 | 3 | [] | no_license | import React, { Component } from 'react';
import moment from 'moment';
import TotoIconButton from './TotoIconButton';
import './MonthNavigator.css';
/**
* Month navigator
* Properties:
* - onMonthChange : (mandatory) callback(yearMonth) called at every month change
*/
export default class MonthNavigator... | true |
4a14c46a921724f6c1558bd2096a0d7341cba733 | JavaScript | nadiacollado/Algos | /Fundamentals/largestSumOfN.js | UTF-8 | 913 | 4.3125 | 4 | [] | no_license | // Write a function that returns the largest sum of n of integers from a given array, and these n integers have to be consecutive
// Input
// ([1, 2, 3, 4, 5, 6, 7], 3) --> 18
// ([2, 3, 8, 11, 3, 2, 6, 2], 4) --> 25
// APPROACH
// We want to find the four digits within that array that add up to the largest nu... | true |
ee05dddc5b148f77cb5dbfff765ea5d1eb197a45 | JavaScript | marek1706/marek1706.github.io | /AJAX/js/main.js | UTF-8 | 1,745 | 3.609375 | 4 | [] | no_license | //1. AJAX - fetch
// fetch('https://jsonplaceholder.typicode.com/posts')
// .then( response => response.json())
// .then( response => console.log(response));
// powstała baza danych z której możemy pobierać elementy (f12)
// 2.AJAX - $.getJSON()
// $.getJSON('https://jsonplaceholder.typicode.com/posts', response => ... | true |
6ddc57d2f09b66305d36bc5aea98de71a34d3d6c | JavaScript | nikolaiwarner/nikolaiwarner.github.io | /projects/apps/nstatus/nstatus.js | UTF-8 | 1,178 | 2.671875 | 3 | [] | no_license | // Generated by CoffeeScript 1.3.1
(function() {
var NStatus,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
NStatus = (function() {
NStatus.name = 'NStatus';
function NStatus() {
this.update_display = __bind(this.update_display, this);
this.fetch_dat... | true |
28d68a90681825761e0184a2ad51fd3c8e53d6b9 | JavaScript | rafaelramalho19/stellar | /bin/commands/makeListener.js | UTF-8 | 1,907 | 2.75 | 3 | [
"MIT"
] | permissive | 'use strict'
// ----------------------------------------------------------------------------- [Imports]
let Command = require('../Command')
let Utils = require('../utils')
// ----------------------------------------------------------------------------- [Class]
class MakeListener extends Command {
/**
* Create... | true |