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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
66d900dfd3607b34567597e73ce5c82124133910 | JavaScript | aimerib/matchthesloth | /script.js | UTF-8 | 4,225 | 3.609375 | 4 | [] | no_license | const shuffle = function (array) {
let currentIndex = array.length, temporaryValue, randomIndex;
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element... | true |
fd290353a59a9477f93c1d5e83b9ab8018f53657 | JavaScript | ShyamaNaveen/SkillSanta-10th | /JS/palindrom.js | UTF-8 | 510 | 3.8125 | 4 | [] | no_license | function chkPalindrome()
{
let palStr=document.getElementById("txtdata").value
let len=palStr.length
for(i=0;i<len/2;i++)
if(palStr[i]!==palStr[len-1-i])
{
return false
}
return true
}
function chkVal(){
if(chkPalindrome())
{
document.getE... | true |
5e351b1a6520966b34c84cf5a319d6770960372b | JavaScript | deepakchinnadurai/sorting_visualizer | /helper.js | UTF-8 | 10,507 | 3.1875 | 3 | [] | no_license |
import './Node.css';
const generateColors = (num) => {
let colors = [];
for(let i=0; i<num; i++){
let h = Math.floor(Math.random() * 450);
colors.push(h);
}
return (colors);
}
export function sort(array) {
let animations = [];
let... | true |
554edf1e3d94dcd5165734116b96a3d8598aa22e | JavaScript | vokie123456/navWebsit | /js/zixun.js | UTF-8 | 3,737 | 2.625 | 3 | [
"MIT"
] | permissive | /**
* 获取咨询
* ajax
*/
(function () {
// 获取6组数据
// ajax
function getDate(url, [typeid, page], sucFn, errorFn, beforeFn) {
$.ajax({
url: url + "?typeid=" + typeid + " &page=" + page,
data: typeid,
page,
type: "GET",
dataType: "json",
... | true |
a32caff081d3c86dec6588d4c320af54ef941aa7 | JavaScript | niguibru/SmartLords | /gpt/toMigrate/arduino copy.js | UTF-8 | 2,276 | 2.515625 | 3 | [] | no_license | export class MoistureSensor {
constructor(mqttClient, deviceId) {
this.mqttCli = mqttClient
this.deviceId = deviceId
this.state
}
newState(payload) {
if (payload.device_id === this.deviceId) {
// console.log(`>> Moisture - Message Arrived `)
// conso... | true |
1dd91e6c2ec3cccd4e3ae6f45ad050df30748071 | JavaScript | kusillus/PracticasyDesarrollo | /megaman2.js | UTF-8 | 541 | 2.578125 | 3 | [] | no_license | function hacerClic(){
//document.getElementsByTagName('p')[0].onclick=mostrarAlerta;
/*var lista=document.querySelectorAll("#principal p");
lista[1].onclick=mostrarAlerta;*/
/*var lista=document.querySelectorAll("#principal p");
for(var f=0; f<lista.length; f++){
lista[f].onclick=mostrarAlerta;
}*/
var lista=d... | true |
d213600d5179a855a36eeb37d412669c3eb63547 | JavaScript | quantumOrange/p5sketches | /CircleInversion/sketch.js | UTF-8 | 2,484 | 3.234375 | 3 | [] | no_license | var p;
var q;
var a
var c;
var cnode;
function setup() {
createCanvas(800, 800);
background(100);
c = new Circle(createVector(width*0.5,height*0.5),100);
cnode = new Node("C");
cnode.weight = 5;
cnode.position = c.center;
p = new Node("P");
q = new Node("Q");
a = new Node("A")... | true |
27809e6b27caddefea792753891f48c3d8c9e03e | JavaScript | jjdonnel/parkwaypages | /parkwayGolf.js | UTF-8 | 2,450 | 2.546875 | 3 | [] | no_license | /* global $ */
function pgaBoard() {
var leaders = document.getElementById('board');
var displayBoard = document.getElementById('pgaBoard');
if (leaders.style.display == 'block') {
leaders.style.display = 'none';
displayBoard.innerHTML = 'PGA Tour';
}
else {
leaders.style.display = 'block';
displayBoard... | true |
8dfdceda0279bb3ad80ec5064f1c17dee5256f8b | JavaScript | BSeipler/react-drink-recipes | /src/pages/DrinksPage.js | UTF-8 | 1,189 | 2.515625 | 3 | [] | no_license | import React, { useEffect, useState } from 'react'
import DrinkCard from './../components/DrinkCard'
import { useParams } from 'react-router-dom'
import axios from 'axios'
const DrinksPage = () => {
const [error, setError] = useState(false)
const [drinks, setDrinks] = useState([])
const { drink } = useParams()
... | true |
6f8a7b6a72b8e5db572d7c5302b349ae4aeb916b | JavaScript | jafrasier50/JavaScript-Calc-Palin | /Palin/Palindrome.js | UTF-8 | 234 | 2.90625 | 3 | [] | no_license | var tb = document.getElementById("nameTextBox")
var btn = document.getElementById("btnClickMe")
var h2 = document.getElementById("heading2")
btn.addEventListener('click',function(){
h2.innerHTML = tb.value
})
console.log(tb)
| true |
e336755dde1fdcc000a7287c325f9aaea0264e5d | JavaScript | ryzokuken/tibetan-date-calculator | /src/generators/get-year-from-western.js | UTF-8 | 636 | 2.546875 | 3 | [] | no_license | import {
RABJUNG_BEGINNING,
RABJUNG_CYCLE_LENGTH,
YEAR_DIFF
} from '../constants';
import { amod, yearAttributes } from '../helpers';
/**
* Figures out a year's info from a Western calendar year number, ex. 2008.
*
* @param {number} wYear: Western calendar year number, ex. 2008
* @returns {Ye... | true |
e4778dbc3166d028af82f137de27c92fb606dd32 | JavaScript | TomSlemenson/FriendFinder | /app/routing/apiRoutes.js | UTF-8 | 869 | 2.96875 | 3 | [] | no_license | var friendArray = require("../data/friends.js");
module.exports = function(app) {
app.get("/api/friends", function(req, res) {
res.json(friendArray);
});
app.post("/api/friends", function(req, res) {
let bestScore = 45;
for( let i = 0; i < friendArray.length; i++){
... | true |
83a85ad9e64035fbb3305a7d9b3c330555c0b51b | JavaScript | panhuibin/CrossPlatformPlayground | /ReactNative/Open_Src_Apps/f8app/js/filter/topicIcons.js | UTF-8 | 1,213 | 2.65625 | 3 | [
"LicenseRef-scancode-facebook-software-license",
"Apache-2.0"
] | permissive | const TOPIC_ICONS = {
default: [require("./img/default/1.png")],
active: [
require("./img/active/1.png"),
require("./img/active/2.png"),
require("./img/active/3.png"),
require("./img/active/4.png"),
require("./img/active/5.png"),
require("./img/active/6.png"),
require("./img/active/7.png... | true |
07b64c30cd2e22a42cbd481f01254d680acb8480 | JavaScript | ashish-devv/cyber-type | /src/stores/typed.js | UTF-8 | 1,623 | 2.578125 | 3 | [] | no_license | import { writable } from "svelte/store";
import words from "./words";
import progress from "./progress";
import keys from "./keys";
import errors from "./errors";
let $progress;
let $words;
progress.subscribe((x) => ($progress = x));
words.subscribe((x) => ($words = x));
// {
// key: 'a',
// time: Date()
// }
ex... | true |
1c00858bb465c2b61c953ca76ee9f4de31105fb7 | JavaScript | ykosinets/mobile-ranker | /src/assets/js/components/navigation.js | UTF-8 | 1,471 | 2.921875 | 3 | [] | no_license | export default function Navigation() {
const headerButton = document.querySelector('.header-toggle');
const navigationButton = document.querySelector('.navigation-toggle');
const menu = document.querySelector('.navigation');
const navigationBackdrop = document.querySelector('.navigation-backdrop');
const body = do... | true |
fa8e8a7ad9d257cf03867f2e256ac78a16e21d27 | JavaScript | azizl/Visualizations-for-fraction-angles-numbers- | /sketch.js | UTF-8 | 698 | 3 | 3 | [
"MIT"
] | permissive | let time= 0;
function setup(){
createCanvas(720,600);
background(204);
}
function draw(){
translate(150,200);
let radius = 50;
stroke(255);
noFill();
ellipse(0,0,radius*2);
let x = (radius)*cos(22*time);
let y = (radius)*sin(22*time);
fill(0);
ellipse(x,y,8);
lin... | true |
e5655a03bb7bcc7ea19d32899bb39857cca587fd | JavaScript | jasnell/fresno-node-js | /20151116/05-style/app.js | UTF-8 | 1,993 | 2.59375 | 3 | [] | no_license | var fs = require('fs');
var canvasBuffer = require('electron-canvas-to-buffer');
var path = require('path');
var counter = 0;
var localMediaStream = null;
var video = document.querySelector('video');
var capture = document.querySelector('button');
var canvas = document.querySelector('canvas');
var ctx = canvas.getConte... | true |
17c120174a36c0c3d6434ba9c38a1b681eb062db | JavaScript | Shamikhquraan/code201 | /script.js | UTF-8 | 666 | 3.328125 | 3 | [
"MIT"
] | permissive |
alert("This website allowed to adults - above 18 - , maybe it contains horrific views . ")
let userAge = prompt("Enter your age :");
console.log(userAge);
while (userAge < 18) {
alert("sorry u are not adult..u will not be able to acsess our website ");
userAge = prompt("wrong entry please Enter your age again ? ... | true |
adf7ae53a6d7ba57e0173baaedf677e44b47ee4b | JavaScript | 18735185652/new-todo | /src/2/1.js | UTF-8 | 650 | 2.5625 | 3 | [] | no_license | import React,{Component} from 'react';
import {render} from 'react-dom';
import PropTypes from 'prop-types'
class Person extends Component{
//默认属性对象
static defaultProps = {
name:'无名'
}
//如果定义组件的时候希望传入组件的属性有类型和是否必填的限制
static propTypes = {
name:PropTypes.string,
age:PropTypes.n... | true |
393d2ad9b7308f20851524ae8b2408f0fd805276 | JavaScript | ashlaban/shadybusiness | /demo/pathfinder-demo.js | UTF-8 | 6,392 | 2.84375 | 3 | [] | no_license | function initPathfinder( nChunks )
{
canvas = document.getElementById('canvas-pathfinder'); // WARNING: Global variable for this demo!
//var nChunks = 64;
var nChunksSqrt = Math.floor( Math.sqrt(nChunks) );
var s = Math.pow(2, 6);
// Setup noise generation
var array = Array(nChunks);
var scale = 0.0125;
... | true |
fdd70241bbe7df20d823bfb33256b4f9b0f2cb2e | JavaScript | Ininit/leetcode-js | /1.两数之和.js | UTF-8 | 488 | 3.125 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=1 lang=javascript
*
* [1] 两数之和
*/
// @lc code=start
/**
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
var twoSum = function(nums, target) {
const mp = new Map()
for(let i = 0; i < nums.length; i++) {
mp.set(nums[i], i)
}
for(let i = 0; i < num... | true |
2a594066e1dfc33a264a3de8c08484d3f0f02b02 | JavaScript | c3rv3au/p2p_node_server | /classes/webrequest.js | UTF-8 | 1,157 | 2.609375 | 3 | [] | no_license | var url = require('url');
// Constructor
function Webrequest(req,res) {
// always initialize all instance properties
this.req = req;
this.res = res;
this.parts = url.parse(this.req.url, true);
this.query = this.parts.query;
this.cookies = parseCookies(this.req);
if (typeof req.headers['x-forwarded-for'] !=... | true |
2c1c94ad4765fdc53161db468b852ad8166db28e | JavaScript | lotusbleu54/Orinoco_Vintage_Market | /numberOfArticlesInBasket.js | UTF-8 | 670 | 3.1875 | 3 | [] | no_license |
let basket = JSON.parse(localStorage.getItem('basket'));
numberOfArticlesInBasket = function(basket) {
let totalNumberOfArticles = 0;
for (let i = 0; i < basket.length; i++) {
totalNumberOfArticles += basket[i].quantity;
}
if (totalNumberOfArticles==0) {
document.g... | true |
4d04c5786bf4d192b23b13f03a51d22de4850d62 | JavaScript | harishviru/ReactJS | /react_hook/src/useState/HookCounterTwo.js | UTF-8 | 1,123 | 3.03125 | 3 | [] | no_license | import React ,{useState} from 'react'
//ii)useState with previous state
function HookCounterTwo() {
const initialState=0;
const [count, setCount] = useState(initialState);
const incrementFive=()=>{
for(let i=0;i<5;i++){
// setCount(count+1) //Whenever your use state ,if it is depend on previous st... | true |
d8b9f4ed3cbc681571b6ca21373e9b9ce9ad6604 | JavaScript | mathematicalninja/Quirk-A-Bot | /packages/discord-bot/src/main.js | UTF-8 | 568 | 2.5625 | 3 | [] | no_license | import { Client } from 'discord.js';
import dotenv from 'dotenv';
import handleReady from './discord-handlers/handleReady.js';
import handleMessage from './discord-handlers/handleMessage/index.js';
// Setting the .env file to a locally accessible form
dotenv.config();
const client = new Client();
// logging in as a... | true |
fa2bc9c34d555413390ea4fe844f9d80b7699dd3 | JavaScript | FrancescoLunesu/php-ajax-dischi | /src/app.js | UTF-8 | 818 | 2.53125 | 3 | [] | no_license | $(document).ready(function(){
$.ajax({
"url" : "http://localhost/Progetti/php-ajax-dischi/server.php",
"method": "GET",
"success": function(risposta){
var source = document.getElementById("entry-template").innerHTML;
var template = Handlebars.compile(source);
... | true |
9aebc50967b7c307e5aee60593f0a2ef85aa12d4 | JavaScript | itzmjauz/JavaWorkspace | /Replay1/Replay1/test.js | UTF-8 | 54 | 2.671875 | 3 | [] | no_license | if(true){
b = 5;
}
else{
b = 7;
}
console.log(b);
| true |
466b1cd4b7c92a239c448a24503f6dd1a60b9091 | JavaScript | DylanMahaffey/Stalk-Trade-api | /src/routes/trades.js | UTF-8 | 1,221 | 2.625 | 3 | [] | no_license | let data = require('../../database');
let express = require('express');
let router = express.Router();
// GETs all crops
router.get('/trades', (req, res) => {
res.send(data.trades)
})
// GET user crops
router.get('/user-trades/:id', (req, res) => {
let allTrades = {
sent: [],
recieved: []
... | true |
a66077e248bd6ca33a2f14620be832757b377008 | JavaScript | loverxp/LeetCode | /JavaScript/src/Check If String Is Transformable With Substring Sort Operations.V2.js | UTF-8 | 921 | 3.171875 | 3 | [] | no_license | // https://leetcode-cn.com/problems/check-if-string-is-transformable-with-substring-sort-operations/
var Test = require('./Common/Test');
var isTransformable = function (s, t) {
const n = s.length;
const indices = Array.from({ length: 10 }, () => []);
for (let i = n - 1; i >= 0; i--) {
indices[pars... | true |
f2faeedad556ab89b940e404441c2a7790dc4831 | JavaScript | pkinlow/wvus-react-starter | /src/services/appRequest.js | UTF-8 | 756 | 2.90625 | 3 | [] | no_license | function randomRange(min, max) {
return Math.ceil(Math.random() * (max - min) + min);
}
function isMockError() {
return window
&& window.location
&& window.location.search
&& /iserror=true/.test(window.location.search)
|| false;
}
function getMockData() {
if (isMockError()) {
throw new Err... | true |
c8e4d0df010bb88f7f6d6247c9018037de402629 | JavaScript | stedyyulius/Battleship | /helpers/getPlayerIndex.js | UTF-8 | 673 | 2.65625 | 3 | [] | no_license | import { getRoomDetails } from '../api/room';
const id = localStorage.getItem('user');
export const mainPlayerIndex = async (roomId) => {
const roomData = await getRoomDetails(roomId);
const { players } = roomData.val();
for (let i = 0; i < players.length; i++) {
if (players[i].id === id) {
... | true |
e7c79c70385a08568ba4303202ce4ff9cf524fbc | JavaScript | harrytang/react | /frontend/src/Me.js | UTF-8 | 817 | 2.78125 | 3 | [] | no_license | /**
* @author Harry Tang <harry@powerkernel.com>
* @link https://powerkernel.com
* @copyright Copyright (c) 2020 Power Kernel
*/
import React, { useState, useEffect } from "react";
import axios from "axios";
export default function Me() {
const [username, setUsername] = useState("");
const [email, setEmail] =... | true |
e91928d401a15674542217998512385a8571f357 | JavaScript | Mkhzoumi/amman-301d23 | /class-06/demo/shred-talk-assign-by-refence/app.js | UTF-8 | 1,399 | 4.1875 | 4 | [
"MIT"
] | permissive | 'use strict';
let x = 5;
let y = 20;
let z = 5;
/*
-------------------------
In our memory 10 will be stored
10 will be stored in the memory
And the memory will return the address where the value 10 is stored
the variable x will point to the place in the memory where 10 exists
-------------------------
*/
... | true |
838a5cf1391a4dfcae42e5bc5ba0c76a176c7503 | JavaScript | MikaelMetropolia/ExperienceFrontEnd | /web/javascript/info.js | UTF-8 | 3,410 | 3.09375 | 3 | [] | no_license | 'use strict';
// Js file containing utility methods that are to be used on most pages.
// Author: Ville L.
// if no id is found stored in the cookie, load the specified page
const noCookieIdLoadPage = (page) => {
const cookies = readCookies();
if (!cookies.includes("id=")) {
window.location.... | true |
970820dc4b2f355b35b195f93e7392dec051f1c0 | JavaScript | blippex/blippex_plugin_chrome | /plugin/common/js/libs/misc.js | UTF-8 | 1,144 | 2.796875 | 3 | [
"MIT"
] | permissive | /*
** Common functions used widely in the project
** @author blippex
** @version 1.0
*/
blippex.define('blippex.libs.misc', {
/*
** Formats the date using format pattern
** @author blippex
** @argument {Date} oArgs.date date object
** @argument {String} oArgs.format format pattern
** @returns {String} fo... | true |
8ee6cbb75d75ce6d10ed5f8d9c1b14d2c3188183 | JavaScript | barust-a/katas | /src/wordWrap.js | UTF-8 | 547 | 3.453125 | 3 | [] | no_license | export function wordWrap(str, columnNumbers) {
let charsCounter = 0
let finalStr = ""
const arrayStr = str.split(" ")
for (let i = 0; i < arrayStr.length; i++) {
charsCounter += arrayStr[i].length
if (charsCounter < columnNumbers) {
finalStr += arrayStr[i] + " "
charsCounter++
} else {
... | true |
dcb545ec56169e3e3141989332fb4c64f4ff83ad | JavaScript | tianruichen/Journey | /search.js | UTF-8 | 1,139 | 2.65625 | 3 | [] | no_license |
var http = require("https");
module.exports = {
search: function (term, callback){
console.log(term);
//console.log(coorB);
var buffer = "";
url = "https://places.demo.api.here.com/places/v1/suggest?at=52.5159%2C13.3777&q=" + term + "&app_id=etW0rzf9MTtJGKg3JUzE&app_code=D... | true |
b58bc38a1a3c75fbd9d6783a41669cfd792da8ed | JavaScript | jay1310/Geminid-Systems-Training | /JULY-29/getUserByID.js | UTF-8 | 220 | 2.828125 | 3 | [] | no_license | // GET
const BASE_URL = "https://reqres.in";
const LIST = "/api/users";
async function getUser(id){
let req = await fetch(BASE_URL + LIST + id);
let json = await req.json();
console.log(json);
}
getUser(7); | true |
bb1a24254fb9eb9ad5755eb79fa0e85daa1df4a2 | JavaScript | adekniyi/message-parser | /app.js | UTF-8 | 851 | 3.40625 | 3 | [] | no_license | let btn = document.getElementById('btn');
let h2 = document.getElementById('h2')
let input = document.getElementById('input');
let span = document.querySelector('.output')
//let p = document.querySelector('p')
btn.addEventListener('click', displayMessage)
function displayMessage() {
let inputValue = input.va... | true |
7eaf8ddcabbf028620730a637979295a23b26572 | JavaScript | vangratnguyhiem/foxMemo | /server/index.js | UTF-8 | 1,443 | 2.625 | 3 | [] | no_license | const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const { Thing } = require('./Thing');
const parser= bodyParser.json();
const app = express();
app.use(cors());
app.use(parser);
app.get('/', (req, res) => {
Thing.find({}).sort({_id: 1})
.then... | true |
e743c2353bcda9e8bca9982a39f9fa5f07e6e334 | JavaScript | Programmersunite/Tutorial_RestaurantPage | /src/index.js | UTF-8 | 1,211 | 2.765625 | 3 | [] | no_license | import {menu} from "./menu"
import {bookTable} from "./booktable"
import {location} from "./location"
const contentDiv = document.querySelector(".content")
const header = document.createElement('header')
header.innerHTML = "The restaurtan"
const nav = document.createElement("div")
nav.innerHTML= "Navigation"
const... | true |
fea5967d09c89e8181fcdfe5ed49f229b90fd5a4 | JavaScript | mag-da-lenka/hack_your_future__react | /22_home_react_2/react_2_hw_todolist_2020/src/c_timer_hooks1.js | UTF-8 | 2,076 | 2.796875 | 3 | [] | no_license | import React, { useState, useEffect } from 'react';
const TimerHooks1 = () => {
const [timer, setTimer] = useState(0);
const increment = () => { setTimer(prev => prev + 1) }
const decrement = () => { setTimer(prev => prev - 1) }
const forward10 = () => { setInterval(() => increment(), 10); }
con... | true |
1db4e9cd244feef141a522dd119813dde5d6e478 | JavaScript | myzingy/lite-shuzi | /cloudfunctions/conf/jinju.js | UTF-8 | 624 | 2.828125 | 3 | [] | no_license | /**
* Created by goto9 on 2018/12/19.
*/
const text = require('./jinju.txt')
module.exports=(function(){
let match=text.match(/(.*)[\r\n]+/g);
let jinju=[];
match.forEach((jj,i)=>{
if(jj.indexOf('《朗读者》')>-1) return;
jj=jj.replace(/[\r\n ]+/g,'').replace(/^[\d]+/,' ');
if(!jj) return;
if(jj.ind... | true |
3906c6811988020ebc5312d673a212062f507eb8 | JavaScript | Garo-A/tinyApp | /express_server.js | UTF-8 | 6,309 | 2.703125 | 3 | [] | no_license | const express = require ('express');
const bodyParser = require("body-parser");
const cookieSession = require ('cookie-session');
const bcrypt = require ('bcrypt');
const methodOverride = require ('method-override');
const app = express();
app.use(bodyParser.urlencoded({extended: true}));
app.set('view engine', 'ejs... | true |
5814fd068a2c0a1864a17d362391f2fcb9fa092d | JavaScript | morchickit/opendatacensus | /public/src/submit.js | UTF-8 | 1,912 | 2.53125 | 3 | [] | no_license | jQuery(document).ready(function($) {
var $yninputs = $('.yntable .js-dependent');
var $existsInput = $('input[name="exists"]');
$existsInput.change(function() {
showHideAvailabilityTable();
});
function showHideAvailabilityTable() {
var val = $('input[name="exists"]:checked').val();
if(val === "N... | true |
9d252ff00ca9a30b242a38d0081645cd2a5f982e | JavaScript | nabendu82/landing-tailwindcss | /public/app.js | UTF-8 | 639 | 2.703125 | 3 | [] | no_license | const bars = document.querySelector('#bars');
const menu = document.querySelector('#menu');
bars.addEventListener('click',() => {
if(menu.classList.contains('hidden') && window.innerWidth < 768) {
menu.classList.remove('hidden');
menu.classList.add('flex','flex-col','text-center','bg-yellow-600','w... | true |
140c53cc31a64f8322e56a7a39b5598b3621f493 | JavaScript | swc-project/swc | /crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/issue_2364_9/input.js | UTF-8 | 233 | 2.765625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | function f(a, b) {
var d = a();
return b.f(d);
}
var o = {
f: function () {
return "FAIL";
},
};
console.log(
f(function () {
o.f = function () {
return "PASS";
};
}, o)
);
| true |
88ef1678f364c6ebf5c086e669d950e57346d28c | JavaScript | tgrall/mongodb-workshop | /node-js/src/routes/comicsRoutes.js | UTF-8 | 1,252 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | 'use strict';
var ComicsRoutes = function (comicsService) {
var COMICS_PAGE_SIZE = 15;
var _get = function (req, res) {
var id = parseInt(req.param('id'), 10);
comicsService.findById(id, function (comic) {
if (comic !== null) {
res.status(200).send(comic);
... | true |
48fe50da924ad548b2c7fd67bc9a2465e5133007 | JavaScript | kazu150/react-hook2 | /src/components/WrapComponent.js | UTF-8 | 778 | 2.53125 | 3 | [] | no_license | import React, {useState, useCallback} from 'react';
import Title from './Title';
import Count from './Count';
import Button from './Button';
const WrapComponent = () => {
const [age, setAge] = useState(0);
const [score, setScore] = useState(0);
const incrementAge = useCallback(() => {
setAge(age +... | true |
869319fb935513dc8e4ee4cf9073db92d750ef47 | JavaScript | DianaFok/Codewars | /js/altERnaTIng cAsE <=> ALTerNAtiNG CaSe.js | UTF-8 | 489 | 4.75 | 5 | [] | no_license | // Create a function that alternates the case of a given string.
// Ex. HeLLo WoRLd => hEllO wOrlD
function alternateStr (str) {
let newStr= '';
for (let i = 0; i < str.length; i++) {
if (str.charAt(i).toUpperCase() === str.charAt(i)) { //charAt() method returns the character at the specified index in a string.... | true |
7b0bc81bebbc25875c96c0c0a2bba42d656ddc18 | JavaScript | CodeKaksha/codekaksha_web | /public/js/video.js | UTF-8 | 7,222 | 2.546875 | 3 | [] | no_license | function video(videoId, username, room) {
const video_grid = document.querySelector(`.${videoId}`);
const myvideo = document.createElement("video");
myvideo.muted = true;
console.log("in video main");
var videoCurrentState = false;
var audioCurrentState = true;
navigator.mediaDevices
.getUserMedia({
... | true |
e160ff3462fdbf577f63c8d84c9c83b0e53e6cfd | JavaScript | gpluta/data | /packages/ember-data/lib/system/serializer.js | UTF-8 | 3,238 | 2.84375 | 3 | [
"MIT"
] | permissive | /**
@module ember-data
*/
/**
`DS.Serializer` is an abstract base class that you should override in your
application to customize it for your backend. The minimum set of methods
that you should implement is:
* `extract()`
* `serialize()`
And you can optionally override the following methods:
*... | true |
39290cf618bdda101346fb4c61e0e16906439e24 | JavaScript | verstaburo/rps | /app/components/ts-list/ts-list.js | UTF-8 | 1,358 | 2.546875 | 3 | [] | no_license | export default () => {
const COMPONENT = '.ts-list';
const ACTION_BTN = '.ts-list__action';
const EDIT_BTN = 'ts-list__action_edit';
const SAVE_BTN = 'ts-list__action_save';
const REMOVE_BTN = 'ts-list__action_remove';
const ROW = '.ts-list__row';
const ROW_STATE_EDITING = 'ts-list__row_editing';
const ... | true |
a12be4921e46d4596ecbdef24ab576ee0aeb4449 | JavaScript | wenyuanzhuo/tooljs | /deepInJavaScript/nextTick.js | UTF-8 | 1,144 | 3.4375 | 3 | [] | no_license | var nextTick = (function () {
const callbacks = []
let pending = false
let timerFunc
function nextTickHandler() {
const copy = callbacks.slice(0)
for(let i = 0; i < copy.length; i++) {
copy[i]()
}
}
const p = Promise.resolve()
/*
* nextTick -> microtask queue
*/
timerFunc = () => ... | true |
63e00b82c4c22cbdadc9ffebd4e3db9bd011657b | JavaScript | semvdwal/mario-js | /public/js/helpers/Canvas.js | UTF-8 | 1,101 | 3.046875 | 3 | [] | no_license | export class Canvas {
constructor(camera) {
this.camera = camera;
this.canvas = document.getElementById("game-canvas");
this.context = this.canvas.getContext("2d");
this.width = this.canvas.width;
this.height = this.canvas.height;
this.camera.setSize(this.width, t... | true |
6dcd42823879c3d77c26e902dcfc6c6c7045028c | JavaScript | Mensch-Und-Computer-2017/conftooljs | /lib/PaperHelper.js | UTF-8 | 3,413 | 2.765625 | 3 | [
"MIT"
] | permissive | /* eslint-env node */
'use strict';
const ConfTool = require('./ConfTool.js'),
Person = require('./Person.js'),
Author = require('./Author.js'),
File = require('./File.js'),
Session = require('./Session.js');
class PaperHelper {
static extractAuthors(paper) {
var authors = [];
for (let i = 0; i < Co... | true |
da476bbcac372b0f659cec710f66b5e7996d2216 | JavaScript | yonibar1/Sprint-2 | /js/drag-and-drop.js | UTF-8 | 2,233 | 2.9375 | 3 | [] | no_license | 'use strict'
var gLine;
var gStartPos;
const gTouchEvs = ['touchstart', 'touchmove', 'touchend']
function initDragAndDrop() {
resizeCanvas()
gLine = createLine()
addListeners()
resetAndDraw()
drawText(gLine)
resetAndDraw()
}
function createLine() {
return gMeme.lines[gMeme.selectedLineIdx]... | true |
39851cc9da59929d87efa5e2ca2257d930f69daa | JavaScript | rslgp/weibo-img-crypto | /src/imgproc.js | UTF-8 | 3,792 | 3.265625 | 3 | [
"MIT"
] | permissive | // // 将图像数据分离为各通道一个数组,返回包含各通道的数组
// export function splitChannels (data, nChannels = 4) {
// let nPixels = data.length / nChannels
// let channels = []
// for (let i = 0; i < nChannels; i++) {
// channels.push(new Uint8ClampedArray(nPixels))
// }
// for (let iChannel = 0; iChannel < nChannels; iChannel++)... | true |
0730f22cea8958d36627569e23e5b938af69f9df | JavaScript | dimitardimitrov93/JavaScript-Applications | /Lecture №2 - REST services and AJAX/Exercise/04.MESSENGER/app.js | UTF-8 | 1,951 | 3.109375 | 3 | [
"MIT"
] | permissive | function attachEvents() {
const authorInputElement = document.getElementById('author');
const contentInputElement = document.getElementById('content');
const textAreaElement = document.getElementById('messages');
const sendButtonElement = document.getElementById('submit');
const refreshButtonElement... | true |
4600f43324f937e9465f7dad9969081282ddb2cf | JavaScript | allopez7/algorithm | /solutions/14.js | UTF-8 | 287 | 2.59375 | 3 | [] | no_license | const check = (num, newArr=[], i=2, j=2)=>{
if(i > num){
return newArr;
}
if(i === j){
newArr.push(i);
return check(num, newArr, i+1, j=2);
}
if(i%j === 0){
return check(num, newArr, i+1, j=2);
}
return check(num, newArr, i, j+1);
}
module.exports = check;
| true |
d9b94e71afae4f4efc8d182b0fd2e225feef88e5 | JavaScript | mohhossain/ColorForKids | /ColorForKids.js | UTF-8 | 1,727 | 3.515625 | 4 | [] | no_license | var color = ["red", "orange", "yellow", "green", "blue", "indigo", "violet", "purple", "pink", "silver", "gold", "beige", "brown", "grey", "black"];
var circles = document.querySelectorAll(".circle");
var picked_color = color[Math.floor(Math.random() * 15)];
var guessColor = document.getElementById("colorName");
guessC... | true |
ab596064878899a2afc6840c967f115dab530945 | JavaScript | priyanshgupta1998/Node.js | /nodeJS/demo_http_url.js | UTF-8 | 617 | 3.3125 | 3 | [] | no_license |
/*The function passed into the http.createServer() has a req argument that represents the request from the client,
as an object (http.IncomingMessage object).
This object has a property called "url" which holds the part of the url that comes after the domain name:
*/
//To run the javascript file on the server the ... | true |
4bd7ec5e9f2ce1317c0ad0d32675f1b8e14e3a84 | JavaScript | ofirlevy6658/Bootcamp | /bootcamp-exercises/back-and-front/11.1-crud/server/utils.js | UTF-8 | 3,915 | 2.875 | 3 | [] | no_license | const { v4: uuidv4 } = require("uuid"); // generate uniqe id
const fs = require("fs");
function addUser({ cash = 0, credit = 0 }) {
// deafult value of 0 if not provided
if (cash > 999999 || cash < 0 || credit > 5000 || credit < 0)
throw new Error("bad parameters");
const user = { cash, credit, id: uuidv4(), isAc... | true |
4d9babb97f6d300ee312bf91ebe4d55781db3f94 | JavaScript | LGmatrix13/sheetsdemo | /src/App.js | UTF-8 | 1,178 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
const API = 'https://sheets.googleapis.com/v4/spreadsheets/1mpFIiSlkqU0BQmn5la3nEwkmy3QJUR8SvkaCHJmm6zk/values:batchGet?ranges=Sheet1&majorDimension=ROWS&key=AIzaawehuTDOtaFrsIMbKhlJ_E3CxKaTwf0tCaW8';
class App extends Compon... | true |
904e502c725a13775132343380812c01931ef97f | JavaScript | vroliveira21/DH-FS-0521 | /aula05/index.js | UTF-8 | 1,437 | 3.453125 | 3 | [] | no_license | let pets = [
{
nome: 'Yoshi',
nomeDono: 'Victor',
Idade: 7,
Tipo: 'Cachorro',
raca: 'Akita Inu',
peso: 40,
genero: 'Macho',
cor: 'ruivo',
vacinado: true,
},
{
nome: 'Cindi',
nomeDono: 'Caio',
Idade: 6,
Tipo: 'Gato',
raca: 'Persa',
... | true |
e5678d6f155f34ea96b3400cbe24881d09e779e5 | JavaScript | ssehacker/jse-pay-frontend | /src/pages/PaySuccessPage.js | UTF-8 | 1,401 | 2.640625 | 3 | [
"MIT"
] | permissive | /**
* Created by ssehacker on 2017/4/18.
*/
import { go, request } from '../util';
export default class PaySuccessPage extends React.Component {
constructor(props) {
super(props);
this.state = {
timeout: 60,
};
this.holding = false;
}
componentDidMount() {
// 60秒之后自动跳转到首页。
this.f... | true |
9968be2c76aabaff285fca7f7a409835f9fc5416 | JavaScript | Dunk14/Datepicker-Grafikart | /src/modules/Month.js | UTF-8 | 890 | 3.296875 | 3 | [] | no_license | import moment from 'moment'
export default class Month {
/**
* Defines limits of a month, its number for month and year
* @param month = [month number]
* @param year = [year number]
*/
constructor(month, year) {
let instance = moment([year, month]);
this.start = instance.sta... | true |
7877bbe9389e8c287ef33e0a7e5dfbf472addee4 | JavaScript | guigallo/breadth-first-search | /helper/routesHelper.js | UTF-8 | 1,030 | 2.828125 | 3 | [
"MIT"
] | permissive | function response(res, status, type, content, view) {
res.status(status);
switch(type) {
case 'render':
res.render(view, { content });
break;
case 'send':
res.send(content);
break;
case 'json':
res.json(content);
break;
default:
res.send('Wrong response ... | true |
feef1a976dd27d2ef8211430ad448714e6cdecce | JavaScript | gitguddy/hanuman | /anmeldung.js | UTF-8 | 1,716 | 2.984375 | 3 | [
"MIT"
] | permissive | // Initialize Firebase
var config = {
apiKey: "AIzaSyCtLV8vwFX9TsdbL0CDgCJG-DB5F7PBFDI",
authDomain: "anmeldung-wlauf.firebaseapp.com",
databaseURL: "https://anmeldung-wlauf.firebaseio.com",
projectId: "anmeldung-wlauf",
storageBucket: "",
messagingSenderId: "1062814993831"
};
firebase.ini... | true |
e7398bb5413f3317c25a7e34705b192f705680c4 | JavaScript | Calvin781/Hangman | /assets/js/keyboard.js | UTF-8 | 620 | 3.0625 | 3 | [] | no_license | class Keyboard {
constructor(game) {
document.addEventListener("keydown", event => { // Keyboard input support.
let letterAttribute = event.key;
checkLetter(game, letterAttribute);
});
let visualLetters = document.querySelectorAll('.key--letter');
visualLe... | true |
ac4329bda26dbf5e55627134e6d51888e3bd461c | JavaScript | alesjora/DIW | /Tema 2/Práctica 5/script2.js | UTF-8 | 1,494 | 3.125 | 3 | [] | no_license | {
window.addEventListener("load", init);
let contexto;
let image = new Image();
image.src = "iss.jpg"
function init() {
contexto = cargarContextoCanvas('micanvas');
if (contexto) {
recortarImagen();
}
}
function recortarImagen(){
//Muestra l... | true |
ac69a9062edcde3fd638c53f10c9783a00971ca1 | JavaScript | leontastic/pong-react-redux | /src/store/helpers/makeDispatcher.js | UTF-8 | 311 | 2.875 | 3 | [] | no_license | // create a function that forwards arguments to the action creator,
// then calls the given dispatch function on the created action
const makeDispatcher = (dispatch, actionCreator) => {
const dispatcher = (...args) => { dispatch(actionCreator(...args)) }
return dispatcher
}
export default makeDispatcher
| true |
8a95b1af2e332c7431a114a5c91cb1a37dd14f88 | JavaScript | BuzzDyne/VibsenseWebapp | /src/components/Sensor.js | UTF-8 | 1,800 | 2.53125 | 3 | [] | no_license | import React, {useState, useEffect} from 'react'
import {useParams} from 'react-router-dom'
import {db} from '../firebase'
import {beautifyDate} from '../helper/SensorHelper'
function Sensor() {
let url = useParams();
let docAddr = 'Sensors/' + url.sID;
const [dataRows, setDataRows] = useState([])
u... | true |
10fe69971fe86a8c9eaa28aa2fed5794ed9f92ab | JavaScript | andrea7896/JavaScriptFundamentals | /eventos.js | UTF-8 | 763 | 3.265625 | 3 | [] | no_license | function setColor(){
let body = document.getElementsByTagName('body');
document.body.style.backgroundColor="red";
}
function changeLetterColor(){
let elem = document.getElementById('contenedor');
elem.style.color = "blue";
}
function mouseFuera(){
let elem = document.getElementById('contenedor');
... | true |
076dc59971d34b133880d73695a908e06bb9d40e | JavaScript | Wayne-Bai/AST-normalize | /data/palantir/plottable/quicktests/js/category_axis_non_string.js | UTF-8 | 930 | 2.53125 | 3 | [] | no_license | function makeData() {
"use strict";
return null;
}
function run(div, data, Plottable) {
"use strict";
var svg = div.append("svg").attr("height", 500);
var scale1 = new Plottable.Scale.Category().domain(["foo", "bar", "baz"]);
var scale2 = new Plottable.Scale.Category().domain([null, undefined, tr... | true |
4a761d0620bf242d036ce6cc68f2aae68a1ffb8c | JavaScript | RichaSundrani/Algorithm-problems | /Problem_solving/PracticeQ Algorithms/LeetCode/Topics/Recursion/searchAllWords.js | UTF-8 | 809 | 3.953125 | 4 | [] | no_license | /*
Word Search II
Given an m x n board of characters and a list of strings words, return all words on the board.
Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring.
The same letter cell may not be used more than once in a word.
Exa... | true |
61acae93b642729888ac7f851ddd8c9ef054a4bb | JavaScript | sMaxym/js_basic_funcs | /convert_object_to_array.js | UTF-8 | 225 | 2.875 | 3 | [] | no_license | toArr = function ( obj ) {
if ( typeof obj !== 'object' ) {
return obj;
}
let objArr = [];
Object.keys( obj ).forEach( key => objArr.push( [ key, toArr( obj[ key ] ) ] ) );
return objArr;
}; | true |
29a1e59c8e9e8fbb1ccf760a625b117ebd0eba9f | JavaScript | bilal12122/Exam_React_Bilal_Hamdaoui | /src/store/reducers/favElements.js | UTF-8 | 713 | 2.734375 | 3 | [] | no_license | const initialState = {favElementsID: []}
function favElements(state = initialState, action) {
let nextState
switch (action.type) {
case 'SAVE_ELEMENT':
nextState = {
...state,
// myValues: [...state.myValues, action.value]
favElementsID: [...s... | true |
824e9a6b3937bfb2e74efeb5391401929958d5ee | JavaScript | ifeLawal/Tic-tac-toe-classified | /app/assets/scripts/modules/MegaTicTacToeBoard.js | UTF-8 | 19,524 | 3.046875 | 3 | [] | no_license | import Board from "./Board";
import utils from "./utils";
import EventEmitter from "events";
const LENGTH_OF_MEGA_TIC_TAC_TOE_BOARD = 9;
const LENGTH_OF_TIC_TAC_TOE_BOARD = 3;
class MegaTicTacToeBoard extends EventEmitter {
constructor() {
super();
this.scoreArea = document.querySelector("#mega-tictactoe-sc... | true |
719848a9f77f74032f06bb3790dd113de2011859 | JavaScript | jlshowngoshen/codemirror-blocks | /src/edits/fakeAstEdits.js | UTF-8 | 7,070 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | import * as P from 'pretty-fast-pretty-printer';
import {warn, poscmp} from '../utils';
import {Required, Optional, List, Value} from '../nodeSpec';
import {ASTNode} from '../ast';
// Say that you have the source code `[1, 3]`, representing a list, and you
// insert `2` at a drop target in between `1` and `3`. We ult... | true |
b5db8877bef449c69a299f5c8541d84f53209a58 | JavaScript | highheat2003/react-demo | /src/Crud/EditForm.js | UTF-8 | 1,018 | 2.640625 | 3 | [] | no_license | import React, {useRef} from 'react';
const EditForm = ({post, updatePost}) => {
const titleRef = useRef();
const messageRef = useRef();
const handleEdit = (e) => {
e.preventDefault();
const newTitle = titleRef.current.value;
const newMessage = messageRef.current.value;
cons... | true |
7468901ea7acf87582a15808bd8dcfe823fe6d09 | JavaScript | dwjohnston/testing_with_jest | /apiExample/useRequireInTests/api.js | UTF-8 | 714 | 2.734375 | 3 | [
"MIT"
] | permissive | import axios from "axios";
export const BASE_URL = "https://jsonplaceholder.typicode.com/";
const URI_USERS = 'users/';
export async function makeApiCall(uri) {
try {
const response = await axios(BASE_URL + uri);
return response.data;
} catch (err) {
throw err.message;
}
}
export ... | true |
51e49575f1003b706c28e686b47063f73892c66a | JavaScript | LySofDev/naive-react-counter | /naive-react-counter/reduce.js | UTF-8 | 405 | 3 | 3 | [] | no_license | function reduce(state, event) {
if (event.type === "click" && event.target.id === "increment") {
return { ...state, counter: state.counter + 1 };
}
if (event.type === "click" && event.target.id === "decrement") {
return { ...state, counter: state.counter - 1 };
}
if (event.type === "click" && event.... | true |
c79e99a302d5e74e0e717298bc6ccbd944698342 | JavaScript | AndreAggalut/snips-backend-ins | /models/Snippet.model.js | UTF-8 | 4,630 | 2.9375 | 3 | [] | no_license | const format = require('pg-format');
const db = require('../db');
const ErrorWithHttpStatus = require('../utils/ErrorWithHttpStatus');
/**
* a snippet object
* @typedef {Object} Snippet
* @property {string} id
* @property {string} author
* @property {string} code
* @property {string} title
* @property {string} ... | true |
4f15db0828562bddb4ea6e81b762343ab425ea90 | JavaScript | LqqJohnny/interview-everyday | /problems/js/array_functions.js | UTF-8 | 253 | 3.21875 | 3 | [] | no_license | // 实现 数组 的 各个方法
// filter
Array.prototype.myFilter = function(fn){
let ret = [];
for(let i = 0 ;i<this.length ; i++){
if(fn(this[i] , i , this)){
ret.push(this[i]);
}
}
return ret;
}
| true |
92d1a0e9cc45638e92f5772aa366e9fcbf689bae | JavaScript | ohaicristina/learning-react | /github-battle/app/components/Loading.js | UTF-8 | 1,650 | 2.828125 | 3 | [] | no_license | import React from 'react'
import PropTypes from 'prop-types'
// building this component with the idea of making it customizable and reusable
const styles = {
content: {
fontSize: '35px',
position: 'absolute',
left: '0',
right: '0',
marginTop: '20px',
textAlign: 'cen... | true |
c1b9f8c22bbb44b889caac5c426735dc5d497d2c | JavaScript | sys1yagi/genpass_chrome_extensions | /genpass.js | UTF-8 | 1,073 | 3.140625 | 3 | [
"MIT"
] | permissive |
var GenPass = (function(){
function GenPass(container){
this.container = container;
};
GenPass.prototype.length = 8;
GenPass.prototype.count = 8;
GenPass.prototype.set = [
//記号
//'!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',':',';','<','=','>','?','@','{','|','}','~','[','\\',']','^','_','`'... | true |
1cd3315def63cf0eecefe2b67d51711276b4e600 | JavaScript | Nikituh/livehiv_web | /news/news.js | UTF-8 | 545 | 2.59375 | 3 | [] | no_license |
var base = "../content/";
$(document).ready(function() {
$(".language").click(loadLanguage2);
loadLanguage2();
});
function loadLanguage2() {
$.get(base + "news_" + CurrentLanguage + ".json", function(data) {
loadNews(data);
});
}
function loadNews(data) {
var container = $(".news_items_wrapper");
con... | true |
ee15dbfa1a3333e274ba41bdaf421a83ae198fb0 | JavaScript | Archaeologist03/algorithms-data-structures | /codewars/6kyu/persistentBugger.js | UTF-8 | 794 | 4.6875 | 5 | [] | no_license | // 6kyu
// Write a function, persistence, that takes in a positive parameter num and returns its multiplicative persistence, which is the number of times you must multiply the digits in num until you reach a single digit.
function persistence(num) {
if (num <= 9) return 0;
let count = 0;
function runAgain(n) {
c... | true |
cf8d749845c5b572b61db4ec98299046eca1d73a | JavaScript | EgorJSbrain/Todo | /src/components/ToDo/toDoReducer.js | UTF-8 | 881 | 2.640625 | 3 | [] | no_license | import { SET_TEXT,
SET_TITLE,
DELETE_TODO,
SET_TODOS,
SET_TODO_FOR_EDIT} from './constants';
const initialState = {
todos: [],
todo_for_edit: null,
title: '',
text: ''
}
const todoReducer = (state = initialState, action) => {
switch(action.type) {
case SET_TITLE:
... | true |
183f47abbfb2a36ede38e7be365b33ba9ba890e5 | JavaScript | shengyusoft/CodeLocation | /WebRoot/jslib/common.js | UTF-8 | 10,161 | 2.578125 | 3 | [] | no_license | /*******************************************************************************
* @author Sunhb
*
* @requires jQuery
*
* 当页面加载完毕关闭加载进度
******************************************************************************/
$(window).load(function() {
$("#loading").fadeOut();
});
/**
* @author Sunhb
* ... | true |
e2bc9888b235e46bc8aa266b48132ae61826b5f8 | JavaScript | Isaaceq/ReminderList | /app.js | UTF-8 | 3,610 | 3.671875 | 4 | [] | no_license | // Reminder Class: Represents a reminder
class Reminder {
constructor(title, date, note) {
this.title = title;
this.date = date;
this.note = note;
}
}
// UI Class: Handle UI Tasks
class UI {
static displayReminder() {
const reminder = Store.getReminder();
reminder.forEach(rem... | true |
60200afb3e2e304e9541ac2e60330a9154b03179 | JavaScript | omkar-deshmukh1804/book-reader-news | /app.js | UTF-8 | 2,251 | 2.734375 | 3 | [] | no_license | const axios = require('axios')
const gTTS = require('gtts');
const express = require('express');
const fetch = require('node-fetch');
const jsdom = require('jsdom');
const { JSDOM } = jsdom;
let articles2 = null;
var app = express();
const api_url =
'http://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=3129... | true |
2484c1b7462669cc8db57c56624543cda1a0fd3b | JavaScript | turntoright/LeetcodeMedium | /algorithms/js/ReverseLinkedListII/ReverseLinkedListII.js | UTF-8 | 752 | 3.5 | 4 | [] | no_license | /**
* Definition for singly-linked list.
* function ListNode(val, next) {
* this.val = (val===undefined ? 0 : val)
* this.next = (next===undefined ? null : next)
* }
*/
/**
* @param {ListNode} head
* @param {number} left
* @param {number} right
* @return {ListNode}
*/
var reverseBetween = function(h... | true |
6517d5a20eca07f1a6de1a76120100238ce2afb5 | JavaScript | ryelizar0v/nodejs-ems | /src/controllers/createController.js | UTF-8 | 905 | 2.5625 | 3 | [] | no_license | require("dotenv").config()
const addEmployee = require("../services/createService")
const { createPermission } = require("../auth/checkPermission")
module.exports = async (req, res) => {
const allowed = createPermission(
req.user.currentUserRoleId,
req.user.currentUserDeptId,
req.body.roleId,
req.bo... | true |
17f4a4b76ac915ab87b6f57fe876e0f20fffe02b | JavaScript | abcdarts/fuyosaqina | /src/js/app.js | UTF-8 | 195 | 2.75 | 3 | [] | no_license | import additionCalculator from './modules/addition-calculator';
var item1Price = 400;
var item2Price = 600;
var totalPrice = additionCalculator(item1Price, item2Price);
console.log(totalPrice); | true |
527357fb3c08dbddb3323d90373747fd1ccc09e3 | JavaScript | jbuoni/node_algos | /dynamic_programming/counting_and_sum.js | UTF-8 | 605 | 3.734375 | 4 | [] | no_license | const test = require('tape');
/**
* Given an array, find the sub array with the max sum
*
* @param {*} arr
*/
const kadanes = (arr) => {
let answer = Number.MIN_VALUE;
t = Array(arr.length).fill(0);
t[0] = arr[0];
for(let i = 1; i < arr.length; i++) {
t[i] = Math.max(t[i - 1], 0) + arr[i];
temp =... | true |
1a1ee798cb2fe52d3fc5a7eb6f840cd2da2c4c24 | JavaScript | KhangNguyen136/HotelManager | /App/Reducers/filterReducer.js | UTF-8 | 951 | 2.703125 | 3 | [] | no_license | const today = new Date()
const initState = {
filterRevenue: today,
filterUsageDensity: today,
filterBill: today,
}
const filterReducer = (state = initState, action) => {
const newState = state
switch (action.type) {
case 'setFilterRevenue':
newState.filterRevenue = action.value... | true |
eeda52a45d13ae5e69c0aa3bbbb0f80bad4f5d0f | JavaScript | cloneforyou/content-review-lookup | /dist/bbroleplaytsw/Common.js | UTF-8 | 7,696 | 2.578125 | 3 | [
"CC-BY-4.0"
] | permissive | // 05:14, September 18, 2011 (UTC)
// <source lang="JavaScript">
/** Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* [[Wikipedia:NavFrame]].
* Taken from Wikipedia's Common.js.
*/
var... | true |
a2376cd98a52b45d60089f1a5cb978269f628742 | JavaScript | will123195/disk-cache | /test/test.js | UTF-8 | 983 | 2.5625 | 3 | [] | no_license | var ok = require('assert').ok
var DiskCache = require('..')
var cache = DiskCache({
path: './cache/' + Math.random()
})
it('should cache to disk', function(done) {
var key = 'some/file.txt'
var value = 'abc123'
cache.set(key, value, function(err) {
ok(!err, err)
cache.get(key, function(err, val) {
... | true |