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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
034bcff7ad3b32b2fe83aac6874001db1ffab551 | JavaScript | Aal-Emraan/more-es6-practice | /class.js | UTF-8 | 1,299 | 3.390625 | 3 | [] | no_license | class Support{
name;
designation = 'Support Web Developer';
address = 'Bangladesh';
constructor(name,address){
this.name = name;
this.address = address;
}
state(game){
return `${this.name} is a ${this.designation} in our company. He is from ${this.address}. He likes to pl... | true |
fd52536a7ccb6ca534df5ac71779c7a51192adf1 | JavaScript | saehejkang/TravlPak | /travlpak/src/components/LogIn.js | UTF-8 | 2,860 | 2.515625 | 3 | [] | no_license | import "../css/LogIn.css";
import { Component } from "react";
import { Link, Redirect } from "react-router-dom";
import logo from "../resources/LogIn-Resources/logo.svg";
import car from "../resources/LogIn-Resources/car.svg";
import continueButton from "../resources/LogIn-Resources/continueButton.svg";
import contin... | true |
c3e05ed9ec51dd3dc7ad2a30920d596de6e854af | JavaScript | DaniellKondoff/JSAdvanced | /10.ExamPreparation 2/02. Add_Delete in ListEX.js | UTF-8 | 2,447 | 3.46875 | 3 | [] | no_license | /**
* Created by Kondoff on 12-Nov-16.
*/
let list=require("./02. Add_Delete in ListEX").list;
let expect=require("chai").expect;
function solve() {
let data = [];
return {
add: function(item) {
data.push(item);
},
delete: function(index) {
if (Number.isInteger... | true |
48c27fda91810252e815eebc676d5e44b7aa646a | JavaScript | 5war00p/gaze-control-applications | /Content Scroller/script2.js | UTF-8 | 741 | 2.515625 | 3 | [
"MIT"
] | permissive | window.saveDataAcrossSessions = true;
const TOP_CUTOFF = window.innerHeight / 8;
const BOTTOM_CUTOFF = window.innerHeight - window.innerHeight / 8;
const scrollPercent = 8;
// how much to scroll
scrollFactor = (data, percent) => {
return (percent / 100) * data;
};
webgazer
.setGazeListener((data, ts) => {
if... | true |
e191ffff670cae24eccea0b19c1689411fa4424b | JavaScript | jonas-eos/gostack-bootcamp-module-06 | /src/pages/Repository/index.js | UTF-8 | 1,413 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { WebView } from 'react-native-webview';
export default class Repository extends Component {
/** Navigation title, get the repository name passed as param by other class/screen */
static navigationOptions = ({ navigation }) => ({
... | true |
e4cd6bf99c001aece1eb3065ea4880371d7843b8 | JavaScript | electronicbits/slow-json-stringify | /src/sjs.mjs | UTF-8 | 1,308 | 2.625 | 3 | [
"MIT"
] | permissive | import _prepare from './_prepare';
import _makeQueue from './_makeQueue';
import _makeChunks from './_makeChunks';
import _select from './_select';
import { attr, escape } from './_utils';
// Doing a lot of preparation work before returning the final function responsible for
// the stringification.
const sjs = (schema... | true |
d4bdc97390051cb3880ce155b9a38e3ca418de64 | JavaScript | tingmusic/eazydict | /src/cli/lookup.js | UTF-8 | 3,552 | 2.640625 | 3 | [
"MIT"
] | permissive | 'use strict';
/* eslint-disable max-params */
const chalk = require('chalk');
const unicons = require('unicons');
const stringBreak = require('string-break');
const cliWidth = require('cli-width');
const config = require('../lib/config');
const { pad } = require('../utils');
let windowWidth;
chalk.enabled = typeof ... | true |
a92b513012b270a5dbcde936bab47392e476c639 | JavaScript | yinm/clone-azu-github-issue-widget | /src/js/script.js | UTF-8 | 2,308 | 2.875 | 3 | [] | no_license | 'use strict'
const params = (() => {
let vars = []
let hash
const hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&')
for (let i = 0, length = hashes.length; i < length; i++) {
hash = hashes[i].split('=')
vars.push(hash[0])
// support param without value
vars... | true |
029d53513574563251f3c91b9dc5734063b20fc7 | JavaScript | Caio-ED/logica | /01 - If_else__Ok/ex06.js | UTF-8 | 372 | 3.625 | 4 | [] | no_license | //retorna peso ideal
var readline = require('readline-sync')
var altura = readline.questionFloat("Digite sua altura (0.00) : ")
var sexo = readline.questionInt("Digite 1 Para Homem ou 2 Para Mulher: ")
var pesoi
if(sexo == 1){
pesoi = (72.7 * altura) - 58
} else {
pesoi = (62.1 * altura) - 44.7
}
console.log... | true |
8b57de34ee069ddad1be2895dc6512a1e60eac7e | JavaScript | dreambot-develop/DreamBot-v2 | /cmds/voicekick.js | UTF-8 | 1,899 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | const Discord = require("discord.js");
const ms = require("ms");
module.exports.run = async (bot, message, args) => {
try {
if (!message.member.hasPermission('MOVE_MEMBERS')) return;
let kUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])),
... | true |
0a589b0483df261741b2fd0ab0459c5cb0992354 | JavaScript | shivamparekh/GifTastic | /assets/javascript/app.js | UTF-8 | 3,248 | 3.0625 | 3 | [] | no_license | //Host: api.giphy.com
//Path: /v1/gifs/search
//api_key - The public beta key is "dc6zaTOxFJmzC"
//q - search query term or phrase
// limit - (optional) number of results to return, maximum 100. Default 25.
// rating - limit results to those rated (y,g, pg, pg-13 or r).
//Sample: http://api.giphy.com/v1/gifs/search?q=f... | true |
266f3d8c3afa58e3a71fba818c7258d565d43b64 | JavaScript | AbdullahAdeeb/Courses-Manager | /sysc/shabka/functions2.js | UTF-8 | 4,513 | 3.171875 | 3 | [] | no_license | var tableNum = 0;
var allTimeTables = [];
function getTimeTables(regCourses,term){
request = new XMLHttpRequest();
request.open("POST","server.php" ,true);
request.setRequestHeader("content-type", "application/x-www-form-urlencoded");
request.onreadystatechange = function(){
if(request.readyState == 4 && reques... | true |
1b1cf276d598227f0f8c5252bcac77b48cae3af2 | JavaScript | janelflo/ReactMovieApp | /src/components/movie-list-container.js | UTF-8 | 576 | 2.78125 | 3 | [] | no_license | /*
This is my parent container and where i'll house my state and create my feed -- this will be placed in App.js
Movie Component: image, summaryReview Container: Review Form, Star Rating, List of Reviews
*/
import React from "react";
import Movie from "./movie";
//Parent Class - house state of App
export default clas... | true |
4c386e0438cdeecb7121e6e12b6db72370b58e06 | JavaScript | joshdrochon/thriftopia | /game/static/js/game.js | UTF-8 | 914 | 2.875 | 3 | [] | no_license | $('form').submit(function(e){
e.preventDefault();
$.ajax({
url: `${$(this)[0].action}`,
method: "post",
data: $(this).serialize(),
success: serverResponse => {
let events = JSON.parse(serverResponse).reverse(),
content = ""
for (let i = 0; i < ... | true |
16b179edae34d98cb623ff230a7ce2451db4075f | JavaScript | aprilmutuc/amutuc-CCS16 | /Week-1-HW/sketch.js | UTF-8 | 16,408 | 2.8125 | 3 | [] | no_license | var rectOnea;
var rectTwoa;
var rectTwob;
var rectThreea;
var rectThreeb;
var rectFoura;
var rectFourb;
var rectFourc;
var rectOnec;
function setup() {
createCanvas(windowWidth, windowHeight);
println("hello world!");
rectOnea = 50;
rectTwoa = 180;
rectTwob = 284;
rectThreea = 312;
rectThreeb = rectFourc;
rect... | true |
c5e32a874d2f6a90295adb93f74dbe3ff16fa415 | JavaScript | HisShoes/RPE-Calculator | /src/Reducers/index.js | UTF-8 | 609 | 2.5625 | 3 | [] | no_license | import { combineReducers } from 'redux';
import {calculateMax} from '../Utils/setCalculations';
const currentSetReducer = (currentSet = {}, action) => {
if(action.type === 'CURRENT_SET') {
//merge new set values into existing set
let set = Object.assign({}, currentSet, action.payload);
//calculate extr... | true |
128cd3c639beb73e7e21271033e80ae520352a1e | JavaScript | jokubka/reach_las_element_of_array | /js/app.test.js | UTF-8 | 443 | 2.90625 | 3 | [] | no_license | const calculatePath = require('./app');
test('Array [0, 2, 4, 5] to be false', () => {
expect(calculatePath([0, 2, 4, 5])).toBeFalsy();
});
test('Array [2, 2, 1, 0, 3, 5, 2] to be false', () => {
expect(calculatePath([2, 2, 1, 0, 3, 5, 2])).toBeFalsy();
});
test('Array [1, 2, 0, 3, 0, 2, 0] to be string of 1 ⇒... | true |
6d7d434c38bf8236a3dac45dc65f94f1b67f0f3c | JavaScript | Rick-Thompson/CovidShotTimer | /viewer.js | UTF-8 | 2,716 | 3.109375 | 3 | [] | no_license | var username = localStorage.getItem("username");
var password = localStorage.getItem("password");
var countDownDate = [];
var i;
for (i = 1; i < 101; i++) {
countDownDate[i] = 0;
}
window.addEventListener('DOMContentLoaded', function () {
});
// Create a client instance: Broker, Port, Websocket Path, Cli... | true |
6d0910586863750ac9f933e2ed5aeb699b1cef55 | JavaScript | enzo175/national_parks_practice | /index.js | UTF-8 | 2,339 | 3.125 | 3 | [] | no_license | 'use strict'
//https://developer.nps.gov/api/v1/parks?parkCode=acad&api_key=pQ6wyhd76wnAlu3Zt2FcrVAl6a3ahQjSTFGJ8baB
const apiKey = "pQ6wyhd76wnAlu3Zt2FcrVAl6a3ahQjSTFGJ8baB";
const searchUrl = 'https://developer.nps.gov/api/v1/parks';
function formatQueryParams(params) {
const queryItems = Object.keys(params)
... | true |
0c39fa5f844c4eec266c9edd2e8f52dbb9f1562d | JavaScript | Anasomari93/digitaltime | /script.js | UTF-8 | 1,014 | 3.09375 | 3 | [] | no_license | function update(){
var date=new Date()
var set_time=document.getElementById("set_time")
set_time.innerHTML=date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
var set_date=document.getElementById("set_date")
set_date.innerHTML=date.getDate()+"-"+parseInt(date.getMonth()+1)+"-"+date.getFullY... | true |
2c8ab430d416229465932dfc8c6c68812e0c047e | JavaScript | Meowmerry/CC4-Practice-Problem | /JavaScriptExercise/javascriptExercise.js | UTF-8 | 5,501 | 3.984375 | 4 | [] | no_license | //========== 1.1 =======================
Array1 = [1,2,30,400]
Array2 = Array1.map( x => x*2)
console.log('The answer is ', Array2) // The answer is [ 2, 4, 60, 800 ]
//========== 1.2 =======================
array1 = [1,2,3,4]
array2 = array1.map( x => x.toString())
console.log('The answer is ', array2)
//=========... | true |
b65b09a40eedf68df51cb174007cb507aced7099 | JavaScript | CloudMinders/green-field | /helpers/api.js | UTF-8 | 3,626 | 2.953125 | 3 | [] | no_license | // Require dependencies
const axios = require('axios');
const xml2js = require('xml2js');
const _ = require('lodash');
// Require API key(s)
const API_KEY = require('../config/google');
/**
PLEASE READ:
The process for 'building' a book before saving is complex.
No single API can return all necessary data.
Likewise... | true |
5fad0f66252762e05dcfe8dbb1443e86712a7fba | JavaScript | WindUpDurb/CC-Challenge | /src/actions/functionTools.js | UTF-8 | 970 | 2.796875 | 3 | [] | no_license | "use strict";
import moment from "moment";
export function daysFromToday(date) {
return moment(date).fromNow();
}
export function filterJobs(searchParams, partTimeOnly, fullTimeOnly, listingArray) {
return listingArray.filter(job => {
if (searchParams) {
let searchMatch = (
... | true |
fe8803ff5891397f04bc654d781d3a633bb703f7 | JavaScript | Naimul-Islam-Siam/LeetCode | /258. Add Digits.js | UTF-8 | 492 | 4.3125 | 4 | [] | no_license | // --- Iterative Approach
function addDigits(num) {
let sum = 0;
while (num > 9) {
sum = 0;
while (num > 0) {
sum = sum + (num % 10);
num = Math.floor(num / 10);
}
num = sum;
}
return num;
};
// --- Recursive Approach ---
function addDigits(num) {
let sum = ... | true |
9b5d758f2444fdca9da8518c0542c4bd03cd8d02 | JavaScript | TomStone76/JavaScript-exercises | /box.js | UTF-8 | 232 | 4.21875 | 4 | [] | no_license | // Create a function that returns true if an asterisk * is inside a box.
function inBox(arr) {
let flag = false;
for (let i = 0; i < arr.length; i++) {
if (arr[i].includes('*')) flag = true;
}
return flag;
} | true |
1499fa3110617a25502eb1115d91eff86439c3ef | JavaScript | Elevationacademy/cohort-19-week-3-Noormasarwa | /dom-task-color-changing/main.js | UTF-8 | 701 | 3.359375 | 3 | [] | no_license | let container = document.getElementById("container");
for(let i =0 ;i < 8;i++){
addingDiv(i)
}
function addingDiv(i){
let p = document.createElement("span")
p.setAttribute("class","box");
p.setAttribute("style",`background-Color:${getRandomColor()}`);
container.appendChild(p)
}
let boxes = doc... | true |
9d1289642600d4e121997984fefe79f8e265abd5 | JavaScript | danigirl329/gatsby-app-cms | /src/pages/contact.js | UTF-8 | 1,642 | 2.6875 | 3 | [] | no_license | import * as React from "react"
import Layout from "../components/layout"
import "../stylesheets/forms.scss"
import "../stylesheets/contact.scss"
export default class ContactPage extends React.Component {
state = {
name: "",
email: "",
comments: "",
}
handleInputChange = event => {
const target ... | true |
5a5975d44aca174d743841c1e830422d8d7f353d | JavaScript | maximilliancharlemagne/emotion-engine | /assets/javascript/textEngine.js | UTF-8 | 4,013 | 3.6875 | 4 | [] | no_license | //Text analysis and display code goes here
//might want to break up analysis and display?
function textAnalyzer(stringToAnalyze){
console.log(`text analyzer called with arg: ${stringToAnalyze}`)
let dataObject = {
api_key: '2UKOrCNzK8621TicKvum4P5XOmEqPm4hVdJ4NZIt4r8',
lang_code: 'en',
text: stringToAnalyze... | true |
f6f9242ce123b446d83fc45cd03eaf0d6925e986 | JavaScript | Mildred-Nakayuki/ValidationForm | /main.js | UTF-8 | 376 | 2.859375 | 3 | [] | no_license | function validation(){
var name=document.validationForm.Fname.value;
var password=document.validationForm.password.value;
if (Fname==null || Fname==""){
alert("Name can't be blank");
return false;
}else if(password.length<6){
alert("Password must be at least 6... | true |
d8b0717a988b4150a1b5ee14f8d66355196dbd96 | JavaScript | CFW25/JS-Challenges | /Beautiful Movies/BMovies.js | UTF-8 | 1,736 | 4.09375 | 4 | [] | no_license | // function beautifulDays(i,j,k) {
// var arr = Array(j - i + 1).fill().map((_, idx) => i + idx)
// let arrResult = []
// arr.forEach((val)=>arrResult.push(flipInt(val)));
// arr.forEach((item,index,checkArr) => checkArr[index] = item - arrResult[index]);
// // item - current value in the loop
// ... | true |
a5a030b4aa58a17b5f93e5b1b548fcf074b88e3c | JavaScript | dallinbledsoe/donut-fe | /src/components/pages/home.js | UTF-8 | 1,029 | 2.546875 | 3 | [
"MIT"
] | permissive | import React, { useState } from "react";
import axios from "axios"
import Card from "./donut-card"
export default function DonutSpace(props) {
const [donuts, setDonuts ] = useState([])
React.useEffect(() => {
axios.get("https://donut-be.herokuapp.com/donuts")
.then(response => {
... | true |
844a5dd829f99933a5aa0a2c3a2875b3f23e9349 | JavaScript | smrq/advent-of-code | /2018/19a.mjs | UTF-8 | 2,023 | 2.921875 | 3 | [] | no_license | import fs from 'fs';
const input = fs.readFileSync('19.txt', 'utf-8').trim();
const testInput = `#ip 0
seti 5 0 1
seti 6 0 2
addi 0 1 0
addr 1 2 3
setr 1 0 0
seti 8 0 4
seti 9 0 5`;
const ops = {
addr: (r, a, b, c) => { r[c] = r[a] + r[b]; },
addi: (r, a, b, c) => { r[c] = r[a] + b; },
mulr: (r, a, b, c) => { r[c] ... | true |
12662047e48f3cfaed651f7257117ac051a9cd15 | JavaScript | LukeMi/nodejs | /code/lesson11/fs.js | UTF-8 | 1,787 | 3.328125 | 3 | [] | no_license | var fs = require("fs");
/* fs.readFile('input.txt', function (err, data) {
if (err) {
return console.error(err);
}
console.log("异步读取: " + data.toString());
})
var data = fs.readFileSync('input.txt');
console.log("同步读取: " + data.toString());
console.log("程序执行完毕。", '\n');
// 异步打开文件
console.log("准备打开... | true |
116f51926094737f5af3ac6b0fecb3fe96357b5d | JavaScript | sunnysetia93/competitive-coding-problems | /LeetCode/All/js/210.course-schedule-ii.js | UTF-8 | 1,333 | 3.171875 | 3 | [
"MIT"
] | permissive | /**
* @param {number} numCourses
* @param {number[][]} prerequisites
* @return {number[]}
*/
var findOrder = function(numCourses, prerequisites) {
let preMap = {};
let visited = new Set();
let result = new Set();
// make adjaceny list
for(let [course,dependsOnCourse] of prerequisites){
i... | true |
35ab25e844f722fe708b872dcfdee4ab06724246 | JavaScript | domuk-k/projectMomentum | /js/src/greeting.mjs | UTF-8 | 2,418 | 3.171875 | 3 | [] | no_license | // DOMs
const layoutGreetings = document.getElementById('layout-greetings');
const greetingClock = layoutGreetings.querySelector('.greeting-clock');
const greetingsUserNot = layoutGreetings.querySelector('.greetings-userNot');
const userInputText = greetingsUserNot.querySelector('input');
const greetingsUserIs... | true |
9fccfdb86574b2cb062abb6c4e52d2d6bde3ed16 | JavaScript | nataliakikuchi/quarenta_exercicios_js | /ex8/index.js | UTF-8 | 341 | 3.109375 | 3 | [] | no_license | const inputCPF = document.querySelector(".cpfnumberinput");
const btn = document.querySelector(".sendcpf");
btn.addEventListener('click', function() {
let inputCPFvalue = inputCPF.value;
inputCPFvalue = inputCPFvalue.replace(/\D/g,''); //d tira dígito e D tira o que não é dígito
console.log(inputCPF);
alert(in... | true |
ae3da00871fbb03524b0cb7605cc854ac3f073c4 | JavaScript | cancerberoSgx/amd-parser | /src/parse.js | UTF-8 | 1,702 | 2.671875 | 3 | [] | no_license | var esprima = require('esprima')
var assert = require('assert')
// if no name is given in the define() declaration we will use given defaultModuleName and if none we will generate a random one.
function parse(str, defaultModuleName){
var esprimaConfig = {
raw: true,
range: true,
comment: true
}
var ast = e... | true |
47a441a1fcffb7853b7da7d4f4a8fdee33a0c506 | JavaScript | alejandroq/Real-Life-Utility-of-Currying | /node/index.js | UTF-8 | 358 | 3.96875 | 4 | [] | no_license | /** Example 1: Addition */
const add = a => b => a + b;
const addThree = add(3);
console.log(addThree(4));
/** Example 2: Prefixing a String */
const addPrefix = a => b => `[${a}] ${b}`;
const prefixWithWarning = addPrefix('WARNING');
console.log(prefixWithWarning('All is well.'))
/**
* Output:
* > $ node index.js
... | true |
5c83740632e511298d85d70a75c1155b4c91e23b | JavaScript | Oxygen2c/star-wars | /src/components/people-page/people-page.js | UTF-8 | 1,358 | 2.578125 | 3 | [] | no_license | import React from "react";
import ItemList from "../item-list";
import PersonDetails from "../person-details";
import ErrorNotification from "../error-notification";
import SwapiService from "../../services/swapi-service";
export default class PeoplePage extends React.Component {
swapiService = new SwapiService();
... | true |
1ea6a4c64634a4436d70953ee424d81d82cb7635 | JavaScript | JuanmaRizzi/GifApp | /src/components/GifGrid.js | UTF-8 | 1,580 | 2.90625 | 3 | [] | no_license | import React /* , { useState, useEffect }*/ from "react";
import { useFetchGifs } from "../hooks/useFetchGifs";
// import { getGifs } from "../helpers/getGifs";
import { GifGridItem } from "./GifGridItem";
export const GifGrid = ({ category }) => {
const { data: images, loading } = useFetchGifs(category);
console.... | true |
13a33341a21b6c51e859cef7fe6fd4ecb319ceaa | JavaScript | abbigrundy/apprenticeship-projects | /corndel-front-end-exercises/dom-and-browser-apis/events/script.js | UTF-8 | 684 | 3.390625 | 3 | [] | no_license | const inner = document.querySelector("#inner");
const middle = document.querySelector("#middle");
const outer = document.querySelector("#outer");
let timer = 1000;
inner.addEventListener("click", function (event) {
changeBackgroundColour(inner, "darkgoldenrod", timer);
timer += 1000;
});
middle.addEventListener(... | true |
02a845a8b2892e4047984ac26b4b3745f6ed8d8d | JavaScript | Rafael-Albano/DevFrontEnd---Petiko | /assets/js/dados-form.js | UTF-8 | 314 | 2.609375 | 3 | [] | no_license | document.querySelector(".btn-estilo").addEventListener("click", event =>{
event.preventDefault();
(fetch("http://127.0.0.1:5500/orcamento.html")
.then ((response) =>console.log(response))
.then((data) => console.log(data)))
.catch((erro)=> console.error(erro));
}); | true |
980c9a6cdf3e95003f4ec00f4914f3c99af32832 | JavaScript | aziziala/Angular | /controller/event_controller.js | UTF-8 | 2,305 | 2.625 | 3 | [] | no_license | const Event = require ('../model/event_model.js'); // inclut le schéma de
const router = require('express').Router();
const cors = require('cors');
router.use(cors());
router.addEvent = async (req, res, next) => {
try {
const evnt = new Event({
title: req.body.title,
description: ... | true |
a5d19ab73250262675f78073b8175ef543f35008 | JavaScript | kbarov/SoftUniExamsAndExercises | /TechModuleJavaScript/Final Exams/Programming Fundamentals Additional Retake Exam - 28 October 2018 Part II/03.ChoreWars.js | UTF-8 | 1,158 | 2.890625 | 3 | [
"MIT"
] | permissive | function solve(params) {
params.pop();
let [timeDishes, timeCleaning, timeLaundry] = [0, 0, 0];
let [regDishes, regCleaning, regLaundy] = [/<[a-z\d]+>/, /\[[A-Z\d]+\]/, /\{.+\}/];
for (let param of params) {
if (param.match(regDishes)) {
timeDishes += sumDigits(param.match(regDishes... | true |
02debac8d5b7b0cbae5b57a5f56d3ea30be1d047 | JavaScript | TuftsVALT/snowcat | /node_middleware/socket_listeners/crudHerald/index.js | UTF-8 | 1,193 | 2.640625 | 3 | [
"MIT"
] | permissive | const createHerald = require("./createHerald.js");
const deleteHerald = require("./deleteHerald.js");
const readHerald = require("./readHerald.js");
module.exports.set = function(session, socket) {
// for dev purpose, maybe removed later
socket.on("getAllHeraldsRequest", () => {
let heraldsMap = session.getHer... | true |
bc3534bda985539be7f2d77f33a9fe6c268445ed | JavaScript | cenacrharsh/From-Figma-to-Code | /Data Analytics Dashboard/Data Analytics Dashboard Code/script.js | UTF-8 | 528 | 2.734375 | 3 | [] | no_license | const menuBtn = document.querySelector(".menu-btn");
const backBtn = document.querySelector(".back-btn");
const menu = document.querySelector("nav");
menuBtn.addEventListener("click", () => {
menu.style.transform = "translateX(0)";
});
backBtn.addEventListener("click", () => {
menu.style.transform = "translateX(-... | true |
678363e08d7c4a90e96041c9b1a83beda14e4beb | JavaScript | razdob15/music-handler | /public/client.js | UTF-8 | 434 | 2.890625 | 3 | [] | no_license | const button = document.getElementById('setVolume');
const volumeInput = document.getElementById('volume');
button.addEventListener('click', function (e) {
let volumeVal = volume.value;
if (volumeVal <= 20) {
console.log("LOWWW");
axios({
method: 'post',
url: '/setvolume/',
... | true |
fa7e0dcd66dbb2fa80aece55883300461611bc7f | JavaScript | miracle-sun/advent-of-code | /2017/day6/day6.js | UTF-8 | 1,272 | 3.453125 | 3 | [] | no_license | var fs = require('fs');
var text = fs.readFileSync('input.txt', 'utf8');
var bigArray = text.split('\t').map(Number);
// console.log(bigArray);
function getMaxOfArray(arr) {
return Math.max.apply(null, arr);
}
function findIndexMaxElem(arr, max){
var indexes = [];
arr.filter(function(item, i){
if(item === max... | true |
0466e94698558933b43e3b5d26459034c068b9a7 | JavaScript | shriyanspur/Project-38 | /sketch.js | UTF-8 | 1,056 | 2.75 | 3 | [] | no_license | var canvas, backgroundImage;
var gameState = 0;
var playerCount;
var allPlayers;
var distance = 0;
var database;
var form, player, game;
var cars, car1, car2, car3, car4;
var ci1, ci2, ci3, ci4;
var track, ground;
function preload() {
ci1 = loadAnimation("b1r1.png", "b1r2.png", "b1r3.png", "b1r4.png", "b1r5.png... | true |
80b59ea7bda162c01847dd7626ec11a575faaa48 | JavaScript | KlassyKat/Keyboard-Tracker | /processKeyboard.js | UTF-8 | 2,179 | 2.875 | 3 | [] | no_license | function processKeyboard(keyboard) {
if(keyboard.includes('?xml')) {
let keyboardArray = keyboard.split(">");
for(item in keyboardArray) {
if(keyboardArray[item].includes('?xml')) {
keyboardArray.splice(item, 1);
}
if(keyboardArray[item].includes('... | true |
34c6da9ccc0263435f12c415c5e6d378d935f068 | JavaScript | storm3d/cw-icfpc-2019 | /src/model/model.js | UTF-8 | 18,745 | 2.953125 | 3 | [
"MIT"
] | permissive | // @flow
export const FREE = 0;
export const OBSTACLE = 1;
export const WRAPPED = 2;
export const FAST_TIME = 50;
export const DRILL_TIME = 30;
export class Coord {
x: number;
y: number;
constructor(x: number = 0, y: number = 0) {
this.x = x;
this.y = y;
}
isEqual(c: Coord): boolean {
return ... | true |
83f9fe1ffe82f2f71fccb7cad534e8e246807ac5 | JavaScript | wiseshrimp/server-locate | /src/inject/inject.js | UTF-8 | 13,652 | 2.609375 | 3 | [] | no_license | let userCoords = {
lat: 0,
long: 0
}
let endpoints = []
let map
let totalDistance = 0
let canvas, ctx, isCapturing = true, isImgLoaded, isImg2Loaded, downloadLink
let stream
let mousePosition = []
let cursorImg = new Image()
let pointerImg = new Image()
let canvasRecorder
// Get user geolocation
function successCa... | true |
6933d1c756de2cb2bd09d6fbe91b4584cf647e8c | JavaScript | mariannademelo/rodini-shop | /ecommerce/ecommerce/src/ProductDetails.js | UTF-8 | 4,967 | 2.703125 | 3 | [] | no_license | import { useState } from "react";
import { useParams } from "react-router-dom";
import useFetch from "./LandingPage/useFetch";
const ProductDetails = ({ data, setData, setAdd }) => {
const { id } = useParams()
const { error, data: product, isPending } = useFetch('http://localhost:7000/all-products/' + id)
... | true |
f6eed713885fb22116481af12a8f7feb51f5e1b8 | JavaScript | bugagashinka/gallery-app | /src/utils/convertors.js | UTF-8 | 592 | 2.546875 | 3 | [] | no_license | import JsZip from "jszip";
import FileSaver from "file-saver";
export const getBlobFromURL = async (objectURL) => {
return await fetch(objectURL).then((res) => res.blob());
};
export const collectionDescriptorsToZip = async (collectionName, descriptorList) => {
const zip = JsZip();
descriptorList.forEach((desc... | true |
99febb684749f023c633695571b12cb60ceeff98 | JavaScript | wzdwc/game-vue | /src/components/toast/index.js | UTF-8 | 1,381 | 2.59375 | 3 | [] | no_license | import ToastComponent from './toast'
import Vue from 'vue'
const ToastConstructor = Vue.extend(ToastComponent)
const $vm = new ToastConstructor({
el : document.createElement('div'),
data: {show: false}
})
document.body.appendChild($vm.$el)
let timer
const Toast = (...args) => {
let options
if (args.l... | true |
70982743c85daf42adea71c66893becd144b6a21 | JavaScript | owshi/dzk | /kadastr.js | UTF-8 | 2,690 | 2.703125 | 3 | [] | no_license | (function() {
//This is attempt to make prototypical inheritance by making prototype of Ukrainian land kadaster
var registeredArray = [],
zemKadastr = function() {
this.name = 'Державний земельний кадастр';
}
Object.prototype.zemDilyanka = function() {
var zemdil = this... | true |
db5cb49fd589a0e270de4afe37ad4345fde42538 | JavaScript | wsx180808/yaoqishan | /src/main/webapp/static/default/javaex/m/js/javaex-formVerify.js | UTF-8 | 2,950 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | /**
* 作者:陈霓清
* 官网:http://www.javaex.cn
*/
// 自定义验证类型 必填项:页面中直接写 data-type="必填" 即可,不需要为其定义正则表达式
var regJson = {
"金额" : "/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/", // 0 + 正整数 + 最多2位小数(正数)
"整数" : "/^-?\\d+$/",
"正整数" : "/^[0-9]*[1-9][0-9]*$/",
"负整数" : "/^-[0-9]*[1-9][0-9]*$/",... | true |
94e97847b358f7b23890a7cf41c8dd96a8ec057f | JavaScript | wh120/Merch | /public/assets/js/Simple-Side-Nav.js | UTF-8 | 292 | 2.546875 | 3 | [
"MIT"
] | permissive | $(document).on('click', '.toggle-side-nav', {}, function() {
if (typeof $(this).data('navId') !== 'undefined')
{
let navId = $(this).data('navId');
$('#'+navId+'.side-nav').toggleClass('open');
}
else
{
$('.side-nav').toggleClass('open');
}
}); | true |
43aaa0e9d91c2457aac122691b95bebc5b22440c | JavaScript | unclexiao/egg-mp | /app/extend/helper.js | UTF-8 | 666 | 2.609375 | 3 | [
"MIT"
] | permissive | 'use strict';
const xml = require('xml-js');
module.exports = {
xml2json(xmlStr) {
let result = xml.xml2json(xmlStr, {
compact: true,
spaces: 4,
});
result = JSON.parse(result);
return this.deleteCDATA(result.xml);
},
json2xml(json) {
const result = xml.json2xml(json, {
com... | true |
00744112f72c4fcc5228c8f55bf3ecde9ee190ee | JavaScript | WillleePang/Javascrip4Practice | /StandardObjects/RegExp.js | UTF-8 | 7,690 | 4.15625 | 4 | [
"Apache-2.0"
] | permissive | /**
* Created by Administrator on 2015/12/28.
*/
//字符串是编程时涉及到的最多的一种数据结构,对字符串进行操作的需求几乎无处不在。
//比如判断一个字符串是否是合法的Email地址,虽然可以编程提取@前后的子串,再分别判断是否是单词和域名,但这样做不但麻烦,而且代码难以复用。
//正则表达式是一种用来匹配字符串的强有力的武器。它的设计思想是用一种描述性的语言来给字符串定义一个规则,
//凡是符合规则的字符串,我们就认为它“匹配”了,否则,该字符串就是不合法的。
//所以我们判断一个字符串是否是合法的Email的方法是:
//创建一个匹配Email的正则表达式;
//用该正则表达... | true |
e739a402c9f8f743b0497e2d530d355b16949e4a | JavaScript | ardisrtilson/martins-aquarium | /scripts/quoteList.js | UTF-8 | 522 | 2.640625 | 3 | [] | no_license | import{useQuote} from "./QuoteDataProvider.js"
import{quote} from "./quote.js"
export const QuoteList = () => {
const contentElement = document.querySelector(".content--left")
const quotes = useQuote()
let quoteHTMLRepresentations = ""
for(const currentQuoteObj of quotes){
quoteHTMLReprese... | true |
d2b4329d7f836d3a784355c3270ba25930920333 | JavaScript | BronzeEgo/WebDevTraining | /guessinggame/script.js | UTF-8 | 358 | 4.375 | 4 | [] | no_license | //create secretNumber
var secretNumber = 33;
//ask user for guess
var guess = Number(prompt("Guess a number"));
//check guess
if(guess === secretNumber) {
alert("You got it right!");
}
else if(guess > secretNumber) {
alert("Too High");
}
else {
alert("Too low")
}
var count = 1;
while(count < 6) {
console.l... | true |
d71c58ff10173e1d5459bd1a83181704ad8d42a2 | JavaScript | wukege/crawler | /node/demo.js | UTF-8 | 1,175 | 2.546875 | 3 | [] | no_license | // process.on('exit',(code)=>{
// console.log(`About to exit with code ${code}`);
// console.log(require)
// })
// const path = require('path');
// console.log(path.parse(path.sep()))
// var url = path.resolve('/foo','/boo/','ff');
// console.log(path.sep)
// const {URL} = require('url');
// // const myUrl =... | true |
6a8ca797816562ae4bce94e17c3cfb77526d1f7b | JavaScript | yisha0307/Daily-Practice | /React/slide-to-open/slide-to-open.jsx | UTF-8 | 2,629 | 3.015625 | 3 | [] | no_license | class App extends React.Component{
constructor(props){
super(props);
this.state ={
isBlank:false,
}
}
handleChild(){
this.setState({
isBlank: true
});
}
render(){
const isBlank = this.state.isBlank;
if(isBlank){
return (
<div className = 'slide__blank'></div>);
}else{
return (
<... | true |
fe15d15ebf6bc3779a770817b2f933298a8c4152 | JavaScript | kodai100/CreativeUniverseWebsite | /sp/js/smartphone.js | UTF-8 | 254 | 2.953125 | 3 | [] | no_license | //UAを確認してbodyにクラス追加
$(document).ready(function(){
var agent = navigator.userAgent;
if(agent.search(/iPhone/) != -1){
$("body").addClass("iphone");
}else if(agent.search(/Android/) != -1){
$("body").addClass("android");
}
}); | true |
64ad053addd2525de610478c27830b72d713c78a | JavaScript | EverettQuebral/LocaleMaps | /static/js/apps/admin/jquery/base_form_view.js | UTF-8 | 1,881 | 2.609375 | 3 | [] | no_license | /**
* @fileoverview Defines an BaseFormView class that is the base for
* form submission on the localemaps.com admin site.
* @author Ryan Cruz (cruzryan@gmail.com)
*/
$.namespace('localemaps.admin');
/** @define {string} */
var HIDDEN = 'hidden';
/**
* Constructs a BaseFormView instance, which wraps around a ... | true |
60e18ac24efddd4fc69d69afe4e1ba23792d19a9 | JavaScript | bsolomatin/Lesson1 | /Main.js | UTF-8 | 568 | 3.578125 | 4 | [] | no_license | "use strict";
let userFirstName = 'Bogdan';
let userLastName = 'Solomatin';
let userBirthDay = prompt("Inpit your day of birth");
let userBirthMonth = prompt("Input your month of birth");
let userBirthYear = prompt("Input your year of birth");
let userAge = solveAge(userBirthYear);
alert("First name: " + userFirstNam... | true |
69a74a87a22b8d5f4caadb5c8f41d7d52c46506e | JavaScript | dam-2017/practica03-ts-camarena-jonatan | /numeroMain.js | UTF-8 | 1,019 | 3.046875 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var numero_1 = require("./numero");
var nums = new Array();
nums.push(new numero_1.Numero(4, 6));
nums.push(new numero_1.Numero(3, 7));
nums.push(new numero_1.Numero(3, 6));
nums.push(new numero_1.Numero(1, 4));
nums.push(new numero_1.Numero(4... | true |
0bbb1e5a89c978c89a2d42af508dc97583bc2818 | JavaScript | abhishekakade/calculator | /src/Calculator.js | UTF-8 | 4,417 | 3.046875 | 3 | [] | no_license | import React, { Component } from "react";
export default class Calculator extends Component {
state = {
displayScreen: 0
};
clearFunction = () => {
this.setState({
displayScreen: 0
});
};
handleClickOnNumbers = event => {
event.preventDefault();
console.log("id - ", event.target.i... | true |
827abcf6b83ae6c547ec23f38349ab0983d872a3 | JavaScript | DraCaster/autism-app | /api/src/modules/security/controllers/RoleController.js | UTF-8 | 1,061 | 2.546875 | 3 | [
"MIT"
] | permissive | import {readRolesService,
readRolesPermissionService} from '../services/RoleService';
module.exports.readRolesAction = async function (req, res) {
if (!req.user || !req.rbac.isAllowed(req.user.id, "LIST_ROLES_PERMISSION")) res.status(401).send("No autorizado")
const roles = await readRolesService()
... | true |
178987d09cb13c9274219e1bef25a6ae454a78f1 | JavaScript | rellison27/React-Rock-Paper-Scissors | /solutions/App.js | UTF-8 | 2,518 | 3.15625 | 3 | [] | no_license | import React, { Component } from 'react';
export default class App extends Component {
constructor(){
super();
this.state = {
computerPick: null,
userPick: null,
animatedClass: 'animated rotateIn',
result: null
}
}
submitUserPick(userPick){
this.setState({userPick: userP... | true |
76d52aae12e727f9486a4abba4671c61f74d4f28 | JavaScript | mgbrando/react-practice | /src/app.js | UTF-8 | 789 | 2.984375 | 3 | [] | no_license | import React from "react";
import PropTypes from "prop-types";
/*const Headline = () => {
return <h1 className="title"> Hello World! </h1>;
};
const Greeting = props => {
const { name, age } = props;
return (
<p>
You will love it {name} ({age})!
</p>
);
};*/
class App extends React.Component {
... | true |
ca5ea67ab4a5939df969e5273fb7090115c92a53 | JavaScript | BillIvanKoo/Apicta_Monash | /client/src/components/AnomalyPage.js | UTF-8 | 2,226 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import Axios from 'axios';
import { Accordion, Card, ListGroup, Button } from 'react-bootstrap';
import { titleCase } from './helper/functions';
class AnomalyPage extends Component {
constructor(props) {
super(props);
this.state = {
packets: []... | true |
7fcf87d7d1a5e6e71b4be10296179ebd93f2f625 | JavaScript | mikeebowen/portfolio-backend | /api/siteInfo/siteInfoRoutes.js | UTF-8 | 3,747 | 2.625 | 3 | [
"MIT"
] | permissive | 'use strict';
const router = require('express').Router();
const getSiteInfo = require('./get/getSiteInfo');
const jsonEndpoint = require('../endpoints/jsonEndpoint');
router.route('/')
.get(getSiteInfo, jsonEndpoint);
module.exports = router;
/**
* @apiGroup ContentItem
* @apiName GET ContentItem
* @api {get... | true |
400f2fedefd5d3732bf13ec55e4a2ac0ae4ab368 | JavaScript | pythoner2019/javascript-ES6-snippts | /1- Array Helper Methods/4-find-helper.js | UTF-8 | 1,696 | 3.328125 | 3 | [] | no_license | const users = [
{ name: 'Muhammed' },
{ name: 'Ali' },
{ name: 'Hossam', id: 44 },
{ name: 'katrina' },
{ name: 'Hossam' },
]
const findUser = users.find((user) => {
return user.name === 'Hossam';
})
const findUser_1 = users.find((user) => {
return user.name === 'katrina';
})
console.log(... | true |
85a90b3373eaa5fb94d443706068dcb96de60421 | JavaScript | nguyentrigiang/cotienxanh | /src/components/Cards/index.js | UTF-8 | 2,307 | 2.5625 | 3 | [] | no_license | import Phaser from 'phaser'
import { loadAsset, removeTimbre } from '../../helpers'
import assetSpec from './asset-spec'
class Cards extends Phaser.GameObjects.Sprite {
static get KEY () {
return 'Cards'
}
static get ASSET_SPEC () {
return assetSpec
}
static preload (scene) {
const { assetColle... | true |
ca6cd8331691a8e201a57803c35739126d3d037a | JavaScript | brytebee/problem_solving | /titleCase.js | UTF-8 | 510 | 3.671875 | 4 | [] | no_license | function titleCase(str) {
const ans = [];
let strArr = str.toLowerCase().split(" ");
for (let i = 0; i < strArr.length; i++){
strArr[i] = strArr[i].charAt(0).toUpperCase() + strArr[i].slice(1);
if (strArr[i] == strArr[strArr.length -1]){
ans.push(strArr[i])
} else {
... | true |
87e7882dc3ad0c6654a223b58747a80887927884 | JavaScript | jmpedro/Ecommerce | /utils/fetch.js | UTF-8 | 1,243 | 2.984375 | 3 | [] | no_license | import { getToken, hasExpiredToken } from '../api/token';
/* Creamos una funcion donde comprobaremos que el usuario este loggeado o no cuando haga una petición al servidor,
y que el tiempo de expiracion de su token haya caducado o no. */
export async function authFetch(url, params, logout) {
// obtenemos el ... | true |
ea6f424a4108764302d8cf2236bcb76f72704356 | JavaScript | AndresCallejasG/AirBnB_clone_v4 | /web_dynamic/static/scripts/1-hbnb.js | UTF-8 | 545 | 3.203125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | const amenities = {};
$(document).ready(function () {
$('input').each(function () {
checkAndAppend(this);
});
});
function checkAndAppend (inp) {
$(inp).click(function () {
if ($(inp).prop('checked')) {
amenities[$(inp).data('id')] = $(inp).data('name');
console.log(amenities);
} else {
... | true |
a02cc0b910c86f9e34be70f1db66e3e69707ddf4 | JavaScript | AnandPawanipagar/FROM-22AUG-HCMAY2021 | /WEEK02/TUESDAY/filterMethod.js | UTF-8 | 391 | 3.5 | 4 | [] | no_license | let result = [];
let cities = [
{ name: "hyd", population: 500 },
{ name: "nagpur", poputation: "200" },
{ name: "Mumbai", population: 600 },
];
for (let i = 0; i < cities.length; i++) {
if (cities[i].population === 500) {
result.push(cities[i].name);
}
}
console.log(result);
let resultCity=cities.filter(... | true |
672a3da9c8c47144b260f9d778040f8497f64226 | JavaScript | NWBStudio/Rockstar-portfolio | /src/scripts/validation.js | UTF-8 | 726 | 3.125 | 3 | [] | no_license | const contactsForm = document.querySelector('.contacts__form');
function isDigit(e) {
if (e.key >= 0 || e.key <= 0) return true;
return false;
}
// function isControl(e) {
// if (e.key == 'Shift' || e.key == 'Backspace' || e.key == 'ArrowLeft' || e.key == 'ArrowRight') return true;
// return false;
//... | true |
27c527cbfa44bce56b7232bb25c2e6bfb671e71e | JavaScript | indykoning/no_reload | /example/js/noreload.js | UTF-8 | 6,838 | 2.640625 | 3 | [] | no_license | // SETTINGS
//you can create your own animations, name is the classname and duration is the time it takes for the animation to fully hide the page
var noreload_animations = [{name: 'fade', duration: 0.5},
{name: 'left-right', duration: 0.9},
{name: 'top-bottom', d... | true |
2936a99de537e87169e147c237609e71a66dcaa4 | JavaScript | alysialfi/search-domain | /src/pages/caridomain.jsx | UTF-8 | 2,706 | 2.765625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import './caridomain.css'
export const Caridomain = () => {
const [input, setInput] = useState('')
const [domain, setDomain] = useState('')
const [display, setDisplay] = useState('')
const [hasil, setHasil] = useState()
const [border, setBorder] = useState(... | true |
f4fc053dde3f1df060dabf1a6102dccdc7f7deba | JavaScript | mendozalourdes/Overlook-Hotel | /src/hotel.js | UTF-8 | 1,384 | 2.9375 | 3 | [] | no_license | class Hotel {
constructor(allBookings, allRooms) {
this.bookings = allBookings,
this.rooms = allRooms,
this.availableRoomsByDate;
}
getAvailableRoomByDate(date) {
const findDateMatches = this.bookings.bookings.reduce((acc, booking) => {
if (date === booking.dat... | true |
c2b7014b355b2a9bb00a119c9323d001a41617e7 | JavaScript | Mohamed0thman/delivery-app-client | /src/redux/categories/categories-reduce.js | UTF-8 | 399 | 2.53125 | 3 | [] | no_license | import { CategoriesActionTypes } from "./categories-type";
const INITIAL_STATE = {
categories: [],
};
const categoriesReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case CategoriesActionTypes.SET_ALL_CATEGORIES:
return {
...state,
categories: action.payload,
... | true |
f800afc764fad066925df355a52424435e05f85c | JavaScript | joblift/node-zookeeper-client | /src/ConnectionStringParser.js | UTF-8 | 2,047 | 2.53125 | 3 | [
"MIT"
] | permissive | import assert from 'assert';
import Path from './Path';
import u from 'underscore';
// Constants.
const DEFAULT_PORT = 2181; // Default Zookeeper client port.
/**
* This class parse the connection string to build the ensemble server
* list and chrootPath.
*
*/
/**
*
* Parse the connect string and random the ser... | true |
9d093dbfa69713a9053243d774d6281bbefd7b2d | JavaScript | voidblue/ojackkyo | /ojackkyoandroid/app/src/main/assets/js/write.js | UTF-8 | 968 | 2.53125 | 3 | [] | no_license | function editArticle(){
sharp = $("#contents").val().split("#")
xxx = []
i = 0;
console.log(sharp)
for (var i = 1 ; i < sharp.length; i++){
xxx[i-1] = sharp[i].split(" ")[0];
}
for (var i = 0 ; i < xxx.length; i++){
str = '{"name":"' + sharp[i+1].split(" ")[0] + '"}';
... | true |
e5bc52b92ab0df96ce71103ce30bf80bb62aa03e | JavaScript | scottrice10/javascript-interview-questions | /primeTester/primeTester.js | UTF-8 | 1,815 | 4.09375 | 4 | [
"MIT"
] | permissive | /**
* A prime number is a whole number that has no other divisors other than
* itself and 1. Write a function that accepts a number and returns true if it's
* a prime number, false if it's not.
*/
var primeTester = function(n) {
var limit = Math.floor(Math.sqrt(n));
for(var i=2;i<=limit;i++){
if(n % i ===... | true |
5b2028031bb2e11cceba5ea0d7eada3e3484ac6a | JavaScript | DanielWebDev/node-js-essential-training | /03-02-start-app.js | UTF-8 | 771 | 3.859375 | 4 | [] | no_license | //console.log(process.argv);// displays the process.argv array that inclused a path to node and a path to the current file
function grab(flag) {
var index = process.argv.indexOf(flag);
// find index of flag in the array, return the value, the next variable in the array to get that value. if index === -1 we did not ... | true |
17d9e37ddcb6680bf606e7ba300e7a2a42f980f6 | JavaScript | Amitwe26/Weather-app | /src/services/weatherService.js | UTF-8 | 3,300 | 2.890625 | 3 | [] | no_license | import axios from 'axios';
import { storageService } from './storageService.js';
import { utilService } from './utilService.js';
const WEATHER_KEY = 'S7HgN9f5jGTGuiAAj8pUL6QwIrfwJlTH';
const KEY_WORD = 'WeatherDays';
export const weatherService = {
queryDaysWeather,
chackFavorite,
getCityKey,
saveWeatherCityT... | true |
09ef3eb69437ab2b5bc9a289d8044be1f813fd7f | JavaScript | julian-abhari/play4change | /Games/-LpGy4YIZUit2u9RS9I7/FSM.js | UTF-8 | 450 | 3.171875 | 3 | [] | no_license | class FSM {
constructor() {
this.stack = [];
}
update() {
var currentStateFunction = this.getCurrentState();
if (currentStateFunction) {
currentStateFunction();
}
}
getCurrentState() {
return this.stack.length > 0 ? this.stack[0] : null;
}
pushState(newState) {
if (this.ge... | true |
ec0ecc557018d574245041e1321feed668c5be4a | JavaScript | dblazevska/js-homework-projects | /project_2_js/index.js | UTF-8 | 803 | 3.828125 | 4 | [] | no_license |
// 1. Declare variables and use the assignment operators
let a = 1;
let b = 2;
let c = 3;
console.log(b);
console.log(b += 3); // b = b + 3
console.log(b -= 3); // b = b - 3
console.log(c /= 3); // c = c / 3
console.log(b *= 3); // b = b * 3
console.log(a %= 3); // a = ostatok od a / 3
// 2. Try out the two kind o... | true |
2a1a0c7341c54c6ee6fd534619c22f304e8cfaca | JavaScript | asdaviid/mock-pl-be | /tests/controllers/authCtrl.spec.js | UTF-8 | 2,689 | 2.515625 | 3 | [] | no_license | let chai = require('chai');
const expect = chai.expect;
let sinon = require('sinon');
const request = require('request');
const authController = require('../../controllers/auth.controller');
describe('controllers.auth', () => {
it('exists', () => {
expect(authController).to.exist;
});
it('has login functio... | true |
6d85ddbee64b14956104f85b68be555aad040c41 | JavaScript | Lidemy/mentor-program-3rd-peiyunchu | /homeworks/week2/hw5.js | UTF-8 | 544 | 4.0625 | 4 | [] | no_license | const join = (str, concatStr) => {
let answer = str[0];
// i = 1 是因為要從第二個元素前面插入字串
for (let i = 1; i < str.length; i += 1) {
answer += concatStr + str[i];
}
return answer;
};
const repeat = (str, times) => {
let result = '';
for (let i = 0; i < times; i += 1) {
result += str;
}
return result;... | true |
2cee630c4d31d881158553b14eff49828c77ad61 | JavaScript | liuwei9413/mybook | /javascript/面向对象.js | UTF-8 | 915 | 4.125 | 4 | [] | no_license | //原型继承 有问题
function SuperType() {
this.colors = ['red','yellow','blue'];
}
function SubType() {
}
//继承后 超类型实例等于子类型原型 超类型原本的实例属性相对于子类型而言就成了原型属性
SubType.prototype = new SuperType();
SubType.prototype.constructor = SubType;
var p1 = new SubType();
p1.colors.push('grey');
console.log(p1.colors); //["red", "yellow", "b... | true |
dc39bc829699baf0c38fe76941605374cfdcd54c | JavaScript | ejwoulfe/fundamentals | /myIsogram.js | UTF-8 | 824 | 3.796875 | 4 | [] | no_license | let str = "Rocky sdad";
function Isogram(str) {
if (str.length === 0 || str.length === 1) {
return true;
}
let trimmedStr = str.replace(/ /g, "").toLowerCase();
let isIsogram = true;
for (let i = 0; i < trimmedStr.length; i++) {
for (let j = i + 1; j < trimmedStr.length; j++) {
if (trimmedStr[i... | true |
7cacf2a9c2ffb4026f5785d64c47ccb228213e1a | JavaScript | nhemerling/just-node-api | /playground.js | UTF-8 | 1,375 | 3.5625 | 4 | [] | no_license | /*
const x = 'x';
const y = 'y';
console.log(x, y);
console.log('My %s has %d years', 'cat', 2);
console.log('%o', Number);
*/
/*
const x = 1;
const y = 2;
const z = 3;
console.count(
'The value of x is ' + x + ' and has been checked .. how many times?'
);
console.count(
'The value of x is ' + x + ' and has been... | true |
290a9472982835699b5a4ddb08ff4c370c787e35 | JavaScript | guilhermesennes/launchbaseRocketseat | /aulas/modulo-01/index.js | UTF-8 | 1,548 | 3.96875 | 4 | [] | no_license | const classA = [
{
name: "Guilherme",
grade: 9.8
},
{
name: "Cristiany",
grade: 10
},
{
name: "Victor",
grade: 2
}
]
const classB = [
{
name: "Débora",
grade: 7
},
{
name: "Robson",
grade: 2
},
... | true |
a0cff5e41b0b84a56622d64f76bae4d04a5e41df | JavaScript | dogpineapple/react-hackernews-class | /src/Story.js | UTF-8 | 458 | 2.796875 | 3 | [] | no_license | import React from "react";
// we can use a function component (its for presentation, since we don't need any state here.)
function Story(props) {
return (
<li><a href={props.url}>{props.title}</a></li>
);
}
export default Story;
// class Story extends React.Component {
// constructor(props) {
// sup... | true |
91a670e5a9ff57415314d00ae0c0fc290373cc2b | JavaScript | ClayBeBoy/ClaysFunGame | /Beans.js | UTF-8 | 1,056 | 3.03125 | 3 | [] | no_license | var image = new Image();
image.src='Sounds/poopBeans.png';
function addBean (x,y)
{
GAME.bean.push(new Bean(x,y));
}
function Bean (x,y){
this.x = x;
this.y = y;
}
var beanAddTimer=69;
function RenderBeans(context){
if(GAME.over==true)return;
else{
context.fillStyle='brown';
for (var i = 0; i<GAME.bean.le... | true |