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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6162f1056d5e948bea2370cf4fa0041866ee6723 | JavaScript | bruceeewong/lagou-camp | /ecmascript/es2015/object-destructing.js | UTF-8 | 394 | 3.875 | 4 | [] | no_license | // 对象解构
const obj = { name: "Jack", age: 18 };
// const { name } = obj;
// console.log(name);
// 命名冲突
// const name = "Amy";
// const { name: objName } = obj;
// console.log(name);
// 命名冲突 - 默认值
// const name = "Amy";
// const { name: objName = "mike" } = obj;
// console.log(name);
// console.log(objName);
// 应用
c... | true |
6b38297722efa2f6956090f01def411d33133fdd | JavaScript | emilyaviva/extraterrestrial-birthday-calculator | /script.js | UTF-8 | 8,894 | 2.6875 | 3 | [
"MIT"
] | permissive | 'use strict';
var planets = {
mercury: {
name: 'Mercury',
adjective: 'Hermian',
year: 87.9691,
facts: [
'It spins on its axis exactly three times for every two times it revolves around the Sun.',
'Despite being closest to the Sun, Mercury is only the second-hottest planet, because unlike ... | true |
b927a8120b17d223e4cc7d3b176249df502f1599 | JavaScript | hammer-t/hakolad.github.io | /test/app.js | UTF-8 | 2,569 | 3.40625 | 3 | [] | no_license | window.onload = function() {
"use strict";
/*
var a_goodGrid = [],
a_starGrid = [],
a_fiveGrid = [],
a_myGridTo = [],
a_bigTableWithGrid = [];
// We start to generate 1 stars, which will be used as grid to obtain
// Generate a number between [1, 10]
var numberGenerate = Math.floor(Math.random()*10) + ... | true |
e2c298cd5671d27ac9ef1748293aa3fb0501d136 | JavaScript | jeahya22/react-strangers-things | /src/components/Posts.js | UTF-8 | 1,967 | 2.734375 | 3 | [] | no_license |
import React, { useState } from "react";
import { useHistory } from "react-router-dom";
import "./specificStyles.css";
const postMatches = (post, searchTerm) => {
const searchTermLower = searchTerm.toLowerCase();
const {
description,
location,
title,
author: { username },
} = post;
const toM... | true |
7b294b2a41994a89bcb38fd524e852bd709bdb22 | JavaScript | cll5/SchoolWork | /siat/355/assignments/03/scripts/loadCSV.js | UTF-8 | 1,526 | 2.640625 | 3 | [] | no_license | var phoneDataset;
var filteredPhoneDataset;
var phoneIds;
d3.csv("data/CellPhoneCallRecords.csv", function(row) {
/*Datetime column should be converted to Date objects for convenient comparison later on*/
var date = row["Datetime"];
var year = +date.substring(0, 4);
var month = (+date.substring(4, 6)) - 1; /*month ... | true |
adea9c8c54dd90006e6480bf41238bc1ce55dc9d | JavaScript | ClaireMath/Nounou-Node | /router/logement.js | UTF-8 | 6,473 | 2.625 | 3 | [] | no_license | /************************************** Start Require module ****************************************************
*****************************************************************************************************************/
const express = require('express');
/**
* Routing refers to determining how an applicati... | true |
4b2b0023174b55cfba5c4d9a007bf4c487a757ff | JavaScript | daria-marczak/neural-network | /js/restaurants.js | UTF-8 | 1,856 | 3.5 | 4 | [] | no_license | const brain = require('brain.js');
const restaurants = {
'Brilliant Yellow Corral': 'Monday',
'Penny’s': 'Tuesday',
'Right Coast Wings': 'Wednesday',
'The Delusion Last Railway Car': 'Thursday',
'Fun Day Inn': 'Friday',
JHOP: 'Saturday',
Owls: 'Sunday',
};
const trainingData = [];
for (let restaurantName in r... | true |
f7b1a584d3d176a3ef51a901aaa94b62fdb39835 | JavaScript | IlNin/Cube-Model | /homework1.js | UTF-8 | 13,316 | 2.53125 | 3 | [] | no_license | "use strict";
// Global variables
var canvas;
var gl;
var numVertices = 36;
var program;
// Arrays
var pointsArray = [];
var colorsArray = [];
var normalsArray = [];
var texPointsArray = [];
// List of vertices
var vertices = [
vec4(-0.5, -0.5, 0.5, 1.0),
vec4(-0.5, 0.5, 0.5, 1.0),
vec4(0.5, 0.5, 0.5... | true |
89f2a6246fedaf05011ed51f637c53c982b79413 | JavaScript | anuslorah/freeCodeCamp | /chunkyMonkey/solution.js | UTF-8 | 920 | 3.34375 | 3 | [] | no_license | function chunkArrayInGroups(arr, size) {
var arr2 = [];
var arr1 = arr;
let g;
for (var i = 0; i < arr.length; i++) {
g = arr1.slice(0, size);
if (g !=0) {
arr2.push(g);
}
arr1 = arr1.slice(size, arr1.length);
}
return arr2;
}
chunkArrayInGroups(["a", "b", "c", "d"], 2);... | true |
6105062cb3e24be7976672e2f833118c2c45ed79 | JavaScript | taosut/48Ukraine | /src/components/UI/Carousel/Carousel.js | UTF-8 | 8,633 | 2.671875 | 3 | [] | no_license | /**
* Custom scroll for overflowed contents
* @module Carousel
*/
import React, { Component, createRef } from 'react';
import PropTypes from 'prop-types';
import ElementResize from '../Events/ElementResize';
import CarouselButton from './CarouselButton';
import styles from './Carousel.scss';
import MouseMotion fro... | true |
17e774c60c07d07b0b48a0c7e6c0042ace347592 | JavaScript | G3far97/CodingCopyCating | /ElzeroWebSchool/Tutorials/JavaScript/LearnJavaScriptInArabic/14_LogicalOperators/main_14.js | UTF-8 | 2,326 | 3.921875 | 4 | [] | no_license | /*global console, alert, document, prompt*/
/////////////////////////
/*
Conditional Operators: Gives Boolean Results As Answers, True or False.
" a > b ": 'a' is Greater Than 'b'
" a < b ": 'a' is Less Than 'b'
" a === b ": 'a' Exactly Equals 'b'
///
Conditional Combinations: Gives Boolean Re... | true |
e5361585e1782a40bcfe1b5477741fb1af45637d | JavaScript | eternalsakura/DIE-corpus | /jsc/script-tests/a/array-sort-sparse.js | UTF-8 | 447 | 3.140625 | 3 | [] | no_license | console.log("This tests that arrays and array like objects containing holes are sorted correctly.");
function testSort(x) {
[].sort.call(x);
return x[0] < x[1] && x[2] === undefined && !(3 in x) && x.length == 4;
}
testSort([, undefined, 0, 1]);
testSort({
length: 4,
1: undefined,
2: 0,
3: 1
});
var array... | true |
5e859d6ae1170c3efdcd141b1cb2b19d65ceca86 | JavaScript | marioman1980/shopify_theme_james | /assets/scripts.js | UTF-8 | 354 | 2.515625 | 3 | [] | no_license | $(document).ready(function(){
// Toggle collection submenus
$(".collection-sub-menu li").hover(function(){
$(".collection-dropdown", this).slideDown(100);
}, function(){
$(".collection-dropdown", this).stop().slideUp(100);
});
$(".collection-sub-menu li").click(function(){
$(".collection-dropdown",... | true |
2aa2496804fbbf625f5cab389d981d94f217e51e | JavaScript | Supacoco/3d-randoom | /src/main.js | UTF-8 | 1,381 | 2.65625 | 3 | [] | no_license | import { Xorshift } from '@supacoc0/randoom'
import P5 from 'p5'
const generator = new Xorshift(1337)
// const generator = new Xorshift(new Date())
const CANVAS_WIDTH = 800
const BOX_WIDTH = CANVAS_WIDTH / 2
const ITERATIONS = 5000
const root = document.createElement('div')
root.id = 'root'
document.querySelector('... | true |
a4b57075e5dac5dc42bb22cd4d5b6525bd994c0d | JavaScript | BaYramKad/game-mortal-combat | /main.js | UTF-8 | 1,468 | 3.203125 | 3 | [] | no_license | const $Scorpion = {
name: "Scorpion",
hp: 98,
img: "http://reactmarathon-api.herokuapp.com/assets/scorpion.gif",
weapon: ["sword", "fire", "machine gun"],
attack: function() {
console.log(`${this.name} Fight...`);
}
}
const $Subzero = {
name: "Subzero",
hp: 39,
img: "http:/... | true |
3d4041df41646587315b2f5bfe06cd856a191c12 | JavaScript | Nikhil9hac/mongo | /crud.js | UTF-8 | 1,950 | 2.6875 | 3 | [] | no_license | const mongo = require('mongoose');
mongo.connect('mongodb://localhost:27017/nikhil', { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: false })
.then(() => {
console.log('connection');
}).catch(err => console.log(err));
// creating mongo.Schema
const studentTyp... | true |
9c04a9e1ecd8a8f14630dd04a4aacbf043e9e20d | JavaScript | Se4ko/All-Telerik | /JavaScript Part 2/DOM Manipulation/secondTask.js | UTF-8 | 1,047 | 3.1875 | 3 | [] | no_license | var x0 = 500;
var y0 = 200;
var radius = 50;
var dFrag = document.createDocumentFragment();
for (var i = 0; i <= 20; i+= 5) {
var currentDiv = document.createElement('div');
currentDiv.id = i / 5;
var x = x0 + radius * Math.cos(i);
var y = y0 + radius * Math.sin(i);
currentDiv.style.position = "a... | true |
0f5e9778214e80bd0a8d598b142000eef7013914 | JavaScript | DiegoVilela/trybe-exercises | /10-testes-automatizados-com-jest/dia_1/exercise5.test.js | UTF-8 | 250 | 2.65625 | 3 | [] | no_license | const { obj1, obj2, obj3 } = require('./exercise5');
describe('Exercise 5', () => {
it('Objects are identical', () => {
expect(obj1).toEqual(obj2);
});
it('Objects are not identical', () => {
expect(obj2).not.toEqual(obj3);
});
});
| true |
6a882db05ecdf7c90e52dc2d1e687cd08738c380 | JavaScript | Clebinm/Aikabot | /commands/avatar.js | UTF-8 | 558 | 2.546875 | 3 | [] | no_license | const { MessageEmbed } = require('discord.js')
module.exports = {
name: "avatar",
category:"info",
description:"Comando para ver avatar",
run: async (client, message, args) => {
const member = message.mentions.users.first() || message.author
let embed = new MessageEmbed()
... | true |
6e3ea2f90b76a566331a1957c140d9beee0382f0 | JavaScript | AkashNeil/FreeCodeCamp | /find-the-longest-word-in-a-string.js | UTF-8 | 425 | 4.125 | 4 | [
"MIT"
] | permissive | /*
Return the length of the longest word in the provided sentence.
Your response should be a number.
*/
function findLongestWord(str) {
var splitStr = str.split(' ');
var longestWord = 0;
for (i = 0; i < splitStr.length; i++) {
if ( splitStr[i].length > longestWord ) {
longestWord = splitStr[i].lengt... | true |
a747229452fa5522099d1cf2f0f4f34d7e97f82b | JavaScript | tgray017/scribbler | /frontend/src/components/game.js | UTF-8 | 1,657 | 3.3125 | 3 | [] | no_license | class Game {
constructor() {
this.adapter = new GamesAdapter()
this.initBindingsAndEventListeners()
}
initBindingsAndEventListeners() {
this.startButton = document.getElementById('start-game')
this.startButton.addEventListener('click', this.start.bind(this))
this.gameContainer = document.getE... | true |
736debc923ee3961047b68084177f5842e650531 | JavaScript | JakubStepinski/weatherApp | /js/PickCity.jsx | UTF-8 | 2,492 | 2.859375 | 3 | [] | no_license | import React from "react";
import ReactDOM from "react-dom";
class PickCity extends React.Component {
constructor(props) {
super(props);
this.state = {
text: 'Check the weather for a city',
city: '',
country: '',
iconUrl: '',
temp: '',
... | true |
c68241dc970a51812999dbb9a7d6a641ccfd1ac6 | JavaScript | sozemego/baby-animals-photo-generator-frontend | /JS/index.js | UTF-8 | 5,991 | 3.328125 | 3 | [] | no_license | let allPhotos = []
document.addEventListener("DOMcontentloaded", init);
console.log("Hello, World!")
function init(){
fetchPhotos()
}
function fetchPhotos(){
fetch('http://localhost:3001/api/v1/photos')
.then(resp => resp.json())
.then(photoJSON => {
photoJSON.data.forEach(photo => {
... | true |
45b059b166c9a3de37e419f4d118e96a86b4ecaa | JavaScript | KoujiMinamoto/dara | /public/js/home.js | UTF-8 | 23,831 | 2.65625 | 3 | [
"MIT"
] | permissive |
function add_job() {
var add_job= document.getElementById('Job_1');
var nodeFather = add_job.parentNode;
var node_clone = add_job.cloneNode();
content = add_job.innerHTML;
node_clone.removeAttribute('id');
node_clone.innerHTML = content;
nodeFather.appendChild(node_clone);
console.... | true |
f00b1f4051bdf16e2961b1596ab24c184670b074 | JavaScript | Paouser/wp109b | /homework/02/star.js | UTF-8 | 84 | 3.140625 | 3 | [] | no_license | function star(n) {
for (var i=0; i<n ; i++)
console.log('*')
}
star (5) | true |
b6d350c38e250cba0115413c2ff3adf18ecde5ba | JavaScript | cursor-education/sample-frontend-app | /assets/scripts/page-help.jsx | UTF-8 | 205 | 3.203125 | 3 | [] | no_license | // https://babeljs.io/repl/
let inc = (b) => b + 1
console.log('test es6', inc(5));
console.log(
[1,2,3,4,5]
.filter((x) => x % 2)
.map((x) => x * 2)
.reduce((x, s) => x + s)
); | true |
559f84feb5e74630ad22a40fa8b9b4453d266ddc | JavaScript | devery512/SelfCare | /SelfCare/main.js | UTF-8 | 8,006 | 2.890625 | 3 | [] | no_license | <script>
$(document).ready(function() {
function ren() {
// render the page -- in case you're wondering,
// nothing will work without javascript!
$("#tit").html('<font face="Garamond"><h1> <i>sleepyti.me <font color="#33CC33">beta 3</font></i></h1></font>');
var mrend = '';
mrend = mrend +
'<ta... | true |
0dff7cbcdc63aca6ceb1a253f7d318b05863962c | JavaScript | innoWatt/tarifes | /bin/tarifa6.js | UTF-8 | 9,045 | 3.46875 | 3 | [] | no_license | /*
TARIFA 6 (espanya)
Implementació de la tarifa 6
Autor: Lluís Bosch
*/
function tarifa6(input)
{
//desempaqueta la variable input en "temps", "blocs" i "potència"
var temps = input[0]; //array d'objectes Date()
var blocs = input[1]; //array d'enters (1,2,3,4,5 ò 6)
var poten = input[2]; //array de floats (... | true |
36bef0d57d8d602f99e0e55de5bfef3dd00efc69 | JavaScript | segayuu/hexo-renderer-rollup | /lib/utils/objectMap.js | UTF-8 | 838 | 3.25 | 3 | [
"MIT"
] | permissive | 'use strict';
/**
* @template T
* @template R
* @template U
* @param {Iterable<T>|ArrayLike<T>|Object.<string, T>} obj
* @param {(this: U, value: T) => R} callback
* @param {U} thisArg
* @return {R[]}
*/
const objectMap = (obj, callback, thisArg = undefined) => {
if (obj == null) {
throw new TypeError();... | true |
181d7f5720ba71296317f6eb5117b5f64dfc2c26 | JavaScript | NikAiyer/CSE134B | /cse134bhw5/public/bs_ver/js/filter.js | UTF-8 | 1,207 | 2.8125 | 3 | [
"MIT"
] | permissive | $(document).ready(function() {
$('select').change(updateClassList);
$('.class-search').keyup(searchFilter);
});
function updateClassList(e) {
// Prevent following link
//e.preventDefault();
var quarter = $('#quarter-sel').val().toUpperCase();
var division = $('#division-sel').val();
var query = quarter + ' -... | true |
b466462e136e7eb8acd9fb26024f3d2709180a81 | JavaScript | August997/hx-product | /untitled/js/email.js | UTF-8 | 727 | 3.421875 | 3 | [] | no_license | // function check(){
// var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; //正则表达式
// var obj = document.getElementById("mazey"); //要验证的对象
// if(obj.value === ""){ //输入不能为空
// alert("输入不能为空!");
// return false;
// }else if(!reg.test(obj.value)){ //正则验证不通过,格式不对
// ... | true |
438bac094c047f6d23adb2a7567a11912d4c470b | JavaScript | gabmart1995/JavaScript | /TypeScript/coche.js | UTF-8 | 1,494 | 3.6875 | 4 | [] | no_license | var Coche = /** @class */ (function () {
//metodos
function Coche(modelo, color) {
this.velocidad = 0;
this.modelo = modelo;
this.color = color;
}
Coche.prototype.accelerar = function () {
this.velocidad++;
};
Coche.prototype.frenar = function () {
thi... | true |
f8dc92197cf54f2dc2632aae3469506a7e3bec1e | JavaScript | ikhsan-fauji/premiere-league | /src/script/js/clubs.js | UTF-8 | 3,294 | 2.671875 | 3 | [] | no_license | import '../component/ClubCard.js';
import { openDb } from '../helper/idb.js';
import material from '../helper/material.js';
import club from '../data/club-data.js';
const clubsScript = async (clubData, onClick) => {
try {
openDb();
const clubs = document.querySelector('#clubs');
if (clubData && clubDat... | true |
01685a4063bd29937d3f19c38fd332bbf9f7d788 | JavaScript | RedyRI/library | /app.js | UTF-8 | 13,622 | 2.953125 | 3 | [] | no_license | let myLibrary = [];
if(localStorage.length != 0) {
let storedBooks = JSON.parse(JSON.stringify(localStorage));
console.log(storedBooks);
for (let key in storedBooks) {
console.log(key);
if (key == 'lastid') {
console.log(storedBooks[key]);
} else {
myLibrary... | true |
37521c633c01914eca8b9b03493eaa36eee0023b | JavaScript | fabribet/movie-search | /src/components/Favorites/FavoriteBox/FavoriteBox.jsx | UTF-8 | 2,601 | 2.671875 | 3 | [] | no_license | import React from 'react'
import PropTypes from 'prop-types'
import styles from './styles.module.scss'
import Truncate from 'react-truncate'
import moviePoster from './imgs/movie-poster.png'
/**
* FavoriteBox - React component.
* Renders a small movie box .
*
* Properties
* - imgUrl {String} - The base url... | true |
7c1c07040f65992292b166c5cafbc0e91225204b | JavaScript | YahorPtashnik/SAP-HANA-CLOUD | /HW_6/Script/pp.js | UTF-8 | 2,017 | 3.203125 | 3 | [] | no_license | function App() {
this.data;
}
var uri = new URL(window.location.href);
var url = "http://localhost:3000/posts"
function Post() {
this.userId;
this.id;
this.title;
this.body;
}
App.prototype.getAll = function () {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false);
xhr.send();
... | true |
9d9d96b226d386ecb0b8de0e481bdfb7c6a58569 | JavaScript | NoeFabris/js-mail-dadi | /Mail/myscript.js | UTF-8 | 541 | 3.84375 | 4 | [] | no_license | var mail= prompt("Insert your E-mail");
var listaAccesso = ["noe@secure-web.it", "mail", "mail1", "mail2", "mail3"];
var mailLower = mail.toLowerCase()
console.log(mailLower)
for (let index = 0; index < listaAccesso.length; index++) {
var element = listaAccesso[index];
console.log(element);
if (mailLower ==... | true |
08c9fdb9bef5d97266b87df353fd9eee18c49d6d | JavaScript | JohnMBond-work/SE-Homework | /1-Mod_Intro_to_Web_Development/Week2_Day4_MorningLab/W2_D2_4_ExerciseCodeAlong5to100.js | UTF-8 | 609 | 4.15625 | 4 | [] | no_license | //The four different types of loops
//for loop counting down from 10 to 1
/*
for(i=10; i>=1; i--){
console.log(i);
}
console.log("for loop ===============")
*/
//while Loop counting down from 10 to 1
var i=5;
while(i<=100){
console.log(i);
i+=5;
}
console.log("while loop ===============")
//do while Loop ... | true |
5994f22dfe833e29382258dc6f12dccab9853f0a | JavaScript | jvincent3/ReactPractice | /app/components/comments.js | UTF-8 | 987 | 2.8125 | 3 | [] | no_license | var React = require('react');
class Comment extends React.Component{
constructor(props){
super(props);
this.state = {editing:false}
this.edit = this.edit.bind(this);
this.save = this.save.bind(this);
}
edit(){
this.setState({editing:true})
}
remove(){
console.log('Removing comment');
}
save(){... | true |
da5b2753137f2d0f8af61e0690bb598bbc4bcb66 | JavaScript | bavix/url-reduce | /resources/js/store/index.js | UTF-8 | 1,906 | 2.546875 | 3 | [] | no_license | /*jshint esversion: 6 */
import Vue from 'vue';
import Vuex from 'vuex';
import has from 'lodash/has';
Vue.use(Vuex);
export default new Vuex.Store({
state: {
handle: null,
attempts: 0,
submitting: false,
loading: false,
link: null,
error: '',
url: '',
total: 0,
links: [],
ha... | true |
4bfc7a8e36f1b73aa7b7eed775f867e812785cd7 | JavaScript | Lucas-Cifuentes/Appointment-Manager | /src/components/card.js | UTF-8 | 1,529 | 2.578125 | 3 | [] | no_license | import React from 'react';
import {Text, View, StyleSheet, TouchableHighlight} from 'react-native';
const card = ({data, eliminateAppointment}) => {
const handleEliminate = (id) => {
eliminateAppointment(id);
};
return (
<View style={styles.card}>
<View>
<Text style={styles.label}>
... | true |
7196c902bb61ad89ccf638b68b51cd9163e42514 | JavaScript | jahanzaibmalik/IoT | /javascript/book_code/38- local/app.js | UTF-8 | 633 | 3.90625 | 4 | [] | no_license | // var theSum;
// addNumber();
// function addNumber() {
// theSum = 2 + 2;
// alert(theSum);
// }
// alert(theSum);
// var theSum = addNumber();
// function addNumber() {
// theSum = 2 + 2;
// // alert(theSum);
// }
// addNumber();
// alert(theSum);
// function main() {
// return theSum... | true |
f8b76475e29b5ca40ba5c9444b89ca75519ec4f1 | JavaScript | chenJiongH/Teaching-management-system | /src/main/resources/resources/theoryjs/news.js | UTF-8 | 983 | 2.640625 | 3 | [
"MIT"
] | permissive | // /0 / id = 3;
// uid = 2;
// did = 4;
$(function (){
// page = 3
showNews()
$(".last").click(changeU);
$(".next").click(changeU);
// 设置全局变量,保证回退正确
var whereComing = localStorage.getItem('backLocation');
$("#selection p a:eq(0)").text("上一级");
$("#selection p a:eq(0)").attr("href", whereComing);
})
fun... | true |
e6ddf56ef4c2cb8b44217d10cc0a2b0c1bdadf1a | JavaScript | namelessan/js_hs | /module 0/night/night.js | UTF-8 | 977 | 3.3125 | 3 | [] | no_license | function killSheep(part) {
const i = part.indexOf('W');
if (i === -1) {
return part;
} else {
return part.replace(/S/gi, '.');
}
}
// function killSheepOutSide(outside) {
// let res = [];
// if (outside.join('').indexOf('W') !== -1) {
// for (part of outside) {
// res.push(killSheep(part)... | true |
53f21b851da6cb6d21f0889fcba71387dbd7f53c | JavaScript | dangrt5/ui-engineer-project | /server/index.js | UTF-8 | 605 | 2.578125 | 3 | [] | no_license | // keep external API endpoints in env variables
require("dotenv").config();
const express = require("express");
const cors = require("cors");
const { get } = require("axios");
const PORT = process.env.NODE_ENV || 5000;
const app = express();
// Mount middlware
app.use(cors());
// Configure route
app.use("/retrieve-... | true |
c4708ac059934a2b1a541a57998858cc5d61e0a4 | JavaScript | alexb-lb/patterns | /behavioral/mediator.js | UTF-8 | 940 | 3.546875 | 4 | [] | no_license | /**
* Mediator pattern
*
* Allows us to expose a unified interface through which the different parts of a system may communicate.
*
* The Mediator promotes loose coupling by ensuring that instead of components referring to each other explicitly,
* their interaction is handled through this central point. This can ... | true |
3aa5cb185351d3b09ab350e1374c003c84d43f75 | JavaScript | zhlfml/html5 | /file/src/main/webapp/js/fileupload.js | UTF-8 | 527 | 2.640625 | 3 | [] | no_license | var uploadFile = function(url, file) {
var $element = $("<div />"),
$progress = $("#progress");;
$element.text(file.name);
$("#target").append($element);
var onProgress = function(e) {
var per = Math.round((e.loaded / e.total) * 100);
$progress.val(per);
};
var onSucces... | true |
c2e0e83e006bece1543fa97d8461e88a952c27a7 | JavaScript | sufangyu/admin-template-vue | /src/utils/array.js | UTF-8 | 339 | 2.96875 | 3 | [] | no_license | export function arrayUtils() {}
/**
* 分割数组
*
* @export
* @param {*} [arr=[]] 原数组
* @param {number} [size=100] 每页数组长度
* @returns
*/
export function arraySplit(arr = [], size = 50) {
const tmp = [];
for (let i = 0; i < arr.length; i += size) {
tmp.push(arr.slice(i, i + size));
}
return tmp;
}
| true |
05fa4f9a9a1d4c436ae3d5fff13d692b9cd66ef9 | JavaScript | Rasi98/Internship_Management_System | /server/controllers/user.js | UTF-8 | 972 | 2.609375 | 3 | [] | no_license | import user from "../models/user.js";
import bcrypt from "bcrypt";
async function hashPassword(pass) {
try {
let password = pass;
const round = await bcrypt.genSalt();
const hashedPassword = await bcrypt.hash(password, round);
return hashedPassword;
} catch (err) {
console.log(err);
}
}
expo... | true |
6e67ae5447764c568d9b749897dad2e88033bbd8 | JavaScript | nelsonjr86/GitHub | /TCC/Script/Bibliografia1.js | ISO-8859-1 | 3,999 | 3 | 3 | [] | no_license | db.Bibliografia.mapReduce(
function() {
// Precisamos salvar isso em uma var local, conforme os problemas de escopo
var document = this;
// Voc precisa expandir isso de acordo com suas necessidades
var stopwords = ["de", "a", "o", "que", "e", "do", "da", "em", "um", "para", "com", "no", "uma", "os",... | true |
1f4c977da13f9fc739aa426153cb56ee79727ffb | JavaScript | 1min2midnight/Crypto-wallet | /griffon/src/lib/backendHandler.js | UTF-8 | 6,332 | 3.140625 | 3 | [] | no_license |
// this function calls the backend API to get data
// in format http://localhost:8080/location?argumentName=argumentValue the backend can make decisions based on location and argument name and value
// TODO: make another one of those that accepts any number of arguments
export function getRequest(location, argumentNam... | true |
4aeef20db53e354a65d36deeb4e3e13b89710c4a | JavaScript | eufat/vacindo | /src/utils/getDestinations.js | UTF-8 | 513 | 2.625 | 3 | [] | no_license | const dummy = require("./dummy.json");
const fs = require("fs");
const shortid = require('shortid');
const Hashids = require('hashids');
const output = {};
function generateHash() {
const hashids = new Hashids(shortid.generate(), 8);
const hash = hashids.encode(1);
return hash;
}
for (let item of dummy... | true |
e29f01a545222e38b73d2a7226bfa16d324a4323 | JavaScript | fernanda888/CMPM120-Final-Game | /src/scenes/LevelScene.js | UTF-8 | 3,475 | 2.828125 | 3 | [] | no_license | class LevelScene extends Phaser.Scene {
constructor() {
super('levelScene');
}
create(){
//add the music
this.levelMusic = this.sound.add('levelMusic', {
mute: false,
loop: true,
rate: 1.05,
volume: 0.1
});
this.levelM... | true |
b457545144a2adb3273962e55253520d1852133d | JavaScript | razumforce/04js-adv-hw | /05HW/js/Basket.js | UTF-8 | 4,015 | 3.0625 | 3 | [] | no_license | function Basket(root) {
Container.call(this, 'basket');
this.countGoods = 0;
this.amount = 0;
this.basketItems = [];
this.collectBasketItems(root); // Загружаем товары, которые уже добавлены (json файл)
}
Basket.prototype = Object.create(Container.prototype);
Basket.prototype.construct... | true |
60fb4919b86034c3404a92ae9beaeac88341c710 | JavaScript | mzje/jukebox-react | /ui/src/components/player-controls.js | UTF-8 | 2,079 | 2.515625 | 3 | [] | no_license | import React from 'react';
class PlayerControls extends React.Component {
static contextTypes = {
jukebox: React.PropTypes.object
}
static propTypes = {
playState: React.PropTypes.string,
userId: React.PropTypes.string
}
previousButton() {
return (
<button className="ui-player-control... | true |
28e9447bab95b637571aa10ee2fdcf6401d2c3c0 | JavaScript | SinSiXX/neon-editor | /app/helpers/words.js | UTF-8 | 288 | 2.625 | 3 | [] | no_license | import { helper } from '@ember/component/helper';
function words([string]) {
let wordsCount;
if (string === undefined || string === '') {
wordsCount = 0;
} else {
wordsCount = string.trim().split(/\s+/).length;
}
return `words: ${wordsCount}`;
}
export default helper(words); | true |
1a674eab1e3c691986e38eca28a2ade5383cbbf0 | JavaScript | JohnBain/reddit-nodejs-api | /reddit.js | UTF-8 | 12,906 | 2.9375 | 3 | [] | no_license | var bcrypt = require('bcrypt');
var HASH_ROUNDS = 10;
module.exports = function RedditAPI(conn) {
return {
createUser: function(user, callback) {
// first we have to hash the password...
bcrypt.hash(user.password, HASH_ROUNDS, function(err, hashedPassword) {
if (err) {
callback(err... | true |
73657624d1f49fc7c2538c353dfb6224f4cccc3d | JavaScript | wecode-bootcamp-korea/24-1st-LaFesta-frontend | /src/pages/SignUp/SignUpUserInfo.jsx | UTF-8 | 6,239 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import { POST_SIGNUP_API } from '../../config';
import './SignUpUserInfo.scss';
class SignUpUserInfo extends Component {
constructor(props) {
super(props);
this.state = {
name: '',
email: '',
mobile: '',
year: '',
month: '',
date: ... | true |
93129bab483fed80ecae1f970e9d9c6c07e0cb8a | JavaScript | mukarthik7/assignment_30 | /site.js | UTF-8 | 1,836 | 3.0625 | 3 | [] | no_license | var email;
var password;
var name;
var login_btn = document.getElementById("loginbtn");
var signup_btn = document.getElementById("signupbtn");
var logout_btn = document.getElementById("logout");
login_btn.addEventListener("click", loginForm);
signup_btn.addEventListener("click", signUpForm);
logout_btn.addEventListen... | true |
1eea9349eeebb7410acdf4eee525ca693ad59614 | JavaScript | increscent/stacked | /routes/classes/uri_class.js | UTF-8 | 1,044 | 2.71875 | 3 | [] | no_license | class Uri {
constructor(app) {
this.used_uris = [];
// populate list of used uris when the server starts
var _this = this;
app.models.Copy.find(function (err, copies) {
for (var i = 0; i < copies.length; i++) {
// insert copies in sorted order
for (var j = 0; j <= _this.used_uris... | true |
597eb804c5aedb7f9c3ee0427f5c66aa1863dd6a | JavaScript | LukasWroclaw/PriceChecker | /dataBase.js | UTF-8 | 746 | 2.71875 | 3 | [] | no_license | /**
* Created by Lukas on 2020-03-01.
*/
function handleMessage(request, sender, sendResponse) {
if(request.typeOfRequest == "store")
{
localStorage.setItem(request.idFromData, request.data);
sendResponse({response: request.typeOfRequest});
}
else if(request.typeOfRequest == "resetBase")
{
localStorage.... | true |
f5e636a9070f21b641ec0e8e8a5d97d0c8268772 | JavaScript | ingnicolaspj/EjericiosJavaScript | /DOM/JS_/06-scripts.js | UTF-8 | 1,017 | 3.375 | 3 | [] | no_license | //Autor
//Cuando lo hiceron
// Traversing the DOM
const navegacion = document.querySelector('.navegacion');
// console.log(navegacion.firstElementChild);
// console.log(navegacion.lastElementChild);
// console.log(navegacion.childNodes); //Los espacios en blanco son considerados en elementos
// console... | true |
f46c5334301282a6cd298b21cfa0d69562cafc21 | JavaScript | senalwijeratne/react-doughnuts | /src/Store.js | UTF-8 | 1,691 | 2.515625 | 3 | [] | no_license | import React from "react"
import styled from "styled-components"
import SelectedDoughnut from "./components/SelectedDoughnut"
import Billing from "./components/Billing"
import json from "./doughnut-api"
const BillingSection = styled.div`
display: flex;
flex-direction: row-reverse;
justify-content: center;
al... | true |
fc3e2fdd83e631793e2713698264efea3a3f6e5e | JavaScript | DONGPANDA/nodeStudy | /2week3day/copy2.js | UTF-8 | 524 | 2.71875 | 3 | [] | no_license | /**
* Created by 96004 on 2017/7/9.
*/
let fs=require('fs')
function copy(source,target) {
let rs=fs.createReadStream(source,{highWaterMark:4})
let ws=fs.createWriteStream(target,{highWaterMark:1})
rs.on('data',function (data) {
let flag=ws.write(data)
if(!flag) rs.pause()
})
ws.on... | true |
67811fcbb4e0b02452ec7b7721eefcabed3ec177 | JavaScript | milankostak/WebGL-Utils | /webgl-utils.js | UTF-8 | 36,095 | 3.015625 | 3 | [] | no_license | "use strict";
/**
* Utils object contains useful functions for use with WebGL.
* Minimum browser support (syntax-wise, NOT function-wise) (mainly because arrow functions): Edge 12+, Chrome 45+, FF 22+, Opera 32+, Safari 10
* It intentionally doesn't support anything that wouldn't work with used syntax.
* @type {Ob... | true |
b94db310d965b19eda90ad9e53a97e491bbcb332 | JavaScript | cbaucom/react-leaderboard | /src/components/EditPlayerForm.js | UTF-8 | 2,485 | 2.71875 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import Form from "./styles/Form";
import Button from "./styles/Button";
const EditPlayerForm = props => {
const [player, setPlayer] = useState(props.currentPlayer);
useEffect(() => {
setPlayer(props.currentPlayer);
}, [props]);
const handleNameChange = ... | true |
388a0e4d92bb8a444f4f1019df81574287dafc47 | JavaScript | santiagoep/rule-of-thumb | /src/hooks/useBreakpoint.js | UTF-8 | 1,411 | 2.625 | 3 | [
"MIT"
] | permissive | import { useState, useEffect } from 'react';
import { breakpoints, breakpointsValues } from '@constants/index';
const calculateBreakpoint = (width) => {
const { mobile, tablet, desktop, screen } = breakpointsValues;
if (width >= screen) {
return breakpoints.screen;
} else if (width >= desktop && width < scr... | true |
a313dcf74452ffac81620665d90d4a5ea09cd969 | JavaScript | enxajt/ex-yoyaku2google-cal | /code.js | UTF-8 | 5,494 | 2.8125 | 3 | [
"MIT"
] | permissive | function run() {
const prop = PropertiesService.getScriptProperties().getProperties();
const last_execution = prop.last_execution; // last execution time
const calendar = CalendarApp.getCalendarById(prop.calendar_id);
const messages = getGmail(last_execution);
messages.forEach(function (message) {
if (m... | true |
1601cc93c6bd943d68963a2c5fda8fc9d0b57748 | JavaScript | jwill93/pkgmgr-test | /scripts/package/PackageManager.js | UTF-8 | 18,769 | 3.203125 | 3 | [] | no_license | // Object representing a package (as-yet installed or not):
const Package = require('./Package');
// Factory which constructs Packages:
const PackageFactory = require('./PackageFactory');
// Class that would actually install Packages to the filesystem if this were a "real" package manager:
const PackageInstaller = requ... | true |
3a99ecc75684786240934ee2a675448bbad1e55b | JavaScript | smadanapally/UNL_ISP | /Team11-HW3-AirlineReservation/WebContent/js/datescript.js | UTF-8 | 1,357 | 2.75 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
function validateForm() {
alert('in validateForm()')
//var iChars = "0123456789!@#$%^&*()+=-[]\\\';,./{}|\:<>?";
//var iChars1 = "abcdefghijklmnopqrstuvwxyz!@#$%^&*()+=-[]\\\';,./{}|\:<>?";
var userid= document.getElementsByName("userId")[0].value;
var email= document.getElemen... | true |
13f53fd71d93a34bb6857dd8cc837e5aa77f7c6e | JavaScript | assematt/COMP392 | /LAB02/js/index.js | UTF-8 | 3,785 | 3.109375 | 3 | [
"MIT"
] | permissive | // App main
(function(){
// Main variables
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
var renderer = new THREE.WebGLRenderer();
var controls = new function() {
this.shapes = "shapes";
this.si... | true |
0c5ce3eb05f3d3f18014b8d46dc3bbc63b53c081 | JavaScript | anylzer/regular-excel-clipboard | /src/index.js | UTF-8 | 4,653 | 2.625 | 3 | [
"MIT"
] | permissive | /**
* Created by Aeo on 2017/10/21.
* Excel 纯前端复制粘贴组件,使用方式如下:
* <Clipboard
* list={list}
* on-getInfo={this.getInfo($event)}
* ></Clipboard>
* list - 粘贴表格数据
* on-getInfo - 获取粘贴表格数据
*/
import './mcss/index.mcss';
import REGULAR from 'regularjs';
import boardTpl from './view.html';
import Modal from '.... | true |
7f67c939e57bf46604e7ed20d6991d9acaa2f417 | JavaScript | nicolas-alv/CursoIngresoJS | /jsIteraciones (10).js | UTF-8 | 1,493 | 3.3125 | 3 | [] | no_license | function mostrar()
/*{
var contador=0;
//declarar contadores y variables
var respuesta="si";
while(respuesta!="no")
{
}
}*/
{
var num;
var contador=0;
var sumaPositivos=0;
var sumaNegativos=0;
var contadorPositivos=0;
var contadorNegativos=0;
var contadorCeros=0;
var contadorPares=0;
whil... | true |
c0cc964b9d4f1340d3e189240b74ebcea7d25eb6 | JavaScript | ziababar/iSkills | /Intro_HTML_CSS_JS/javascript/demo.js | UTF-8 | 813 | 3.1875 | 3 | [] | no_license | // Generate a number from 1 to 100
function randomInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Check if the registration is correct
function checkRegistration() {
var regNumber = randomInteger(1, 100);
var firstName = document.getElementById('fname').value;
var... | true |
da8482be4009ca0b3adac8b021cd551d10049f69 | JavaScript | tas56/statistics_calculator | /src/Operations/Statistics/Random.js | UTF-8 | 2,401 | 3.453125 | 3 | [] | no_license | const Calculator = require('../../Calculator');
var seedrandom = require('seedrandom');
class Random {
static randomIntNoSeed(min, max) {
let number = Math.random() * (max - min) + min;
return number;
}
static randomDecimalNoSeed(min, max){
let number = Math.random() * (max - min... | true |
1253b43986ba6054a51eb49e93f3393bbeaa5804 | JavaScript | jolaya182/bowlingRepo | /src/js/main.js | UTF-8 | 6,953 | 3.375 | 3 | [
"MIT"
] | permissive | function bowlingScore(bowlingSequenceValues) {
let bsv = bowlingSequenceValues;
//serparate them by spaces
let pS = processString(bsv);
//pair them
let pairs = pairThem(pS);
//score the pairs
return scorePairs(pairs);
//return the number score
}
function scorePairs(pairs) {
//define the variables
... | true |
ed198f981bdfd565df97f6d314580e58463525e4 | JavaScript | SunD004/Taker_APP | /AppTaker/redux/reducer.js | UTF-8 | 520 | 2.546875 | 3 | [] | no_license | import { USER, HISTORY, CURRENT } from "./constant";
const initialState = {
user: {},
current: [],
history: [],
};
export const reducer = (state = initialState, action) => {
switch (action.type) {
case USER:
return {
...state,
user: action.payload,
};
case HISTORY:
re... | true |
d14593cc091d38d063cddb65f3d7c27543ba36ad | JavaScript | yersan/petsore-javaee7 | /src/main/webapp/resources/js/home.js | UTF-8 | 765 | 2.609375 | 3 | [
"MIT"
] | permissive | /**
* Created by yeraysb on 9/5/16.
*/
var home = home || {};
$(function () {
home.Category = function () {
this.id = ko.observable();
this.name = ko.observable();
this.description = ko.observable();
}
home.Person = function(){
this.id = ko.observable();
}
... | true |
792a223c2d5a7cffc6315aab63eff4ffb97dab44 | JavaScript | thaddeusbort/dashboard.js | /widgets/weather/widget.js | UTF-8 | 1,905 | 2.8125 | 3 | [
"MIT"
] | permissive | var dashboard_widget_weather_url = null;
var dashboard_widget_weather_default_location = "Auckland";
function weather_init(widget) {
var url = "http://api.openweathermap.org/data/2.5/weather?units=imperial&";
var location = widget.cfg().location;
dashboard_widget_weather_url = url + "q=" +
... | true |
d53b554e785d8f9fc8c97b02bf590c523230c43f | JavaScript | chauchausoup/dataAlgo | /signal/old/erath4.js | UTF-8 | 421 | 3.75 | 4 | [] | no_license | const primes = number => {
const numbers = new Array(number + 1);
numbers.fill(true);
numbers[0] = numbers[1] = false;
for (let i = 2; i <= Math.sqrt(number); i++) {
for (let j = 2; i * j <= number; j++) numbers[i * j] = false;
}
return numbers.reduce(
(primes, isPrime, prime) ... | true |
1ecc6253cb0f2128dc82141a1972b530bc5ff799 | JavaScript | jromainkrupa/plants-with-tags | /app/javascript/components/toggle_form.js | UTF-8 | 320 | 2.625 | 3 | [] | no_license | const ToggleForm = () => {
// récupère le button
const button = document.querySelector("#toggle-form");
const form = document.querySelector("#form");
console.log(button);
console.log(form);
button.addEventListener("click", (event) => {
form.classList.toggle("d-none");
});
};
export { ToggleForm };
| true |
50593027bd5811fe61fe281bb5f46318040cdee4 | JavaScript | Deivesilvaka/SAPUI5_TABLE | /src/index.js | UTF-8 | 1,722 | 2.71875 | 3 | [] | no_license |
// 'Importação' das classes.
const { App, Page, Table, Column, ColumnListItem, Text, Label, LabelDesign,
Toolbar } = sap.m
const { model: { json: { JSONModel } } } = sap.ui
// -> Trás o core da aplicação.
const core = sap.ui.getCore()
// -> onload.
core.attachInit(start) // -> Event emiter cagado.
function... | true |
a9db4e49f2a27762d8f425bd63b48a0c7263d276 | JavaScript | bfcarter/PWA1-GITRepo-CARTER | /PWA1:WK4/goal7_assign_objects/js/main.js | UTF-8 | 1,341 | 4.0625 | 4 | [] | no_license | /*
Name:Brittni Carter
Date:11/19/14
Class & Section: PWA1-1411
Assignment: objects.Person
main code
*/
(function(){
//naming variables
var numOfPeople = 3; //number of people to be displayed
var people =[]; //selected people from names
var names = ["Brittni", "Esther", "Jethro", "Chris", "Xanth... | true |
61a9a459f63f974fde7a7ceb465b7b5ca4d9e155 | JavaScript | fedorgit/GladiatorsGame | /client/www/script/service/current/currentUser.js | UTF-8 | 307 | 2.703125 | 3 | [] | no_license |
class CurrentUser {
/**
*
* @param {number} id
* @param {string} login
* @param {string} name
* @param {any} icon
*/
constructor(id, login, name, icon) {
this.id = id;
this.login = login;
this.name = name;
this.icon = icon;
}
} | true |
a789b8887b059969bccd018014b81e8f6bab522b | JavaScript | DmitryShalaeyv/memory | /js/script_1.js | UTF-8 | 3,036 | 2.890625 | 3 | [] | no_license | "use strict";
Array.prototype.shuffle = function() {
if(this.length == 1) return this;
for(var j, x, i = this.length; i; j = Math.floor(Math.random() * i), x = this[--i], this[i] = this[j], this[j] = x);
return this;
};
const deck = ["6_BUB.gif", "7_BUB.gif", "8_BUB.gif", "9_BUB.gif", "10_BUB.gif", "A_BUB.gif",... | true |
99fc4a5108c906238014b7044b2dd6e1d0136743 | JavaScript | caletorres59/reservaapp | /Controllers/roomController.js | UTF-8 | 3,125 | 2.734375 | 3 | [] | no_license | 'use strict'
var Room = require('../models/rooms');
function homeRoom(req,res){
res.status(200).send({
message: 'estamos en pruebas reserva ok'
})
}
function saveRoom(req, res){
var room = new Room();
var params = req.body;
if(params.numero && params.costo && params.impuesto &&
... | true |
08fa2f7e88c2fd76f20077c65319dcbf13e86470 | JavaScript | JS-MOON/semi-project | /WebContent/resources/js/backup/pageClose.js | UTF-8 | 757 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | var clicked = false;
function CheckBrowser() {
if (clicked == false) {
//Browser closed
} else {
//redirected
clicked = false;
}
}
function bodyUnload() {
if (clicked == false)//browser is closed
{
var request = GetRequest();
request.open("GET", "/testLogou... | true |
bfaa337d5f84fd3b5c3674a48e495a5562507a83 | JavaScript | minmin0530/reply | /index.js | UTF-8 | 2,003 | 3.140625 | 3 | [] | no_license | const QUESTION_PARENT = 1;
const QUESTION_BROTHER = 2;
const QUESTION_CHILD = 3;
const QUESTION_OPPOSITE = 4
const global = [];
const Reply = require('./reply');
const reply = new Reply();
const Node = require('./Node');
const root = new Node('name');
let prev = null;
process.stdin.resume();
process.stdin.setEncoding... | true |
a4f268bd121d62e72f14c10ca9f1550d35508e1f | JavaScript | angelinasentyakova/Home-Work | /Macarons/src/js/components/ProductGallery.js | UTF-8 | 281 | 2.640625 | 3 | [] | no_license | $(function () {
$(".js-thumb").on("click", function () {
let mainImage = $(this).index();
$(".js-thumb").removeClass("--active");
$(this).addClass("--active");
$(".js-main").removeClass("--active");
$(".js-main").eq(mainImage).addClass("--active");
});
});
| true |
6a8c47d7f7927ded29da707d0d8b5edfee97f6a9 | JavaScript | aliyr/babel-transformation | /index.js | UTF-8 | 1,783 | 2.78125 | 3 | [] | no_license | var babel = require('@babel/core')
const code = `
function teerg(eman) {
return 'Hello ' + eman;
}
console.log(teerg('tanhauhau'));
`
const output = babel.transformSync(code, {
plugins: [
function myCoolBabelPlugin() {
return {
visitor: {
Identifier(path)... | true |
48e37398d68b89a8fc564d865beae3b82fb6662f | JavaScript | joshmillgate/unsplashsearch | /src/components/ImageCard.js | UTF-8 | 1,379 | 2.90625 | 3 | [] | no_license | import React, { Component } from 'react'
export default class ImageCard extends Component {
// We define constructor and super because we are creating an Ref.
constructor(props) {
super(props)
this.state = {
spans: 0
}
// Create an imageRef so we can access all the... | true |
e4f1e23c59d9aae7d57a24260917c723acece814 | JavaScript | Adamfsk/jest-webgl-canvas-mock | /__tests__/classes/CanvasRenderingContext2D.textAlign.js | UTF-8 | 905 | 3.0625 | 3 | [
"MIT"
] | permissive | let canvas;
let ctx;
beforeEach(() => {
canvas = document.createElement('canvas');
ctx = canvas.getContext('2d');
canvas.width = 400;
canvas.height = 300;
});
describe('textAlign', () => {
it("should set the default value to 'start'", () => {
expect(ctx.textAlign).toBe('start');
});
it("should not ... | true |
801988bc0f3f3f08179a959de7a16782f04abb6d | JavaScript | 0x8801/commit | /contributions/superglue/javascript/Core/2016-09-14.js | UTF-8 | 128 | 2.65625 | 3 | [] | no_license | Setting the length of an array
Counting the months from zero
NaN === NaN?
Apply `map` function to array items
Prototype methods | true |
c3acf3d63a60c773820d686446fbf58fc11bcc1e | JavaScript | node-opcua/node-opcua | /packages/node-opcua-binary-stream/test/test_binary_stream.js | UTF-8 | 13,240 | 3.015625 | 3 | [
"MIT"
] | permissive | "use strict";
const { assert } = require("node-opcua-assert");
const { Benchmarker } = require("node-opcua-benchmarker");
const { BinaryStream, BinaryStreamSizeCalculator, calculateByteLength } = require(".."); // node-opcua-binary-stream
const should = require("should");
describe("Testing BinaryStream", function() ... | true |
8c0cda3ccb1abda2c1296cfcbc80ace73644ca2b | JavaScript | TokyoComPleX/InnerMap | /test/testscripts/draftCompeletVersion/scanPos.js | UTF-8 | 2,671 | 2.734375 | 3 | [] | no_license | //获取信息并解析
// var res = '{"result": {"location": [11.256330002, -256.33259878], "parkingplace": 15, "floor": "1F"}}';
/*
* @brief 扫一扫定位,在用户端显示当前所在车位
* @param res 扫码获得的json字符串
*
* */
function scanPos(res){
var posInfo = JSON.parse(res).result;
console.log(posInfo);
var loc = posInfo.location;
var parkingp... | true |
284cbb0988e395bc2212ebc1fbc1404cb6a2a22e | JavaScript | philip-rasmusson/prime-number-calculator | /app.js | UTF-8 | 4,821 | 3.453125 | 3 | [] | no_license | 'use strict'
//Main array to store prime numbers
let primeNumbers = []
//Background colors for display-message
const green = '#8AD385'
const red = '#D8596F'
const white = '#fff'
const evenEnding = [0, 2, 4, 5, 6, 8]
const primeQuery = () => {
const input = document.getElementById("userInput").value
const lastDigi... | true |
bd93e048aaa3d5466379900c206a06623425315c | JavaScript | Evgeniy-boop/cautious-winner | /local_modules/CcyConversionRates/Controller.js | UTF-8 | 6,177 | 2.578125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Copyright (c) 2014-2019, MyMonero.com
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// cond... | true |
8761247479577df367c112c3f284e0bb83097158 | JavaScript | joermann/SavvyHomework | /week3homework/homeworkweek3.js | UTF-8 | 577 | 3.046875 | 3 | [] | no_license | let pizzaToppings = ['mozzarella', 'provolone', 'pepperoni', 'onion', 'garlic'];
function greetCustomer() {
}
let greetCustomer = "Welcome to Honkey Tonk Pizza. We have " loop pizzaToppings " "
function getPizzaOrder(size, toppings, crust,){
console.log "Cooking Pizza"
}
let preparePizza = ['size', 'crust', 'l... | true |
86624359a46a3ff29e4fd3beb7c7b22a94edbc46 | JavaScript | brunafinSD/treinamento-js | /rocketseat/03-expressoes-e-operadores/scripts/6-script.js | UTF-8 | 854 | 3.359375 | 3 | [] | no_license | //são considerados falsy
console.log(false ? 'verdadeiro' : 'falso');
console.log(0 ? 'verdadeiro' : 'falso'); //type coersion transforma 0 em false
console.log(-0 ? 'verdadeiro' : 'falso');
console.log("" ? 'verdadeiro' : 'falso');
console.log(null ? 'verdadeiro' : 'falso');
console.log(undefined ? 'verdadeiro' : ... | true |
dc846bf581929ce81df62d0e8b03bd2c7c047f10 | JavaScript | acodegame/MobileFlashcards | /reducers/index.js | UTF-8 | 895 | 2.765625 | 3 | [
"MIT"
] | permissive | import { RECEIVE_DECKS, ADD_DECK, ADD_CARD } from '../actions';
function deck(state = {}, action) {
switch (action.type) {
case RECEIVE_DECKS:
return Object.assign(state, action.decks);
case ADD_DECK:
if (Object.keys(state).length === 0 && state.constructor === Object) {
return {
... | true |