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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bdaa3aba436986aee71f5255dd026b7ec399c7a7 | JavaScript | future4code/Elber-Sousa | /semana12/Backend/node-package-template/node-package-template/index.js | UTF-8 | 231 | 2.859375 | 3 | [] | no_license | const countries = require("./countries")
const query = process.argv[2];
console.log(query)
const result = countries.filter(
(country) => country.name.toLowerCase().includes(query.toLocaleLowerCase())
);
console.table(result); | true |
5f549c1657eb41295a161ee4a94599b547b27b22 | JavaScript | Krystian-Debecki/Live-chat | /backend/index.js | UTF-8 | 2,896 | 2.71875 | 3 | [] | no_license | const app = require('express')();
const httpServer = require('http').createServer(app)
const cors = require('cors');
app.use(cors())
const io = require('socket.io')(httpServer,{
cors: {
origins: ['*']
}
})
function getRoomsList(map) {
const arr = Array.from(map);
const filtered = arr.filter(... | true |
63a07180f4dd6177223a270718bbd0e76e0c174d | JavaScript | ganyaotong/iidopage | /page.js | UTF-8 | 954 | 2.9375 | 3 | [] | no_license | /*
iidoMenu is a generator for page menu
you need to customize callback
*/
var iidoMenu = function iidoMenu(pageMenuId){
this.pageMenuId = pageMenuId;
return this;
}
iidoMenu.prototype.generate = function(pageCount,current) {
current = parseInt(current);
var html = "";
var startHtml = "";
var currentHtml = "<li ... | true |
d29c0a21be203828ce2b67879b09768d946e9efd | JavaScript | nirastor/ra-4-2-tr-list | /src/App.jsx | UTF-8 | 1,133 | 2.6875 | 3 | [] | no_license | import React, { useState } from 'react';
import './App.css';
import { nanoid } from 'nanoid';
import Header from './components/Header/Header';
import List from './components/List/List';
import FormAdd from './components/FormAdd/FormAdd';
export default function App() {
const initialNotes = [
{ id: nanoid(), date... | true |
9b26fb5d9622244c2736c48a6722544d092a6cfb | JavaScript | drradicevic/BIT-PP | /BuiltInObjects/BuiltInObjects1/task10.js | UTF-8 | 660 | 4.5 | 4 | [] | no_license | /*10.
a. Write a constructor function that creates points in space. Each point in space has
its own x, y, and z coordinate. For example, (3, 5, 1) can be a point in space.*/
function Point(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
}
var pointSpace = new Point(3, 5, 1);
var secondPoint = new Point(4, 2,... | true |
d805b06077052ae9a122f5c10e5d006bc4d6d4ca | JavaScript | LeoAdrian/MovieAppReact-frontend | /src/App.js | UTF-8 | 5,434 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Main from './routes/main.js';
import Spinner from './components/spinner';
import Movie from './routes/movie';
import Movies from './routes/movies';
import MovieList from './components/movie_list';
import MovieCarousel from './components/movie_carousel... | true |
ea568ab99955f7d73fab1dba5beb9911dd4ba195 | JavaScript | lfriedrichs/balanced-brackets-seattle-web-030920 | /index.js | UTF-8 | 374 | 3.6875 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | function isBalanced(input){
let parentheses = "[]{}()"
let stack = []
for(let parenthesis of input) {
let parenthesisIndex = parentheses.indexOf(parenthesis);
if(parenthesisIndex % 2 === 0) {
stack.push(parenthesisIndex + 1); // push next expected brace position
} else {
if(stack.pop() !== parenthesisIndex) {
... | true |
bd41301e8e0bf69e108700effd9583991b3fe7f5 | JavaScript | gojnimer/weatherproject | /app.js | UTF-8 | 2,224 | 3.1875 | 3 | [] | no_license | function sair() {
localStorage.clear();
window.location.reload();
}
function teste(cidade) {
alert(cidade);
}
function iniciaModal(modalID, nomecidade) {
const modal = document.getElementById(modalID);
if (modal) {
let xhr = new XMLHttpRequest();
xhr.open('GET', "https://api... | true |
644d410d324808329ecb95068022e6756436563c | JavaScript | rishigupta1109/FoodApp | /src/comp/hooks/useValidate.js | UTF-8 | 1,252 | 2.734375 | 3 | [] | no_license | import {useReducer} from "react";
const initialstate={value:'',IsTouchedx:false};
const reducer=(state,action)=>{
if(action.type==="touched"){
return({value:state.value,IsTouched:true});
}
else if(action.type==="reset"){
return (initialstate);
}
else if(action.type==="input"){
... | true |
28908ee8741bf785bb821ce8572503b528d3fe23 | JavaScript | SunSat/ethereum | /tutorial/public/javascripts/address_generator.js | UTF-8 | 4,307 | 2.71875 | 3 | [] | no_license | let crypto = require('crypto');
let utils = require('ethers').utils;
const CryptoJS = require('crypto-js');
const BIP39 = require('bip39');
let wordCount = 15;
let bitsLen = wordCount * 11;
let cehckSumBits = bitsLen % 32;
let totalNuBytes = (bitsLen - cehckSumBits) / 8;
console.log("wrods Count : ", wordCount, ", b... | true |
960d16f45cf9c342098e162889faa34a2d7781c0 | JavaScript | hellopovi/plates | /src/index.js | UTF-8 | 3,735 | 2.8125 | 3 | [] | no_license | import NumberPlate from './NumberPlate.js';
import CanvasImage from './CanvasImage.js';
import { getMousePosInCanvas } from './Utils.js';
class PlateNumber {
constructor() {
// user input elements
this.numberInput = document.getElementById('plate-number');
this.imageInput = document.getElementById('image... | true |
20654cbe45b8398b90fea3e62e5f0ef864298d60 | JavaScript | cchanse/reactnd-project-myreads-starter | /src/App.js | UTF-8 | 2,811 | 2.859375 | 3 | [] | no_license | import React from "react";
import * as BooksAPI from "./BooksAPI";
import Bookshelf from "./Bookshelf";
import Search from "./Search";
import { Route, Link, Switch } from "react-router-dom";
import "./App.css";
class BooksApp extends React.Component {
state = {
books: []
};
/**
* @description Make Ajax r... | true |
c24516c98ed3d741a45b61972a427840d1c6a4ce | JavaScript | KarthusLorin/js-design-patterns | /src/iterator-pattern/index.js | UTF-8 | 1,001 | 4.0625 | 4 | [] | no_license | /*
迭代器模式主要特点是:
1.顺序访问一个集合
2.使用者无需知道集合的内部结构(封装)
常见场景:
1.jquery $.each函数
2.es6 iterator
设计原则验证:
1.迭代器对象和目标对象分离
2.迭代器将使用者与目标对象隔离开
3.符合封闭开放原则
*/
// 迭代器
class Iterator {
constructor (container) {
this.list = container.list
this.index = 0
}
next () {
if (this.hasNext()) {
return... | true |
ee049ee1b551c7b601f0b044978a75aaf105df4b | JavaScript | bean720/seasonal-cuisine | /src/testing-data/Retrieve.js | UTF-8 | 1,187 | 3.34375 | 3 | [] | no_license | let dishes = require('./Data.js');
function getCountry(dishes) {
return dishes.filter(dish => {
return dish.country === "China";
});
}
console.log(getCountry(dishes));
//returns all recipes for China
function getCourse(getCountry) {
return getCountry(dishes).filter(dish => {
return dish.co... | true |
c2e266bf466bff20ac60806ca8a2e196121c75ab | JavaScript | B3RTG/M0656DWAPEC2 | /PEC2_Ej3/Ejer3 - MVC Users/services/user.service.js | UTF-8 | 1,240 | 3.046875 | 3 | [] | no_license | /**
* @class Service
*
* Manages the data of the application.
*/
class UserService {
constructor() {
this.users = (JSON.parse(localStorage.getItem("users")) || []).map(
user => new User(user.name, user.email, user.address, user.phone)
);
this.selectedUser = null;
}
bindUse... | true |
21173bb146bac3c5d2e793049cb0d916668bc15f | JavaScript | khoinmdIT99/QuanLyThuyen | /WebApplication/wwwroot/js/leaflet/map_marina.js | UTF-8 | 1,686 | 2.578125 | 3 | [] | no_license | var mymap;
mymap = initMap('map');
mymap.setView([56.2639, 9.5018], 7);
var marinaPopup = '\
<div class="text-center" style="width: 200px">\
<b>Selected Location</b>\
<div style="display: flex; align-items: baseline; justify-content: space-evenly;">\
<label class="control-label" style=... | true |
b6310ae1cd40f1433e66d5d81b1b0d18a0ba0df2 | JavaScript | LuizHenriqueKS/webp-to-png | /src/main.js | UTF-8 | 658 | 2.59375 | 3 | [] | no_license | const gm = require('gm');
const path = require('path');
const source = path.resolve('./data/1.webp');
const output = path.resolve('./data/1.png');
const output2 = path.resolve('./data/1.jpg');
const output3 = path.resolve('./data/2.png');
gm().command('convert').in(source).write(output, (err) => {
if (err) {
co... | true |
6d6b7847d58e68f4b9fc62e3669e30f6d2618a53 | JavaScript | jayH4487/hn-clone-react | /src/Context.js | UTF-8 | 949 | 2.671875 | 3 | [] | no_license | import React, {useState, useEffect} from "react"
const Context = React.createContext()
function ContextProvider(props) {
const [baseUrl, setBaseUrl] = useState("https://node-hnapi.herokuapp.com")
const [favorites, setFavorites] = useState([])
function addFavorite(story) {
setFavorites(prev ... | true |
5720720db440dacae3a3ef10e3bdecb79b15fcaf | JavaScript | smucode/kingside | /src/rex/test/fen-test.js | UTF-8 | 12,342 | 2.671875 | 3 | [] | no_license | if (typeof define !== 'function') { var define = (require('amdefine'))(module); }
define(["require", "vows", "assert", "underscore", "../Fen"], function(require, vows, assert, __, Fen) {
vows.describe('Fen').addBatch({
'creating a new Fen object' : {
topic : new Fen(),
'should... | true |
4deb7a8f9b984c3c8d2bbe9f329f4d9743d64f68 | JavaScript | Projet-dev-mobile/CT_Dev_Mobile | /src/api/themoviedb.js | UTF-8 | 2,055 | 2.546875 | 3 | [] | no_license | const API_KEY = '794d7e35141645cb62a0d7fcf70c4a93';
export async function getPeopleList(searchTerm = '', offset = 0) {
try {
const myHeaders = new Headers({ 'user-key': API_KEY });
const url = `https://api.themoviedb.org/3/person/popular?api_key=${API_KEY}&language=en-US&page=1`;
const response =... | true |
2b8b5363661ac645cb1bc34625022c7bc354d1cb | JavaScript | stanfordakpsi/stanfordakpsi.github.io | /bootstrap_3.1.1/js/preload_images.js | UTF-8 | 649 | 2.6875 | 3 | [] | no_license | /* Citing the first answer from StackOverflow
* https://stackoverflow.com/questions/476679/preloading-images-with-jquery
*
* Used for non-commercial purposes
*/
function preload(arrayOfImages) {
$(arrayOfImages).each(function(){
$('<img/>')[0].src = this;
});
}
// Usage:
preload([
'./bootstra... | true |
27ab29c30d4d1513ea1040294f6b56ea815c0d84 | JavaScript | Adailson-25/Rede-Neural | /sketch.js | UTF-8 | 376 | 2.6875 | 3 | [] | no_license | function setup() {
createCanvas(400, 400);
background(220);
var m1 = new Matrix(2, 2);
var m2 = new Matrix(2, 2);
//Matrix.add(m1,m2).print();
var m3 = new Matrix(2, 1);
var m4 = new Matrix(1, 2);
//Matrix.multiply(m1,m2).print();
var rn = new RedeNeural(1, 3, 1);
var arr = [1... | true |
e9e0d6e20ccb1de4b0ef1308d6c148b333ce6d55 | JavaScript | AguirreAlexa/CTD-FE-storytelling | /src/components/Historial.jsx | UTF-8 | 427 | 2.5625 | 3 | [] | no_license | import React, { Component } from "react";
class Historial extends Component {
render() {
return(
<div className="recordatorio">
<h3>Última opción elegida: {this.props.anterior}</h3>
<h3>Elegido anteriormente: </h3>
<ul>{this.props.historial.map((i... | true |
cb3f8156b507181b853fdf74230c3e37c021e13a | JavaScript | jacobmoe/planb | /dist/lib/utils.js | UTF-8 | 5,039 | 2.515625 | 3 | [] | no_license | 'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['de... | true |
fdd1351082845f59e851756bfd8648452cedf61e | JavaScript | adrigr4/React | /apps/src/Partidas/Partidas.js | UTF-8 | 3,363 | 2.5625 | 3 | [] | no_license | import React, { Component } from 'react';
import {
Link,
} from "react-router-dom";
class Partida extends Component {
constructor(props) {
super(props);
this.state = {
creador: ""
}
}
componentDidMount() {
fetch("https://localhost:44360/api/Jugadores/" + this... | true |
063c67eddf3ff21f2cc341137856b43858e9a2d0 | JavaScript | karen-rivas0410/codeup-web-exercises | /js/bonus_functions.js | UTF-8 | 5,919 | 4.125 | 4 | [] | no_license | // (function () {
"use strict";
// ================ SIMPLE FUNCTION DRILLS
// 1) Make a function called returnTwo() that returns the number 2 when called
// ---Test this function with console.log(returnTwo())
// function returnTwo(number) {
// return number = 2;
//
// }
// console.log(returnTwo('8'));
// ... | true |
b17fd9df7cf77903ce4947db2dc7be32f9e90946 | JavaScript | jvntf/beyond-the-census | /public/scripts/old_scripts/getNewEntries.js | UTF-8 | 1,125 | 2.546875 | 3 | [] | no_license | var fs = require('fs');
var csv = require('csv');
var _ = require('lodash');
var ids = [];
// var sourcePath = '../source/QueensLanguages.csv'; // path to file with utf8 encoding
var sourcePath = 'languages.csv'; // path to file with utf8 encoding
var newData = 'ids.csv'; // path to file with utf8 encoding
var ... | true |
bef240a7d3e1ef08347602143f3a327ee7afa7fa | JavaScript | meganmckeough/WDI_16_HOMEWORK | /Megan/wk01/3-wed/scripts.js | UTF-8 | 1,515 | 3.953125 | 4 | [] | no_license | // Exercise: Objects
// The Recipe Card
// var recipe = {
// title: "Okonomiyaki",
// servings: 2,
// ingredients: ['cabbage', 'ginger', 'egg', 'flour'],
// }
// console.log(recipe.title);
// console.log("Serves: " + recipe.servings);
// console.log("Ingredients:");
// console.log(recipe.ingredients[0]);
// cons... | true |
c2aae3fe08fb61d98fc287839ee7a979018cd265 | JavaScript | lyluyi/ES6-TS-Node | /16.Process/1.js | UTF-8 | 2,235 | 3.609375 | 4 | [] | no_license | // process 对象是一个全局变量,它提供有关当前 Node.js 进程的信息并对其进行控制。
// 作为一个全局变量,它始终可供 Node.js 应用程序使用,无需使用 require()。
// 它也可以使用 require() 显式地访问:
// console.log(process)
// console.log(process.memoryUsage()) // cpu使用情况
//
//
// console.log(process.env)
//
// if (process.env.mode === 'dev') { // 电脑高级设置中的环境变量,mode === 'dev'
//
// cons... | true |
c61c0f4879c3e39d4b35651779317a07d96e3710 | JavaScript | k16t2000/mongodb | /generateDate.js | UTF-8 | 589 | 3.3125 | 3 | [] | no_license | //anonimnaja funkzija
exports.getDate=function(){
let today=new Date();
//zadaem format dlja objekta
let options={
weekday: "long",
day: "numeric",
month: "long"
}
let day=today.toLocaleDateString("en-Us", options);//peredaju dannie sjuda spomoshju objekta options
return ... | true |
d481bddbc75dfebb2b58a798326a599cc13a3f00 | JavaScript | mayuripark/Mastek-JavaScript-JQuery-and-KnockoutJS-Assignments | /Assignment 5/JavaScript Express Server/server.js | UTF-8 | 866 | 2.9375 | 3 | [] | no_license | const express=require('express');
const server=express();
const port=3000;
server.use(express.json());
server.use(express.urlencoded({extended:true}));
server.get('/',(req,res)=>{
res.sendFile(__dirname+"/index.html");
});
server.get('/js/main.js',(req,res)=>{
res.sendFile(__dirname+"/js/main.js");... | true |
45b0efd732d9b15df268fc0d069029d0a4263fbd | JavaScript | werew/Money-Street | /src/entities/personages/treasures.js | UTF-8 | 2,477 | 2.703125 | 3 | [
"MIT"
] | permissive | play.createTreasures = function() {
var treasures = this.add.group();
treasures.enableBody = true;
for (i = 0; i < play.level.personages.treasures.length; i++){
treasures.create(play.level.personages.treasures[i].path[0].x,
play.level.personages.treasures[i].path[0].y,'treasure');
tr... | true |
35345851233b1dc229d990d393332847cfdd36b2 | JavaScript | anirodrin/Obligarotio | /Dominio/PresentacionWeb/JavaScript/ValidarAltaExcursion.js | UTF-8 | 1,569 | 2.8125 | 3 | [] | no_license | function ValidarDiasTraslado(sender, args) {
var ret = true;
var dias = args.Value;
if (isNaN(dias)) {
ret = false;
}
else if (dias <= 0) {
ret = false;
}
args.IsValid = ret;
}
function ValidarPuntos(sender, args) {
var ret = true;
var puntos = args.Value;
if (i... | true |
feda4912d43d49f723c8a6a7ae418120d7f727b4 | JavaScript | ploythan93/pixel | /ant2/GameManager.js | UTF-8 | 4,173 | 3.234375 | 3 | [] | no_license | /**
* Manages all objects in the game
*/
function GameManager(canvasHandle) {
/* Initialize Object */
this.FPS = 20;
// Get primary canvas
this.mainCanvas = canvasHandle;
this.mainContext = this.mainCanvas.getContext('2d');
// create buffer
this.backBufferCanvas = document.createElement('canvas');
... | true |
7bf3b79302f23400c774dd92569de7a929122776 | JavaScript | LeoMelody/FE-route | /Regex/base/part2/test.js | UTF-8 | 3,381 | 3.8125 | 4 | [] | no_license | /*
* @Author: leo
* @Date: 2019-07-05 15:56:26
* @Last Modified by: leo
* @Last Modified time: 2019-07-05 22:42:10
* 位置理解案例
*/
// 案例1、写一个匹配不到任何东西的正则
let reg = /.^/g // 开始位置前面还有东西必然是不可能滴
console.log(reg.test('hello'))
// 12345678 => 12,345,678
let money = '12345678'
reg = /(?=\d{3}$)/g // 生成最后一个,
reg = /(?=(\d... | true |
fb1bb5d2c6b5a018ee8b595a8694b4c791b8f86a | JavaScript | stefanliydov/JavaScriptCore | /JSAdvanced/ExerciseDomManipulation/distanceConverter.js | UTF-8 | 1,526 | 3.046875 | 3 | [] | no_license | function attachEventsListeners() {
// TODO: attach click event to convert button
document.getElementById('convert').addEventListener('click', Convert);
function Convert() {
let input = document.getElementById("inputUnits").value;
let output = document.getElementById("outputUnits").value;
... | true |
989b0e7f9ef912423e316ced208a986699995c74 | JavaScript | serby/ctrl | /bundles/section/lib/model.js | UTF-8 | 2,699 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | // Sections like Categories in Wordpress can be used to divide up the content on
// your site. They are the different folders under which all other content can
// sit. i.e. **/featured** **/popular**
var validity = require('validity')
, schemata = require('schemata')
, crudModel = require('crud-model')
// We wor... | true |
86176590301dc089856fbbee87219b7285a16bd1 | JavaScript | filipe03freitas/atividade7 | /ex3/index3.js | UTF-8 | 373 | 3.296875 | 3 | [] | no_license | // Pedindo os dados
const login = prompt('Informe o seu login: ');
const senha = prompt('Informe a senha: ');
// Apresentar a resposta
if (login === 'aluno' && senha === '123') {
alert("Login realizado com sucesso!");
} else if(login === 'professor' && senha === '456'){
alert("Login realizado com sucesso!")... | true |
2b0450d91b38929d63a0f2470be780207ddef440 | JavaScript | kwikl3arn/react-with-django-part-1 | /src/components/Posts/Posts.js | UTF-8 | 4,143 | 2.6875 | 3 | [] | no_license | import React, {useState, useEffect} from 'react';
import {Button, Spinner, Alert} from 'react-bootstrap'
import Post from './Post';
import axios from 'axios'
let myPosts = [
{
id: 0,
title: 'post 1',
description: 'description post 1',
liked : false,
likes: 0,
},
{
... | true |
b96341fc16f78e2ffc15a92166bfc17eacb2b256 | JavaScript | swiftwinning/brown-cis-random-users-app | /src/index.js | UTF-8 | 7,470 | 3.359375 | 3 | [] | no_license | /*
* Jeffrey Winning
* swiftwinning @ gmail . com
* 617 595 8972
*
* Brown CIS - Random User API Parser Application
*
* This is a one-page React.js application for fetching and dynamically displaying
* the data of random users from the randomuser.me API.
*
* It retrieves an Array of 20 users from U.S. and C... | true |
8b82054780ae57c3b17bd396f712b62b41f9b00d | JavaScript | nickzuber/doxide | /lib/compiler.js | UTF-8 | 3,549 | 3.140625 | 3 | [
"MIT"
] | permissive | /**
* Compile the container given by the parser into string? markdown code.
*
* Write this out to a destination file denoted by -o flag or write to command line.
*/
'use strict';
const _ = require('./constants');
const Compiler = function(nodeTree){
this.nodeTree = nodeTree;
this.flagged = false;
this.outp... | true |
e56e489408c09588f6fb5d514e73eea4c08a69f0 | JavaScript | 3d3d3d-code/CRM-01-DWWM- | /nodejs/02_Areas/Models/Path.js | UTF-8 | 474 | 2.609375 | 3 | [] | no_license | class Path extends Point {
constructor(player, nbPassages) {
this.player = player;
this.nbPassage = nbPassages;
super(Point); //rajout en parametre lié au dossier parent
}
isPlayer() {
return this.player;
}
setPlayer(){
this.player = nPlayer;
}
getNb... | true |
ffeb8aed02f52b57b6eb0a25434fe92f1a7f5c36 | JavaScript | ngothuonghoanganh/parking | /bin/DAO/parkinglot.js | UTF-8 | 1,867 | 2.875 | 3 | [] | no_license | let parking = require('../DTO/parking')
let paringLot = []
let capacities = 0
module.exports = {
createParking(capacity) {
capacities = capacity
for (let index = 0; index < capacities; index++) {
paringLot.push(new parking(index + 1, '', 0))
}
console.log(`Created parking lot with ${capacities... | true |
aa0b327669e8c706504fad1f89dfaee82e1593d5 | JavaScript | abhishekkumar1711/File-Tracking-System | /javascript.js | UTF-8 | 378 | 2.828125 | 3 | [] | no_license | function myFunction() {
var x = document.getElementById("myTopnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
}
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function cur... | true |
ded0fa55c81d6db614dcad01b37121b01a2c015b | JavaScript | gonzalosian/angular-adv-adminpro-backend | /controllers/hospitales.js | UTF-8 | 3,702 | 2.96875 | 3 | [] | no_license | // response me puede servir para definir el tipo, por ejemplo, si no viene la res (response), ponemos un valor por default
const { response } = require('express');
const Hospital = require('../models/hospital');
const getHospitales = async(req, res = response) => {
// const hospitales = await Hospital.find({}, ... | true |
30e4210af43f34c3ec71a49fe3546910bd650b3b | JavaScript | MEianelli/portal-noticias | /js/noticias.js | UTF-8 | 2,551 | 2.765625 | 3 | [] | no_license | async function getNoticias(){
let resposta = await fetch("http://newsapi.org/v2/top-headlines?apiKey=b51892084dc34b95aa48faf2277b2fcc&country=br");
let todasNoticias = await resposta.json();
let principal = document.querySelector('#principal');
let container = document.querySelector('#listaDeNoticias0')... | true |
0074dd556d8522e53e2c67e3f8ab7ae911bed980 | JavaScript | ForestKatsch-Archive/harold | /assets/scripts/main.js | UTF-8 | 1,980 | 2.53125 | 3 | [] | no_license |
var VERSION=[0,0,1];
var modules=["main","prop","canvas","crayon","world","gestures","things","load"];
var module_number=0;
var module_start_time;
function loaded(module) {
if(!(module in modules))
throw "ModuleError: nonexistent module '"+module+"'";
if(modules[module] == true)
throw "ModuleError: module ... | true |
b4994c1e1a38d3116d0847129a3e80a32d2fad0e | JavaScript | Schow94/clock | /src/components/Daylight.js | UTF-8 | 725 | 2.578125 | 3 | [] | no_license | import React from 'react';
const lightConfig = {
day: {
text: "Let's get some sun!!!",
iconName: 'sun'
},
night: {
text: 'Time to get some Zzzzz',
iconName: 'moon'
}
}
const getLight = (milTime) =>{
if(milTime >= 7 && milTime < 18 ){
return 'day';
}
else{
return 'night';
}
}... | true |
2fe5b197b3fc853f61dd0b563e012f87f7439d06 | JavaScript | voidblue/frontend-web | /08/app.js | UTF-8 | 857 | 2.75 | 3 | [] | no_license | // $('body').fadeOut().delay(1000).fadeIn();
// $( document ).ready(function() {
// //브라우저가 다르더라도 로딩되면 실행
// $('div').css("background-color", "black"); //모든 div에 적용
// $('div').css("height", "300px");
// $('div').css("width", "500px");
//
//
// // console.log($('div').scrollTop());
// });
//$('div').css("ba... | true |
2338c9b29334f53a93adad4bbee279403fdee196 | JavaScript | sergop321/Wproject | /javascript/string_helpers.js | UTF-8 | 1,100 | 2.96875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | String.prototype.toCapitalize = function() {
return this.toLowerCase().replace(/^.|\s\S/g, function(a) {return a.toUpperCase();});
};
String.prototype.toLargeNumberReadableFormat = function() {
return this.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
};
String.prototype.makeLink = function(link_name) {
return l... | true |
377220dc066d8ac39a7adedecabce388aa0eac5f | JavaScript | Nikolaevaanneta/frontend-project-lvl1 | /games/brain-gcd.js | UTF-8 | 670 | 3.265625 | 3 | [] | no_license | import game, { getRandomNumber } from '../src/index.js';
const greeting = 'Find the greatest common divisor of given numbers.';
const nod = (x, y) => {
while (y !== 0) {
const tmp = x % y;
// eslint-disable-next-line no-param-reassign
x = y;
// eslint-disable-next-line no-param-reassign
y = tmp;
... | true |
2d045a154d4a7eff30278481b04c2cceb5af1e15 | JavaScript | setheugene/project2 | /public/js/index.js | UTF-8 | 3,621 | 3.03125 | 3 | [] | no_license |
// initialize firebase auth
var config = {
apiKey: "AIzaSyCWat2b43WXa7yr8dZ4_aZ0WnyGPH-4dos",
authDomain: "mybeer-8d95e.firebaseapp.com",
databaseURL: "https://mybeer-8d95e.firebaseio.com",
projectId: "mybeer-8d95e",
storageBucket: "mybeer-8d95e.appspot.com",
messagingSenderId: "222789239888"
};
firebase.i... | true |
7131906390d8a66dd09660900884613f98aebd3e | JavaScript | holladayian/turing-cafe-fe-ih | /src/App/App.js | UTF-8 | 1,363 | 2.53125 | 3 | [] | no_license | import React, { Component } from 'react';
import fetcher from '../apiCalls/apiCalls.js';
import {Reservations} from '../Reservations/Reservations.js';
import {ResForm} from '../ResForm/ResForm.js'
import './App.css';
class App extends Component {
constructor() {
super()
this.state = {
reservations: []... | true |
19c7a788f1a78b92889fccc1948f9bf8c24e467a | JavaScript | dofinator/TypeScript4sem | /TypeScript - Week3/exercises/ex2A.js | UTF-8 | 1,264 | 3.34375 | 3 | [] | no_license | const fetch = require('node-fetch')
let obj = { name: "", firstFilm: "", firstSpecies: "", homeworld: "" }
function getPlanetforFirstSpeciesInFirstMovieForPerson(id) {
return new Promise((resolve, reject) => {
fetch("https://swapi.dev/api/people/" + id)
.then(response => response.json())
... | true |
93f62e1080c6bac7819fbe7499a90c3aa563fc86 | JavaScript | T-Mizno/work | /20230219-2Dplot.js | UTF-8 | 5,426 | 3.296875 | 3 | [] | no_license | function assert(b) {
if (b) return;
console.info(false, "ASSERT FALUE!");
let e = new Error();
//e = e.stack.split("\n")[2].split(":");
//e.pop();
console.log(e);
}
function _newAxis(aEnd, aToEnd) {
assert(Math.abs(aEnd - aToEnd) > 0.0001);
let axis = {};
axis.end = aEnd;
axis... | true |
46077445877973e32472839bc57743c56a9c5c32 | JavaScript | cmtaormino/CCAWebsite | /public_html/JS/Index.js | UTF-8 | 1,119 | 2.90625 | 3 | [] | no_license | function getProjectTasks(projectName){
if(document.getElementById(projectName).childNodes.length < 3){
var project = document.getElementById(projectName);
var taskList = document.createElement('ol');
var taskOne = document.createElement('li');
taskOne.appendChild(document.cr... | true |
c53852a2aa219b4a2173218ee6b898ad0d4f137a | JavaScript | hodayaAMITAY/NodeJsEmployeePresence | /server.js | UTF-8 | 1,331 | 2.625 | 3 | [] | no_license | const express = require('express');
const app = express();
const employee = require('./employee')
const Hours=require('./Hours')
const fs = require('fs');
//const teacher = require('./teacher')
var bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
... | true |
ae67fc73b0e8f3795a0073edac4a0e594b5a75c3 | JavaScript | WeBeautifulNow/jsAsync | /promiseIntroduce.js | UTF-8 | 527 | 3.890625 | 4 | [] | no_license | var promise = new Promise(function (resolve, reject) {
console.log("inner promise"); // 1
resolve(42);
// reject(1);
});
promise.then(
function (value) {
console.log(value); // 3
},
function (value) {
console.log(`reject for number ${value}`); // 3
}
);
console.log("outer pro... | true |
02191237b71d2dadf8ca03b9bb7bd8cebd85d135 | JavaScript | jortiz-el/Phaser3 | /tutorial+manual/Phaser_3_escenas/src/sceneA.js | UTF-8 | 889 | 2.859375 | 3 | [
"CC0-1.0"
] | permissive | class SceneA extends Phaser.Scene{
constructor(){
super({
key:"SceneA"
});
}
preload(){
}
create(){
let graphics = this.add.graphics();
graphics.fillStyle(0xff3300, 1);
graphics.fillRect(100,200,600,300);
graphics.fillRect(100,100,100,10... | true |
5c796251cf42bd4968b20e553344a254b161aaae | JavaScript | MateusKawazoe/Web-2 | /src/pages/login.js | UTF-8 | 4,144 | 2.578125 | 3 | [] | no_license | import React, { useState } from "react";
import Switch from "@material-ui/core/Switch";
import axios from "axios";
import Swal from "sweetalert2";
import "../styles/login.css";
import logo from "../assets/logo.png";
export default function Login({ history }) {
if (localStorage.getItem("token") != null) {
histor... | true |
5652276d20b3cc5a04acf64b03a0b282a59fefd4 | JavaScript | Sidahmeders/ld_talent_codes | /test2.js | UTF-8 | 1,705 | 4.28125 | 4 | [] | no_license | // CODE 2
/*
Write a function that takes as input a filename.
The function parses the file reading line by line and determines if
the line contains a single valid number.
It should return a list of all the numbers found in the file.
Example input file:
==========================================
#This is an input fi... | true |
db3a352d1b8887b20fb240d23ff372f7fd32d42d | JavaScript | Poden/venues-static-client | /src/components/AddVenues.js | UTF-8 | 1,757 | 2.578125 | 3 | [] | no_license | import React from 'react';
import config from'../config';
import './Components.css';
class AddVenues extends React.Component {
static defaultProps ={
onVenueSubmit: () => {}
}
handleSubmit = (event) =>{
event.preventDefault()
const {venue_name, venue_zipcode, venue_website} = event.target
consol... | true |
2daebdfad1613655518640dd8dd0ac37aa46ecc5 | JavaScript | sureshprajapati076/WAP-LAB | /clearscreen/CIrcle_files/control.js | UTF-8 | 3,106 | 2.703125 | 3 | [] | no_license | $(function(){
"use strict";
let timerId=null;
let timerForOpacity=null;
$('#start').click(showCircle);
$('#stop').click(reset);
function reset() {
$('#width').removeAttr("disabled");
$('#number').removeAttr("disabled");
$('#rate').removeAttr("disabled");
$('.circle').remove();
$('... | true |
2e23584c22310c179c6fbfebe6c62949b7e439b6 | JavaScript | krishna-auto/JavaScriptSample | /Pages/constuctors.js | UTF-8 | 334 | 3.515625 | 4 | [] | no_license | let empDetails = function(name,age){
this.name = name;
this.age = age;
this.getAge = function() {
return this.age;
}
}
empDetails.prototype.getName = function() {
return this.name;
}
let empdetailsobj = new empDetails('krishna','28');
console.log(empdetailsobj.getName());
console.log(empdetails... | true |
d805a28fc62bcf2d472df67b11c3d96febe0f8a4 | JavaScript | suverahealth/dev-challenge | /news-service/handler.js | UTF-8 | 1,041 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | const news = require('./newsapi')
/**
* This is a basic hello function.
*
* @param {Object} event - HTTP event
* @return {JSON} HTTP response JSON obj
*
*/
module.exports.hello = async (event, ctx, cb) => {
cb(null, {
statusCode: 200,
body: JSON.stringify(
{
message: 'Go Serverless v1.0! ... | true |
3abc0be3a856156659b45b79b037477f1270ec70 | JavaScript | Rolkyssoh/quicksss_Ui | /src/redux/annonces/annonce.reducer.js | UTF-8 | 493 | 2.515625 | 3 | [] | no_license | const INITIAL_STATE = {
annonces: null
}
const annoncesCollectiionReducer = (state=INITIAL_STATE, action) => {
switch (action.type) {
case 'GET_ALL_ANNONCE':
return {
...state,
annoncesCollection: action.payload
}
// case 'LOG_OUT':
... | true |
91ed138b336721f1dc66af6b7b3a22b03932e28b | JavaScript | ziad-elnaggar/Movies-Games | /games/static/games/recommended.js | UTF-8 | 5,541 | 2.671875 | 3 | [] | no_license | $(document).ready(function(){
$(".navbar li").removeClass('active');
$(".navbar .games").addClass('active');
// duration of scroll animation
var scrollDuration = 300;
// paddles
var leftPaddle = document.getElementsByClassName('left-paddle');
var rightPaddle = document.getElementsByClas... | true |
619f1dc9c8c3345f4825bbdc628f7847ef8364b6 | JavaScript | klint27/BlockChainDataManagement | /test/BlockChainDMExceptions.js | UTF-8 | 5,511 | 2.734375 | 3 | [] | no_license | const BlockChainDM = artifacts.require("./BlockChainDM.sol");
contract('BlockChainDM', function (accounts) {
let dataInstance;
const seller = accounts[1];
const buyer = accounts[2];
const id = 1;
const dataName = "Data Instance 1";
const dataContent = "Content of Data Instance 1";
const da... | true |
bf0ebf9d7070a8c41f32b47df932fa23f3f7f677 | JavaScript | pilgrim2go/lupoex-client | /src/resources/decorators/subsription-service.js | UTF-8 | 1,068 | 2.53125 | 3 | [] | no_license | /**
* Created by istrauss on 9/8/2017.
*/
import _findIndex from 'lodash/findIndex';
export function subscriptionService() {
return function (target) {
target.prototype.subscribe = function subscribe(subscriber) {
if (!this.subscribers) {
this.subscribers = [];
}
... | true |
194ad33a495d0e957debef8dfda9ca94fdbf6c51 | JavaScript | bhargavkumar1612/tower-of-hanoi-with-react | /src/components/Table/index.js | UTF-8 | 469 | 2.53125 | 3 | [] | no_license | import {Component} from "react"
import "./index.css"
class Table extends Component {
state = {stripes: 20}
render(){
const {stripes} = this.state
let stripesArr = []
for(let i=0;i<stripes;i++){
stripesArr.push(i)
}
return <div className="table">
{... | true |
f2c83e9867a45d164977bc06f43b7ff23b219a01 | JavaScript | noequalindi/React-App-Exercises | /reactexpress/server.js | UTF-8 | 447 | 2.78125 | 3 | [] | no_license | const express = require('express')
const app = express();
app.get('/api/customers', (request,response) => {
const customers = [
{ id: 1, firstName: 'Noelia', lastName: 'Qualindi'},
{ id: 2, firstName: 'Other', lastName: 'Customer'},
{ id: 3, firstName: 'Other2', lastName: 'Customer2'}
... | true |
c4a756819be1611d047662e59e3125346ebaf365 | JavaScript | HaqueMannan/The-Complete-Node.js-Developer-Course | /Section 15 - Realtime Web Applications with Socket.io (Chat App)/15.8 - Form and Button States/chat-app/public/js/chat.js | UTF-8 | 2,100 | 3.484375 | 3 | [] | no_license | const socket = io()
// Elements:
// Convention of using $ sign to let us know what we have in the variable is a DOM element. Makes it easier to write and read our code.
const $messageForm = document.querySelector('#message-form')
const $messageFormInput = $messageForm.querySelector('input')
const $messageFormButton = ... | true |
f766716c4b07b6bf2ae9d661002cde37ede2a039 | JavaScript | redbearin/skill-work | /find-the-discount/answer.js | UTF-8 | 141 | 2.90625 | 3 | [
"MIT"
] | permissive | const discount = (num, disc) => {
return (num - (num * disc * .01)).toFixed(2);
};
const num = 1500;
const disc = 50;
discount(1500, 50); | true |
87030737b01c7ab07059075ed880ad04faa3cb91 | JavaScript | jgdigitaljedi/newPort | /public/modules/core/services/weather.client.service.js | UTF-8 | 2,862 | 2.5625 | 3 | [
"MIT"
] | permissive | 'use strict';
/*jshint camelcase: false */
/*global moment: false */
angular.module('core').service('Weather', ['$q', '$http',
function($q, $http) {
var nowTimestamp = moment().unix(),
cachedConditions = null,
conditionsTimestamp = null,
cachedForecast = null,
forecastTimestamp = null;
return {
get... | true |
0fcb19d88ce66de3be0a4a315f980364a66424cc | JavaScript | HussainAlhadab/Full-Stack-28-03-21 | /wk1/d2/algo/algo team 5.js | UTF-8 | 1,375 | 4.4375 | 4 | [] | no_license | /*
Recreate the .push method without using .push
Given an array and a new item, add the new item to the back of the array
return the new length of the array
hint: What index are you adding a new item at?
let array1 = [];
console.log(array1);
array1[0] = 2;
console.log(array1);
array1[5] = 4;
console.log(arra... | true |
fc2b800f930828c806b46c29ceaca87b2f8b8308 | JavaScript | yondonfu/livepeer-scripts | /checkTranscoderRankMove.js | UTF-8 | 1,553 | 2.578125 | 3 | [] | no_license | const Web3 = require("web3")
const BondingManagerABI = require("./abi/BondingManager.json")
const BigNumber = require("bignumber.js")
const prompt = require("prompt-sync")()
const main = async () => {
const startRound = parseInt(prompt("Start round: "))
const endRound = parseInt(prompt("End round: "))
cons... | true |
dec22b0253ff083015be8ef80bac787f7f0e1afb | JavaScript | raineorshine/crypto-gains | /src/index.js | UTF-8 | 13,594 | 2.734375 | 3 | [] | no_license | const memoize = require('nano-persistent-memoizer')
const got = require('got')
const secure = require('../data/secure.json')
const Stock = require('./stock.js')
const stock = Stock()
// group transactions by day
const groupByDay = trades => {
const txsByDay = {}
for (let i=0; i<trades.length; i++) {
const key... | true |
16813067a38765cbbb7a6366d5e336565e77079e | JavaScript | gaurang619/Grocery-List | /js/app.js | UTF-8 | 3,748 | 2.578125 | 3 | [] | no_license | var app= angular.module('groceryListApp', ["ngRoute"]);
app.config(function ($routeProvider, $locationProvider) {
$locationProvider.hashPrefix('');
$routeProvider
.when("/",{
templateUrl: "views/groceryList.html",
controller: "HomeController"
... | true |
6a6e68f7da783f2a6e83243a1a6873fbf31b8dab | JavaScript | c31415/c31415.github.io | /js/ImageLoading.js | UTF-8 | 2,099 | 3.078125 | 3 | [] | no_license | var warriorPic = document.createElement("img");
var monsterPic1_0 = document.createElement("img");
var monsterPic1_1 = document.createElement("img");
var monsterPic2_0 = document.createElement("img");
var monsterPic2_1 = document.createElement("img");
var monster1_anim = [monsterPic1_0, monsterPic1_1];
var mons... | true |
0837eb3d95de03b04161d7658ed1bf80f5a621b9 | JavaScript | yoman07/geo-server | /web.js | UTF-8 | 2,336 | 2.59375 | 3 | [
"MIT"
] | permissive | var express = require('express')
, app = express()
, http = require('http')
, server = http.createServer(app)
, io = require('socket.io').listen(server);
var port = process.env.PORT || 5000; // Use the port that Heroku provides or default to 5000
// listen for new web clients:
server.listen(port... | true |
a3d4db4ea49a3d89b41396a3dcb1b1a55394f9c6 | JavaScript | Neurochrom/cowjourney | /js/particle.js | UTF-8 | 1,776 | 2.828125 | 3 | [
"MIT"
] | permissive | function Particle(){
this.preload = ["img/red1dot.png"
,"img/red2dot.png"
,"img/dustdot.png"
,"img/red3dot.png"
,"img/simpleparticle.png"];
this.init = function(){
// preparing particle sets
this.bloodSys = ParticleSystem.createParticleSystem(world.scene,
... | true |
68a37311005334a69c3dcb6b559a8e88ec57775b | JavaScript | ducbaovn/elevator | /assets/app/components/system/system.controller.js | UTF-8 | 2,304 | 2.578125 | 3 | [] | no_license | /**
* @ngdoc controller
* @name elevatorApp.controller:systemController
*
* @description
* Controller for init elevator system and manage input params:
* people on floors, the floor people wish to go, booking a elevator
* @example
<example module="elevatorApp">
<file name="system.html">
<div class="r... | true |
89c9b9f5ad1e78c9ce52a01350acb5472d2fc5c4 | JavaScript | BenRub/coup_game | /static/coup_api.js | UTF-8 | 2,400 | 2.9375 | 3 | [] | no_license | async function sendRequest(url, data=undefined, changeButton=true) {
let bodyToSent = data ? JSON.stringify(data) : null
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: bodyToSent,
})
if (!response.ok) {
... | true |
91838006907f5cf880a57b886c10b00de631a916 | JavaScript | min987655/Jsp-blog-model2 | /WebContent/js/reply.js | UTF-8 | 1,627 | 2.609375 | 3 | [] | no_license | function replyWrite(boardId, userId) {
var data = {
// 변수가 아니라 그냥 key : value 임
boardId : boardId,
userId : userId,
content : $("#reply__write__form").val()
};
$.ajax({
type : "post",
url : "/blog/reply?cmd=writeProc",
data : JSON.stringify(data),
contentType : "application/json; charset... | true |
6109ffa47dbdc4cd7b46a512b251cd19636b3a64 | JavaScript | Kimeunsuh/DeptGuideGame | /scripts/app.js | UTF-8 | 1,750 | 2.546875 | 3 | [] | no_license | var initialMenuScreen = document.getElementById("initialMenuScreen");
var loadingScreen = document.getElementById("loadingScreen");
var achievementScreen = document.getElementById("achievementScreen");
var inGameScreen = document.getElementById("inGameScreen");
var personalityTestScreen = document.getElementById("perso... | true |
7c74240fb705b681ddca6f73ef73d93995cad238 | JavaScript | gtunggala/CrystalCollectorGame | /assets/javascript/game.js | UTF-8 | 2,453 | 3.5625 | 4 | [] | no_license | // If you can't code, do da pseudocode gabz
// This game has 4 crystals
// A random number between 19-120 will be generated
// Every crystal will hold a random value between 1-12
// The objective of the game is to add the sums of the crystals to equal the random number that is generated
// When clicking a crystal, the... | true |
96c7a2201db0c365ef81f7cfbe0379c244afa8a8 | JavaScript | lishican/codereview | /whistle/biz/webui/cgi-bin/import-remote.js | UTF-8 | 700 | 2.546875 | 3 | [
"MIT"
] | permissive | var parseUrl = require('url').parse;
var util = require('../lib/util');
var HTTP_RE = /https?:\/\//i;
module.exports = function(req, res) {
var url = req.query.url;
if (HTTP_RE.test(url)) {
util.getResponseBody(parseUrl(url), function(err, body, response) {
if (err) {
return res.json({ec: 2, em: ... | true |
00bc86d72786e8e585b07e5820b409882038ec0c | JavaScript | 19peter90/bot-rondo | /src/helpers/Porteros.js | UTF-8 | 456 | 2.609375 | 3 | [] | no_license |
exports.getRandom = function() {
var porteros = [
{
text: 'Petr Cech'
},
{
text: 'Courtois'
},
{
text: 'Karius'
},
{
text: 'Ederson'
},
{
text: 'Iker Casillas'
},
{
text: 'Butland'
},
{
text: 'Buffon'
},... | true |
05a51ce9d22284423e7378152833d9c405e93ac8 | JavaScript | abvolatile/WeatherApp | /js/script.js | UTF-8 | 3,095 | 2.875 | 3 | [] | no_license | $(document).ready(function(){
$('#getWeather').on('click', function() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showWeather);
} else {
document.getElementById('location').innerHTML = "Geolocation is not supported by this browser.";
}
$('#unit').show();
});
$(... | true |
9ef9b9396b274dbac3ae93adca908c11ce303455 | JavaScript | phanhongphat/ReactJS---Working-Management | /src/components/TaskForm.js | UTF-8 | 4,379 | 2.796875 | 3 | [] | no_license | import React, { Component } from 'react';
class TaskForm extends Component {
constructor (props){
super(props);
this.state = {
id :'',
name : '',
status : false
}
}
onChange = (event) => { //lấy biến trong form
var target = event.target;
var name = target.n... | true |
e8ba58c322baacb09ef528775c4662c56633fa70 | JavaScript | linh-n/qweqwe.io | /src/modules/text2bettertext/utilities/transform.js | UTF-8 | 707 | 2.625 | 3 | [
"Unlicense"
] | permissive | import templateToParameters from "./template-to-parameters";
export default ({ source, template }) => {
if (!source || !template) {
return [];
}
const templateParameters = templateToParameters(template);
const transformItem = sourceItem =>
templateParameters.reduce((prev, curr) => {
if (prev ==... | true |
a88d95beb2a43956c49b4c44dd1fd5968be5153b | JavaScript | Sushmeet/training | /js-design-patterns-book/pages/reactDocs/useState/ex5.js | UTF-8 | 1,034 | 3.640625 | 4 | [] | no_license | // What is the difference between passing useState an updater function
// or just passing the next state directly
import { useState } from "react";
const Updater = () => {
const [increment, setIncrement] = useState(42);
const incrememntValue = () => {
// setIncrement(increment + 1);
// The above code won'... | true |
b9f42d382967eb4db31717af75b1205ae1ae7b16 | JavaScript | zoumson/AzureTest | /myExpressApp/routes/index.js | UTF-8 | 584 | 2.65625 | 3 | [] | no_license | var express = require('express');
var router = express.Router();
var firstTestObject = require('../Objects/FirstTestObject');
/* GET home page */
router.get('/', (req, res) => {
//Request an input from user
res.send(
'Add a string extension to the URL to see its corresponding reverse form'
);
});
/* Get page... | true |
e19e8efeccfcbd085c5506cc01c9c9e6de7105ff | JavaScript | ShariqAteeq/Hadoop-frontEnd | /src/store/reducer/authReducer.js | UTF-8 | 1,320 | 2.625 | 3 | [] | no_license | const initialState = {
auth : localStorage.getItem('auth') || false,
sisuc: false,
msg: '',
username: localStorage.getItem('username') || '',
role: localStorage.getItem('role') || '',
message: '',
Simessage: ''
}
const authReducer = (state = initialState , action) => {
switch(action.ty... | true |
130fac078980137793b1b8a62fd7e0e8ea90e222 | JavaScript | AJarombek/jarombek-com-sources | /2018/04-Apr/4-30-React-Dynamic-JSX-Element/index.js | UTF-8 | 840 | 2.859375 | 3 | [] | no_license | import React from "react";
import { render } from "react-dom";
import Link from "./Link";
/**
* Demonstrate creating dynamic JSX elements
* @author Andrew Jarombek
* @since 4/29/2018
*/
const elements = [
{
tag: "h1",
attributes: null,
value: "Webpage Title"
},
{
tag: "p",
attributes: nu... | true |
7423b2d2dc1c5a0531f2a1e92fd2695ed0a20ff8 | JavaScript | fetaoily/phaser2-game-examples | /examples/Groups/groups_030_set_all.js | UTF-8 | 1,179 | 2.59375 | 3 | [
"MIT"
] | permissive | (() => {
'use strict';
let game;
window.onload = () => {
game = new NewGame();
};
class NewGame extends ErtaoGame {
constructor() {
super(800, 600, Phaser.AUTO);
this.state.add('PlayGame', PlayGame);
this.state.start('PlayGame');
}
}
class PlayGame extends ErtaoGameState {... | true |
397648e9f66aef7602537c556f8ea9cee0396acc | JavaScript | liaowow/js-basics-functions-lab-dumbo-web-120919 | /index.js | UTF-8 | 1,462 | 3.953125 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | // Code your solution in this file!
function distanceFromHqInBlocks(n) {
let distance = (n - 42);
if (distance >= 0) {
return distance;
} else {
return -distance;
}
}
function distanceFromHqInFeet(n) {
let numBlocks = distanceFromHqInBlocks(n);
return numBlocks * 264;
}
funct... | true |
647fb4bd538296692cde2b47f08d4c0fbe75ca7c | JavaScript | sunminghong/firePhoenix | /js/src/uid.js | UTF-8 | 360 | 2.875 | 3 | [] | no_license | (function(){
/*
用来生成一个全局唯一的ID。
*/
var UID = Elf.UID = { _counter:0 };
/**
* 根据指定名字生成一个全局唯一的ID,如Stage1,Bitmap2等。
*/
UID.create = function(name){
var charCode = name.charCodeAt(name.length - 1);
if (charCode >= 48 && charCode <= 57) name += "_";
return name + this._counter++;
};
})(); | true |
7dd2fa7165dea748c7ab71d66d1ebc56085e4d39 | JavaScript | mullermr/JavaScript-Function-Homework | /script.js | UTF-8 | 1,312 | 4.15625 | 4 | [] | no_license | var wrapper = document.querySelector(".wrapper");
var resultEle = document.querySelector(".result");
var submitEle = document.querySelector(".submit");
// main function
function display(){
// propmting user of how many miles per year they drive and saving to variable
var numberOfMilesPerYear = Number(prompt("Plea... | true |
0dffffd80ea09344b037be53eccc75bb3963dd77 | JavaScript | Whatapalaver/bowling-challenge | /src/Game_ugly.js | UTF-8 | 3,388 | 3.34375 | 3 | [] | no_license | 'use strict';
function Game() {
this.frame = 0; // for frame 1 to 10
this.rollHistory = new Array(21); // holds all rolls history (max 21). Index is referred to as roll_index
this.frameHistory = [[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0,0]];
this.rollIndex = 0; // 0 to 20 for all potential ro... | true |