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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
826bb9d2516537c2a7de9a24b2850f2b2ed5ffdc | JavaScript | JanpleGaming/Lazy-Guardian-Project | /src/commands/Fun/8ball.js | UTF-8 | 1,070 | 2.890625 | 3 | [
"ISC"
] | permissive | const Discord = require('discord.js');
module.exports = {
name: "8ball",
category: "fun",
description: "Ask a question and receive an answer",
run: async (client, message, args) => {
let reason = args.join(' ');
let yes = new Discord.MessageEmbed()
if (reason.length < 1) return message.ch... | true |
c9ed28594861185011d65969b6ae185ad10521ab | JavaScript | ericblancas23/CS2-Code-Challenges | /reverseCase/reverseCase.js | UTF-8 | 529 | 4.46875 | 4 | [] | no_license | /*
* Write a function that reverses the case of each letter in the strings that it receives.
* Example: 'Hello World' -> 'hELLO wORLD'
* Assume that each string will contain only spaces and letters.
*/
const convert = (str) => {
let s = '';
for (let i = 0; i < str.length; i++) {
let n = str.c... | true |
1a9acf9ca9619fd79850b12a2148b2fb5b8af3f2 | JavaScript | BhavneetKaur/AlgorithmVisualization | /js/sort.js | UTF-8 | 6,485 | 3.484375 | 3 | [] | no_license | /*This code was referred from
https://bl.ocks.org/alexmacy/770f14e11594623320db1270361331dc
for implementation purpose*/
/*Variable declaration*/
var dataset = []
var data = []
var rects, labels;
var durationTime = 2000,
unsortedArray = [],
sortedArray = [],
stop = false,
steps = 0,
bogoShuffles ... | true |
19cebf4e5bcb03e11945396ae59b07613bb9ab8f | JavaScript | markcollis/mapoholic-server | /src/services/orisAPI.js | UTF-8 | 2,843 | 2.765625 | 3 | [
"ISC"
] | permissive | // Functions that exploit the ORIS API (oris.orientacnisporty.cz/API)
const fetch = require('node-fetch');
const logger = require('./logger');
const ORIS_API_GETCLUB = 'https://oris.orientacnisporty.cz/API/?format=json&method=getClub';
const ORIS_API_GETEVENT = 'https://oris.orientacnisporty.cz/API/?format=json&method... | true |
b75cc0efb032953ebe07670571ac3039d6aa1d98 | JavaScript | alirezaandersen/exercism | /javascript/pangram/pangram.js | UTF-8 | 254 | 2.96875 | 3 | [] | no_license | function Pangram(word){
this.isPangram = function(){
var ar = Array.from(new Set(word.toLowerCase().split('')));
newAr = ar.filter(function (val) {
return /^[a-z]$/.test(val);
});
return newAr.length === 26;
};
}
module.exports = Pangram;
| true |
6c25c0986e876f7c3c0d11b755b6be51ff76ff4e | JavaScript | Mandeepk01/ScribblerProject | /js/common.js | UTF-8 | 814 | 2.578125 | 3 | [] | no_license | var mdl = document.getElementById("myModal1");
var topBtn1 = document.getElementById("top-button1");
var topBtn2 = document.getElementById("top-button2");
var span = document.getElementsByClassName("close")[0];
var mdl2 = document.getElementById("myModal2");
var span2 = document.getElementsByClassName("close")[1];
topB... | true |
598f039164c1fb2848d191719bae4baade6c7496 | JavaScript | Jeting72/angular-erp-ui | /works/1314080901140/js/danjumingxiModule.js | UTF-8 | 840 | 2.578125 | 3 | [] | no_license | // create a new module called 'myAppModule' and save
// a reference to it in a variable called myAppModule
var danjumingxiModule = angular.module('danjumingxiModule', []);
// use the myAppModule variable to
// configure the module with a controller
danjumingxiModule.controller('MyFilterDemoCtrl', function ($scope) {... | true |
50b5a8131f335865a79c58ad9e1d204acd05797f | JavaScript | Bronomatic/simone-game | /script.js | UTF-8 | 4,265 | 2.921875 | 3 | [] | no_license | //! === | Shortcuts | === //
const Q = q => document.querySelector(q);
const A = q => document.querySelectorAll(q);
const C = console.log;
//! ===== ===== | VARIABLES | ===== ===== //
var level, roundPosition, gameActive;
var currentPosition = 0;
var checkPosition = 0;
var dn = 0;
var speed = 1000;
var leng = 5;
cons... | true |
c621a45df99c60a507f9c2c6de44684ac9a62509 | JavaScript | davidhorst/CardGames | /server/games/war.js | UTF-8 | 9,932 | 2.96875 | 3 | [] | no_license | 'use strict'
var Deck = require('./decks.js');
var Player = require('./player.js')
class War {
constructor(gameId) {
this.name = "war";
this.gameId = gameId;
this.minPlayers = 2;
this.maxPlayers = 4;
this.activePlayers = 0;
this.warPlayers = 0;
this.playerMap ... | true |
c2b00facf9e8e365a04de644b92ff69d599e731a | JavaScript | Muller-Mendonca/AllHeisen | /modules/slider.js | UTF-8 | 575 | 3.03125 | 3 | [] | no_license |
export default function initSlider(){
let currentImageIndex = 0;
let images = document.querySelectorAll('#slider img');
images[0].classList.add('selected');
function nextImage(){
images[currentImageIndex].classList.remove('selected');
currentImageIndex++;
if(cu... | true |
c91cf07443ab99de1e52728abbd3f94d3afa8572 | JavaScript | anshika-18/chemistry-frontend | /src/components/QuizLayout.js | UTF-8 | 3,891 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react'
import {quizData} from './quiz-data'
import Button from 'react-bootstrap/Button'
import axios from 'axios'
export default class QuizLayout extends Component {
state={
score:0,
selectedValue:[]
}
handleChange=(e)=>{
let temp=[...thi... | true |
8518aa9af7e6f46c7d0050719cd485f9e9e7d7d4 | JavaScript | witekf/witekf.github.io | /zadania-domowe/cwiczenie-bootstrap/js/main.js | UTF-8 | 976 | 2.8125 | 3 | [
"MIT"
] | permissive | //console.log('123') - sprawdzamy czy skrypt mamy podpiety;
//uzyeamy jquiry bo i tak ja mamy, bootstrap dziala tylko z jquery
//dodaje lub odejmuje klase do nav przy przewijaniu/scrollowaniu okna - jest lub znika przezroczysta rameczka nav
$(document).ready(function() {
ifScrolled();
$("a").on('click', ... | true |
6dbf8c340ac9a8fc8de547d26561d54572c30c61 | JavaScript | wangbing666/react-hooks-app | /src/hooks/useFormState.js | UTF-8 | 1,159 | 2.9375 | 3 | [] | no_license | import { useReducer } from 'react';
export function isFunction(value) {
return typeof value === 'function';
}
function stateReducer(state, newState) {
return { ...state, ...newState };
}
export function useFormState(initialState) {
const [state, setState] = useReducer(stateReducer, initialState || {});
cons... | true |
a8df0a736dade2c40c3efa92f88137c1ec170ec7 | JavaScript | Hunter-Xin/study | /手撕代码/二分法旋转排序.js | UTF-8 | 781 | 4.1875 | 4 | [] | no_license | // 假设按照升序排序的数组在预先未知的某个点上进行了旋转。
// ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。请找出其中最小的元素。你可以假设数组中不存在重复元素。
function find(arr) {
let left = 0;
let right = arr.length - 1;
let mid;
if (arr.length === 0) return null;
if (arr[right] > arr[left]) return arr[0];
while (left <= right) {
mid = Math.floor((lef... | true |
5bc4f8d6b0ebe158b7b13b6cdc1350a3b6536b89 | JavaScript | eleme/thrift-client | /lib/storage.js | UTF-8 | 443 | 2.75 | 3 | [
"MIT"
] | permissive | class Storage extends Map {
constructor(...args) {
super(...args);
this.inc = 0;
}
noop() { return ++this.inc; }
push(data) {
let id = this.inc++;
this.set(id, data);
return id;
}
take(id) {
let data = this.get(id);
this.delete(id);
return data;
}
takeForEach(callback) {
... | true |
6db6a12d4edcfd6fe2c54a1ec9056f5d2309f7fe | JavaScript | DukeBaird/experiments | /babel/src/defaultParams.test.js | UTF-8 | 142 | 3.078125 | 3 | [] | no_license |
const foo = (x=5, y=6) => x+y;
console.log(foo()); // expecting 11
console.log(foo(2)); // expecting 8
console.log(foo(2,2)); // expecting 4 | true |
bd371e5ac8ab215b85e0493f0d051c52f9b741dd | JavaScript | nicotsou/receipt | /src/state/selectors.js | UTF-8 | 2,501 | 2.703125 | 3 | [
"MIT"
] | permissive | import { createSelector } from 'reselect';
import map from 'lodash/map';
import add from 'lodash/add';
import multiply from 'lodash/multiply';
import round from 'lodash/round';
import { calculateItemPrice } from './helpers';
const TAX = 0.0825;
const isFetchingFruitsSelector = state => state.fruits.isLoading;
const ... | true |
6be0bbc58c130f03f7b3630a822acc969302f1b2 | JavaScript | srinivascherupalli/Aware_Devhub | /force-app/main/default/aura/GROW_SiteGrainPriceView/GROW_SiteGrainPriceViewHelper.js | UTF-8 | 1,828 | 2.609375 | 3 | [] | no_license | ({
getGrainPricesFromServer : function(component, event, helper) {
console.log('***In helper');
var action = component.get('c.getGrainPrices');
action.setCallback(this, function(response) {
//store state of response
var state = response.getState();
... | true |
b8f48bb8313521aa7570fa60be1aac2f524ce4ad | JavaScript | Adam-Koza/exam2 | /adam.js | UTF-8 | 7,873 | 3.59375 | 4 | [] | no_license | // Lab1, 1.
function is_array(something) {
if ((typeof(something) === "object") && (typeof(something[0]) !== "undefined")){
return true;
}
return false;
}
console.log(is_array('w3resource'));
console.log(is_array([1, 2, 4, 0]));
// Lab1, 2.
function array_Clone(arry) {
var newArray = [];
... | true |
149e46ac14f1f71dc59b74e058cf8c3d658dbd08 | JavaScript | indexexchange/share-through-adapter | /spec/generateRequestObj.spec.js | UTF-8 | 6,841 | 2.609375 | 3 | [] | no_license | /**
* @author: Index Exchange
* @license: UNLICENSED
*
* @copyright: Copyright (C) 2017 by Index Exchange. All rights reserved.
*
* The information contained within this document is confidential, copyrighted
* and or a trade secret. No part of this document may be reproduced or
* distributed in any form o... | true |
bd31c028e586cbd0061e06e888d52ac3a972feaa | JavaScript | Hristiyan-Petrov/photo-sharing-blog | /src/components/Category/Category.js | UTF-8 | 1,583 | 2.6875 | 3 | [] | no_license | import './Category.css';
import { Component } from "react";
import * as photoService from "../../services/photoServise";
import PhotoCard from '../PhotoCard/PhotoCard';
class Category extends Component {
constructor(props) {
super(props);
if (props.match.url != '/my-photos') {
let cate... | true |
d43ef320e03462eadfba4604221290d4e2d139aa | JavaScript | shawnbaden/Biofinity | /BiofinitySite/src/main/webapp/resources/scripts/model/Location.js | UTF-8 | 2,251 | 2.984375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | var geocoder;
var elevationService;
function lookupLocation() {
var latitude = $("#location-latitude").val();
var longitude = $("#location-longitude").val();
var location = new google.maps.LatLng(latitude, longitude);
geocoder = new google.maps.Geocoder();
geocoder.geocode(
{
'latLng': location
},
functi... | true |
87207163b20343f1a8d876a5977654e9c1eb14a4 | JavaScript | TrevLee5/AniMaps | /src/Components/Europe.js | UTF-8 | 3,347 | 2.765625 | 3 | [] | no_license | import React, {useState} from 'react'
import '../App.css';
import './Europe.css';
import {Link} from 'react-router-dom';
import styled from 'styled-components';
// import Image from '../Sprites/crow.jpg';
import Modal from './Modal';
import {motion} from 'framer-motion';
import {fromRightAnimation} from '../Animations'... | true |
6b71e3b7f3a0c19e1a74669897a0e96fd4fac359 | JavaScript | Enciosafe/nodejs-contactBook-rest-api | /model/contactsOperations/readData.js | UTF-8 | 270 | 2.578125 | 3 | [] | no_license | const fs = require('fs/promises')
const filepath = require('./filepath')
const readData = async () => {
try {
const data = await fs.readFile(filepath)
return JSON.parse(data)
} catch (error) {
console.log(error.message)
}
}
module.exports = readData
| true |
0d0a377c8637463db384643e21ba0e5b28a4aeb0 | JavaScript | michael-whelan/JavaScript | /js/Goal.js | UTF-8 | 540 | 3.421875 | 3 | [] | no_license | var Goal=function (x,y,w,h,xval,yval)
{
this.x=x;
this.y=y;
this.width=w;
this.height=h;
this.isAlive=true;
this.xval = xval;
this.yval = yval;
};
Goal.prototype.draw = function(ctx)
{
ctx.fillStyle=rgb(0,0,0);
ctx.fillRect(this.x,this.y,this.width,this.height);
};
Goal.prototype.clear = function()
{
};
... | true |
66f976b51d4f4bb8dc374459e254bd7be1319f72 | JavaScript | Steffkn/TelerikAcademy | /HTML and CSS/JS/03.JS OOP/01.FunctionExpressions/js/03.console.js | UTF-8 | 1,340 | 3.078125 | 3 | [
"MIT"
] | permissive | var fansyConsole = (function () {
function placeHolder(input) {
var format = input[0];
for (var i = 0; i < 30; i++) {
while (format.indexOf('{' + i + '}') != -1) {
format = format.replace('{' + i + '}', input[i + 1]);
}
}
return format;
}
... | true |
1bda320694a24020cf2c45e6ed081dcea3049f5e | JavaScript | henriknorberg/prune | /index.js | UTF-8 | 1,997 | 2.75 | 3 | [] | no_license | var cssom = require('cssom');
var cheerio = require('cheerio');
module.exports = function (sel,html,css){
var classes = []
//load and parse html
var markup = cheerio.load(html);
var cssInHtml = markup(sel).find("*");
//var kids = markup(sel).find("*");
//Add in sel classes
cssInHtml[cs... | true |
d2716b0b2781be4c0c2d8b92fadde759c351eaeb | JavaScript | bantek89/Plant-Care | /src/filterJSON.js | UTF-8 | 695 | 3.078125 | 3 | [] | no_license | // const objectifyPlants = json => {
// const obj = JSON.parse(json);
// return obj
// }
const filterPlants = obj => {
let filteredPlants = [];
obj['data'].map((x, i) => {
let completeObj = {}
for (let j=0; j<Object.keys(obj.data[i]).length; j++){
if (Object.v... | true |
84ef128e8d1be3f2668645937fe198406e520083 | JavaScript | MVIEIRAB/Estudando-Javascript | /JAVASCRIPT&NODE/estruturas_da_linguagem/objetos_arrays/array/2_push_pop/index.js | UTF-8 | 221 | 3.84375 | 4 | [] | no_license | let arr = ['luiz', 'gabi', 'dudu', 'pedro']
let elemento = arr.pop()
//POP Deleta um elemento do ARRAY.
//PUSH Adiciona um elemento ao ARRAY.
console.log(arr)
console.log(elemento)
arr.push('matheus')
console.log(arr) | true |
3c2ea9bb6333ee5a72dc7230aa744e130b5acd17 | JavaScript | RishabhGithub7348/Yotube_Clone | /assets/js/main.js | UTF-8 | 292 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | var menuIcon = document.querySelector(".menu-icon");
var sidebar = document.querySelector(".sidebar");
var container = document.querySelector(".container");
menuIcon.onclick = function(){
sidebar.classList.toggle("small-sidebar");
container.classList.toggle("large-container");
}
| true |
68bc09d79a4380c7ca595fa7e42e4c111ef64b47 | JavaScript | danishprakash/ejs-exercises | /Ch2/chess_board.js | UTF-8 | 230 | 3.46875 | 3 | [] | no_license | var size = 8;
var player = "#";
for (var a = 0; a < size; a++) {
for (var b = 0; b < size/2; b++) {
if(a % 2 == 0)
process.stdout.write(player + " ");
else
process.stdout.write(" " + player);
}
console.log("\n");
}
| true |
86e273d1863c0e50b3180eeacea2d765dac0aeab | JavaScript | smintz93/ReduxSimpleStarter-1 | /src/index.js | UTF-8 | 196 | 2.9375 | 3 | [
"MIT"
] | permissive | // Create a new component
// This component should produce some HTML
const App = function(){
//jsx
return <div>Hi</div>
}
// Take this component's HTML and put it on the page (in the dom)
| true |
86e8ea079169b03432edf3f743a85b7fad387d1f | JavaScript | yyazdi13/ChoreTracker | /client/src/components/ChoreCard/ViewChore.js | UTF-8 | 3,821 | 2.703125 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import axios from 'axios';
import Button from "@material-ui/core/Button";
import Input from '@material-ui/core/Input';
import InputAdornment from '@material-ui/core/InputAdornment';
import AccountCircle from '@material-ui/icons/AccountCircle';
import Icon from '@mater... | true |
94a08829d9be1357001c72b8552fe3e9180cb48f | JavaScript | GregGouveia/webdev-by-cod3r | /S05.1-Javascript-listaExercicios-03-04-05/exercicio-31.js | UTF-8 | 150 | 2.921875 | 3 | [] | no_license | /* 31) Escrever um algoritmo que percorre um vetor de inteiros, conta quantos números negativos há nesse vetor
e imprime a quantidade no console. */ | true |
756f0d91b737a5af847ed8e539c3a6a7618e4006 | JavaScript | alfradchew/JS101_Programming_Foundation_with_JS | /lesson_6/tictactoe_bonus.js | UTF-8 | 6,372 | 3.609375 | 4 | [] | no_license | const readline = require('readline-sync');
const INITIAL_MARKER = ' ';
const HUMAN_MARKER = 'X';
const COMPUTER_MARKER = 'O';
const NUM_WINS = 2;
const WINNING_LINES = [
[1,2,3], [4,5,6], [7,8,9],
[1,4,7], [2,5,8], [3,6,9],
[1,5,9], [3,5,7]
];
const START_OPTIONS = ['Player', 'Computer', 'Choose'];
let startOptio... | true |
4ac1f854ddd4335c9f92b7a75b92532c31f43199 | JavaScript | ar00gula/llyg-frontend-final | /src/features/books/booksSlice.js | UTF-8 | 3,194 | 2.609375 | 3 | [
"MIT"
] | permissive | import { createSlice, createAsyncThunk } from '@reduxjs/toolkit'
const initialState = {
books: [],
status: 'idle',
error: null
}
export const fetchBooks = createAsyncThunk('books/fetchBooks', async () => {
const books = await fetch(`http://localhost:3001/books`).then(resp => resp.json())
return ... | true |
ebf8c41c82f0ddfa231e397658d3be395e3e25d3 | JavaScript | m4rkh0ng/hackerrank-practice | /10-days-of-js/functions.js | UTF-8 | 368 | 3.875 | 4 | [] | no_license | /*
* Create the function factorial here
*/
function factorial(n) {
let previousN = 1;
let currentN = 1;
for (let i=1; n>0; n--) {
if(i>0) {
currentN = n*previousN;
previousN = n-1;
i--;
} else {
currentN *= previousN;
previousN =... | true |
3be0cee246c0020050b8070bb3bdf603a9ae9a8a | JavaScript | Rishabhravindra/jobdrop | /middleware/index.js | UTF-8 | 416 | 2.640625 | 3 | [] | no_license | var re = /^[0-9a-fA-F]{24}$/;
module.exports.isValid = function(req,res,next) {
var jobID = req.body.jobID;
if(jobID && ('string' !== typeof jobID) && jobID.toString)
{ jobID = jobID.toString(); }
if ( jobID && re.test(jobID)) {
return next();
}
else {
var err = new Error("String is not a valid o... | true |
a202af297064050366f8fb28b06ee5e5cd5ef8fb | JavaScript | LucianoWilberger/JavaScript_Clases | /Proyecto FiNAL 2/js/desafiofinal2.js | UTF-8 | 4,156 | 3.9375 | 4 | [] | no_license |
// Variables que se muestran en el HTML usando EVENTS.
let warrior = document.getElementById("warrior");
warrior.addEventListener("click", showWarrior)
let magician = document.getElementById("magician");
magician.addEventListener("click", showMagician)
let ladron = document.getElementById("ladron");
ladron.addEvent... | true |
9e988ae136983538a51dc4f9de6931411d7c6414 | JavaScript | Kirkkt/react-redux-calendar-grid | /test/common/GraphTest.js | UTF-8 | 7,795 | 2.84375 | 3 | [] | no_license | import test from 'ava';
import Graph from '../../src/common/Graph';
test('constructor', t => {
const graph = new Graph(3);
t.is(graph.n, 3);
// nodes
t.is(graph.nodes instanceof Array, true);
t.is(graph.nodes.length, 3);
t.is(graph.nodes[0] instanceof Object, true);
t.is(graph.nodes[1] instanceof Object,... | true |
c75e56a5dd74684d8e2873669f9f889f83e9e5c5 | JavaScript | ahd3r/hard_parts_code_js | /Asynchronicity/app.js | UTF-8 | 2,861 | 3.390625 | 3 | [] | no_license | /////////////////
// //
// CHALLENGE 1 //
// //
/////////////////
// console.log('I am at the beginning of the code');
// setTimeout(function(){
// console.log('I am in the setTimeout callback function');
// },3000);
// console.log('I am at the end of the code');
////////////////... | true |
79084486a08b943d1a2bca2305149564fc08a11d | JavaScript | toAtulArora/IISER_repo | /Semester_4/Misc/Countdown/js/main.js | UTF-8 | 1,071 | 3.1875 | 3 | [] | no_license | $(function(){
var initialseconds=1*60*60;
var numberofdivisions=3;
var tseconds=0;
var teseconds=initialseconds;
countdown=setInterval(function(){
if(teseconds==0)
{
$("#main_count").html('1 hour elapsed');
$('#count').html('');
}
else
{
teseconds--;
tseconds=teseconds;
... | true |
5c4b48139e8c42e9f24faab3f68a8e3ead736c81 | JavaScript | shailpat5/CEG-Capstone | /web-app/frontend/src/components/Graphs/Music.jsx | UTF-8 | 2,394 | 2.84375 | 3 | [
"MIT"
] | permissive | /* eslint-disable react/jsx-no-target-blank */
import React, { Component } from "react";
import "./Music.scss";
const MAX_BAR_HEIGHT = 18;
class Music extends Component {
componentDidMount() {
this.addBarSpans();
setInterval(() => {
this.setRandomBars();
}, 300);
}
set... | true |
40befd37c09f01f4931350e02bab6a8712842832 | JavaScript | billduque34/billduque-proto.github.io | /script.js | UTF-8 | 264 | 2.984375 | 3 | [] | no_license | let total = document.querySelector('#total');
let quantity = document.querySelector('#quantity');
let h2 = document.querySelector('h2');
function getPrice(event) {
total.value = 'P' + (event.target.value * 375);
}
quantity.addEventListener('click',getPrice); | true |
fa2b65e00ab7fbafce3316185d5c16e987bd8e42 | JavaScript | drecon/jscomponents | /dist/jselect.js | UTF-8 | 572 | 2.59375 | 3 | [
"MIT"
] | permissive |
$.fn.jselect = function( action, opt) {
$.select = this;
//create input select
$.create_options = function(opt){
var field_html = '';
for( var option_index = 0; option_index < opt.data.length; option_index++ ){
var selected = '';
/*
if(data[opt.field_value] == opt.value ){
selected = 'selecte... | true |
fe9cb5c67daf346e250d46aeb01e50f824da0044 | JavaScript | SUSITHRAHARIDAS/ZENTASK | /WEEK 2/DAY 8/script.js | UTF-8 | 11,851 | 4.40625 | 4 | [] | no_license | /*Write a function called “addFive”.Given a number, “addFive” returns 5 added to that number.*/
function addFive(a) {
c = Math.abs(a)
b = c + 5;
return b
}
var out1 = addFive(5);
var out2 = addFive(0);
var out3 = addFive(-5);
console.log(out1)
console.log(out2)
console.log(out3)
/*Write a func... | true |
28a80ae6eac05dfae258264053a76a005b10ad3e | JavaScript | tempaccount1712/discordbotduplicate | /data/pickup.js | UTF-8 | 1,692 | 2.5625 | 3 | [] | no_license | const {MessageEmbed} = require("discord.js")
const c_pickup = {
image: "https://uploadstatic-sea.mihoyo.com/contentweb/20210807/2021080717452736570.jpg",
duration: "2021년 08월 10일(화) 19:00 ~ 2021년 08월 31일(화) 15:59",
fivestar: "요이미야",
fourstar: ["사유", "디오나", "신염"]
}
const w_pickup = {
image: "https://... | true |
cc12d9b151fcd56fc7cae552eccc041e806ba7c1 | JavaScript | MaxPlav/demo-express-rest-api | /lib/utils.js | UTF-8 | 3,632 | 2.515625 | 3 | [
"MIT"
] | permissive | /**
* Created by max on 28.11.15.
*/
module.exports = function () {
var config = require('../config/config')
, fs = require('fs')
;
/**
* Success response
* @param res
* @param data
*/
function success(res, data) {
res.status(200).send(data || {});
}
/**
... | true |
0cf6b4722dd04564e1fc3e6aadc3b891c495c81b | JavaScript | Kopochev/basic-js | /src/st-delete-digit.js | UTF-8 | 657 | 3.515625 | 4 | [
"MIT"
] | permissive | import { NotImplementedError } from "../extensions/index.js";
/**
* Given some integer, find the maximal number you can obtain
* by deleting exactly one digit of the given number.
*
* @param {Number} n
* @return {Number}
*
* @example
* For n = 152, the output should be 52
*
*/
export default function deleteD... | true |
17b776a91f3cc107f3c6e3eb435ac75149407eb9 | JavaScript | NGBlanchard/bulldog-bingo | /src/App.js | UTF-8 | 1,508 | 3.078125 | 3 | [] | no_license | import React, { useState } from "react";
import Board from "./Board.js";
import Header from "./Header.js";
import "./App.css";
function App() {
const [selected] = useState(["13"]);
const [won, setWon] = useState(false);
const winners = [
["1", "2", "3", "4", "5"],
["6", "7", "8", "9", "10"],
["11", ... | true |
94238af9c80f1323fd553d9de42828cdf8ca0c5c | JavaScript | kobra8/complete-react | /react-app/src/components/Persons/Persons.js | UTF-8 | 1,406 | 2.828125 | 3 | [] | no_license | import React, { Component, PureComponent } from 'react';
import Person from './Person/Person';
class Persons extends PureComponent {
// static getDerivedStateFromProps(props, state) {
// console.log('[person.js] getDerivedStateFromProps');
// return state;
// }
// Jeżeli przy update sprawdzamy wszystkie... | true |
c50905c81751ed671314404a9d5ca7357d7c08e2 | JavaScript | nemanjapesic/background-generator | /src/js/main.js | UTF-8 | 1,926 | 3.609375 | 4 | [
"MIT"
] | permissive | // Get Elements
const BODY = document.body;
const TOAST = document.querySelector("#toast");
const COLOR1 = document.querySelector("#color1");
const COLOR2 = document.querySelector("#color2");
const SLIDER = document.querySelector("#slider");
const CSS_TEXT = document.querySelector("#css-text");
const BTN_RANDOM = docum... | true |
1ce2276ae8900cbe87b73f692d8185ed9f88d904 | JavaScript | scub45t3v3/Transformation | /test/toBase64.js | UTF-8 | 1,366 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
// include dependencies
const unit = require('unit.js');
const toBase64 = require('../toBase64');
// describe #toBase64
describe('#toBase64', () => {
it('should be a function', () => {
unit
.function(toBase64);
}); // end it
it('should return a base64 encoded string for strings', () => ... | true |
f846e0a334ace8e4d8a50e69ba7de3d9893bc50b | JavaScript | lovepeople6292/moment.github.io | /momentum/js/quotes.js | UTF-8 | 1,641 | 3.046875 | 3 | [] | no_license | const quotes = [
{
quote: "삶이 있는 한 희망은 있다",
author: "키케로",
},
{
quote: "산다는것 그것은 치열한 전투이다",
author: "로망로랑",
},
{
quote: "하루에 3시간을 걸으면 7년 후에 지구를 한바퀴 돌 수 있다",
author: "사무엘존슨",
},
{
quote: "언제나 현재에 집중할수 있다면 행복할것이다",
author: "파울로 코엘료",
},
{
quote:
... | true |
48275c1b6ae0310c7c7b13bb0fbb0cb2fc6eb7a3 | JavaScript | carlosholguinc/Easy-Coffee | /JiraDashboard.js | UTF-8 | 358 | 2.734375 | 3 | [] | no_license | function getLink() {
var char = document.getElementsByClassName('gadget color2');
var links= char[0].getElementsByClassName('issue-link');
var linksFilter = links[0].getElementsByTagName('a'), hrefs = [];
for (var i = 0; i<links.length; i++)
{
hrefs.push(links[i].href);
}
let unique = [...new ... | true |
904732079f6cbf0d78e6d9489187ab9fa191cb7a | JavaScript | hung0968374/Computadora_frontEnd | /src/pages/StyledComponent.js | UTF-8 | 1,618 | 2.546875 | 3 | [] | no_license | import React from "react";
import { useState, useEffect } from "react";
import {
Wrapper,
Title,
Input,
Detail,
} from "../components/styleComponent/style";
import { ThemeProvider } from "styled-components";
import { useRef } from "react";
function StyledComponent() {
const [toggleColorToDark, setToggleCol... | true |
7e0e050f08288eda6cfa638ec7ccde9892cd7e38 | JavaScript | coolpup/openEtG | /dom.js | UTF-8 | 4,660 | 2.53125 | 3 | [
"MIT"
] | permissive | "use strict";
var audio = require("./audio");
var options = require("./options");
var h = preact.h;
exports.style = function(){
var style = arguments[arguments.length-1]
for(var key in style){
for(var i=0; i<arguments.length-1; i++){
arguments[i].style[key] = style[key];
}
}
return arguments[0];
}
function ... | true |
ed4da79114466d186f98f0c6f655c1f6b392cbf8 | JavaScript | sequoian/calendar | /client/src/reducers/calendar.js | UTF-8 | 607 | 2.703125 | 3 | [] | no_license | import {CHANGE_DAY, NEXT_DAY, PREV_DAY} from '../actions'
import moment from 'moment'
const defaultState = {
selectedDay: moment().startOf('day'),
showOlder: false
}
const calendar = (state = defaultState, action) => {
switch (action.type) {
case CHANGE_DAY:
return {
selectedDay: action.day
... | true |
2c91d5cd4e1732d54289f22cd08d2a4c8944b749 | JavaScript | nghiacap91/web | /todo/public/script.js | UTF-8 | 3,156 | 3.34375 | 3 | [] | no_license | // let todos = fetch("/todos").then((response) => response.json()).then((data) => {
// let list = data.map(({ title, completed }) => {
// if (completed == false) return `<li><input type="checkbox" class="checkbox">${title}</li>`;
// else if (completed == true) return `<li><input type="checkbox" cla... | true |
b3ef4a4797d28636f61875f91b302861b46dcec8 | JavaScript | bai294536333/my_app | /JavaScript_snake/js/function-$.js | UTF-8 | 14,921 | 3.125 | 3 | [] | no_license |
// -------------------------------------------------------
// 获取指定类名元素的集合1 getClass(classname,ranger)
function getClass(classname,ranger){
ranger= ranger===undefined?document:ranger;
// ranger=ranger||document;
// ranger= ranger?ranger:document;
if(document.getElementsByclassName){
return ranger.getElemen... | true |
d0504e728b20477ea48d9546af147ac01a935b8c | JavaScript | cardstack/cardstack | /packages/boxel/tests/integration/helpers/dayjs-from-test.js | UTF-8 | 1,745 | 2.546875 | 3 | [
"MIT"
] | permissive | // https://github.com/stefanpenner/ember-moment/blob/master/tests/unit/helpers/moment-from-test.js
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import dayjs from 'dayjs';
module('Integrat... | true |
66daed97c023f38277f9678cc1570f2ffd044c4c | JavaScript | killvxk/espree-fuzz | /espree-fuzz/testcase-run/CVE-2017-11893D6IC2V.js | UTF-8 | 343 | 2.578125 | 3 | [] | no_license | let o1=0
function o4() {
let o1 = [1.1, e, 3.3, 4.4];
try {
for (var o4 = "x"; o5 < 10000; o5++) {
try {
o0(o1, [1, o1102(), 3, 4]);
}catch(o518){}
}
}catch(e){}
try {
o70 >> 4;
}catch(e){}
try {
o0(o1, {});
}catch(e){} // can't handle, calls Math.max
try {
o5(o1[0]);
}catch(e){}
}
... | true |
75b2e12a7da5a57d9fb6f94365fa71d750541ad1 | JavaScript | EzeBernardine/Components | /src/lib/factory.lib.js | UTF-8 | 335 | 3.265625 | 3 | [] | no_license |
/**
* Truncate
* returns the truncated text with "..." or any specified ending character
* @param {String} str
* @param {Number} length
* @param {String} ending
* */
export const truncate = (str = "", length = 20, ending = "...") =>
str.length > length
? `${str.substring(0, length - ending.length)} ${endin... | true |
a7805c34496835475a6cefef006ab353dc715f0a | JavaScript | ayungavis/next-jobhunter | /redux/reducers/users/organizations.js | UTF-8 | 1,670 | 2.65625 | 3 | [] | no_license | const initialState = {
data: [],
item: {},
isLoading: false
}
const userOrganizations = (state = initialState, action) => {
switch (action.type) {
case "GET_USERORGANIZATION_PENDING":
return { ...state, isLoading: true }
case "GET_USERORGANIZATION_REJECTED":
return { ...state, isLoading: false }
case... | true |
d03aff75dcabd3836da5419c005fd1407585eec6 | JavaScript | jessemull/MicroFlexJS | /src/util/platevalidation.js | UTF-8 | 17,413 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... | true |
fe92257e58dd01593caa022dbb4d3da9f8a23d2a | JavaScript | matmaxgraphics/Node-Fle-System__fetchapi | /node-server/index.js | UTF-8 | 1,001 | 3.203125 | 3 | [] | no_license | const fetch = require('node-fetch');
var fs = require('fs');
const url = 'https://jsonplaceholder.typicode.com/posts';
function jsonData() {
return fetch(url)
.then(res => {
return res.json()
})
.then((output) => {
let result = output;
// console.log(result);
... | true |
079157ba22f628a1050df74c487c1af304c31e0f | JavaScript | jameswilky/chess | /dist/chessmen.js | UTF-8 | 9,476 | 3.328125 | 3 | [] | no_license | let chessmen = []; // Hold living chest piece objects
// Populate list of current chess pieces
function init_chessmen(items) {
for (let id = 0; id < items.length; id++) {
chessmen[id] = new Chessman(id, items[id].type, items[id].row, items[id].col, items[id].faction);
chessmen[id].render(chessmen_ctx);
}
}... | true |
e0680f7f222e162c7690535866f9ccf67b623ebd | JavaScript | xu1211/JavaScript | /webpack/webpack-demo/src/main.js | UTF-8 | 1,690 | 2.859375 | 3 | [] | no_license | // 这是 main.js 是我们项目的JS入口文件
// 1. 导入 Jquery
import $ from 'jquery'
// import *** from *** 是ES6中导入模块的方式 // 由于 ES6的代码太高级了,浏览器解析不了,所以这一行执行会报错
//相当于node语法 const $ = require('jquery')
// 使用 import 语法,导入 CSS样式表
import './css/index.css'
import './css/index.less'
import './css/index.scss'
// 注意: webpack, 默认只能打包处理 JS 类型的文件,无法处... | true |
1dafa1f5eb7fc8f1e7ad170b53d3138307e02cda | JavaScript | jayasurya17/supply-chain-disruption-analysis | /backend/src/modules/analyzedData/controller/analyzedData.js | UTF-8 | 30,557 | 2.53125 | 3 | [] | no_license | 'use strict'
import AnalyzedFoodProductionData from '../../../models/mongoDB/analyzedFoodProductionData'
import AnalyzedFoodExportData from '../../../models/mongoDB/analyzedFoodExportData'
import AnalyzedFoodImportData from '../../../models/mongoDB/analyzedFoodImportData'
import AnalyzedFoodStateExportData from '../..... | true |
e0f08f8ab2fec649014dd3898e9b2e357d7367b4 | JavaScript | tdhooper/dragon-snake | /guided-curve.js | UTF-8 | 823 | 2.625 | 3 | [] | no_license |
var GuidedCurvePath = function() {
THREE.CurvePath.call(this);
this.guideCurvePath = new THREE.CurvePath();
};
GuidedCurvePath.prototype = Object.create(THREE.CurvePath.prototype);
GuidedCurvePath.prototype.constructor = GuidedCurvePath;
GuidedCurvePath.prototype.add = function(curveAndGuide) {
this.curv... | true |
aecb7a6e04a2be77177f3fbcd6fb9af1399758c1 | JavaScript | TransportSG/TransportSG | /application/static/scripts/bus/service.js | UTF-8 | 11,110 | 2.640625 | 3 | [] | no_license | function toggle(stopNumber) {
let div = $(`div.service-info[stop-number="${stopNumber}"]`);
if (div.style.display === 'none')
div.style.display = 'flex';
else
div.style.display = 'none';
}
function calculateStudentFare(distance, mode, service) {
if (service === 'chinatown') return 110;... | true |
8e599d449a14aa0daa39209ae15c3039d708c621 | JavaScript | charlesrobertolima/charles-roberto-cubos-academy-operadores-artimeticos | /m01-a02-classe-08/index.js | UTF-8 | 263 | 2.71875 | 3 | [] | no_license | let precoTenis = 129;
let dinhMes = 80;
let cupomDesc = precoTenis - dinhMes
cupomDesc += cupomDesc * 100
cupomDesc = Math.round(cupomDesc / precoTenis)
console.log(`A Porcentagem necessária de desconto para conseguir comprar o tênis e de ${cupomDesc} %`); | true |
7b8e6e6bfee51e2a81c1158ceb017b19197b8caa | JavaScript | isuru-sam/graphql-traiiningapp-server | /client/src/util/elements.js | UTF-8 | 390 | 2.84375 | 3 | [] | no_license |
export const prepareImage = image =>{
const canvas = document.createElement('canvas');
canvas.width = image.width;
canvas.height = image.height;
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'rgba(0, 0, 0, 0)';
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
ctx.draw... | true |
6e8a23554273e3a46231a06ab7bc531f99caf3e6 | JavaScript | andre347/nextjs-express-example | /pages/about.js | UTF-8 | 466 | 2.703125 | 3 | [] | no_license | import React from "react";
import fetch from "isomorphic-unfetch";
const About = props => {
return (
<div>
<p>
Helloooo!! from <strong>{props.name}</strong>
</p>
</div>
);
};
About.getInitialProps = async function() {
// this is our data route
const res = await fetch("http://localh... | true |
4c688205dde4d5a41016184bae2a0cb13be6bc9c | JavaScript | CriminalInjuriesCompensationAuthority/ajv-formats-mobile-uk | /index.test.js | UTF-8 | 1,327 | 2.578125 | 3 | [
"MIT"
] | permissive | 'use strict';
const ajvFormatsMobileUk = require('./index');
describe('validator', () => {
describe('UK mobile phone number', () => {
it('should accept a UK mobile number', () => {
const result = ajvFormatsMobileUk('07701 234567');
expect(result).toEqual(true);
});
... | true |
7a54bdd68a0d153d527a4be77938d272a1cf3e64 | JavaScript | meetdre17/reactwpgjune20 | /example.js | UTF-8 | 56 | 2.78125 | 3 | [] | no_license | const a = 10;
let b = a;
console.log(a) // 10
a = 100;
| true |
618fd0ca32e134547e382b660534615d0a0c8435 | JavaScript | mastermatt/advent_of_code | /2020/day24/original.js | UTF-8 | 1,774 | 3.34375 | 3 | [] | no_license | const readFile = require("../../helpers/readFile");
const CoordinateMap = require("../../helpers/coordinateMap");
const CoordinateSet = require("../../helpers/coordinateSet");
// e, se, sw, w, nw, and ne.
// swswnwnesewswsesesewwwwnwwswnewww
const input = readFile(__dirname, "./input.txt");
const dirsMap = {
e: [-1... | true |
982b577783dcbeec3c3f89f828be2402b1f84873 | JavaScript | jorgediazsa/jspy-meetup-mayo-hooks | /src/Effect.js | UTF-8 | 1,010 | 2.984375 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
export default () => {
const [count, setCount] = useState(0);
const [status, setStatus] = useState("activo");
useEffect(() => {
window.history.pushState({}, null, `/contador/${count}`);
}, [count]); //componentDidUpdate
useEffect(() => {
window.hi... | true |
9a79c82a11f52047d99988dcc7125bd966f363e4 | JavaScript | lanyuxqh/node.js | /day05/code/promise/demo.js | UTF-8 | 1,228 | 3.109375 | 3 | [] | no_license | var fs = require("fs");
function pReadFile(filePath) {
return new Promise(function (resolve, reject) {
fs.readFile(filePath, "utf8", function (err, data) {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
}
// var p1 = new Promise(function (resolve, reject) {
// ... | true |
e1c4ea750f5dab2de03d61db548e4fea04b9a91f | JavaScript | phss/two_things | /public/javascripts/application.js | UTF-8 | 842 | 2.578125 | 3 | [] | no_license | $(document).ready(function() {
var popup = new Popup('#entryPopup', '#submit_entry', '/entry/submit');
$('#new_entry').click(function(event) {
event.preventDefault();
popup.open();
});
});
var Popup = function(popupLocator, submissionLocator, actionUrl) {
function popupLoaded() {
$(submissionLocat... | true |
f1b163323c5222aa82ccc97f1ca7d87f7cdb5cf2 | JavaScript | cassiomartimdev/Zenon | /src/commands/utility/UserInfoCommand.js | UTF-8 | 2,280 | 2.65625 | 3 | [] | no_license | const { Command, Constants, ZenonEmbed, Utils } = require('../../../structures');
module.exports = class UserInfoCommand extends Command {
constructor(name, client) {
super(name, client);
this.name = 'userinfo';
this.aliases = ['ui'];
this.category = 'Utilidades';
}
async ... | true |
265f5990763fd34efdf09efde90089eb9eea6d62 | JavaScript | OihaneGomez/SmiWork | /modules/SMD-TempHum/SMD-TempHum.js | UTF-8 | 2,439 | 2.875 | 3 | [] | no_license | /*
SmiWork: Smart Mirror DeustoTech
Modulo: SMD-TempHum
MIT Licensed.
*/
Module.register("SMD-TempHum", {
defaults: {
},
start: function() {
this.temperature = null;
this.humidity = null;
this.light = null;
Log.info('Starting module: ' + this.name);
this.sendSocketNotification('CONFIG', thi... | true |
672fbf969540bcb4a5650c0624e286853a10af37 | JavaScript | jiangyibo/newrootfs | /vispace/www/js/public.js | GB18030 | 1,923 | 2.828125 | 3 | [] | no_license | function cf_GetUrlParm()
{
var hrefstr,pos,parastr;
hrefstr = window.location.href;
pos = hrefstr.indexOf("?");
if (pos>-1)
p = hrefstr.substring(pos);
else
p="";
//alert(p);
return p;
}
function cf_GetParaVal(paraStr, url)
{
var result = "";
//ȡURLȫб
var str = "&" + url.s... | true |
7e339e367261378624a08367812d1fde7f2d823a | JavaScript | watashiSHUN/chromeExtension | /chromeFiles/moveTab.js | UTF-8 | 3,789 | 2.84375 | 3 | [] | no_license | function logAfterMove(tabs){
console.group();
tabs.forEach(function(item,index,array){
console.log("move tab: " + item.id + ", url: " + item.url + ", index: " + item.index);
})
console.groupEnd();
}
function compareHost(Url, host){
if(host.length > Url.length){
return false;
}
... | true |
876e396d8b255bbf671d2bc8a2412523bfc1bfcd | JavaScript | danprocoder/ireporter | /assets/js/ireporter.js | UTF-8 | 955 | 3.03125 | 3 | [] | no_license | class Dropdown {
constructor(element) {
this.element = element;
this.menus = element.getElementsByClassName('dropdown-menu')[0] || null;
const o = this;
this.element.addEventListener('click', (ev) => {
o.menus.style.display = 'block';
return false;
});
}
close() {
this.menus.sty... | true |
46abe39ab9205c65cbe78dedc50e93a90f1f0bea | JavaScript | addegbenga/hackerbayFrontendTask | /src/components/boards/board.js | UTF-8 | 8,427 | 2.703125 | 3 | [] | no_license | /* eslint-disable no-unused-vars */
import React, { useState, useEffect } from "react";
// import Form from "../src/components/form";
import { useSelector, useDispatch } from "react-redux";
import RandomSprite from "../Sprite";
import WinModal from "../../modals/winModal";
import FormModal from "../../modals/formModal"... | true |
6923afba8fe32f09da00993e925c815465617550 | JavaScript | liddellj/nodejs-deep-dive | /string-templates.js | UTF-8 | 583 | 4.3125 | 4 | [] | no_license | const person = {
name: 'Jim',
age: 38
};
// string templates provide a terse way to substitute variables within a template string
console.log(`Hello ${person.name}, you are ${person.age} years old`);
// you can also evaluate expressions within a template
console.log(`${person.name === "Jim" ? "the dude" : "rando"... | true |
85129e8286bc1f68e71690ba6d8f0e0f21ad9fcd | JavaScript | bpb27/tta-elastic | /src/utils/tests/query.test.js | UTF-8 | 2,229 | 3.109375 | 3 | [] | no_license | import { parseQuery } from 'utils/query';
describe('query utils', () => {
describe('parseQuery', () => {
it('handles empty inputs', () => {
expect(parseQuery()).toEqual([]);
expect(parseQuery(undefined)).toEqual([]);
expect(parseQuery(null)).toEqual([]);
});
it('removes stars', () => {... | true |
6fdff61ec8d6bd87d7fc188cf06cd0b5570283ed | JavaScript | elliehoward/dreamhub2 | /public/js/app.js | UTF-8 | 17,538 | 2.65625 | 3 | [] | no_license | const DreamsDashboard = React.createClass({
getInitialState: function () {
return {
dreams: [],
};
},
componentDidMount: function () {
this.loadDreamsFromServer();
setInterval(this.loadDreamsFromServer, 5000);
},
loadDreamsFromServer: function () {
... | true |
0d3a8ddf088e13604412d033566f2fd945c36850 | JavaScript | sgauravk/string-practice-assignment | /isPalindrome_while.js | UTF-8 | 257 | 3.703125 | 4 | [] | no_license | let text = process.argv[2];
let isPalindrome = true;
let pos = 0;
let middle = text.length/2;
while (pos <= middle && isPalindrome){
let oppPos = (text.length-1) - pos;
isPalindrome = (text[pos] == text[oppPos]);
pos++;
}
console.log(isPalindrome);
| true |
3e5d7efd1a966f1b4f5af2515c5a0a076d09c163 | JavaScript | raingxm/comments | /public/scripts/main.js | UTF-8 | 3,356 | 2.65625 | 3 | [] | no_license | var Comment = React.createClass({
render: function() {
var rawMarkup = marked(this.props.children.toString(), {sanitize: true});
return (
<div className="comment">
<h2 className="commentAuthor">
{this.props.author}
</h2>
... | true |
bd338b7b12299678777047adf803f9a31c2b63c0 | JavaScript | AlliDoisCode1234/Leetcode | /numberOfGoodPairs.js | UTF-8 | 428 | 3.5 | 4 | [] | no_license | //nums = array of integers
// pair (i,j) is called good IF nms[i] == nums[j] AND i < j
// Return the number of good pairs
const numIdenticalPairs = (nums) => {
const map = new Map();
let count = 0;
for (n of nums) {
if (map.has(n)) {
count += map.get(n);
map.set(n, map.get(n) + 1);
} else {
... | true |
4377b596dd362ce7b6f77881ab6c19edca05f423 | JavaScript | rawphp/bundle-bundler | /test/fixture/utils.js | UTF-8 | 392 | 2.625 | 3 | [
"MIT"
] | permissive | import Promise from 'bluebird';
import walk from 'walk';
/**
* Creates a walker.
*
* @param {*[]} args list of args
*
* @returns {Object} walker instance
*/
export default function getWalker(...args) {
const walker = walk.walk(...args);
walker.end = () => new Promise((resolve, reject) => {
walker.on('er... | true |
6ae48902248cdfb39e7f0479d7608245c9f20d34 | JavaScript | kangjieun99/portfolio | /js/main.js | UTF-8 | 7,857 | 2.765625 | 3 | [] | no_license | $(document).ready(function() {
var $menu = $('.menu ul li');
var $cntwrap = $('#container .cntwrap'); /* marginLeft로 animate() 시켜서 이동 */
var tgIdx = 0; //문서 로딩시 보여지는 섹션의 인덱스 번호
var total = $('#container .cntwrap section').length; //6 섹션의 전체 개수
var timerResize = 0; //스크롤바가 생성되지 않으므로 resize, mousewheel만 제어
... | true |
f8a2fdc7a71bda3f91b0ac868542ce7ebfe5eb43 | JavaScript | uihoh0/protobuf.js | /src/tokenize.js | UTF-8 | 3,844 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | /* eslint-disable default-case, callback-return */
module.exports = tokenize;
var delimRe = /[\s{}=;:\[\],'"\(\)<>]/g,
stringDoubleRe = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,
stringSingleRe = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g;
/**
* Tokenizes the given .proto source and returns an object with useful util... | true |
b438d7fcf804669eec6a3516bb3a28dd823ea38f | JavaScript | gdias/modalManager | /src/modules/getSizeElement.js | UTF-8 | 356 | 2.96875 | 3 | [
"MIT"
] | permissive | "use strict";
/*
getSize() : Return width and height of Object passed in parameter
objElem => Object | Object of DOM
*/
module.exports = function(objElem) {
var widthElem, heightElem, objSize;
widthElem = objElem.offsetWidth;
heightElem = objElem.offsetHeight;
objSize = {
width: widthElem,
height: ... | true |
e474c53fdf6b38284fe810f241c9c23bc4c040b8 | JavaScript | sarawithad/group-project-movie-history-the-academy | /javascripts/db-interaction.js | UTF-8 | 2,564 | 3.015625 | 3 | [] | no_license | "use strict";
// This module has no knowledge of the DOM, or where the data goes after it is fetched from Firebase.
// It is only concerned with getting and setting data in the db
let $ = require('jquery'),
firebase = require("./firebaseConfig");
// ****************************************
// DB interaction using F... | true |
d0c572a6f36957c56a9b00b3b51bb087c1b169e6 | JavaScript | Jigalag/zeo | /src/js/script.js | UTF-8 | 410 | 2.515625 | 3 | [
"MIT"
] | permissive | $(document).ready(() => {
$('.openModal').on('click', (e) => {
e.preventDefault();
$('.modal').addClass('open')
});
$('.modalClose').on('click', function(e) {
e.preventDefault();
$('.modal').removeClass('open');
if ($(this).hasClass('modalCloseAlert')){
se... | true |
50f176fb7714f85fcc511e1f9582aaeadadbc14a | JavaScript | dominikmanowski/infoshareacademy-exercises | /exercise-13/src/components/ContactListView.js | UTF-8 | 2,197 | 2.515625 | 3 | [] | no_license | import React, {Component} from 'react'
import AddContactForm from "./AddContactForm";
import ContactsList from "./ContactsList";
class ViewContactList extends Component {
state = {
contacts: [
{
id: 1,
name: "John McClane",
phoneNumber: "555-555-... | true |
cb186cac023615949f9db6f27ee5cb45e8223f95 | JavaScript | luojanet/task | /practices/filter/choose_no_repeat_number.js | UTF-8 | 424 | 2.984375 | 3 | [] | no_license | 'use strict';
function choose_no_repeat_number(collection) {
//在这里写入代码
var result=[];
for(var i=0;i<collection.length;i++){
var flag =true;
var temp = collection[i];
for(var j=0;j<result.length;j++){
if(temp===result[j]){
flag = false;
break;
}
}
if(flag){
r... | true |