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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e4893e76358cf750f866328aaa962075d30d0af9 | JavaScript | GillesRasigade/pattern | /src/Queue/Queue.js | UTF-8 | 563 | 2.6875 | 3 | [] | no_license | 'use strict';
const EventEmitter = require('events').EventEmitter;
/**
* Queue object extending the EventEmitter class.
*
* @alias Queue
* @constructor
*
* @param {Object} options EventEmitter object configuration
*/
class Queue extends EventEmitter {
constructor(options) {
const _options = Object.assign... | true |
ef8ec52041082a7645184466a5bd6b830025f483 | JavaScript | GaoZhiChaoChina/React_chouchou | /src/components/home/other/commonly/reactHooks.js | UTF-8 | 2,140 | 2.828125 | 3 | [] | no_license | import React, { useState, useEffect, useRef } from 'react'
import { cold } from 'react-hot-loader'
import { Row, Col, Button } from 'antd'
let flag = true
const ReactHooks = () => {
const [count, setCount] = useState(0)
const ref = React.useRef(count)
const increment = () => {
setCount(count + 1)
... | true |
cac719c3edebe3f20cd54438c1927c90d9146f7b | JavaScript | jzamora5/holbertonschool-interview | /0x0F-starwars_api/0-starwars_characters.js | UTF-8 | 892 | 2.640625 | 3 | [] | no_license | #!/usr/bin/node
const argv = process.argv;
const urlFilm = 'https://swapi-api.hbtn.io/api/films/';
const urlMovie = `${urlFilm}${argv[2]}/`;
const request = require('request');
request(urlMovie, function (error, response, body) {
if (error == null) {
const fbody = JSON.parse(body);
const characters = fbody.... | true |
4fc2c19db8dce9501e126ab8d23a49ec2a8f4ade | JavaScript | qxh021314/competition-ui | /utils/chunkArray.js | UTF-8 | 745 | 3.1875 | 3 | [] | no_license |
/**
* 数据分组
* arr <array> 源数组
* size <number> 子数组长度
* fill <any> 空位数据
* 如:([1,2,3,4,5],2) -> [[1,2], [3,4], [5, null]]
*/
export default function chunkDataWithInUI(arr, size, fill = null) {
let ret = []
if (arr.length === 0) return []
if (size > 1) {
const len = arr.length
const ri = len / size // 行数
let... | true |
2d6adc18ce078f7c83cff0c0207c44efd9bf4b0f | JavaScript | MrWinston700/real_world_math_frontend | /src/components/Question.js | UTF-8 | 1,119 | 2.828125 | 3 | [
"MIT"
] | permissive | import React, { Component }from 'react'
class Question extends Component {
// const Question = (data) => {
// console.log(data)
// const questionData = data.pop()
// if(questionData !== undefined) {
// //
// console.log(questionData.question);
// const question = questionData.question
render() {
... | true |
930c75c1aa5bd7143a271688aa38f76e620535e5 | JavaScript | aidchumacero/laboratorio1 | /candies.js | UTF-8 | 135 | 2.984375 | 3 | [] | no_license | function candies(n,m){
a = 0;
b = 0;
a = parseInt(m/n);
b = parseInt(a*n);
return parseInt(b);
}
console.log(candies(3,10));
| true |
d97d16a256fa1592b63017e03d16af4cef6f2a1d | JavaScript | drraken/stayStrong-app | /src/pages/Product/Product.js | UTF-8 | 8,926 | 2.515625 | 3 | [] | no_license | /* eslint-disable react/destructuring-assignment */
/* eslint-disable react/prop-types */
/* eslint-disable react-hooks/exhaustive-deps */
import React,{useState,useEffect} from 'react';
import './Product.scss';
import { API } from 'aws-amplify';
import { useHistory } from 'react-router-dom';
import Loading from '../..... | true |
6921ab4289f1868f35c0d19cb10aef16720cfac3 | JavaScript | ofelya-mikayelyan/cs110_hw2 | /stars.js | UTF-8 | 570 | 3.265625 | 3 | [] | no_license | <!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" src="factorial.js"></script>
<script type="text/javascript">
const Space = function(spc){
if(spc === 0){
return"";
}
return" " + Space(spc-1);
};
const Stars = function(str){
if(str <= 0){
return"";
}
return"*" + Star... | true |
db3533c5c852d32d9d33e69466270bcfe12a79a4 | JavaScript | lordzohar/resort | /index.js | UTF-8 | 3,393 | 2.640625 | 3 | [] | no_license | $(document).ready(function()
{
$.ajax({
type: "GET",
url: "sample.xml",
dataType: "xml",
success: function(xml){
$(xml).find('schedule').each(function(){
var roomno = $(this).find('roomno').text();
var price = $(this).find('price').text();
var status =$(this).find('status').tex... | true |
18ace1c7766b0e08636e0cb4d6549edd74f0d870 | JavaScript | Zaiba123/WebDevToDo | /WEBDEV-NEWTODO/src/App.js | UTF-8 | 1,978 | 2.75 | 3 | [] | no_license | import React, { Component } from 'react';
import {BrowserRouter as Router, Route} from 'react-router-dom';
import Header from './components/layout/Header';
import './App.css';
import Todos from './components/Todos';
import AddTodo from './components/AddTodo';
import About from './components/pages/About';
import axios f... | true |
fbd6511813ecaa55bae0cf5a0f67fb9ec4e5daa0 | JavaScript | martreyz/ejercicios-de-adalab | /Pruebas/Ejercicio Global/main.js | UTF-8 | 3,550 | 3.203125 | 3 | [] | no_license | 'use strict';
const preview = document.querySelector('.js-preview');
const tbody = document.querySelector('.js-tbody');
const buttonCart = document.querySelectorAll('.js-buttoncart');
const infoProduct1 = {
name: "Node JS",
price: 16,
imgUrl: "./camiseta.jpg",
units: 0
}
const infoProduct2 = {... | true |
c9def833d846d35fc2929c1eb92f49c299a212ab | JavaScript | radishengine/denormalize | /GIF.js | UTF-8 | 8,235 | 2.59375 | 3 | [] | no_license | define(function() {
'use strict';
const UNCOMPRESSED_MODE = true;
const ONEBYTE_128_255 = (function() {
var abuf = new ArrayBuffer(128);
var arrays = new Array(128);
for (var i_arr = 0; i_arr < 128; i_arr++) {
(arrays[i_arr] = new Uint8Array(abuf, i_arr, 1))[0] = 128 + i_arr;
}
re... | true |
e643e72988f3c39c5cac9eebfaeb857138454600 | JavaScript | polytropo/FSWD-JS-DAY03 | /basic3.js | UTF-8 | 249 | 3.28125 | 3 | [] | no_license | function myfunction (array) {
var product = 1;
for (i = 0; i < array.length; i++){
product *= array[i];
var result = product;
}
return result;
}
var numbers1 = [4, -15, 44, 847, -2, 4, 11, 3];
console.log(myfunction(numbers1)); | true |
8e18a135f76e6b21c73050a32ece5610ace7e936 | JavaScript | BogUkraine/nodejs-hw-3-backend | /server/routes/trucks.routes.js | UTF-8 | 5,845 | 2.53125 | 3 | [] | no_license | const {Router} = require('express');
// eslint-disable-next-line new-cap
const router = Router();
const Truck = require('../models/Truck');
const User = require('../models/User');
const auth = require('../middleware/auth.middleware');
const validate = require('../middleware/valid.middleware');
const validTruck = requi... | true |
8f6909d18811d4ecfcd962d0818de39629bbc1f6 | JavaScript | andrew-t-james/headcount2.0 | /src/test/unit/iteration-1-part2.test.js | UTF-8 | 864 | 2.828125 | 3 | [] | no_license | import DistrictRepository from '../../helper.js';
import kinderData from '../../data/kindergartners_in_full_day_program.js';
describe('DistrictRepository iteration 1 - part 2', () => {
const district = new DistrictRepository(kinderData);
test('findAllMatches defaults to returning all data in an array', () => {
... | true |
4c4f679409554fbbd6c3ad27b9f6093f7f06a20c | JavaScript | JenilaS599/Employee-survey | /src/pages/employees.js | UTF-8 | 1,532 | 2.515625 | 3 | [] | no_license | import React from 'react'
import { useState, useEffect } from 'react'
import axios from "axios";
import 'bootstrap/dist/css/bootstrap.min.css';
import '../index.css';
export default function Employees() {
const [EmployeeData, setEmployeeData] = useState('');
const getEmployeeData = () =>{
ax... | true |
290346b593d175def01cfece39e56b50cf417242 | JavaScript | peterneely/doctors | /src/doctors/reviewViewModel.js | UTF-8 | 1,172 | 2.578125 | 3 | [] | no_license | import _ from 'lodash';
import { formatDate, getRandomDate } from '../services/dateUtils';
import { getRandomIndexes } from '../services/numberUtils';
const extendReviews = (reviews, authors) => {
const limitedReviews = getRandomIndexes(20).reduce(
(chosenReviews, index) => [...chosenReviews, reviews[index]],
... | true |
0039ef17ce20f8658bb3d25f76c8abe95c489770 | JavaScript | Carsinalys/Pink | /app/js/index.js | UTF-8 | 10,156 | 2.578125 | 3 | [] | no_license |
//сдайдер
$(document).ready(function () {
(function () {
function changeSlide(item, tab, itemActive) {
tab.addClass('active_tab').siblings().removeClass('active_tab');
itemActive.fadeOut(200, function () {
item.fadeIn(200, function () {
$(this).ad... | true |
9dd6a39783c3635ccce0671a1d15c227ba7691f2 | JavaScript | KillerCodeMonkey/baqend-blog | /js/main.js | UTF-8 | 493 | 2.59375 | 3 | [
"MIT"
] | permissive | function showPosts() {
DB.Post.find()
.descending("date")
.limit(30)
.resultList()
.then(function(result) {
var html = "";
var converter = new showdown.Converter();
result.forEach(function(msg) {
html += '<div class="col-md-4"><h2>';
html += msg.title + '</h2><p>' + ... | true |
d62f60af4734ba2fddd4caac22fe520ea57e08df | JavaScript | jdd2007/JavaScript-III | /assignments/this.js | UTF-8 | 3,597 | 4.65625 | 5 | [] | no_license | /* The for principles of "this"; in your own words. explain the four principle for the "this" keyword below.
*
* 1. Window/Global Object Binding: It might be ambiguous what the value of 'this' is in JS, but it is always contextual. The FIRST principle is that there is an object I think of as a background object, but kn... | true |
563a37d95c8e8d7bc729cc889b2d59652560439b | JavaScript | ameerrah9/fewpjs-iterators-fndcl-fnexpr-filter-lab-onl01-seng-pt-050420 | /index.js | UTF-8 | 360 | 3.046875 | 3 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | function findMatching(drivers, driverList) {
return drivers.filter(n => n.toLowerCase() === driverList.toLowerCase());
}
function fuzzyMatch(drivers, driverList) {
return drivers.filter(n => n.toLowerCase().indexOf(driverList.toLowerCase()) === 0)
}
function matchName(drivers, driverList) {
return driver... | true |
925c1e24f12d904c5131c07fe4089fc019223257 | JavaScript | xavizus/Webb19-forum | /components/form/InputField.jsx | UTF-8 | 1,827 | 2.53125 | 3 | [
"MIT"
] | permissive | import React, {useEffect, useState} from 'react';
import {isPromise} from '../../utilities/validators';
const InputField = ({onChangeFunction, value, placeholder, type, name, label, required, index, setValue, hideLabel}) => {
const [data, setData] = useState(null);
const [isLoaded, setIsLoaded] = useState(fal... | true |
0a53a1687f311fc4c0a6e2a59880e5ed328bbfb8 | JavaScript | adammking/beervana | /front-end/src/components/NewBeerForm.js | UTF-8 | 3,290 | 2.640625 | 3 | [] | no_license | import React from 'react';
function NewBeerForm() {
const [beerData, setBeerData] = useState({
name: "",
brewery_id: `${breweryName}`,
abv: "",
ibu: "",
descript: ""
});
function handleChange(evt) {
const {name, value} = evt.target;
setBeerData(... | true |
95998d7a44f897f53a97c01c328eb7fb63d0d664 | JavaScript | davidvollmar/ld33 | /src/wall.js | UTF-8 | 826 | 2.671875 | 3 | [
"MIT"
] | permissive | var PIXI = require('pixi.js');
var GameObject = require('./gameobject');
var Cell = require('./cell');
var CellType = require('./CellType');
import { toModelCoordinates, toCanvasCoordinates } from './CoordinatesMapper';
/**
* A cell that can't be walked through.
*/
class Wall extends Cell {
/**
* Creates a new W... | true |
7f4c8b37a2f2cf96ebe7d3d02c9b68d5c5095eba | JavaScript | jm-sky/3d-portfolio | /src/library/Star.js | UTF-8 | 767 | 2.546875 | 3 | [] | no_license | import * as THREE from 'three';
import math from '../library/src/math';
class Star {
//-------------------------------
constructor(options = {}) {
this.options = options;
this.spread = options.spread || 100;
this.init();
}
//-------------------------------
init() {
this.geometry = new THREE.S... | true |
a506d826974df5ed0d449270982030528167440e | JavaScript | booleangate/Klib | /tests/collections.js | UTF-8 | 3,147 | 3.34375 | 3 | [] | no_license | var K = require("../dist/K.min.js");
var test = require("tape");
test("concat", function(t) {
var a1 = [1, 2], a2 = [3, 4],
s1 = "as", s2 = "df";
// Concat array
t.same(K.concat(a1), a1, "array + undefined");
t.same(K.concat(null, a1), a1, "null + array");
t.same(K.concat(a1, a2), a1.concat(a2), "array + arr... | true |
55b58fe3f3be9d2efe875a72c2a0b3a1bed16365 | JavaScript | dividead/interviews | /leetcode/my/125_valid_palindrome.js | UTF-8 | 207 | 3.375 | 3 | [] | no_license | var isPalindrome = function (s) {
s = s.replace(/\W/g, '').toLowerCase()
let lo = 0
let hi = s.length - 1
while (lo < hi) {
if (s[lo] != s[hi]) return false
lo++
hi--
}
return true
}; | true |
5169cc057ce2a9a827dbb819983af40a013f8740 | JavaScript | roi-isr/LBR-Diamonds-LTD-Final-Project | /src/Components/Admin/ContactData/jsx/ContactData.jsx | UTF-8 | 5,917 | 2.515625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import Button from 'react-bootstrap/Button';
import ManagementTable from '../../../ManagementTable/jsx/ManagementTable';
import { getValidToken } from '../../../../ApiEndpoints/Authentication';
import Loader from 'react-loader-spinner';
import '../css/ContactData.css'... | true |
b12adaf431846b8dcb7f02452bc912aba75aa55b | JavaScript | jhonvo/GettingGithub | /js/index.js | UTF-8 | 946 | 3.265625 | 3 | [] | no_license | function fetchuser(){
let URL = `https://api.github.com/users/${username}`;
let settings = {
method : 'GET'
};
fetch(URL, settings)
.then ( response => {
console.log (response);
if (response.ok){
return response.json();
}
... | true |
cbc68c4bbf72581cf1ed3d62d3556b0c1363c014 | JavaScript | H-Senhaji/evaluationclient | /src/components/batch/batchDetails/batchDetailsContainer.js | UTF-8 | 3,245 | 2.65625 | 3 | [] | no_license | import React from "react";
import BatchDetails from "./batchDetails";
import { connect } from "react-redux";
import { loadBatches } from '../../../actions/batches';
class BatchesDetailsContainer extends React.Component {
constructor() {
super();
this.state = {
batchdetails: [],
id: null,
... | true |
5b6a1ca2a94d74d0153ee83eae2bc41f01e145b9 | JavaScript | nickvdw/memory-cards | /script.js | UTF-8 | 1,960 | 3.59375 | 4 | [] | no_license | // intial variables
const cards = document.querySelectorAll('.memory-card');
let cardFlipped = false;
let boardLocked = false;
let firstCard, secondCard;
// function that flips a card
function flipCard() {
// don't flip if the board is locked or if this is the first card
if (boardLocked || (this === f... | true |
ed17cd60fdf73cabd4ffc016ca5f0d506d854074 | JavaScript | ahribori/daily-algorithm | /solutions/programmers/네트워크.js | UTF-8 | 540 | 3.46875 | 3 | [] | no_license | function solution(n, computers) {
let answer = 0;
const visited = [];
function dfs(original, i) {
if (visited[i]) {
return 0;
}
visited[i] = true;
for (let j = 0; j < original.length; j++) {
if (original[i][j] === 1) {
dfs(original, j);
}
}
return 1;
}
for... | true |
35a991cfe8513fc84731e4db52ed4a8741cdd1d7 | JavaScript | EmmaPhommatha2020/Node-Folder | /day3/node-note.js | UTF-8 | 5,174 | 3.265625 | 3 | [] | no_license |
// NPM //
/*
NPM = Node Package Manager
• install code package managers shared by others.
• a tool used from the command line.
• automatically installs dependencies of packages we install.
*/
// NPM install //
/*
• use (--save) to save the package.
• if you see error = like: EACCES: use (sudo infront of everythin... | true |
ee7bbd50864db28bbccddb38daed763268f35bd0 | JavaScript | stoconnor/generator-graphql-rocket | /generators/app/templates/infrastructure/src/db/logging/tarnLogging.js | UTF-8 | 2,188 | 2.625 | 3 | [
"MIT"
] | permissive | require('colors')
const message = (eventId, resource) => `${eventId} available resource: ${resource.available} healthy: ${resource.healthy} knexUid: ${resource.__knexUid}`
module.exports.initializeTarnLogging = (pool) => {
// resource is acquired from pool
pool.on('acquireRequest', eventId =>
console.l... | true |
c0409c564498dbaa82077f03aae4bb027361adf5 | JavaScript | JinminYANG/baekjoon | /나머지.js | UTF-8 | 526 | 2.828125 | 3 | [] | no_license | // 3052
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let input = [];
rl.on('line', (line) => {
input.push(line);
}).on('close', () => {
let divides = input.map((element) => parseInt(element) % 42);
let... | true |
9b0c1a1d96b7a4a4cb1f14775cbdc0b2ab727b68 | JavaScript | marlonbrum/Br1.Common.JS | /Br1StringHelpers.js | UTF-8 | 4,980 | 3.296875 | 3 | [] | no_license | /*************************************************************************************
* Polyfills para métodos de String
* (Um polyfill é um método que é adicionado ao tipo caso não exista, para suprir uma
* incompatibilidade de browser. Se o browser já dá suporte ao método nativamente, usa-se
* ... | true |
96f98bd712c95e03d1e73dbeb82e45c569472834 | JavaScript | davidcorcoran/condicio | /dist/condicio.js | UTF-8 | 11,308 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | /**
* @preserve
* condicio.js - A preconditions library for JavaScript similar to Google's Preconditions from Guava
* Version 2.0.0
* Written by Vivin Paliath (http://vivin.net)
* License: BSD License
* Copyright (C) 2015
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
... | true |
d27960305da4a25db6d0864aa2a87ddb9e3f8e7b | JavaScript | Saw-mon-and-Natalie/ic-auto-tek | /src/hooks/use-intersection-observer/intersection.js | UTF-8 | 3,822 | 2.78125 | 3 | [] | no_license | // ref: https://github.com/thebuilder/react-intersection-observer/
const INSTANCE_MAP = new Map()
const OBSERVER_MAP = new Map()
const ROOT_IDS = new Map()
let consecutiveRootId = 0
/**
* Generate a unique ID for the root element
* @param {Element} root
*/
const getRootId = root => {
if( !root ) return ''
... | true |
b99809127714472eddcd1ed26f2d8637546c78e9 | JavaScript | bsalgado98/LongLine | /js/Algorithm.js | UTF-8 | 3,118 | 3.34375 | 3 | [] | no_license | class Algorithm {
constructor(array, method) {
this.array = array;
this.method = method;
this.animationHelper = new Animate(this.array)
this.animationSteps = []
this.moveAmount = array.length
this.moveFactor = array.length/2
}
timeout(ms) {
return new ... | true |
117c118160934600a3f4ea4bb4d70ed72f584405 | JavaScript | juhyn88/JSP | /JspWorks3/MemberDB/WebContent/resources/js/validation.js | UTF-8 | 916 | 3 | 3 | [] | no_license | /**
* 회원 등록 폼 유효성 검사
*/
function checkForm(){
var form = document.regForm;
var id = form.memberId.value;
var pwd1 = form.passwd.value;
var pwd2 = form.passwd_confirm.value;
var name = form.name.value;
var regExId = /^[a-zA-Z0-9]{4, 10}$/; //영문 대소문자, 숫자 조합 4자에서 10자까지 입력
if(!regExId.test(id) ||... | true |
ea5c317e7d9bc10a6bf481bc9191b26d871ac3c5 | JavaScript | shubham184/RoutingLogic_v2.0 | /src/answerGenerator.js | UTF-8 | 2,220 | 3 | 3 | [] | no_license | /* eslint linebreak-style: ["error", "windows"] */
class AnswerGenerator {
static newReplyObject() {
return { replies: [] };
}
static newMessagesObject() {
return { messages: [] };
}
static generateTextAnswer(text) {
const answer = {
type: "text",
content: text,
};
return an... | true |
1a1a05f24f348849160de8f2ed79a639b0fbbcc3 | JavaScript | PeterDoom/JavaScript-Excercises-SoftUni | /MatricesRipples.js | UTF-8 | 501 | 4.25 | 4 | [] | no_license | //A fun excersice that let's you pick coordinates for a starting number in a 2D matrice and creates 'riples' of numbers around it.
function solve([cols, rows, x, y]) {
let matrix = [];
for (let row = 0; row < rows; row++) {
matrix[row] = [];
for (let col = 0; col < cols; col++) {
... | true |
124bb328db28748424f61e9db675c474557ccfad | JavaScript | butlersrepos/reduxtris | /state-stuff/reducer.js | UTF-8 | 2,480 | 2.609375 | 3 | [] | no_license | let GameStates = require('../game-logic/game-states');
let ActionTypes = require('./action-types');
let Piece = require('../game-logic/piece');
let PieceBag = require('../game-logic/piece-bag');
let GameGrid = require('../game-logic/game-grid');
let MoveReducers = require('./reducers/move-reducers');
let GameLoop = req... | true |
c81c802a641c467d67117cf2ba2bf6ae6cec5b09 | JavaScript | nanoghelfi2/brothers-birras | /private/js/despliega.js | UTF-8 | 992 | 2.671875 | 3 | [] | no_license |
function productos(){
var mostrar = document.querySelector('.contenedorProducto');
if(mostrar.style.display === 'none'){
mostrar.style.display = 'block';
document.querySelector('.lugarEntrega').style.display = 'none';
document.querySelector('.botonProductos').style.boxShadow = '0 0 8px 1px black';
document.qu... | true |
1920e6c66643206d5ce78b99cfe2ef92a9e7db00 | JavaScript | powch/wifeweather | /src/reducers/index.js | UTF-8 | 1,055 | 2.734375 | 3 | [
"MIT"
] | permissive | import { SET_WEATHER_DATA } from '../constants/action-types';
const testData = {
weather: {
name: 'Charleston',
currentTemp: 61,
dailyHigh: 63,
dailyLow: 60,
currentConditions: 'Drizzle',
conditionDescription: 'light intensity drizzle',
currentWind: 10,
icon: `https://openweathermap.o... | true |
d54557edc3f722a36443a6a649016751d2635b6b | JavaScript | AriaGGosu/Estructuras-de-datos | /forEach.js | UTF-8 | 1,274 | 4.5625 | 5 | [] | no_license | // // funciones de orden superior en javascript
// uno de los principales usos de las funciones de orden superior en
// javascript es para iterar sobre arreglos (Arrays).
// EL objeto de array en javascript tiene los siguientes metodos en su prototipo
// [ ]Array.forEach();
// forEach() funciona como un loop para re... | true |
f304850638a01ca42712a09809b6c6257847c184 | JavaScript | 3esawe/VAW | /static/index.js | UTF-8 | 719 | 3.125 | 3 | [] | no_license | document.addEventListener('DOMContentLoaded', () =>{
document.querySelector('#name').onkeyup = () =>
{
const request = new XMLHttpRequest();
const username = document.querySelector('#name').value;
request.open('POST', '/check');
request.onload = () => {
// Extract json object
response... | true |
d8e91e88f20d4168606a7ad65157b8f6e305ad3a | JavaScript | acgotaku/leetcode | /algorithms/javascript/087.scrambleString/scrambleString.spec.js | UTF-8 | 848 | 2.609375 | 3 | [] | no_license | import { isScramble } from './scrambleString'
describe('isScramble', function () {
it('test case 1', function () {
const s1 = 'great'
const s2 = 'rgeat'
expect(isScramble(s1, s2)).toEqual(true)
})
it('test case 2', function () {
const s1 = 'abcde'
const s2 = 'caebd'
expect(isScramble(s1, ... | true |
c2e1a8f63bf796d0cac58a3d150a328e6b76b1fb | JavaScript | akipekoren/Survey-Application-Nodejs-React | /server.js | UTF-8 | 4,830 | 2.609375 | 3 | [] | no_license | const express = require("express");
const morgan = require("morgan");
const db = require("./data.js");
const session = require("express-session"); // session middleware
const passport = require("passport");
const passportLocal = require("passport-local");
const cors = require("cors");
const path = require("path");
con... | true |
9b58acfdfcffe37ac4ac398c5810f9ca7da5bfa5 | JavaScript | KuristinaMakise/ObjectModelLab | /src/model/index.js | UTF-8 | 2,620 | 3.171875 | 3 | [] | no_license | //var SensorType = Object.freeze("TEMPERATURE":1, "HUMIDITY":2, "LIGHT":3, "SWITCH":4, "DOOR":5, "FAN_SPEED":6);
const SensorType = {
TEMPERATURE: 'TEMPERATURE',
HUMIDITY: 'HUMIDITY',
LIGHT: 'LIGHT',
SWITCH: 'SWITCH',
DOOR: 'DOOR',
FAN_SPEED: 'FAN_SPEED',
}
export const decod = (fichierJSON) =>
{
var fichierLon... | true |
39e217d9f0ff7b5d0e146f4cd57cf8e7588c10ce | JavaScript | ArekStasko/fiinger_backend | /controllers/thingControllers.js | UTF-8 | 610 | 2.609375 | 3 | [] | no_license | const Thing = require('../models/thing')
exports.getThings = async(req, res) => {
const { category } = req.params
const id = req.query.userID
const things = await Thing.find({category: category, author: id})
res.send({things})
}
exports.createThing = async(req, res) => {
const thing = new Thing(... | true |
d812c06c86dfbb3c22d488ef7cd31bd284e528c6 | JavaScript | lydiavangammeren/WincAcademy_Front-end_alle_opdrachten | /Module05_Level18/5_003_Array Methods deel 1/script.js | UTF-8 | 2,348 | 4.25 | 4 | [] | no_license | //A Schrijf een JavaScript functie om het woord "cool" aan een array met strings toe te voegen.
// Gebruik de .push method.
const addTheWordCool = function(array){
array.push('çool');
return array;
}
//console.log("Add cool:", addTheWordCool(["nice", "awesome", "tof"]));
// resultaat: ["nice", "awesome", "tof", ... | true |
039a6f5fceb335aedad7ee726b1405a5df6fd54b | JavaScript | connieelee/redux-ts | /js/tests/helpers/reducer.js | UTF-8 | 885 | 2.828125 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initialState = {
cats: [],
dogs: [],
};
function catsReducer(prevState = exports.initialState, action) {
const nextState = Object.assign({}, prevState);
switch (action.type) {
case 'ADD_CAT': {
nextS... | true |
7e29f6ded83f660e722167f8c5454bdd40c4ee58 | JavaScript | Anatoliy700/BasicCourse_JavaScript | /lesson_6/Anatoliy/task_3/js.js | UTF-8 | 9,865 | 2.90625 | 3 | [] | no_license | "use strict";
/**
* @property {Object} settings Объект с настройками галереи.
* @property {string} settings.previewSelector Селектор обертки для миниатюр галереи.
* @property {string} settings.openedImageWrapperClass Класс для обертки открытой картинки.
* @property {string} settings.openedImageClass Класс открытой... | true |
cda621c07f1de7e91868b2c5a6d0c7a092a2b718 | JavaScript | ChipsGaming/test | /public/js/src/modules/World.js | UTF-8 | 3,208 | 2.734375 | 3 | [] | no_license | if(typeof define !== 'function'){
var define = require('amdefine')(module);
}
define(function (require) {
UnitState=require('./UnitState');
function World (step, game) {
this.game=game;
this.players={};
this.step=step;
this.lastId=-1;
}
World.prototype.createSprite=... | true |
7d36cbd4f806614d580887a14bb0519d99905943 | JavaScript | raphaklaus/es6-promises-and-generators | /generators.js | UTF-8 | 696 | 3.171875 | 3 | [] | no_license | 'use strict';
var q = require('q');
// function* numberGenerator(){
// console.log('Started');
// var index = 0;
// while (true){
// console.log('Before add');
// yield index++;
// console.log('After add');
// }
// }
// var gen = numberGenerator();
// console.log(gen.next().value);
// console.log(... | true |
c89c669a8fb8c37ad798acc7e31c3c8d7fd8778e | JavaScript | XSasami/-TypeScript-demo | /拖动小球.js | UTF-8 | 3,152 | 3.203125 | 3 | [] | no_license | // 获取元素
var container = document.querySelector(".container");
var addBtn = document.querySelector(".addBtn");
var flag = false;
var newEle = null;
var tarEle = null;
var mouseX = null;
var mouseY = null;
var topSize = 99;
var colorList;
(function (colorList) {
// "red" = 1,
colorList[colorList["red"] = 0] = "re... | true |
fbba78cc3dbfc4e161ed873b4dac81a853412709 | JavaScript | clay-whitley/p9_client_server | /public/js/application.js | UTF-8 | 529 | 3.015625 | 3 | [] | no_license | $(document).ready(function() {
$('.awesomeness_teller').on('click', function() {
var awesomeValue = $(this).data('heading');
$('#awesomeness_holder').text(awesomeValue);
});
$('.skill_teller').on('click', function(){
var path = window.location.pathname;
var regex = /[^/]+$/;
var skill = regex... | true |
552b3602e1b6bb11b98795741ecf76ed725bf436 | JavaScript | maaazahmed/thepagex | /src/store/reducers/MyInfosReducer/MyInfosReducer.js | UTF-8 | 2,429 | 2.515625 | 3 | [] | no_license | import {
LOGIN_USER,
UPDATE_MY_USER_INFOS,
GET_MY_INFOS,
LOGOUT_USER,
UPDATE_MY_PROFILE,
} from '../../actions/ActionType';
const initialState = {
dateOfCreation: '',
token: '',
fullname: '',
firstname: '',
lastname: '',
profilePhoto: '',
userId: '',
email: '',
passion: {
title: '',
description: '',
... | true |
3a99406a724275daec4f9b17e5fc353605469a99 | JavaScript | DevKeravi/learning-reacthooks | /src/useClick/index.js | UTF-8 | 813 | 2.9375 | 3 | [] | no_license | import React, { useState, useEffect, useRef } from "react";
import ReactDOM from "react-dom";
const useClick = (onClick) => {
const ref = useRef();
useEffect(() => {
const element = ref.current;
if (element) {
element.addEventListener("click", onClick);
}
// useEffect 사용시 return으로 함수를 주면 comp... | true |
164fc642af8bd75f4a19653d9f4e94bb19d27fad | JavaScript | hugopsp/nodewpg | /js/ex_142/index142.js | UTF-8 | 670 | 3.703125 | 4 | [] | no_license | const firstPerson = ['Hugo ', 'Prado ', '1179 Grant Av ', 16];
// const secondPerson = ['Serafim ', 'Prado ', '1179 Grant Av ', 76]; //to test the second person with different names
const secondPerson = ['Hugo ', 'Prado ', '1179 Grant Av ', 16];
const reduceF = firstPerson.reduce(function(accumulator, currentValue) {
... | true |
02c81a5305101c59c6787b2f2f8f33ed54ddb1d4 | JavaScript | spencern/javascript30 | /11-custom-video-player/index.js | UTF-8 | 2,493 | 2.921875 | 3 | [] | no_license | const video = document.querySelector('video.viewer');
const playButton = document.querySelector('.player__button.toggle');
const skipButtons = document.querySelectorAll('.player__button:not(.toggle)');
const playbackRateSlider = document.querySelector('input[name="playbackRate"]');
const volumeSlider = document.querySe... | true |
2b846fcd149cef27068aa82f3112233333adaee8 | JavaScript | sandalio7/ejercicios-js | /TP3-Arreglos y funciones/ejercicio-3.js | UTF-8 | 246 | 3.203125 | 3 | [] | no_license | function random(){
return Math.floor(Math.random() * (7 - 1) + 1);
}
function random2(){
return Math.floor(Math.random() * (7 - 1) + 1);
}
let numero1 = random()
let numero2 = random2()
let suma = numero1 + numero2
let sumas = [suma]
| true |
3457e50f3e90654f1d1ec0c7695bb9639170a206 | JavaScript | rickOls/cursowebudemy | /07 esnext/07 map.js | UTF-8 | 1,210 | 3.875 | 4 | [] | no_license | const tecnologias = new Map() //instancia tecnologia como new map como obj gerado por map
tecnologias.set('react', { framework: false }) // com o set vc atribui em react o atributo framework
tecnologias.set('angular', { framework: true })
console.log(tecnologias.react) //vc não consegue acessar o atributo dessa f... | true |
ab79fe2a12c261828d6f1b11c36424e0df6ba669 | JavaScript | natealcedo/budget-watch-client | /src/reducers/authentication.js | UTF-8 | 389 | 2.625 | 3 | [] | no_license | import { SET_USER } from "../actions/actionTypes";
import { isEmpty } from "lodash";
const initState={
isAuthenticated: false,
user: {}
};
export default function authentication(state=initState, action){
switch(action.type){
case SET_USER:
return {
...state,
isAuthenticated: !isEmpty(action.u... | true |
82d0964b9705a16a5b0dc0a8ec00c819b0d5c897 | JavaScript | LauraBrandt/url-shortener | /src/redirect.js | UTF-8 | 959 | 2.59375 | 3 | [
"MIT"
] | permissive | 'use strict';
var Url = require("./url_model.js");
module.exports = function(req, res) {
var shortUrl = req.headers['x-forwarded-proto'] + '://' + req.headers.host + '/' + req.params.shortid;
getOrigURL(shortUrl,
function(err, origUrl) {
if (err) console.error(err);
... | true |
195d7195c6b07d925724a2b52f03d03c11feeb92 | JavaScript | sethips/Destroyer | /renderer.js | UTF-8 | 8,158 | 2.9375 | 3 | [] | no_license | var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
var ballRadius = 10;
var x = canvas.width/2;
var y = canvas.height-30;
var dx = 3;
var dy = -3;
var paddleHeight = 10;
var paddleWidth = 75;
var paddleX = (canvas.width-paddleWidth)/2;
var rightPressed = false;
var leftPress... | true |
12bd0aa8cb51acd2b7ae5a7b206f743cfbdaf60a | JavaScript | andrudog7/brunchr | /src/Actions/UserActions.js | UTF-8 | 6,098 | 2.734375 | 3 | [
"MIT"
] | permissive | const signUpUser = (user) => ({type: "SIGN_UP_USER", payload: user})
const loginUser = (user) => ({type: "LOGIN_USER", payload: user})
const addRestaurant = (restaurant) => ({type: "ADD_TO_PROFILE", restaurant})
const removeRestaurant = (restaurant_id) => ({type: "REMOVE_FROM_PROFILE", restaurant_id})
const updateResta... | true |
8828f69220f0e596f8ea743fcc3dad14e52c0b2f | JavaScript | EnglishAdam/colyseus-nuxt-express-example | /server/colyseus/verifyClient.js | UTF-8 | 1,347 | 2.546875 | 3 | [
"MIT"
] | permissive | const consola = require('consola')
const isServerTokenWorking = true
/**
* Verification function to verify clients
*
* @param {*} info
* @param {string} info.origin - Origin of sender
* @param {Object} info.req - Request object of sender
* @param {boolean} info.secure - Flag determining if request secure
* @p... | true |
2b577f11a0d0b23dffe65feccaa0c6fd333ed334 | JavaScript | angeloparchitelli/IoT-Reflective-Persistence-System | /reflective_middleware/classes/FileObserver.js | UTF-8 | 3,031 | 2.8125 | 3 | [
"MIT"
] | permissive | function FileObserver(fn) {
this.fs = require('fs');
this.setFileName(fn);
this.settings = null;
};
FileObserver.prototype.observe = function() {
console.log("(II) Observing file " + this.fileName);
var p = this;
p.fs.readFile(p.fileName, 'utf8', function(err, data) {
if(err) {
console.log("(EE) ... | true |
5a5e7b004801a3373bce96807c08cc467ef2d305 | JavaScript | t3qdev/nextg | /src/main/webapps/resources/js/jquery.SHVirtualForm.js | UTF-8 | 1,873 | 2.71875 | 3 | [
"MIT"
] | permissive | /*
Virtual Form Submit
0.1 : 초기버전...
$("body").SHVirtualForm({
vForm:{action:""},
vInput:[{input:"a":value:"a"},{input:"b":value:"b"}]
}).submit();
*/
;(function ($, window, document, undefined) {
var pluginName = "SHVirtualForm",
dataKey = "plugin_" + pluginName;
var Plugin = f... | true |
0b82b8dc8d30aaedf9b82610e7e51ea8bda9de62 | JavaScript | harshshah78910/JavaScript-Foundation | /ObjectCreationEx.js | UTF-8 | 449 | 3.765625 | 4 | [] | no_license | //How to create object
var person = {
firstname:'Harsh',
lastName:'Shah',
address:'Pune',
birthYear:1994,
job:'Software Developer',
family:['Jinesh','Poonam','Mom','Dad']
};
console.log(person);
console.log(person.firstname);
console.log(person.lastName);
console.log(person['address']);
... | true |
3c6478ab68cfca761b86e8633f2e906dd1a3eb6f | JavaScript | tganyan/14-rest-apis | /tyler-anyan/server/server.js | UTF-8 | 6,507 | 3.0625 | 3 | [
"MIT"
] | permissive | 'use strict'
// Application dependencies
const express = require('express');
const cors = require('cors');
const pg = require('pg');
const superagent = require('superagent');
// Application Setup
const app = express();
const PORT = process.env.PORT;
const TOKEN = process.env.TOKEN;
// COMMENT: Explain the following ... | true |
6909ec36e49ee523d3971bc4287876e3e0e5168c | JavaScript | Sergejnikolaj/promo-site | /src/components/LoginControl.js | UTF-8 | 2,355 | 2.546875 | 3 | [] | no_license | import React, {Component} from 'react';
import Main from "./MainComponent";
import AuthorizationForm from "./AuthorizationForm";
import LogOutForm from "./LogOutForm";
const mainWrapperStyle = {
width: '100%',
maxWidth: '600px',
margin: '3% auto',
backgroundColor: '#eef',
textAlign: 'center',
padding: '20px 0 5p... | true |
60dc43c6417ecb562472d796d27f0f691bec3801 | JavaScript | chrispiech/cs106b-winter-2016-website | /lectures/25-WebApplications/code/ClassPlaylist/playlistSoln.js | UTF-8 | 999 | 3.296875 | 3 | [] | no_license | window.onload = init;
function init() {
console.log("page loaded...")
serverRequest("http://localhost:8888/getSongs", {}, populateSongs);
}
function populateSongs(response) {
console.log(response)
var data = eval(response);
var songListDiv = document.getElementById("songList")
songListDiv.innerHTML = "";
for(v... | true |
dfd91001d8b9447cfa800f70464a150d92c2dd63 | JavaScript | kmorgan8588/CTCI | /Chapter_1/Permutation/isAnagram.test.js | UTF-8 | 598 | 2.828125 | 3 | [] | no_license | const isAnagram = require('./isAnagram');
test('expect empty strings to return true', () => {
expect(isAnagram('', '')).toBe(true);
});
test('expect the same word twice to be true', () => {
expect(isAnagram('high', 'high')).toBe(true);
});
test('expect an anagram to be true', () => {
expect(isAnagram('r... | true |
613a848fbf15e013edd2bbbfe955da6d34b3b700 | JavaScript | dev-shovon13/simple-bank | /js/banking.js | UTF-8 | 1,996 | 3.828125 | 4 | [] | no_license | // targeting the elements
const depositButton = document.getElementById("deposit-btn")
const withdrawButton = document.getElementById("withdraw-btn")
// deposit button event
depositButton.addEventListener("click", function () {
const depositInput = document.getElementById("deposit-input")
const depositValue =... | true |
5efeb527e10ebba67e630a2632469ea4c07273e6 | JavaScript | thisispreston/testing-lecture | /src/__tests__/bankAccount.test.js | UTF-8 | 715 | 2.75 | 3 | [] | no_license | import bankAccount from '../bankAccount'
// describe allow us to relate tests without having them depend on each other
//beforeEach, afterEach, beforeAll, and afterAll set conditions in relation to the tests
describe('backAccount methods and properties', () => {
beforeEach(() => {
bankAccount.balance = 1000
})... | true |
4d92b7226a5f8f148b1447f7842ec4fda756defd | JavaScript | droog126/javascript | /必看/数据扁平化.js | UTF-8 | 414 | 3.546875 | 4 | [] | no_license | var test=[1, [2, 3, [4, 5]]];
function func(arrs){
const r=[];
let dfs=function(arr){
//如果他不是我们就转化为我们想要的格式
for(let item of arr){
if(Array.isArray(item)){
dfs(item)
}else{
r.push(item);
}
}
}
dfs(arrs)
retur... | true |
57f3f14f643e23f01ce3c3710746fe751c042707 | JavaScript | jxu43/BASA | /client/public/js/catalog.js | UTF-8 | 3,355 | 2.65625 | 3 | [] | no_license | var options = {
valueNames: [
'courseId',
'courseName',
'subject',
{ data: ['age']}
],
page: 3,
pagination: true
};
var courseList = new List('courses', options);
function resetList(){
courseList.search();
courseList.filter();
courseList.update();
$(".filter-all").addClass("is-checked");
$('.filter').... | true |
ce5a77c8582dc9ee074a3a027c1832b897df5b92 | JavaScript | andreiavramm/Practica-Front-End-Wantsome | /saptamana12/P1/homework.js | UTF-8 | 2,207 | 3.796875 | 4 | [] | no_license | // call(), apply(), bind(), execution context, polyfill.io, normalize.css, - de cautat
// The Car and the Truck class have similar behavior and properties.
// Rewrite them in a way such that they share those properties.
var Vehicle = function(driver, nameOfVehicle) {
this.driver = driver;
this.speed =... | true |
19e8a29828dd93934e236fa99b6442d4ad1c0c89 | JavaScript | Ronak0020/lazy-anime | /commands/info/roleinfo.js | UTF-8 | 946 | 2.703125 | 3 | [
"MIT"
] | permissive | const Discord = require('discord.js');
module.exports = {
name: 'roleinfo',
category: "info",
description: "Get a role info.",
usage: "<role name | role mention>",
run: async(client, message, args) => {
const role = message.guild.roles.find(r => r.name === args.join(" ")) || message.mention... | true |
b7be289bb1369a071394d8e04d16c01f9cb3687e | JavaScript | kienvo1202/asset-farm | /dev-data/data/import-data.js | UTF-8 | 2,190 | 2.5625 | 3 | [] | no_license | const fs = require('fs');
const dotenv = require('dotenv');
const mongoose = require('mongoose');
const IO = require('../../models/ioModel');
const Asset = require('../../models/assetModel');
const Account = require('../../models/accountModel');
const User = require('../../models/userModel');
const Farm = require('../.... | true |
f485f07998a455b81ab7578c5ba47143a938194d | JavaScript | xiaoxiaolePlus/graduationDesign2017 | /WebContent/js/informationManagement.js | UTF-8 | 14,300 | 2.515625 | 3 | [] | no_license | //信息录入
$("#essentialInformation").click(function () {
$(".leftTitle").removeClass('active2');
$(this).addClass('active2');
$(".rightContent").hide();
$(".rightContent1").show();
}).trigger("click");
//信息修改
$("#attendanceStatus").click(function () {
$(".leftTitle").removeClass('active2');
$(this... | true |
91676d2cbbb525642af9608167dc178dc3a9812b | JavaScript | frank-dspeed/eggdrop-js | /plugins/admin.js | UTF-8 | 1,728 | 2.53125 | 3 | [
"Unlicense"
] | permissive | /**
* Admin Plugin
*
* @author Markus M. May
* @website http://www.javafreedom.org
* @copyright Markus M. May 2013
*
* Provides some basic functionalities like changing nick
*/
var util = require('util');
Plugin = exports.Plugin = function(ph) {
this.ph = ph;
this.name = this.ph.name;
t... | true |
3c974f8a47127e07db1abb4933f5f3a47bdf99dc | JavaScript | 795900/APCSPrinciples795900 | /816 FirstProject/sketch.js | UTF-8 | 584 | 3.234375 | 3 | [] | no_license | // Your Name
// Date or version number
// This is a comment
// The setup function function is called once when your program begins
function setup() {
var cnv = createCanvas(800, 800);
cnv.position((windowWidth-width)/2, 30);
background(250, 250, 250);
fill(200, 30, 150);
}
// The draw function is called... | true |
55122f2d5a5573c2b85c1f4c9ec0d11a004dbd00 | JavaScript | kentucky-roberts/javascript-sandbox | /js/script-countdown-object.js | UTF-8 | 795 | 2.796875 | 3 | [] | no_license | function clock()
{
var pauseObj = new Object();
var totalSeconds = 0;
var isPaused = false;
var delay = setInterval(tick, 1000);
function pause()
{
isPaused = true;
}
function resume()
{
isPaused = false;
}
function setTime()
{
var ctr;
... | true |
2b91e60b78ae7eabf74af2a33da6f25312b5ccc2 | JavaScript | MistuhMok/LeetCodePractice | /30 Day LeetCoding Challenge 5-2020/Ransom Note.js | UTF-8 | 610 | 3.171875 | 3 | [] | no_license | /**
* @param {string} ransomNote
* @param {string} magazine
* @return {boolean}
*/
var canConstruct = function(ransomNote, magazine) {
const hash = {}
for(let i = 0; i < magazine.length; i++){
let curr = magazine[i]
if(hash[curr]) hash[curr]++
else hash[curr] = 1
}
... | true |
4f41ad85c8aafc11ba683f2540d36ad84e0f1968 | JavaScript | Tauseef117/MedsCart-Pharmacy-Website | /static/js/cart.js | UTF-8 | 2,852 | 2.703125 | 3 | [] | no_license |
let updateBtns = document.querySelectorAll(".update-cart");
// console.log(updateBtns);
updateBtns.forEach((btn) => {
btn.addEventListener("click", () => {
const productId = btn.dataset.product;
const action = btn.dataset.action;
console.log("productId: ", productId, "action: ", action);
if (user ===... | true |
60e5334059c371c74a200093903d87332c33b362 | JavaScript | alexmassicott/weather_api | /src/statistics/measurement-aggregator.js | UTF-8 | 1,507 | 3.140625 | 3 | [] | no_license | import { HttpError } from '../errors';
import { Measurement } from '../measurements/measurement';
/**
* Compute statistics for given measurements
* @param {Measurement} measurements
* @param {String[]} metrics
* @param {String[]} stats
* @return {*}
*/
export function computeStats(measurements, metrics, stats) {... | true |
dc3d467af70e8ad0c5ca00bbe10d2ded40c2fbaa | JavaScript | DmytroSkrinnyk/sqrt | /js/script.js | UTF-8 | 340 | 3.375 | 3 | [] | no_license | console.clear()
const a = [1, 4, 3, 0, 4, 5, 4];
const b = [1, 4, 3, 0, 4, 5, 4,4,2,22,33,4,5];
const c = [1, 4, 4, 4, 3, 0, 4, 5, 4,4,2,22,33,4,5];
function sqr (a){
let x = 0;
for(let i = 0; i < a.length; i++){
if(a[i] % 2 === 0){
x += Math.sqrt(a[i])
}
}
return x.toFixed(2)
}
consol... | true |
03da8073810eda89c75c5f526be45046b8d50493 | JavaScript | leozdgao/rn-2048 | /src/mods/utils/gesture.js | UTF-8 | 335 | 3.09375 | 3 | [] | no_license | export const getDirectionFromGesture = gesture => {
const { dx, dy } = gesture;
let direction;
// horizontally
if (Math.abs(dx) >= Math.abs(dy)) {
if (dx > 0) direction = 'right';
else direction = 'left';
} else { // vertically
if (dy > 0) direction = 'down';
else direction = 'up';
}
retur... | true |
73ae05e88140cf7b8e92114939a1ad374721d047 | JavaScript | joelgardner/curryj | /test/unittests.js | UTF-8 | 2,713 | 3.296875 | 3 | [
"MIT"
] | permissive | var curryj = require('../src/curry');
var assert = require('chai').assert;
describe('curryj library', function () {
it('for arity 1, should return the same function', function () {
var hello = curryj.curry(_f1);
assert.equal(_f1, hello);
});
it('for arity 1, should return a function whose return value ... | true |
034ba01d9e8bcba0483983110d6cbaf80d3b456e | JavaScript | MaxYuzva/sch | /public/js/go-back-button.js | UTF-8 | 6,039 | 2.6875 | 3 | [] | no_license | $( document ).ready(function() {
var GoBackButtonHandler = {
/**
* The css selector for links that should have the 'go back Button' querystring appended.
* @type {string}
*/
goBackButtonClass: "a.go-back-button",
/**
* The css selector for si... | true |
c1f756b7a4aaf0a12f2762a4218c121237547870 | JavaScript | jebradbury39/facetpong | /public/bundle.js | UTF-8 | 65,976 | 3.078125 | 3 | [
"MIT"
] | permissive | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.ex... | true |
cb28ea4410b1e875abf1af64974221d05a5381ff | JavaScript | moida74/vinmonopolet | /test/filters/trim.test.js | UTF-8 | 496 | 2.578125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | 'use strict';
var expect = require('chai').expect;
var trim = require('../../src/filters/trim');
describe('trim filter', function() {
it('trims whitespace from start and end of string', function() {
expect(trim(' Foo bar ')).to.equal('Foo bar');
expect(trim('\nFoo\nBar\n')).to.equal('Foo\nBar');
... | true |
88f2b73889b5d617a72c67064594336185c60d5a | JavaScript | Tom-Staples/connect4 | /src/Game/Output/Output.js | UTF-8 | 461 | 2.828125 | 3 | [] | no_license | import React from 'react';
const Output = (props) => {
let activeMessage = "";
if (props.gameWon) {
activeMessage = props.activePlayer + " wins!";
}
else if (props.p1Cells.length === 21 && props.p2Cells.length === 21) {
activeMessage = "It's a draw!";
}
else {
activeM... | true |
aa238a4772e6a6954587de21edb2785ffb52e7eb | JavaScript | vantonov1/meet | /web/src/api/EquityPublicAPI.js | UTF-8 | 1,682 | 2.546875 | 3 | [] | no_license | import {baseURL, fetchJSON} from "./fetch";
export default class EquityPublicAPI {
static BASE = baseURL() + '/api/public/v1/equities';
static findByIds(ids) {
let url = new URL(this.BASE + "/ids");
url.searchParams.append("ids", ids);
return fetchJSON(url)
}
static findById(i... | true |
a6d9cccb3ec35fe1cf511a679f68b2282e342e9a | JavaScript | rhiokim/post-to-post-redirect | /s2/index.js | UTF-8 | 692 | 2.609375 | 3 | [] | no_license | const express = require('express')
const bodyParser = require('body-parser')
const app = express()
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
app.get('/', (req, res) => {
res.send('working server2')
})
app.post('/post-to-post', (req, res) => {
console.log('[SERVER2] RECIVED POS... | true |
62fa8ba53c1e8f09c4e2b8ffd44e152e1b93156e | JavaScript | HSilve/ProjectEuler | /js/01-20/02-even_fib_numbers.js | UTF-8 | 657 | 4.3125 | 4 | [] | no_license | // Each new term in the Fibonacci sequence is generated by adding the previous two terms.
// By starting with 1 and 2, the first 10 terms will be:
// 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
// By considering the terms in the Fibonacci sequence whose values do not exceed four million,
// find the sum of the even-valued t... | true |