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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
882125668d7a6a8b7910ea7bcc80baa60654a178 | JavaScript | jdraiv/expense-frontend | /src/components/DailyStats.js | UTF-8 | 2,773 | 2.90625 | 3 | [] | no_license |
import React, {Component} from 'react';
import PieChart from 'react-simple-pie-chart';
import '../css/DailyStats.css';
class DailyStats extends Component {
// Props = expenses
constructor(props) {
super(props);
this.state = {
pieData: [],
totalExpenses: 0
}
... | true |
5d2103e83a3678d837f2c33fb9cd771f84042c80 | JavaScript | screlix/navbar_animation | /script.js | UTF-8 | 931 | 2.65625 | 3 | [] | no_license | const menu = document.querySelector("h2");
//const close = document.querySelector("h3");
var side = document.querySelector("aside");
var first = document.getElementsByTagName("hr");
menu.addEventListener("click", function(){
if(side.style.right !== "0px"){
side.style.right="0px";
first[0].style.anima... | true |
3716d7abb130884c3ac2aee4a471853ab60779e5 | JavaScript | xDouglasmm/smartCampus | /backend/src/routes.js | UTF-8 | 590 | 2.5625 | 3 | [] | no_license | const express = require('express');
const ComputerController = require('./controllers/ComputerController');
//const initial = require
// Router é responsavel pelas rotas
const routes = express.Router();
// dentro do routes temos get, post, put, delete, etc
// Define se será put, post, get, delete e escolhe a rota
/... | true |
d0e670fdf7cd1ee150441e1aa7883add5fcde756 | JavaScript | AgustinEscobarr/Ingenierunm | /assets/js/mainAportes.js | UTF-8 | 1,290 | 2.53125 | 3 | [] | no_license | traerAportes(mostrarAportes);
function traerAportes(callback) {
let url = "http://127.0.0.1:3000/api/aportes";
let xhttp;
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
let aportes = JSON.parse(this.res... | true |
ec70239c03e3ca3c72d207cd2116e13ec1f7ee8c | JavaScript | Axeleo/warmups | /palindrome/palindrome.js | UTF-8 | 600 | 3.578125 | 4 | [] | no_license | console.log('plaindrome tester on')
// assingment
// Return true if the given string is a palindrome.Otherwise, return false.
// A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.
// create a function that test a string and returns ... | true |
b2ed7408a38542c090f797482fdd034f803fddac | JavaScript | AzuriaN-BeltraniX/adminPro-backEnd | /helpers/actualizarImagen.js | UTF-8 | 3,442 | 3.046875 | 3 | [] | no_license | // Importaciones
const fs = require('fs');
const Medico = require('../models/medicos');
const Usuario = require('../models/usuario');
const Hospital = require('../models/hospitales');
// Borrando imágenes
const borrarImagen = (path) => {
// ...Si existe el path anterior,, si sí existe una imagen, entonces...
... | true |
6d5f59c064d713ad94032a35cabe368b62b5132f | JavaScript | kuryaki/MIU-WAP | /js/ascii.js | UTF-8 | 1,028 | 2.8125 | 3 | [
"MIT"
] | permissive | $( document ).ready(function() {
let loop = null;
let counter = 0;
let frames = [];
function playLoop () {
if(counter >= frames.length) {
counter = 0;
}
$("#text-area").val(frames[counter++])
}
$("#text-area").val(ANIMATIONS.BLANK);
$("#animation").on(... | true |
b63b228b8720c651f47fb6039ed714212daa53cf | JavaScript | ByronLian/algorithm-javascript | /Leetcode/count-substrings-with-only-one-distinct-letter.js | UTF-8 | 416 | 3.609375 | 4 | [
"MIT"
] | permissive | // https://leetcode.com/problems/count-substrings-with-only-one-distinct-letter/
/*
* @param {string} S
* @return {number}
*/
var countLetters = function (S) {
let total = 0;
let current = "";
let counter = 1;
for (let i = 0; i < S.length; i++) {
if (S[i] !== current) {
current = S[i];
cou... | true |
691f2dab4a65bd5fb8af497de7e8b0d48e562718 | JavaScript | BarPe1/webdriverjs | /StiboDetails.js | UTF-8 | 6,210 | 2.78125 | 3 | [] | no_license | //javascript using node.js
//Script for Selenium Webdriver
/**@Author: Bartosz Peta
Date: 13.03.2018*/
var webdriver = require('selenium-webdriver');
//var assert = require('assert');
var until = webdriver.until;
var driver = new webdriver.Builder().forBrowser('chrome').build();
//Go to Google website
module.exports... | true |
10e4109f0b8fd716226c0074ff53533f33b981b1 | JavaScript | VeikkoSe/paratrooper | /out/src/Common/AstarManager.js | UTF-8 | 1,124 | 2.609375 | 3 | [] | no_license | var AstarManager = function AstarManager() {
"use strict";
var data = [];
for (var i = 0; i < 256; i++) {
$traceurRuntime.setProperty(data, i, []);
for (var j = 0; j < 256; j++) {
if ((j > 25 && j < 37) && (i > 25 && i < 35))
$traceurRuntime.setProperty(data[$traceurRuntime.toProperty(i)], j... | true |
ef4505518e639444d5c485835f20f5beeee6d24d | JavaScript | icecreamhead/icepush-wicket_1_5_4-2.0.0-alpha3 | /core/src/main/javascript/lib/functional.js | UTF-8 | 2,620 | 2.734375 | 3 | [] | no_license | /*
* Version: MPL 1.1
*
* "The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is dis... | true |
d00293f13f0dd57fe739bed459600256740d950d | JavaScript | billbunkum/web-server-nodeJS | /src/utils/forecast.js | UTF-8 | 562 | 2.71875 | 3 | [] | no_license | const request = require('request');
const forecast = (latitude, longitude, callback) => {
darkskyAPIKEY = '297842be681beeba3e18b115c8bab523';
darkskyURL = `https://api.darksky.net/forecast/${darkskyAPIKEY}/` + `${latitude},${longitude}`;
request( {url: darkskyURL}, (error, { body }) => {
if (error) {
callback(... | true |
fc1eee9d5fcfdcaefd42f9062d7114812104c551 | JavaScript | yxnely/Ramirez_Yanely_WPF | /Day 10 Review/Day 7 copy/js/day7Beer.js | UTF-8 | 867 | 4.125 | 4 | [] | no_license |
/*
Yanely Ramirez
Beer
WPF 1411
11-10-2014
*/
//alert("Testing 1,2,3!");
//Console.log the whole song of 99 Bottles of Beer on the wall.
//Setup loop
//for(initialize variable; condition; increment of change){}
for(var i = 99; i>0; i--){
//Add an if statement testing for last case
if(i === 1){
consol... | true |
bd7960cff2454c2375dd60e562dc768c67ba87fe | JavaScript | NaveenEdala/PhoneDirectoryAppJS | /main.js | UTF-8 | 3,219 | 3.53125 | 4 | [] | no_license | //Global Variables declaration
var clickcount = 0;
var tablecount = 0;
var name = document.getElementById("name").value;
var number = document.getElementById("mobnumber").value;
//Onclick event tree for Add entry button
function addFunction(id) {
clickcount++;
if (clickcount % 2 == 0) {
closeEntry(id);... | true |
40d1d60503cdbce7c2a492fe2b53068050f3f2ba | JavaScript | AlekseyLexey/IRVAS | /src/js/modules/modals.js | UTF-8 | 2,210 | 2.515625 | 3 | [] | no_license | const modals = (state) => {
function bindModal(triggerSelector, modalSelector, closeSelector, dataWindow = true) {
const trigger = document.querySelectorAll(triggerSelector),
modals = document.querySelector(modalSelector),
close = document.querySelector(closeSelector),
windows = document.queryS... | true |
1f12d208e8c3bee782e070f8b6ae7412b542bb97 | JavaScript | ppambler/leetcode-js | /clock-in/2020-10-22.js | UTF-8 | 806 | 3.375 | 3 | [] | no_license | /**
* @param {number[]} nums
* @return {number[]}
*/
var smallerNumbersThanCurrent = function (nums) {
let map = new Map();
let numsArr = [...nums];
nums.sort((value1, value2) => value1 - value2);
nums.forEach((item, index) => {
map.has(item) ? "" : map.set(item, index);
});
return numsArr.map((it... | true |
d89f686fa65c19a25b3d72044ca46855edcd0bf7 | JavaScript | BrettMW88/Sport-Video-Background | /script.js | UTF-8 | 1,298 | 2.765625 | 3 | [] | no_license | const menuToggle = document.querySelector('.toggle')
const showcase = document.querySelector('.showcase')
const climbingBtn = document.querySelector('.climbing')
const golfBtn = document.querySelector('.golf')
const hikingBtn = document.querySelector('.hiking')
const climbing = document.querySelector('.climbing-section... | true |
7faa1d218dda613512eec0c7fdbdc9fef21f0335 | JavaScript | kawshar798/PracticeJavascript | /objects.js | UTF-8 | 1,583 | 4.5625 | 5 | [] | no_license | //Create javascript object
// a JavaScript object can be created by simply setting its properties within a pair of curly braces: {...}.
// Each property is a key/value pair. This is called an object literal.
// The semicolon ; after the closing brace is optional, but it’s safer to add it anyway.
const person = {
... | true |
c705bf6f6dc49588dbe89e2962413648843f52e6 | JavaScript | ShamilJs/-LESSON_5 | /script/script.js | UTF-8 | 835 | 4.03125 | 4 | [] | no_license | 'use strict';
// Функция проверки на число
let isNumber = function (n) {
return !isNaN(parseFloat(n)) && isFinite(n);
};
//
const guessNumber = function (number) {
let userNumber = prompt('Угадай число от 1 до 100');
if (!isNumber(userNumber) && userNumber !== null) {
alert('Введи число!');
... | true |
13a98acff5c9faeef9de5076f9e66a40363bb44b | JavaScript | datagrok-ai/public | /packages/ApiSamples/scripts/data-frame/find-columns.js | UTF-8 | 648 | 2.75 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | //tags: Column, access
// Gets columns by type or tags
let demog = grok.data.demo.demog();
for (let column of demog.columns.categorical)
grok.shell.info(column.name);
for (let column of demog.columns.numerical)
grok.shell.info(column.name);
demog.getCol('race')
.setTag('tag1', 'value1')
.setTag('tag2', 'val... | true |
1b5d70bab5e4d2c43c5a57f774d484295bc65bb3 | JavaScript | Harivansh8888/learning_JS | /dom.js | UTF-8 | 1,026 | 3.625 | 4 | [] | no_license | //Finding HTML Elements
document.getElementById(id) //Find an element by element id
document.getElementsByTagName(name) //Find an element by Tag name
document.getElementByClassName(name) //Find an element by Class Name
//Changing HTML ELements
element.innerHTML = new html content //Change the inner HTML of an element... | true |
eeba949d20f540a7a154b66fd7486fd798b157e1 | JavaScript | paulo-hst/gethub-react | /src/components/TopUsers/TopUsers.jsx | UTF-8 | 1,040 | 2.59375 | 3 | [] | no_license | import axios from 'axios'
import './TopUsers.css'
import React, { useEffect, useState } from 'react'
import UserInfo from '../UserInfo/UserInfo'
const apiTop = axios.create({
baseURL: 'https://commiters.now.sh/rank'
})
function TopUsers(props) {
const [ topUserData, setTopUserData ] = useState([])
use... | true |
87940f9f3db582c325680040149f43c982270830 | JavaScript | szabgab/slides | /mobile/examples/javascript/objects.js | UTF-8 | 239 | 3.421875 | 3 | [] | no_license | var phone_of = {
'Foo' : 123,
'Bar' : 456
};
console.log(phone_of); // { Foo: 123, Bar: 456 }
for (var k in phone_of) {
console.log(k + ' - ' + phone_of[k]);
}
// Foo - 123
// Bar - 456
console.log(phone_of.length); // undefined
| true |
7206979b62f79fbe86ee7caddef669d3bdb3eb6d | JavaScript | wilfredmutai/100-days-of-code | /day36/script.js | UTF-8 | 1,293 | 4.3125 | 4 | [] | no_license | /* constants
window.onload = function(){
const pi = 3.142;
console.log(pi);
function areaCirc(r){
console.log("The area is: " + pi * r * r);
}
areaCirc(5)
}
*/
/*
the let keyword
window.onload = function(){
var items = document.getElementsByTagName("li");
for (let x = 0; x < items.le... | true |
d46a29104b8f81f9cd2edebbe9b3afaa6bb6e251 | JavaScript | CamArturo/Museo-Talk | /services/scrape-calls/scrapeTextile.js | UTF-8 | 885 | 2.671875 | 3 | [] | no_license | const callNightmare = require('../scraper');
const { writeFile } = require('fs');
let collectionTextile = [];
scrapeTextile('https://denverartmuseum.org/collection?f%5B0%5D=field_co_department_term%3A1178&page=');
function scrapeTextile(url, pgNum = 0) {
if (pgNum === 10) {
const stringifiedData = JSON.stringi... | true |
0c4fe95f198820dcb23270f4722037f435844718 | JavaScript | henryhkyim/reactjs-sample | /src/app/components/flashgame/FlashGame.js | UTF-8 | 2,481 | 2.671875 | 3 | [] | no_license | import React from "react";
import { QuestionPoolUtil } from "../../utils/QuestionPoolUtils"
import { FlashGameQuestion } from "./FlashGameQuestion"
import { FlashGameResult } from "./FlashGameResult"
import { NewGame } from "./NewGame"
import "../../css/FlashGame.css"
export class FlashGame extends React.Component {
... | true |
f0343decb1c3d5bc6957b722f19e0409cbd37aad | JavaScript | ronfletcher1/unit3 | /Nodejs101/readFile1.js | UTF-8 | 369 | 3.109375 | 3 | [] | no_license | let fs = require('fs');
fs.readFile(process.argv[2], 'utf8', function(err, contents) {
if(err){
console.log('you have an error');
}else{
console.log(contents.toUpperCase());
}
});
// console.log('after calling readFile');
// var fs = require('fs');
// var contents = fs.readFileSy... | true |
48b6a64dd9def4e938e11354edbe721462042c9b | JavaScript | kalinmarkov/SoftUni | /JS Core/JS Fundamentals/10. Lab - JavaScript Objects and Assoc Arrays/10. V2 Extract Unique Words.js | UTF-8 | 817 | 2.78125 | 3 | [
"MIT"
] | permissive | function uniqWords(arr) {
let unique = new Set();
let text = arr.join('\n');
let words = text.split(/\W+/)
.filter(x => x !== '')
.map(x => x.toLowerCase())
.forEach(x => unique.add(x));
console.log([...unique].join(', '));
}
uniqWords([
'Lorem ipsum dolor sit amet, consect... | true |
9cd544fa3b5d939e5a51dffe7b9b95f4423038b6 | JavaScript | ctiller15/js-design-patterns | /builder/builder.js | UTF-8 | 1,488 | 4.15625 | 4 | [] | no_license | class Tag
{
static get indentSize() { return 4; }
constructor(name='', text='')
{
this.name = name;
this.text = text;
this.children = [];
}
toStringImpl(indent)
{
let html = [];
let i = ' '.repeat(indent * Tag.indentSize);
html.push(`${i}<${this.name}>\n`);
if (this.text.length > 0)
{
html.... | true |
5a2f3f12c01706654b44cd8ecea228e215aab3db | JavaScript | liwenkang/leetcode | /479. Largest Palindrome Product.js | UTF-8 | 332 | 3.484375 | 3 | [] | no_license | const log = console.log.bind(console)
var largestPalindrome = function (n) {
var arr = [9,987,123,597,677,1218,877,475]
return arr[n-1]
};
log(largestPalindrome(1))
log(largestPalindrome(2))
log(largestPalindrome(3))
log(largestPalindrome(4))
log(largestPalindrome(5))
log(largestPalindrome(6))
log(largestPali... | true |
851345377ea3789e18d0ef484c9fb8809a87308c | JavaScript | guillermo132/git-workshop-nodejs | /first-server/services/pet.service.js | UTF-8 | 2,852 | 3 | 3 | [] | no_license | const logger = require('logger');
const PetModel = require('../models/pets.model');
const ObjectId = require('mongoose').Types.ObjectId;
function * GenId(){
let i = 0;
for(;;){
yield i++
}
}
class PetService {
constructor(){
this.pets = [];
this.genId = GenId();
}
... | true |
f1ea70a404fba32b9ebbf0bfa802b05d41dd94aa | JavaScript | mahmoud-sayed/JS-Drum-Kit | /js/main.js | UTF-8 | 726 | 2.984375 | 3 | [] | no_license | function playSound(e) {
const sound = document.querySelector(`audio[data-key="${e.key}"]`);
const key = document.querySelector(`.key[data-key="${e.key}"]`);
if (!sound) return; // here we stoping the program from running
sound.currentTime = 0; // here we set the playing time to 0
sound.play(); // h... | true |
3c4db19a08e9f69b8f8629bfc6b0140cce119255 | JavaScript | otto-torino/lim | /painter.js | UTF-8 | 10,383 | 2.734375 | 3 | [] | no_license | "use strict";
lim.painter = new Class({
Extends: lim.component,
/**
* @summary painter tool class
* @classdesc The painter tool class let's the user draw over the page contents
* In edit mode some tools are provided to draw over the page contents
* In view mode the stored drawing ... | true |
31765061c4275ac9ab76342481a1037fd251ed9a | JavaScript | gamebody/blog | /javascript函数式编程/src/_concat.js | UTF-8 | 314 | 2.875 | 3 | [] | no_license | function _concat(set1, set2) {
const set1 = set1 || []
const set2 = set2 || []
const result = []
let ind = 0
while (ind < set1.length) {
result[result.length] = set1[ind]
ind++
}
ind = 0
while (ind < set2.length) {
result[result.length] = set2[ind]
ind++
}
return result
} | true |
c3a34f51d5e59f1e96967bf6fe76acd1bd4fc02c | JavaScript | lu4ezar/todolist | /src/components/Todo/Todo.stories.jsx | UTF-8 | 1,229 | 2.671875 | 3 | [] | no_license | import React from "react";
import {
text,
boolean,
// number
} from "@storybook/addon-knobs";
import Todo from "./Todo";
export default {
component: Todo,
title: "Todo",
};
const title = text("Title", "Todo with knob");
const status = boolean("Status", false);
export const withAButton = () => (
<button t... | true |
cc55dbc29817e194832dc14712a914d1bf42e936 | JavaScript | gordongest/chatterbox-client | /client/scripts/friends.js | UTF-8 | 471 | 2.609375 | 3 | [] | no_license | var Friends = {
initialize: function() {
this.toggleStatus();
},
toggleStatus: function(username) {
let $username;
$('.username').on('click', (event) => {
$username = $(event.target).text();
if (!Friends.friendsList.includes($username)) {
Friends.friendsList.push($username);
... | true |
7144431c013c46e89e05bdc851108b9b38b23dfd | JavaScript | manavkohli/itab-demo | /src/index.js | UTF-8 | 1,089 | 2.9375 | 3 | [] | no_license |
// Google Actions SDK
import ActionsSDKApp from 'actions-on-google';
// Handles creating creating server
import express from 'express';
import bodyParser from 'body-parser';
// 1) Create the route handler
const app = express();
const port = 3000;
// 4) Define actions
const actions = {
BUY: 'buy_action'
};
// 5) ... | true |
122795ca393f781d1502aa90c84c41f3f5abdec6 | JavaScript | houwhu/touch-drag-button | /src/index.js | UTF-8 | 3,457 | 2.609375 | 3 | [] | no_license | /**
* 功能介绍:可拖拽的移动端悬浮图标
* Created By small_knife On 2020/6/3 16:19
*/
import React, { useState, useRef, useEffect } from 'react';
import PropTypes from 'prop-types';
import ClassNames from 'classnames';
import './index.css';
// 变量集合
const _variables = {
// 是否移动
isMoving: false,
// 是否点击
isClick: false,
// ... | true |
95a841e487ce44e4616405e563a324b98af2b3cb | JavaScript | jundolor/seafood-paluto | /JS/delivery_summary.js | UTF-8 | 1,941 | 2.921875 | 3 | [] | no_license | const orders_URL = !(objUrlParams.orders === null)? objUrlParams.orders : '';
const orders = decodeURI(orders_URL);
console.log(orders);
const order_summary = document.querySelector('#order_summary');
const objOrders = JSON.parse(orders);
const b1 = document.querySelector('#b1');
const b2 = document.querySelector('#b2'... | true |
869f5b352dbf08e82a62667ad8d5db2b087ba146 | JavaScript | GuilhermeMesquita/booking-googlebooks-api | /js/requisitionFuncs.js | UTF-8 | 3,065 | 2.796875 | 3 | [] | no_license | let section_res = document.querySelector("#res");
window.onload = () => {
$(section_res).hide();
}
var icon = '<i class="fas fa-book-open main-color-theme" id="book"></i>';
document.getElementById("submit_search").addEventListener("click", function () {
let input_search = document.querySelector("#text_search... | true |
291665f20f6e6af2b4d4fc33de256e35afe1b974 | JavaScript | mtham8/toyproblems | /javascript/flattenArray.js | UTF-8 | 281 | 3.734375 | 4 | [] | no_license | // flatten deeply nested arrays recursively
// using map
const flatten = arr => Array.isArray(arr) ? [].concat(...arr.map(flatten)) : arr;
// using reduce
const flatten = arr => arr.reduce((prev, curr) => Array.isArray(curr) ? prev.concat(flatten(curr)) : prev.concat(curr), []); | true |
330b8601022ac42ef9afd08ec4709a578ad19438 | JavaScript | Dkdaniz/criptografia-aula | /Assimetrica/index.js | UTF-8 | 728 | 2.90625 | 3 | [
"MIT"
] | permissive | const keys = require('./generateKeys');
const cypher = require("./cypher");
execute = async () => {
const text = "MY TEXT";
const { publicKey, privateKey } = await keys.generate();
console.log("THIS PUBLIC KEY\n\n");
console.log(publicKey);
console.log("\n\nTHIS PUBLIC KEY\n\n");
console.log("THIS PRIVATE KEY\... | true |
027d3ac58340be1a8adff98d22ff1af53e44889c | JavaScript | fatimarafiqui/1MG-Assignment | /cssTest/script.js | UTF-8 | 728 | 3.265625 | 3 | [] | no_license | const validateForm = () => {
let email = document.forms["loginForm"]["email"];
let password = document.forms["loginForm"]["password"];
let emailRegex = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
let passwordRegex = /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/;
let errorFound = false... | true |
2719eee97d29e6442dcaff9cdd75f07053f2a977 | JavaScript | talhaaydn/film-app | /add-film.js | UTF-8 | 1,423 | 3.65625 | 4 | [] | no_license | // Film Constructor
function Film(title, category, imdbScore, photoPath){
this.title = title;
this.category = category;
this.imdbScore = imdbScore;
this.photoPath = photoPath;
}
// get elements
const addFilmForm = document.getElementById("addFilmForm");
const titleInput = document.getElementById("title... | true |
3e04d3b4d7d27d24b5f1f3be8701bd1b9d6e3567 | JavaScript | tutturen/BeanMaster | /scripts/play.js | UTF-8 | 1,323 | 2.640625 | 3 | [
"MIT"
] | permissive | var spawn = require('child_process').spawn;
var request = require('request');
var fs = require('fs');
var API_URL = 'http://drachten.informatik.uni-mannheim.de/api';
var OLD_NAME = 'Good-Old-Larry';
var NEW_NAME = 'Shiny-New-Moe';
var oldPath = '../out/OldBeanMaster.jar';
var jarPath = '../out/BeanMaster.jar';
funct... | true |
5d91512b33f617a92dafdbd5355d3a7669f39023 | JavaScript | MaliugaSergiy/shtirliy-gmail.com | /src/scripts/indicate-mobile-devices.js | UTF-8 | 492 | 2.578125 | 3 | [] | no_license | import { addClass, getIsMobileDevice } from './utils';
const MOBILE_DEVICES_CLASS_NAME = 'is-mobile-device';
const NO_MOBILE_DEVICES_CLASS_NAME = 'is-not-mobile-device';
export default function indicateMobileDevices(targetSelector) {
const target = targetSelector
? document.querySelector(targetSelector)
: do... | true |
1afec8c2618cc5d80717ea43f7c10cb4a13c0e4f | JavaScript | 1degrees/my-blog | /demo/js/test.js | UTF-8 | 3,382 | 2.859375 | 3 | [] | no_license | (function(){
function findparent(el, name){ //递归找元素的特定class的父元素
if(!el.parentElement) return null;
if(el.parentElement.className.includes(name)) {
return el.parentElement
} else {
return findparent(el.parentElement, name);
}
}
function findAllMoveNode... | true |
814daaacc9993df9114b949366625dc87a43efb3 | JavaScript | anibalcucco/bodyarmor | /public/javascripts/shields.js | UTF-8 | 407 | 2.53125 | 3 | [] | no_license | (function($) {
$(document).ready(function() {
$('#shields').find('area').each(function () {
$(this).mouseover(function (e) {
var name = $(this).attr('id');
$("#selected_shield").attr("src", "/images/shields/" + name + ".jpg");
$("#selected_shield").show();
}).mouseout(function... | true |
3ccc2cfef3981d0231f6b61ef14800f07460a1cb | JavaScript | ssilverm/pelias-openaddresses-ubuntu | /pelias-openaddresses/test/streams/cleanupStream.js | UTF-8 | 983 | 2.6875 | 3 | [
"MIT"
] | permissive | var tape = require( 'tape' );
var event_stream = require( 'event-stream' );
var CleanupStream = require( '../../lib/streams/cleanupStream' );
function test_stream(input, testedStream, callback) {
var input_stream = event_stream.readArray(input);
var destination_stream = event_stream.writeArray(callback);
input... | true |
d8142e6fbb7fc7c2db1e998a27a37f311bf4f6b8 | JavaScript | eslintcc/eslintcc | /test/src/message_node__get_name.js | UTF-8 | 1,468 | 3.140625 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-new, no-useless-constructor, new-cap */
/* global define */
function func1(a1) {
console.log(a1)
}
func1()
const func2 = function func2(a1) {
console.log(a1)
}
func2();
(function() {})()
const func3 = function(a1) {
console.log(a1)
}
func3()
const func4 = a1 => {
if (a1) {
conso... | true |
b4580cd98f2b85fefdf688fee1d7d338a4dd91f6 | JavaScript | awcross/images-loaded | /dist/index.es.js | UTF-8 | 2,547 | 2.734375 | 3 | [
"MIT"
] | permissive | /* eslint-disable unicorn/prefer-add-event-listener */
var slice = Array.prototype.slice;
var reurl = /url\(\s*(['"]?)(.*?)\1\s*\)/g;
var camelCase = function camelCase(name) {
return name.replace(/([a-z])-([a-z])/g, function (str, m1, m2) {
return '' + m1 + m2.toUpperCase();
});
};
var check = function check(ob... | true |
152643bc5a2dfdbf4dc07aafabef3311ec407c3a | JavaScript | zzzeyez/blossoms | /sketch.js | UTF-8 | 1,985 | 3.078125 | 3 | [] | no_license | var phase, speed, maxCircleSize, numRows, distance, numCols, numStrands, colorA, colorB;
function setup() {
createCanvas(window.innerWidth, window.innerHeight);
noStroke();
// var colorWidth = 255;
// var colorHeight = 255;
// var colorWidth = colorW;
// var colorHeight = colorH;
phase = 0;
speed = ran... | true |
582e7026173cc893f14658833efb791b08207804 | JavaScript | heptaluan/react-example | /example/Hook/useMemo/2.js | UTF-8 | 618 | 2.578125 | 3 | [] | no_license | import React, { useState, memo, useMemo } from 'react'
const isEqual = (prevProps, nextProps) => {
if (prevProps.name !== nextProps.name) {
return false
}
return true
}
const Child = memo(({ data }) => {
console.log(`子组件渲染`)
return (<div>
<div>{data.name}</div>
</div>)
}, isEqual)
const App = () ... | true |
8680d9c8b3a54521bfc1642ff7d5b19396c1ae3a | JavaScript | ChrisCruze/jutility | /library/underscore_functions.js | UTF-8 | 731 | 2.734375 | 3 | [] | no_license | // get sum from array with key
function sum_float_convert_from_array_underscore(arr,key_name) {
// returns the sum total of all values in the array
return _.reduce(arr, function(memo, num) {
r = memo + (parseFloat(num[key_name])||0)
return r
}, 0);
}
//group by an array
function group_by_underscore(g... | true |
d634c4c7383e3949c9a1736de16485b024a68feb | JavaScript | liuxingyishi/stone | /models/mail.js | UTF-8 | 1,159 | 2.578125 | 3 | [] | no_license | /**
* send email
* 发送邮件
* related to @nodemailer
* Created by lenovo on 2015/3/13.
*/
var nodemailer = require('nodemailer');
var config = require('../settings').settings;
//邮件管理对象
var mailer = function(){
this.transporter = nodemailer.createTransport({
service:config.emailService,
auth: {
... | true |
b1c7d56eb9c2e82a3f989e202769a52a1f66b65e | JavaScript | ShuhratBek/refinery-platform | /refinery/ui/source/js/globals/services/contains-dom-element.js | UTF-8 | 721 | 2.546875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | 'use strict';
angular
.module('containsDomElement', [])
.service('containsDomElement', [function () {
return function (searchEl, targetEl) {
var found = false;
// Set special attribute to identify element while browsing up the
// DOM tree.
searchEl.domSearchTarget = true;
var ta... | true |
0d677d49008e3b0d4d940a36c8ecd665aaab8e0f | JavaScript | myiskk/leetcode | /interview/面试题16.05.阶乘尾数.js | UTF-8 | 283 | 3.375 | 3 | [] | no_license | /**
* https://leetcode-cn.com/problems/factorial-zeros-lcci/
* @param {number} n
* @return {number}
*/
var trailingZeroes = function(n) {
let m5=0;
while(n>0){
m5 += parseInt(n/5);
n = parseInt(n/5);
}
return m5
};
console.log(trailingZeroes(4)) | true |
a4e69a6ea91c66dc5abfd5e2affd1dffdb364b28 | JavaScript | RishaanvB/WincMainRemote | /JavaScript/Opdracht_12_Eindopdracht_Events/script.js | UTF-8 | 4,428 | 3.171875 | 3 | [] | no_license | const menu = document.querySelector("#menu-icon");
const colorRed = document.getElementById("color-red");
const colorWhite = document.getElementById("color-white");
const colorBlue = document.getElementById("color-blue");
const colorOrange = document.getElementById("color-orange");
const body = document.querySelector("... | true |
29709ef8fa3075b05d4651109ecb390981432086 | JavaScript | CamillaCdC/seic38-warmups | /week7/Day3/js/app.js | UTF-8 | 1,084 | 3.75 | 4 | [] | no_license | const grains = {
sum: 0,
allSquares: [],
generateOneSquare: function (num) {
return 2 ** (num - 1);
},
generateAllSqures: function () {
for (let i = 1; i <= 64; i++) {
this.allSquares.push(this.generateOneSquare(i));
}
},
calculateSum: function () {
this.sum = this.allSquares.reduce(function (acc, ... | true |
8a1f261e2dcbac2687a62b7ca9590edd0f8dff86 | JavaScript | strongloop/strong-docs | /sandbox/method.js | UTF-8 | 360 | 2.5625 | 3 | [
"MIT"
] | permissive | // Copyright IBM Corp. 2014,2018. All Rights Reserved.
// Node module: strong-docs
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
/**
* Adds two numbers
*
* @param {Number} a
* @param {Number} b
* @returns {Number} result The two added numbers
*/
... | true |
1b88645c75bf0d2cb8b97f0ea4dca7c8717f1383 | JavaScript | xpring88/reactnd-myreads-project | /src/components/ChangerBookShelf.js | UTF-8 | 1,366 | 2.765625 | 3 | [
"MIT"
] | permissive | import React from 'react';
import PropTypes from 'prop-types';
class ChangerBookShelf extends React.Component {
constructor(props){
super(props);
this.state = {
value: this.setDefaultValue(),
}
}
static propTypes = {
book: PropTypes.object.isRequired,
books: PropTypes.array.isRequir... | true |
ef787271fd94915297d6bec54809386861476d78 | JavaScript | rondevera/webfontloader | /src-test/google/lastresortwebkitfontwatchrunnertest.js | UTF-8 | 5,873 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | var LastResortWebKitFontWatchRunnerTest =
TestCase('LastResortWebKitFontWatchRunnerTest');
LastResortWebKitFontWatchRunnerTest.prototype.setUp = function() {
var self = this;
this.fontFamily_ = 'fontFamily1';
this.fontDescription_ = 'n4';
this.fontActiveCalled_ = 0;
this.fontActive_ = {};
this.fontIn... | true |
b8539c98e1843649e8bb69e21fa4b3a39e50edd3 | JavaScript | carmen0208/JS-Daydayup | /OOP/9constructor_inheritance5.js | UTF-8 | 423 | 3.375 | 3 | [] | no_license | function Animal(){}
Animal.prototype.species = "动物";
function Cat(name, color) {
// Animal.apply(this, arguments);
this.name = name;
this.color = color;
}
function extend2(Child, Parent) {
var p = Parent.prototype;
var c = Child.prototype;
for(var i in p) {
c[i] = p[i];
}
c.uber = p;
}
extend2(Ca... | true |
7da9981597c2660bddc3b80dfc7dcd86fa5ef231 | JavaScript | EcksZA/dragtest | /scripts.js | UTF-8 | 2,233 | 3.109375 | 3 | [] | no_license | var draggedItem = null;
var storage1 = null;
var storage2 = null;
var reference = null;
function dragStart(ev) {
this.style.opacity = '0.4';
draggedItem = this;
ev.dataTransfer.effectAllowed = 'move';
ev.dataTransfer.setData('text/html', this.innerHTML);
}
function dragEnter(ev) {
return false;
}
function dragO... | true |
9676e9fe6ecf2ebbde0f5272b062bab20fbe59bf | JavaScript | TLmaK0/kimsufi-checker | /check.js | UTF-8 | 1,916 | 2.515625 | 3 | [
"MIT"
] | permissive | const request = require('request');
const _ = require('lodash');
const opn = require('opn');
var requests = 0;
if (!process.argv[4]) {
console.error('Usage: node check.js <secondsWait> <countryId> <hardwardId> <hardwardId> ....');
console.info('\nnode check.js 10 ES 1801sk13 1801sk12');
console.info('Check ever... | true |
91585dbcdbd2228c45a6a2665f37ec7e05e06fa9 | JavaScript | asifkareem03/MEARN-STACK | /JavaScript/array/findelmnt.js | UTF-8 | 170 | 3.53125 | 4 | [] | no_license | var arr=[1,2,3,4,5,6];
var elmnt=15,flag=0;
for(let num of arr){
if(num==elmnt)
{
flag=1;
break;
}
}
console.log(flag==1?"Found":"not found"); | true |
1ee66e9d0a151326fe2376f28a7faf49f42ef676 | JavaScript | Derek-Cruz/m2-0621-code-solutions | /javascript-constructors/new-objects.js | UTF-8 | 731 | 3.171875 | 3 | [] | no_license | var aObject = new Object()
console.log('value of aObject:', aObject);
console.log('typeof aObject:', typeof aObject);
var aArray = new Array()
console.log('value of aArray:', aArray);
console.log('typeof aArray:', typeof aArray);
var aFunction = new Function()
console.log('value of aFunction:', aFunction);
console... | true |
c8bc68e7e9c1e9f42e75f4154afbd90050d334b0 | JavaScript | kapy2010/food_truck | /app.js | UTF-8 | 4,451 | 2.953125 | 3 | [] | no_license | function loadJSON(path, success, error) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function()
{
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
if (success)
success(JSON.parse(xhr.responseText));
} el... | true |
2b4e756caea47f686227837fe438d779bd46c1cf | JavaScript | Vizzuality/gfw-style-guides | /scripts/klass.js | UTF-8 | 2,742 | 3.96875 | 4 | [
"MIT"
] | permissive | var Class = function(){};
Class.extend = function(prop) {
// Este es el proto de la clase de la que se extiende
// (es decir, el padre)
var _super = this.prototype;
// Hacemos el truco del constructor vació para mantener
// la cadena de prototipos pero sin ejecutar el constructor
// del padre innecesariam... | true |
a84d338e3e9b2038dfc98925dab258312acba7c8 | JavaScript | FredericHeem/rubico | /dist/x/defaultsDeep.mjs | UTF-8 | 2,054 | 2.75 | 3 | [
"MIT"
] | permissive | /**
* rubico v2.2.1
* https://github.com/a-synchronous/rubico
* (c) 2019-2023 Richard Tong
* rubico may be freely distributed under the MIT license.
*/
const isArray = Array.isArray
const arrayDefaultsDeepFromArray = function (array, defaultArray) {
const defaultArrayLength = defaultArray.length,
result = ... | true |
985458bfe78da27a49b3e462e32f4027b5801b7c | JavaScript | dmcgrouther/event-app-front-end | /src/components/UserPage/EditUserPage.js | UTF-8 | 3,659 | 2.515625 | 3 | [] | no_license | import React, { Component } from 'react';
import axios from 'axios';
import { Link } from 'react-router-dom';
import './EditUserPage.css'
//https://stackoverflow.com/questions/47012169/a-component-is-changing-an-uncontrolled-input-of-type-text-to-be-controlled-erro/47012342
//followed the above for input field value of... | true |
9d7af3131ad8e9ba693ea4e6a73869189b42d4d2 | JavaScript | gerrgg/floodlight-design-react | /src/pages/Home.js | UTF-8 | 4,963 | 2.625 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import Slider from "../components/slider";
import Dropdown from "../components/Dropdown";
import Color from "../components/Color";
import Filter from "../components/Filter";
import Repository from "../components/Repository";
import axios from "axios";
const styles =... | true |
f5f4d07c1636b882587cd02f29634699cb9d53d5 | JavaScript | ggomesneto/globetrotter-heroku | /client/src/components/ViewTrip/ViewTripResume.js | UTF-8 | 1,478 | 2.53125 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import axios from "axios";
import "../Dashboard/css/Resume.css";
const ViewTripResume = ({ user }) => {
const API_URL = process.env.REACT_APP_API_URL || "/api/trips/user";
const { living, bio } = user;
let [trips, setTrips] = useState([]);
let daysTraveled... | true |
6e868a0b51b3332daea6824342d9556ecc130e31 | JavaScript | AlexanderSosnovskiy/react-redux-weather-app | /src/redux/reducers/weatherReducer.js | UTF-8 | 555 | 2.59375 | 3 | [] | no_license | import { SET_CURRENT_WEATHER, SET_DAILY_FORECAST } from '../types';
const initialState = {
weather: {},
isLoading: true,
error: '',
};
const weatherReducer = (state = initialState, action) => {
if (action.type === SET_CURRENT_WEATHER) {
return {
...state,
currentWeather: action.data,
isL... | true |
c3325ab3eeb4d2a8e3eb457be47efd3664cf2377 | JavaScript | beneon/html-css-javascript-the-basic-things | /c6/test.js | UTF-8 | 687 | 3.453125 | 3 | [] | no_license | var txt = "A:See Point A (subspinale).\nAAO:See American Association of Orthodontists.\nAAOF:See American Association of Orthodontists Foundation."
var recite = ["A","AAO","AAOF"]
var answer = ["See Point A (subspinale).","...","....."]
// \n
// \s
var words = txt.split(/\n/)
console.log(words[0]);
var recite = []
var ... | true |
0d59de8ea4a65e6ed8d9fd18f3d73d24d2d07758 | JavaScript | franciscobenedict/Basket-Case | /app/product-app.js | UTF-8 | 390 | 2.5625 | 3 | [] | no_license | /* Created by Francisco Benedict - 21/05/2015 */
var App = angular.module('App', []);
App.controller('dataCtrl', function($scope, $http) {
// Products
$http.get('data-source/products.json')
.then(function(res){
$scope.products = res.data.products;
$scope.predicate = '-name';
angular.forEach($scope.products,... | true |
59885da099c55f0dd94ba4e07099301ca4e5e14f | JavaScript | sashakolachko/calculator | /js/script.js | UTF-8 | 855 | 3.296875 | 3 | [] | no_license | document.getElementById("resultBtn").onclick = function() {
var input = document.getElementById("numberInput").value;
input = eval(input).toString();
input = input.substring(0, 15);
document.getElementById("numberInput").value = input;
}
document.getElementById("clean").onclick = function() {
var numberInput... | true |
46943f6c78fd6b19ebc57281ab6ccdbe7d184ace | JavaScript | hieudt-2054/avengers-bot | /tests/moment.js | UTF-8 | 693 | 2.78125 | 3 | [] | no_license | const moment = require('moment-timezone');
moment.tz.setDefault('Asia/Ho_Chi_Minh');
const monthYear = moment().subtract(1, 'month').format('MM/YYYY');
const nowYear = moment().format('MM/YYYY');
var prevMonth = moment().subtract(1, 'month').startOf('month');
var prevMonthDays = prevMonth.daysInMonth();
var fromLastMo... | true |
31332265499c22d9fd4a934fb52ab6b8f9306231 | JavaScript | yinazee/Artphilia | /app/assets/javascripts/own_artworks.js | UTF-8 | 1,148 | 2.90625 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
artworksOwned();
getEditOwnedArtwork();
})
/////// click on nav bar link for owned Artwork ///////
const artworksOwned = () => {
$(document).on('click', '#owned_artworks', function(e){
getRouteResponse(e, this);
});
}
/////// ADD OWNED ARTWORKS using filter function ///////
... | true |
ac665e7b549edd6253af668c2a354dd7b81a7c28 | JavaScript | Ing-Web/JS-2016 | /js-05-turno-2/js05-2turno/06-formEvents.js | UTF-8 | 871 | 3.703125 | 4 | [] | no_license | /*
EVENTOS DE FORMULARIOS
focus
Cuando se activa un campo
blur
Cuando se sale de un campo
change
Cuando se cambia el valor de un select, input o textarea
submit
Cuando se envia el formulario (este evento se asocia al formulario completo, no al input submit)
*/
// Ejercicio 1: detectar la opc... | true |
2d4261d5794f770c41d67008f33cb3ab0058fda2 | JavaScript | BoomPowbep/MasterclassML | /js/perceptron.js | UTF-8 | 3,673 | 3.484375 | 3 | [] | no_license |
function randomDoubleInRange(min, max) {
return Math.random() < 0.5 ? ((1-Math.random()) * (max-min) + min) : (Math.random() * (max-min) + min);
}
function shuffle(array) {
return array.sort(() => Math.random() - 0.5);
}
// -----------------------------------------------------------------------------------------... | true |
0884e7b26340172536b4278991dc14375c61767b | JavaScript | yashkulshrestha97/Resume-builder | /controllers/authController.js | UTF-8 | 4,216 | 2.703125 | 3 | [] | no_license | const User = require('../model/User');
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
const Joi = require('@hapi/joi');
const registerschema = Joi.object({
name: Joi.string().min(6).required(),
email: Joi.string().min(6).required().email(),
password: Joi.string().min(6).required()... | true |
3e5a5e35d5936d172e2c72532733a9fa719fd810 | JavaScript | EJ132/EJ-BookmarkMe-App | /Store.js | UTF-8 | 2,820 | 3.0625 | 3 | [] | no_license | 'use strict';
/* global Item */
// eslint-disable-next-line no-unused-vars
const BookStore = (function () {
const addItem = function (object) {
if (object.url === undefined){
alert('Please insert valid inputs')
return null;
}
object.view = true;
this.items.push(object);
};
const find... | true |
a1f7648e18ffadbe42b83b211d4bfeb799d6dc2d | JavaScript | aramay/algo-toolbox | /js/stack.js | UTF-8 | 620 | 3.5625 | 4 | [] | no_license | function Stack(size) {
this._list = [];
this._size = size;
this._index = 0;
}
Stack.prototype.push = function (item) {
var index = this._index++;
this._list[index] = item;
console.log("item pushed ", this._list);
};
Stack.prototype.pop = function () {
//remove last item
console.l... | true |
3f1451eb3065624698958c1118f91caa8faef844 | JavaScript | fraziern/easyscreen | /public/javascripts/display.js | UTF-8 | 2,138 | 2.8125 | 3 | [
"MIT"
] | permissive | /*global io _uid */
// textFitHeight will adjust text height to fill window
Element.prototype.textFitHeight = function(_options) {
const options = _options || {
min: 0,
max: 100
};
const shrinker = () => {
this.style.fontSize = ''; // reset to default CSS property
let currentSize = options.max;... | true |
bf59505b7c34c8234e10b967bd2d4f4f22c77ad7 | JavaScript | fritzm/node-cgal | /spec/Polygon2.spec.js | UTF-8 | 4,943 | 2.859375 | 3 | [
"BSD-2-Clause"
] | permissive | describe("CGAL.Polygon2", function() {
'use strict';
var CGAL = require('..');
it("should be constructable from an array of points", function() {
expect(function() { return new CGAL.Polygon2([[0,0], [1,1], [0,2]]); }).not.toThrow();
expect(function() { return new CGAL.Polygon2(); }).not.to... | true |
fde1215e9bce02a57d96f610ed7183fa2f9c1f1f | JavaScript | Anastasiya4/goit-js-hw-07 | /task-02/ex2.js | UTF-8 | 421 | 2.890625 | 3 | [] | no_license | 'use strict'
const ingrListRef = document.querySelector('#ingredients');
const ingredients = [
'Картошка',
'Грибы',
'Чеснок',
'Помидоры',
'Зелень',
'Приправы',
];
const productList = ingredients.map(item =>{
const itemList = document.createElement('li');
itemList.textContent = item;... | true |
25f76c5528f5b47f0ec877a5b3db21b75b0b0b15 | JavaScript | simondell/wk2_synth_ui_assignment | /smack.js | UTF-8 | 2,260 | 2.671875 | 3 | [] | no_license | // make white noise sample
var bufferSize = 2 * con.sampleRate;
var noiseBuffer = con.createBuffer(1, bufferSize, con.sampleRate);
var output = noiseBuffer.getChannelData(0);
for (var i = 0; i < bufferSize; i++) {
output[i] = Math.random() * 2 - 1;
}
var smackRate = 0.001;
var smackDepth = 0.001;
var smackFilter =... | true |
ac50afac70b9d2433e91d8628ee89be07a0d796c | JavaScript | SergioRocha92/Apps-Mobile | /ej9.js | UTF-8 | 239 | 3.140625 | 3 | [] | no_license | const aa = [9, 4, 8, 7, 3];
function even(num){
return num % 2 === 0;
}
function rechazar(con, arr){
array = arr.filter(element => (con(element) === false));
return array;
}
console.log(rechazar (even, aa));
| true |
251800a08556b92d1c5299ee4eb54d6f9d5c193c | JavaScript | gabrielgodoy-zz/learning-react-16-novas-features | /1 - Lidando com erros usando Error Boundaries/src/Profile.js | UTF-8 | 312 | 2.5625 | 3 | [] | no_license | import React from 'react';
class Profile extends React.Component {
onClick = () => {
this.setState(state => {
throw new Error('Oh nooo!');
return { ...state };
});
};
render() {
return <div onClick={this.onClick}>Name: {this.props.user.name}</div>;
}
}
export default Profile;
| true |
fc9b894be1ede3c957c2d38cf5720489ee8d639f | JavaScript | huq-industries/carto-spatial-extension | /modules/h3/bigquery/test/integration/ST_ASH3.spec.js | UTF-8 | 2,100 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | const { runQuery } = require('../../../../../common/bigquery/test-utils');
test('ST_ASH3 returns the proper INT64', async () => {
const query = `
WITH inputs AS
(
SELECT 1 AS id, ST_GEOGPOINT(-122.0553238, 37.3615593) as geom, 5 as resolution UNION ALL
SELECT 2 AS id, ST_GEO... | true |
c39313ed02d1a9ecfe435eb4f47060d71abdf885 | JavaScript | akashgarg3a/PepCoding-Automation-with-selenium-Project | /facts/Async await, Callbacks/multiFileReadAsync_PromiseHeaven.js | UTF-8 | 1,439 | 2.859375 | 3 | [] | no_license |
let fs = require('fs');
let f1 = './f1.txt';
let f2 = './f2.txt';
let f3 = './f3.txt';
let f4 = './f4.txt';
let f5 = './f5.txt';
let f6 = './f6.txt';
let f7 = './f7.txt';
let f1p = fs.promises.readFile(f1);
f1p.then(function(c){
c += "";
if(c === '1'){
let f2p = fs.promises.readFile(f2);
retu... | true |
d6ff07cb0579489773e679c6004256c67df33a71 | JavaScript | suns-echoes/array-utils | /src/utils/diff.spec.js | UTF-8 | 629 | 2.765625 | 3 | [
"MIT"
] | permissive | import { diff } from './diff';
describe('ArrayUtils.diff', () => {
it('returns differences between arrays', () => {
const one = [1, 2, 3];
const two = [3, 4, 5];
const result = {
common: [3],
deletions: [1, 2],
insertions: [4, 5],
};
expect(diff(one, two)).to.be.eql(result);
});
it('throws if ... | true |
37856c1b85adce7d429f1cb8df3081dfb13dbc91 | JavaScript | Quaggie/react-native-weather | /src/api.js | UTF-8 | 752 | 3.328125 | 3 | [] | no_license | 'use strict';
let rootUrl = 'api.openweathermap.org/data/2.5/weather?APPID=75d379fc192326441cf68b994709a1fe';
function kelvinToF (kelvin) {
// return Math.round((kelvin - 273.15) * 1.8 + 32) + '˚F';
return Math.round(kelvin - 273.15) + ' ˚C';
}
function getUpper (str) {
let first = str.substring(0, 1).toUpperC... | true |
6facd773f113096ee326bb42a46459f253459f43 | JavaScript | KoolieTheKangaroo/blogspa | /scripts/pages/Overview.js | UTF-8 | 1,719 | 2.546875 | 3 | [
"MIT"
] | permissive | import React from 'react';
import ReactDOM from 'react-dom';
//import Details from './Details';
export default class Overview extends React.Component{
constructor(props){
super(props);
this.state = {
state: 'initial',
config: {}
};
this.config = {};
... | true |
a01dcea37228046191121a93b5c0764a6078a5e5 | JavaScript | itsjohncs/memorial-searchbar | /exampleFilters/mountExampleFilters.js | UTF-8 | 707 | 2.90625 | 3 | [] | no_license | function createFilter(label, onToggle) {
const container = document.createElement("label");
container.classList.add("filter");
const checkbox = document.createElement("input");
checkbox.setAttribute("type", "checkbox");
checkbox.addEventListener("change", function(event) {
onToggle(event.target.checked, label);... | true |
a27d665f7a9d8cf61bb7802f1bb0dc3a9b1142f5 | JavaScript | navyakusam/web-and-mobile-programming | /ICP - 4/source/Hover image/hover4.js | UTF-8 | 447 | 2.75 | 3 | [] | no_license | function upDate(previewPic) {
const altText = previewPic.alt;
const imageUrl = previewPic.src;
const imageDiv = document.getElementById("image")
imageDiv.style.backgroundImage = "url("+imageUrl+")";
imageDiv.innerText = altText;
}
function unDo() {
const imageDiv = document.getElementById("imag... | true |
bd97cd65cf43733cdb0fdf07d055c5035fab0088 | JavaScript | alekz29/Cookie-clicker | /game/active.js | UTF-8 | 806 | 2.796875 | 3 | [] | no_license | import manufacturers from "./manufacturers";
const active = cookies => {
manufacturers.map(item => {
const product = document.getElementById(`product${item.id}`),
currentPrice = (item.price || item.basicPrice)
if (currentPrice <= cookies && product.classList.contains('locked')) {
... | true |
58a7b38553e97da939f835f43d89dfa77f69fb56 | JavaScript | nickvirden/ga-exercises | /7-DOM-jQuery/favoritesList/app.js | UTF-8 | 1,981 | 4.46875 | 4 | [] | no_license | /* Independent Practice
Making a favorites list: DOM manipulation
- When the user clicks the submit button, take the value they've typed
into the input box and add it to the list (remember: appendChild)
- Also, when a new item is added to the list, clear the input box.
(Hint: the `value` property of the inp... | true |
53bd7e0f1939799486dc32d597de5a4e146b071c | JavaScript | peter-vilja/midi-visualization | /app/scripts/oscillatorPool.js | UTF-8 | 2,356 | 2.90625 | 3 | [] | no_license | class OscillatorPool {
constructor(ctx, size) {
this.ctx = ctx;
this.maxSize = size;
this.osc = new Array(size);
this.oscNote = new Array(size);
this.oscBusy = new Array(size);
for (var i = 0; i < this.osc.length; i++) {
this.osc[i] = new Voice(this.ctx);
this.oscBusy[i] = false;
... | true |