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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
10bc650c8767a56216f4ecf69da5e89401c892e0 | JavaScript | NofarUliel/ArStangaGame | /Server/Classes/Ball.js | UTF-8 | 374 | 2.546875 | 3 | [] | no_license | let shortId = require("shortid");
let Vector3 = require("./Vector3.js");
module.exports = class Ball {
constructor() {
this.id = shortId.generate();
this.position = new Vector3();
this.lobby = 0;
}
Print() {
return (
"id:" +
this.id +
"position:" +
this.position.Print() +... | true |
71a38456afdd14ebe494ad71652f24448cb42cc7 | JavaScript | alexeyraspopov/monad | /index.js | UTF-8 | 739 | 3.09375 | 3 | [] | no_license | exports.monad = function(modifier){
var unit, prototype;
prototype = { isMonad: true };
unit = function(value){
var monad = Object.create(prototype);
monad.bind = function(fn, args){
args = Array.prototype.slice.call(args || []);
return fn.apply(this, [value].concat(args));
};
if(typeof modifier =... | true |
90944687dd0d855430b535070ac4da14bf7eac3a | JavaScript | kaellis/bch-js | /test/integration/price.js | UTF-8 | 1,461 | 2.59375 | 3 | [
"MIT"
] | permissive | const assert = require('chai').assert
const BCHJS = require('../../src/bch-js')
const bchjs = new BCHJS()
describe('#price', () => {
beforeEach(async () => {
if (process.env.IS_USING_FREE_TIER) await sleep(1000)
})
describe('#current', () => {
describe('#single currency', () => {
it('should get cu... | true |
f7e5431ce65643d8ea20707b2a384f2bfbea9dff | JavaScript | JClackett/evobike | /app/assets/javascripts/components/results.js.jsx | UTF-8 | 2,364 | 2.65625 | 3 | [] | no_license | var gravity = 9.81
var density_air = 1.29
var frontal_area = 0.41
var hill_incline = 0
var wind_speed = 0
var air_drag_coeff = 1
var roll_drag_coeff = 0.021
var elec_pwr_for_lights = 220
var Results = React.createClass({
getInitialState() {
return {
topSpeed: '',
drivingRange: '',
batteryLife: '',
motor... | true |
c447772492de95bdb3caa2f9b6be6e1bcfd94f0c | JavaScript | Luizsiqueirask/Platium | /view/src/features/beneficiary/EditBeneficiary.jsx | UTF-8 | 3,172 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import { useDispatch, useSelector } from "react-redux";
import {useHistory, useLocation} from "react-router-dom";
import { useState } from "react";
import { UpdateBeneficiary } from "../../api/beneficiarySlice";
export function EditBeneficiary() {
const { pathname } = useLocation();
const beneficiaryId = parse... | true |
57b035d685c885394b001d690fa1eb746d736e29 | JavaScript | drcberry/covid19-v2 | /src/components/statestats.js | UTF-8 | 1,484 | 2.671875 | 3 | [] | no_license | import React, {useContext} from "react";
import Daily from './daily';
import {ApiContext} from '../utils/apicontext';
import {DataContext} from '../utils/datacontext';
export default function StateStats() {
const {country:[isCountry, setIsCountry], state:[isState, setIsState]} = useContext(ApiContext);
const {data... | true |
4ef7a9c5d14ef25603d4c6b656d7d036ce7ab03d | JavaScript | venil7/rust-minimax | /web/index.js | UTF-8 | 2,532 | 2.75 | 3 | [] | no_license | import classnames from 'classnames';
import { Field, Game, Player } from "darkruby-tictactoe";
import * as React from 'react';
import { useEffect, useReducer } from 'react';
import * as ReactDOM from "react-dom";
const { Cross, Empty, Nought } = Field;
const { None, CPU, Human } = Player;
const initState = () => ({
... | true |
163b2d3d8d252e32253f29affbee49e07e02f9b2 | JavaScript | ashimd/Games | /SnakeLadder/Scripts/snakeladder.js | UTF-8 | 3,884 | 2.96875 | 3 | [] | no_license | var canvas = document.getElementById('canvas'),
context = canvas.getContext('2d'),
height = canvas.clientHeight,
width = canvas.clientWidth,
colors = ['rgba(255, 255, 0, 0.5)', 'rgba(255, 0, 0, 0.5)', 'rgba(0, 0, 255, 0.5)', 'rgba(0, 255, 0, 0.5)'],
hParts = height / 100,
wParts = width / 100;
... | true |
4ea27a639906d33980bf23b65fcb8ddfcd349e19 | JavaScript | helloword10086/disanzou | /func_args/demo1.js | UTF-8 | 158 | 2.6875 | 3 | [] | no_license | function information(name,sex){
return `${name} ${sex} ${money} ${birthday} ${color} ${likes} ${follow} ${age}`
}
let user ={name: ''}
information(user)
| true |
7d2aabb1aad22143ffceb37235be2af269051a0c | JavaScript | alex-learn/mesh.js | /lib/_getFilter.js | UTF-8 | 459 | 2.671875 | 3 | [
"MIT"
] | permissive |
module.exports = function(match) {
if (match instanceof RegExp) {
return function(operation) {
return match.test(operation.name);
};
} else if (match.test) {
return function(operation) {
return match.test(operation);
};
} else if (typeof match === "function") {
return match;
} ... | true |
caa3d73cbb9cfd4a3df08d66edb3bf4d09d2dcb3 | JavaScript | prabashn/react-layout-exp | /src/WeakMapEx.js | UTF-8 | 864 | 2.8125 | 3 | [] | no_license | import { tryRemoveItem } from "./arrayHelpers";
export class WeakMapEx {
keys = [];
map = new WeakMap();
has(key) {
return this.map.has(key);
}
get(key, factoryOrValue) {
let value = this.map.get(key);
if (value !== undefined) {
return value;
}
if (factoryOrValue ... | true |
60a0e0c499c097d55c785d1e2bde1b528945f8d6 | JavaScript | idealab-org/bender-ui | /src/app/App.js | UTF-8 | 2,653 | 2.65625 | 3 | [] | no_license | import dotenv from 'dotenv';
import axios from 'axios';
import React, {Component} from 'react';
import './App.css';
import Query from './query/Query.js'
import Grid from './grid/Grid.js'
dotenv.config()
class App extends Component {
constructor() {
super();
alert("You will have 5 seconds to compl... | true |
85edad8833b13c12496e81c9d61664676e9dd3e0 | JavaScript | fadelf/wfm-marketing | /src/components/services/EmployeeSkillService.js | UTF-8 | 665 | 2.53125 | 3 | [] | no_license | import axios from 'axios';
const HOST_API = 'https://workforce-app.herokuapp.com';
const SERVICE_API = `${HOST_API}/employeeSkills`;
class EmployeeDataService {
retrieveAllEmployeeSkills(name) {
return axios.get(`${SERVICE_API}/list`,);
}
deleteEmployeeSkill(id) {
return axios.delete(`${SE... | true |
04aa0df694fb1119cddd986ddba3273a31dd1352 | JavaScript | lucasxlu/mateface | /utils/util.js | UTF-8 | 2,553 | 3.234375 | 3 | [
"MIT"
] | permissive | const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map... | true |
30993c79db06671819f0763a8b601d8db12c0003 | JavaScript | vinnycl/challenge-charlie | /src/filters/conversions.js | UTF-8 | 1,414 | 2.859375 | 3 | [] | no_license | export default {
setWindDirection(val) {
if (val >= 0 && val <= 11.25) { return 'N'; }
if (val > 11.25 && val <= 33.75) { return 'NNE'; }
if (val > 33.75 && val <= 56.25) { return 'NE'; }
if (val > 56.25 && val <= 78.75) { return 'LNE'; }
if (val > 78.75 && val <= 101.25) { r... | true |
38a70cf35f675738b1377ed710b2e8899f0c2af8 | JavaScript | guochun/js-skill | /Function/call/fakeCall.js | UTF-8 | 670 | 3.109375 | 3 | [
"MIT"
] | permissive | Function.prototype.fakeCall = function (context) {
if (typeof this !== 'function') {
throw new TypeError( this.name + ' must be function')
}
if (context == null) {
context = context || window || global
} else if (typeof context === 'number') {
context = new Number(context)
} else if (typeof contex... | true |
353276429cae614455e2bece93780e88ec342a52 | JavaScript | matheuscamarques/sistemaxerox | /public/js/validarform.js | UTF-8 | 1,251 | 2.75 | 3 | [] | no_license | function ValidarFrmCadastroUsuario() {
var txtNome = frmCadastrarUsuario.nome.value;
var txtEmail = frmCadastrarUsuario.email.value;
var txtCpf = frmCadastrarUsuario.cpf.value;
var txtSenha = frmCadastrarUsuario.senha.value;
var txtConfSenha = frmCadastrarUsuario.confsenha.value;
// Valida cam... | true |
9c58ccfe3254aae5e1a712634faf15234e588526 | JavaScript | evaldas1994/codeacademy_front | /demo18_js_radio/script.js | UTF-8 | 655 | 3.421875 | 3 | [] | no_license | const button = document.querySelector("button");
button.addEventListener("click", showDataToConsole);
function showDataToConsole() {
const age = Number(document.querySelector("input").value);
const gender = document.querySelector("input:checked").value;
if ((age !== null) && (age < 120) && (age > 0) )
... | true |
1579bd8d9bea7f038063155cfdeb88568b3a47ea | JavaScript | mefogle/AtoIFTTT | /AtoIFTTT.js | UTF-8 | 8,711 | 3.140625 | 3 | [
"MIT"
] | permissive | /**
* This Lambda is adapted from the simple skill sample using the Amazon Alexa Skills Kit. It implements a simple
* bridge between Alexa and the IFTTT "Maker" Channel (https://ifttt.com/channels/maker). See the IFTTT site for more
* details on how the Maker channel works.
*
* The linkage between the two is th... | true |
8fa90cd25999d88fd180fc2079d78645e9b6c212 | JavaScript | Oliver-G-R/M-JavaScript | /POO/POO Ts/Tipos de datos/index.js | UTF-8 | 235 | 3.90625 | 4 | [] | no_license | // string
var cadena = "Hola Mundo"; //Permite solo esos dos tipos de datos
cadena = 'Hola';
//number
var num = 9;
//boolean
var verdadero = true;
//any
var cualquiera = "Hola";
//array
var lengaujes = ['Java', 'c'];
console.log(cadena);
| true |
b84716dc47af7f49cb1aab3959103c4d5ec82dfd | JavaScript | MortyX4004/lab-bots-mortyx-4004 | /comandos/adicionar.js | UTF-8 | 3,257 | 2.65625 | 3 | [] | no_license | const Discord = require('discord.js')
let user;
exports.run = async (client, message, args) => {
/*
user = message.author;
let canal = message.guild.createChannel(`${message.author.username}`, { type: 'text' }).then(x =>{
x.overwritePermissions(message.guild.roles.find(x => x.name == '@everyone'), {
'VIEW_CHANNEL': fal... | true |
15e855e785c410bfd19b30b566b85c9bba78bd0c | JavaScript | Shivaani168/Project-24 | /sketch.js | UTF-8 | 948 | 2.6875 | 3 | [] | no_license | const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
function setup() {
createCanvas(1500,550);
engine = Engine.create();
world = engine.world;
//Create the Bodies Here.
side1=new Side(width-200,height-30,200,20);
side2=new Side(width-310,height-... | true |
bd4c5016371dc62f525cde0ab48478b2b07dc232 | JavaScript | bighexmachine/JavascriptSimulator | /simRunner.js | UTF-8 | 4,802 | 2.625 | 3 | [] | no_license | var memoryA;
var memoryB;
var clock = null;
var hex = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'];
var oport1;
var oport2;
$(document).ready(function(){
$('#fileInputA').on('change', function(e) {
var reader = new FileReader();
reader.onload = function(e) {
$('#fileDisplay... | true |
c19e6aadd10a8d3a433f56803fb9df719b605f5e | JavaScript | sssurvey/complete-javascript-course | /8-asynchronous-JS/starter/asyncAwaits.js | UTF-8 | 3,917 | 4.03125 | 4 | [] | no_license | const getIds = new Promise((resolve, reject) => {
setTimeout(() => {
for (let i = 0; i < 10000000000; i++) { /**no op */ }
if (Math.random() * 100 > 50) {
resolve(`resolved`);
} else {
reject(`rejected`);
}
}, 0);
});
function getEmployeeName(id) {
re... | true |
21b1aaa2a3502e1e64cd42cf9391a2c3d64f20eb | JavaScript | baldurbjarnason/ink-frontend | /src/routes/doc/[id]/_preload.js | UTF-8 | 930 | 2.546875 | 3 | [] | no_license | export async function preload({ params, query }) {
try {
const { id, path } = params;
const response = await this.fetch(
`/api/id-to-opf?id=%2F${encodeURIComponent(id)}`,
{
credentials: "include"
}
);
const book = await response.json();
const chapterResource = book.resour... | true |
2b99ac686ade717d7089b7c7487c6d323771c7f4 | JavaScript | epscoe/chess-js | /src/chess/models/PieceCommon.js | UTF-8 | 3,463 | 3.046875 | 3 | [] | no_license | export class Position {
constructor(row, col) {
this.row = row;
this.col = col;
}
notation() {
let colChar = String.fromCharCode(97 + this.col);
return `${colChar}${this.row + 1}`;
}
add(rowDelta, colDelta) {
return new Position(this.row + rowDelta, this.col... | true |
b05cb874ff23b5034051bc146623a5e22bf0575e | JavaScript | awronka/my-react-redux-universal-hot-example | /api/crud/widget/index.js | UTF-8 | 1,121 | 2.578125 | 3 | [
"MIT"
] | permissive | import mongoose from 'mongoose';
const Widget = mongoose.model('Widget');
// seed widgets data if none exists
Widget.find().then((widgetsArr) => {
if(!widgetsArr.length)
Widget.create([
{id: 1, color: 'Red', sprocketCount: 7, owner: 'John'},
{id: 2, color: 'Taupe', sprocketCount: 1, owner: 'George'}... | true |
c64412de145d899f42fa4595137376e1b2e741fc | JavaScript | araleT/majan-point-management | /program.js | UTF-8 | 13,929 | 2.953125 | 3 | [] | no_license | var Name = ['あるぱか','いぬ','ねこ','ぺんぎん'];
var Kaze = [0, 1, 2, 3]; //東、南、西、北
var KtoS = { 0: "東", 1: "南", 2: "西", 3: "北" };
var ribo = 0;
var prev = [-1, 0, 1, 0, 25000, 25000, 25000, 25000, 0, 1, 2, 3, 1000];
var now = [1, 0, 1, 0, 25000, 25000, 25000, 25000, 0, 1, 2, 3, 0];
var next = [-1, 0, 1, 0, 25000, 25000, 25000, ... | true |
0c32d2864b8a4b29d07619987b14876a3241c98c | JavaScript | ViktorPanchenkov/homework | /js/app.js | UTF-8 | 158 | 3.4375 | 3 | [] | no_license | ; 'use strict';
let a = 2;
let b=4;
if ( a > b){
console.log ( a + b / (2 * 4));
} else if ( a < b){
console.log ( a - b + 2 / (b * 4));
}
| true |
d7c571c3c3750876b4ca9ba2b048a11f97b79035 | JavaScript | mcMickJuice/football-query-compiler | /src/lexer/index.js | UTF-8 | 1,816 | 2.96875 | 3 | [] | no_license | const builders = require('./token-builders')
const predicates = require('./token-predicates')
function lexer(query) {
if(query == null || query.trim() === ''){
throw new Error('Lexer Error: no query provided')
}
//prolly need to filter out carriage returns, tabs etc
const querySplit = query.split(' ').f... | true |
bb6121cb4f15dc70e66c568854bc5e9cb8a9b843 | JavaScript | jcattanach/10-10-18 | /app.js | UTF-8 | 754 | 3.21875 | 3 | [] | no_license | let starterList = document.getElementById("starterList")
let entreeList = document.getElementById("entreeList")
let dessertList = document.getElementById("dessertList")
for(let i = 0;i < dishes.length; i++) {
let dish = dishes[i]
let menuItem = `
<li class="listItem">
<img src="${dish.imageURL}" />
<div... | true |
1ee3a9bbf89916b562a01984a8b2b86ce1fe8089 | JavaScript | umergta/Pethaven | /PetHaven/pet-haven1/src/components/Pet/CreatePet.js | UTF-8 | 2,192 | 2.703125 | 3 | [] | no_license | import React, { Fragment, useState } from "react";
import { Grid, TextField, Button } from "@material-ui/core";
export default function CreatePet() {
const [newPet, setPet] = useState({
pet_name: "",
special_requirements: "",
pet_category: "",
pet_age: "",
});
const { pet_name, special_requirements, pet_ca... | true |
b8b074cc8c3340a6ebaff390c2b5c1eba90fd5db | JavaScript | joseph-zabaleta/notesy | /lib/note.js | UTF-8 | 1,852 | 3.140625 | 3 | [
"MIT"
] | permissive | 'use strict';
const NoteService = require('./model/notes-service.js');
const mongoose = require('mongoose');
const noteService = new NoteService()
/**
* Note class that creates and handles notes from user input.
* @param {object} obj An object representing user input data to be passed to the note class.
*/
class N... | true |
e86349f0891a9fed6c3d40af1a1d6e15ce6bb232 | JavaScript | hlorenzi/collision2d | /src/player.js | UTF-8 | 3,929 | 2.828125 | 3 | [] | no_license | class Player
{
constructor(position = null)
{
this.position = position != null ? position : new Vec2(0, 0)
this.radius = 15
this.useGravity = true
this.onGround = false
this.onGroundLast = false
this.jumping = false
this.speedGravity = new Vec2(0, 0)
this.speedMovement = new Vec2(0, 0)
}
... | true |
393f033e662dee0c36bd46f7bacec37209724e36 | JavaScript | sarahledu/lab-react-ironnutrition | /starter-code/src/components/FoodAdd.jsx | UTF-8 | 959 | 2.578125 | 3 | [] | no_license |
import React, { Component } from 'react'
export default class FoodAdd extends Component {
state={
name: "",
calories: "",
image:"",
showForm: false
}
handleSubmit = evt=>{
evt.preventDefault()
this.props.clbk(this.state);
}
handleChange =evt=>{
... | true |
7a44a36f3fcb0391c777661ae86d6c85694dfa4f | JavaScript | ampproject/amphtml | /build-system/babel-plugins/babel-plugin-const-transformer/test/fixtures/transform-assertions/should-transform/input.js | UTF-8 | 384 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | const foo = true;
const bar = 1;
const baz = NaN;
const yep = 'hello';
const another = {};
const array = [];
function thing() {
const foo = true;
const bar = 1;
const baz = NaN;
const yep = 'hello';
const another = {};
const array = [];
}
thing: {
const foo = true;
const bar = 1;
const baz = NaN;
... | true |
410186de4d0356e3bfb42b46c7901b9311f50379 | JavaScript | zkrami/SuperLibrary | /JavaScript/Algorithms/String/swap.js | UTF-8 | 475 | 3.9375 | 4 | [
"Apache-2.0"
] | permissive | /**
* Swaps the characters of a given string
*
* @param {string} string
* @param {int} i
* @param {int} j
*/
function swap(string, i, j) {
var stringFirstPart = string.substring(0, i);
var stringSecondPart = string.substring(i + 1, j);
var stringThirdPart = string.substring(j + 1);
return string.... | true |
a9f24340ee823337fb548821223d93e891ee54a1 | JavaScript | metanitesh/Js.algorithms | /04-counting elements/min-number.js | UTF-8 | 857 | 4.0625 | 4 | [] | no_license | // you can write to stdout for debugging purposes, e.g.
// console.log('this is a debug message');
function solution(A) {
// sortedArray = A.sort();
let smallestNumber = 0;
let biggestNumber = 0;
const len = A.length;
let result = [];
for (let i=0 ; i<len ; i++) {
if(A[i]<=0){
continue;
... | true |
e0552c9b7874b5652933284a8df60da1fd15e414 | JavaScript | timopotato/Archoid-update | /commands /uptime.js | UTF-8 | 783 | 2.578125 | 3 | [] | no_license | exports.run = async (bot, msg, args) => {
const Discord = require("discord.js");
function format(seconds) {
function pad(s) {
return (s < 10 ? '0' : '') + s;
}
var hours = Math.floor(seconds / (60 * 60));
var minutes = Math.floor(seconds % (60 * 60) / 60);
va... | true |
fb4091cf523598121dd8cba999a76030af05d0a7 | JavaScript | justmanovic/Next_S2J4 | /app.js | UTF-8 | 1,133 | 4 | 4 | [] | no_license | class Node {
constructor(value) {
this.value = value
this.left = null
this.right = null
}
insertInNode(value) {
if (value >= this.value) {
if (this.right === null) {
this.right = new Node(value)
} else {
this.right.insertInNode(value)
}
} else {
if (thi... | true |
95bd04fabdb653001e71754a35fd4f9064ad9990 | JavaScript | Jencyroca30/Changecurrency | /src/component/Info.js | UTF-8 | 809 | 2.5625 | 3 | [] | no_license | import React, {useEffect, useState} from 'react';
const Info=()=>{
const [news, setNews]= useState({});
useEffect( ()=>{
fetch('https://s3.amazonaws.com/dolartoday/data.json')
.then(response => response.json())
.then(data => {
console.log(data)
setNews(data)
... | true |
4a9f6690576dae2d36911c5b6109ee4b5405f4b1 | JavaScript | austintheriot/algorithms-and-data-structures | /src/Algorithms/Bit Manipulation/isEven/isEven.test.js | UTF-8 | 1,130 | 2.875 | 3 | [] | no_license | const isEven = require('./isEven.js');
for (let callback in isEven) {
describe(callback, () => {
it(`Should be truthy if even`, () => {
expect(isEven[callback](-14218)).toBeTruthy();
expect(isEven[callback](-254)).toBeTruthy();
expect(isEven[callback](-12)).toBeTruthy();
expect(isEven[callback](-6)).toB... | true |
4af3c12feb100968ff15470577671794fb5b4579 | JavaScript | zhengxiaochen/iota_mam_data_sharing | /air_quality_mam/mam_receive.js | UTF-8 | 2,657 | 2.71875 | 3 | [
"MIT"
] | permissive | /*
Author: Xiaochen Zheng (xiaochen.zheng@alumnos.upm.es)
The mam_receive.js file extracts stored data from the tangle using MAM and print them on the screen.
Usage:
1) You can change the default settings: MODE or SIDEKEY. In this case, make the same changes in mam_publish.js
2) Command to start the app: node mam_r... | true |
611a2f2c8a9be83deb881e9e932c652ef91dd8b6 | JavaScript | danlash/disc-explorer | /load.js | UTF-8 | 1,543 | 2.734375 | 3 | [] | no_license | var fs = require("fs");
var HTTPRequest = require('HTTPRequest');
var totalRecordsCreated = 0;
fs.readFile('./disc-database.json', parseFile);
function parseFile(err, data) {
if (err) throw err;
var discs = JSON.parse(data);
discs.forEach(function(disc) {
var url = 'http://localhost:3000/discs.json';
va... | true |
af1f421d9f97fe0d9f83d17b5e57ef5a7eec94c8 | JavaScript | SirnikVladik/No-name | /scripts/script.js | UTF-8 | 943 | 2.890625 | 3 | [] | no_license | var callToAction = document.querySelector(".callToAction");
var stayWithUs = document.querySelector(".stayWithUs");
var down = document.querySelector(".down");
var textBlock = document.querySelector(".text-block");
down.addEventListener('click', (event) => {
let index = textBlock.getBoundingClientRect().top;
... | true |
61fc2163f4f3fee0e47bcccc394bbaa10f49f5a3 | JavaScript | NandiniNayak/Js_clasroom_lessonPlan | /Day4/js_execution.js | UTF-8 | 294 | 3.515625 | 4 | [] | no_license | var name
console.log("what is your name?")
process.stdin.on("readable", function() {
name = process.stdin.read();
if (name != null) {
console.log(`hello ${name}, nice to meet you`);
}
});
console.log("someother piece of code continues, while waiting for name value to be provided");
| true |
0582029e2dcb2d29e85f99a4d803bc0717adbc33 | JavaScript | gusr27/Recipe-Box-Pro | /src/reducers/index.js | UTF-8 | 1,164 | 2.8125 | 3 | [] | no_license | import {ADD_RECIPE, DELETE_RECIPE, EDIT_RECIPE} from '../constants.js'
import {bake_cookie, read_cookie} from 'sfcookies'
const recipe = (action) => {
let {name, ingredients} = action
return {
name,
id: Math.random(),
ingredients
}
}
const removeById = (state = [], id) => {
const recipes = state.filter... | true |
b6a7eda88537ba0ee2fe8e1ccf413f18f34f8ff6 | JavaScript | nuricodes/codewars | /8kyu/reverse_string.js | UTF-8 | 407 | 3.703125 | 4 | [] | no_license | // Complete the solution so that it reverses the string passed into it.
/////////////////////////////////////////////
// SOLUTION 1
/////////////////////////////////////////////
function solution(str) {
return str.split('').reverse().join('');
}
/////////////////////////////////////////////
// SOLUTION 2
///////... | true |
be4aea78341417701bd80ef027b2d71740d28c74 | JavaScript | jasonstevens13/algorithms-practice | /02-Odd-or-Even/test/odd-or-even.test.js | UTF-8 | 443 | 3.28125 | 3 | [] | no_license | var expect = chai.expect;
describe("oddOrEven", function () {
it('should return the string "odd" if a number IS NOT evenly divisible by 2', function () {
var num = 777;
var result = oddOrEven(num);
expect(result).to.eql("odd");
});
it('should return the string "even" if a number IS evenly divisibl... | true |
dfcd9e4976dae982f32a27d5145da9463b009f43 | JavaScript | HickHack/Exograph-Server | /public/js/graph-info-panel.js | UTF-8 | 4,480 | 2.671875 | 3 | [] | no_license | var graphInfoWidget = null;
function GraphInfoWidget(dataEndpoint) {
this.graphContainer = $('.graph');
this.container = $('.graph-info-container');
this.imgContainer = $('.info-img-container');
this.infoItemsContainer = $('.info-items');
this.friendItemsContainer = $('.friend-items');
this.mod... | true |
70ab659b9bbec13df4d4ed7e84b9b10531cf8da6 | JavaScript | sanchezm5/daily_practice | /Strings/CaesarCipherEncryptor.js | UTF-8 | 1,877 | 4.75 | 5 | [] | no_license | /* This question is from AlgoExpert
Given a non-empty string of lowercase letters and non-negative integer value
representing a key, write a function that returns a new string obtained by shifting
every letter in the input string by k positions in the alphabet, where k is the key.
Note that letters should "wrap" arou... | true |
0c88febc9df9e08d3d82e76be0134e6bf7a5f16f | JavaScript | Zhang-xiaohui/redux | /src/todos/reducer.js | UTF-8 | 510 | 2.859375 | 3 | [
"MIT"
] | permissive | import {ADD_ITEM, CHECK_ITEM} from "./actionTypes.js";
let number = 1;
export default (state = [], action) => {
switch(action.type) {
case ADD_ITEM: {
return [...state, {
id: number++,
value: action.value,
completed: false
}]
}
case CHECK_ITEM: {
return state.map((item) => {
if (item... | true |
5c970995504cf09754a7260a7acabc1a037665c8 | JavaScript | fleetofthemalden/comp20 | /mspacman/mspacman.js | UTF-8 | 586 | 2.953125 | 3 | [] | no_license | var canvas;
var ctx;
var spriteSheet;
function start_game(){
//initialization
spriteSheet = new Image();
spriteSheet.src = "pacman10-hp-sprite.png";
canvas_init();
}
//ctx.drawImage(imageName, sx, sy, swidth, sheight, dx, dy, dwidth, dheight);
function canvas_init(){
canvas = document.getElementById("pacman... | true |
b4f37389f27a3b5474750256f026daaa71dd77ed | JavaScript | ttuca123/jquery | /mod1/js/jquery-aula4.js | UTF-8 | 857 | 2.828125 | 3 | [
"MIT"
] | permissive |
//Executa a partir do momento que o documento está carregado
$(document).ready(function(){
$('h2').css('margin', '0');
$('p').css({'margin': '0', 'color': 'blue'});
$('.div1').css({'margin-bottom' : '20px', background : '#ccc'});
//Filhas
$('.div1 span').hide().delay('1000').fadeIn(1000).css({... | true |
998017cf2b35e0ed322703d69e5f6e767c2a9896 | JavaScript | 401-js-WesamAlmasri/data-structures-and-algorithms | /hashmapLeftJoin/hashmap-left-join.js | UTF-8 | 632 | 2.90625 | 3 | [
"MIT"
] | permissive | 'use strict';
function leftJoin(table1, table2) {
const result = [];
// Iterate over all table 1 buckets
for (let bucket of table1.table) {
// Iterate over each bucket's element
if (bucket) {
let currentNode = bucket.head;
while (currentNode) {
const key = Object.keys(currentNode.data... | true |
6955400d2d18e86fb21f344f519178a9057bdd5c | JavaScript | ac-freeman/adaptive_resolution | /public/javascripts/clientshowimage.js | UTF-8 | 20,592 | 2.515625 | 3 | [] | no_license | window.addEventListener ?
window.addEventListener("load",getImageShape,false) :
window.attachEvent && window.attachEvent("onload",getImageShape);
var OGIMAGEURL;
var fullImageWidth;
var fullImageHeight;
var imageSpecs = {sliceX1: 0, sliceX2:0, sliceY1:0,sliceY2:0,wZoomScale:0,hZoomScale:0};
var portWidth = parseInt... | true |
7caaa51b3d498b7886d9f4fb0ef089b95622cc01 | JavaScript | dperea10/coderhouse-backend | /Clase 2/clases.js | UTF-8 | 2,986 | 3.96875 | 4 | [] | no_license | // En este ejercicio construiremos una herramienta que permita que diferentes personas puedan llevar cuentas individuales sobre algo que deseen contabilizar,
// al mismo tiempo que nos brinde una contabilidad general del total contado. Para ello:
// 1) Definir la clase Contador.
// 2) Cada instancia de contador ... | true |
49ea5edd880d7ba4e8bc74b249f8dbcb2fe5eac4 | JavaScript | Zipexpo/mazegame | /src/js/ulti.js | UTF-8 | 628 | 2.859375 | 3 | [] | no_license | exports.rand = function(max) {
return Math.floor(Math.random() * max);
}
exports.shuffle = function(a) {
for (let i = a.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[a[i], a[j]] = [a[j], a[i]];
}
return a;
}
exports.getSizeWindow = function ({viewWidth,viewH... | true |
4859bc8ee10a678abc404fa79766a62eca65576d | JavaScript | Megadeth1988/curso_frontend | /JS/22_vuelo.js | UTF-8 | 2,317 | 4.46875 | 4 | [] | no_license | // Esto
//let vuelo1 = new Object()
let vuelo1 = {
airline: 'Oceanic',
number: '815', // a la hora de guardarlo es mejor que los numeros que no son aritméticos se guarden en forma de string
departure: {
IATA: 'SYD',
time: '2004-09-22 14:55',
ciudad: 'Sydney',
},
arrival: {
... | true |
3c96c0144317dec12bf878887f38088d97727488 | JavaScript | Abedfordhart/trianglechallenge | /src/App.js | UTF-8 | 2,262 | 3.15625 | 3 | [] | no_license | import React, { Component } from 'react';
import './App.css';
import Result from './Components/Result/Result.js'
import DimensionsInput from './Components/DimensionsInput/DimensionsInput.js'
import Button from './Components/Button/Button.js'
class App extends Component {
state = {
msg: "Please enter the dimensi... | true |
ea9174433c114e6b4003aa1be43d5cae46d6caea | JavaScript | lexax666666/whiteBoxCodeChallenge | /node/index.js | UTF-8 | 2,431 | 2.75 | 3 | [] | no_license | const mysql = require("mysql2/promise");
const pivot = require("sqlpivot");
const xlsx = require("xlsx");
async function connectToDb() {
try {
const connection = await mysql.createConnection({
host : process.env.DATABASE_HOST,
port : process.env.MYSQL_PORT,
user ... | true |
0829fe687017deac0b71517fc8926ec6672feca0 | JavaScript | IvanSotelo/Portfolio | /src/webgl/GlObject.js | UTF-8 | 939 | 2.703125 | 3 | [] | no_license | import * as THREE from 'three'
const store = {
ww: window.innerWidth,
wh: window.innerHeight,
isDevice: navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPod/i) |... | true |
4394b5b6a640927d0dad9c9c0d6835f7b0277253 | JavaScript | dthang3/n220fall2020 | /Objectmanipulation/personalcomposition/js/app.js | UTF-8 | 228 | 2.890625 | 3 | [] | no_license | let dvBox = document.getElementById("box");
dvBox.innerHTML = "Click to increase Size";
function myFunction(){
dvBox.style.backgroundColor="#66fc03";
dvBox.style.height= "500px";
dvBox.style.width = "500px";
}
| true |
09245ff776d5ae52054c8e580effb6a67908c5de | JavaScript | mpicod/bddi-exercices | /index.js | UTF-8 | 465 | 2.546875 | 3 | [] | no_license | let express = require ('express')
let app = express()
app.get('/', function(req,res) {
res.send('Hello World')
})
app.get('/user/:name', function(req,res) {
res.send('Hello ' + req.params.name)
})
app.use(function (req, res, next) {
console.log('time', Date.now())
next()
})
app.get('/user/:name', fu... | true |
f3a77281952b0bdd415cb25935896aed34f68490 | JavaScript | D4rkdev1987/Javascript-Exercises | /oop_javascript_promises.js | UTF-8 | 1,392 | 3.890625 | 4 | [] | no_license | //Promises
//communicating with outside api's
//promises allows you to go to page show page and show things when outside services when is available
let sleepyGreeting = new Promise((resolve, reject) => { //let sleeping greeting creating a new Promise and storing in sleepy greeting and 2 arguments resolve and reject
... | true |
2cfbe40b1bba0fe33ef4ce9c8aa96be8ffb653ee | JavaScript | nikolayneykov/TelerikAcademyAlphaJavaScript | /Preparation/Workshop3Loops/05.CalculateDiscount.js | UTF-8 | 487 | 3.390625 | 3 | [
"MIT"
] | permissive | const getGets = arr => {
let index = 0
return () => {
const toReturn = arr[index]
index += 1
return toReturn
}
}
// this is the test
const test = ['4', '13.50', '19.99', '29.99', '39.99']
const gets = this.gets || getGets(test)
const print = this.print || console.log
let n = +gets()
for (let i = 0;... | true |
da5ec172c75edfd50f558c10b72c290f0f82fc5d | JavaScript | Jlawlzz/game_time | /lib/levels/level.js | UTF-8 | 444 | 2.734375 | 3 | [
"MIT"
] | permissive | const getBoard = require('./get-board');
const getMonies = require('./get-monies');
const getEnemies = require('./get-enemies');
let difficulties = {
1: 5,
2: 3,
3: 1
};
let Level = function(level, difficulty){
this.stage = level;
this.difficulty = difficulty;
this.board = getBoard(level);
this.enemies ... | true |
20777f92fc8acedef2bc4eafb319bd7a5891aac1 | JavaScript | siarhiejkresik/siarhiejkresik.github.io | /rolling-scopes-school-2018Q1/match-match-game/scripts/app/AppData.js | UTF-8 | 1,941 | 2.96875 | 3 | [] | no_license | import { DB_KEY, DEFAULT_DB } from '../constants.js';
export default class AppData {
constructor() {
this._storage = new LocalStorage();
this.data = this._storage.load();
}
addNewPlayer(firstname = '', lastname = '', email = '') {
const id = this.data.players.length + 1;
const player = {
i... | true |
c569dd7e6c97f23459c59933ff6cb54626535ba4 | JavaScript | HELL0ANTHONY/PI-Pokemon-FT13 | /api/src/controllers/pokemons/pagination.js | UTF-8 | 479 | 2.78125 | 3 | [] | no_license | function pagination(page, limit, array) {
const startIndex = (page - 1) * limit;
const endIndex = page * limit;
const rowsTotal = array.length;
const totalPages = Math.ceil(rowsTotal / limit);
let next = previous = null;
if (endIndex < rowsTotal) next = page + 1;
if (startIndex > 0) previo... | true |
50dfb78e38a1e53b0f5e02068e73d894124fa784 | JavaScript | Syavirachya/Mengubah-Huruf-Vokal | /javascript.js | UTF-8 | 4,469 | 3.203125 | 3 | [] | no_license | function javascript(){
//untuk menyimpan nilai dlm textarea
let input = document.getElementById("input_user").value;
let rd_fibonannci = document.getElementById("rd_fibonannci");
let rd_ganjil = document.getElementById("rd_ganjil");
let rd_genap = document.getElementById("rd_genap");
let rd_cha... | true |
08ec14fc54f35b51fa3aff98433f523dd8622323 | JavaScript | lucas-cosson/nuit-de-linfo-2020 | /client/js/user.js | UTF-8 | 1,670 | 2.859375 | 3 | [] | no_license | document.addEventListener("DOMContentLoaded", () => {
document.getElementById("submit-register").addEventListener("click", (ev) => {
ev.preventDefault();
const data = {
user: document.getElementById("re_name").value,
password: document.getElementById("re_password").value,
};
fetch("/api/... | true |
55489ad423c73264f0ff5185d4502eb85358cc5a | JavaScript | DenGogolin/studies | /src/general-tasks/trees-and-graphs/index.spec.js | UTF-8 | 1,326 | 2.640625 | 3 | [] | no_license | const { findRoute } = require("./find-route"),
{ expect } = require("chai");
const { BinaryTree } = require("../../algorithms/tree/binary-tree");
const { Tree } = require("../../algorithms/tree");
const { buildOrder } = require("./build-order");
describe("General Tasks", () => {
describe("Trees and Graphs", (... | true |
5d26f62f61461a9f0f07e68054acbd28fe598161 | JavaScript | thelbaumann/javascriptQuiz | /script.js | UTF-8 | 8,805 | 3.265625 | 3 | [
"MIT"
] | permissive | // variables
// assigning variable names to html elements for shorthand
var clock = document.getElementById("clockdiv");
var questionList = document.getElementById("questionList");
var startBtn = document.getElementById("startBtn");
var answerMsg = document.getElementById("answerMsg");
var answerMsgDiv = docu... | true |
bcd8b3111020eb44ba62e9dc5c6a3f4490542539 | JavaScript | terickson67/tic-tac-toe-react | /src/components/Board/Board.jsx | UTF-8 | 2,871 | 2.890625 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-unused-vars */
import React, { useState, useEffect, useRef } from "react";
import { useHistory } from "react-router-dom";
import Square from "../Square/Square";
import { calculateWinner } from "../../utils/helpers";
import "./Board.css";
const Board = () => {
// prettier-ignore
const empty... | true |
d5befc1c04b7430fefc7308c672df4b76137467a | JavaScript | LayanJay/React-todo-app | /src/App.js | UTF-8 | 2,881 | 2.796875 | 3 | [] | no_license | import React, { useEffect, useState } from "react";
import Header from "./components/Header";
import Todo from "./components/Todo";
import { db, auth } from "./firebase";
import firebase from "firebase";
import "./App.css";
function App() {
const [todos, setTodo] = useState([]);
const [input, setInput] = useState(... | true |
60ef4eeb0521493e271212fc0da052a0ac6b08e9 | JavaScript | ohendrick1223/fs-pet-shop | /pets.js | UTF-8 | 4,267 | 3.140625 | 3 | [] | no_license | 'use strict';
var fs = require('fs');
var path = require('path');
var petsPath = './pets.json';
var node = path.basename(process.argv[0]);
var file = path.basename(process.argv[1]);
var cmd = process.argv[2];
//beginning of read subcommand
if (cmd === 'read') {
var index = process.argv[3];
fs.readFile(petsP... | true |
e0b19ab748eab6ebcedd4eb053a7df3649fb1ec6 | JavaScript | lufemas/socket-chat-server | /src/index.js | UTF-8 | 1,660 | 2.546875 | 3 | [] | no_license |
const PORT = process.env.PORT || 3000
const app = require('express')()
const httpServer = require('http').createServer(app)
const io = require('socket.io')(httpServer, {
cors: {
origin: '*',
methods: ["GET", "POST"]
},
})
const loggedUsers = []
const messagesLog = []
// SERVER.JS SERVER-NOD... | true |
8f0b47f9ac540368d7b36549754af7a86e008bfb | JavaScript | Alisha-stack/c-25-hww | /sketch.js | UTF-8 | 1,168 | 2.75 | 3 | [] | no_license |
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Body = Matter.Body;
var ground;
var left, base, right;
var ball;
//var xyz;
var hello;
var anim;
function preload(){
hello = loadImage("dustbingreen.png");
}
function setup() {
createCanvas(800, 700);
engine = Engin... | true |
bfde86f892a4b01bcfeaf166c202bd582442049e | JavaScript | ginkgo012/codewars-kata | /5 kyu/Scramblies.js | UTF-8 | 1,247 | 4.375 | 4 | [] | no_license | /* Complete the function scramble(str1, str2) that returns true if a portion of str1 characters can be rearranged to match str2, otherwise returns false.
Notes:
Only lower case letters will be used (a-z). No punctuation or digits will be included.
Performance needs to be considered
Examples
scramble('rkqodlw', 'world... | true |
c31b4e04585e69b4f91a282ffe09bbd07445294a | JavaScript | arnoldthchan/Chatty | /src/App.jsx | UTF-8 | 4,062 | 3.03125 | 3 | [
"MIT"
] | permissive | import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import MessageList from './MessageList.jsx';
import ChatBar from './ChatBar.jsx';
class App extends Component {
constructor(props) {
super(props);
this.state = {
userCount: 0,
color: "black",
currentUser: {name: "Anon... | true |
bfb99dd08bbbf279c289d2ad097dc4a5595925aa | JavaScript | bigpies/study | /iterator、generator.js | UTF-8 | 292 | 3.75 | 4 | [] | no_license | // 1.========实现数组扁平化(普通方法和generator)
var arr = [1, [[2, 3], 4], [5, 6]];
var flat = function* (a) {
for(let i=0;i<a.length; i++){
if(typeof a[i] === 'number'){
yield a[i]
}
yield* flat(a[i])
}
};
for (var f of flat(arr)){
console.log(f);
} | true |
38c06f0d66755d4fd69803a3565b4578b009bba7 | JavaScript | guuma/hello-webpack | /webpack_cooma/src/scripts/libs/scroll.js | UTF-8 | 1,164 | 3.171875 | 3 | [] | no_license | class ScrollObserver {
constructor(elements, cb, options) {
const defaultOptions = {
root: null,
rootMargin: '0px',
threshold: 0,
once: true,
};
this.elements = document.querySelectorAll(elements);
this.cb = cb;
// this.options = Object.assign(defaultOptions, options);
... | true |
88600dde824b255e7059ab3a184bda1a6699c177 | JavaScript | SergioMadrigal/pixpil | /Assets/GameTemplate/Scripts/PlayerController.js | UTF-8 | 4,734 | 2.84375 | 3 | [] | no_license | var velosityObject : Vector2 = Vector2.zero;
var cam : GameObject;
var bubles : GameObject;
var fishSprite1 : Sprite;
var fishSprite2 : Sprite;
var fishSprite3 : Sprite;
var fishSprite4 : Sprite;
var fishSprite5 : Sprite;
var fishSprite6 : Sprite;
var fishSprite7 : Sprite;
var fishSprite8 : Sprite;
var fishSprite9 : ... | true |
6ff47f8cdcb0112a4e7b863dfe652e0ef0d26a6e | JavaScript | dfeshed/nw-ueba-saas | /sa-ui/respond/tests/unit/utils/math/rad-to-deg-test.js | UTF-8 | 799 | 2.703125 | 3 | [] | no_license | import mathRadToDeg from 'respond/utils/math/rad-to-deg';
import { module, test } from 'qunit';
module('Unit | Utility | math/rad to deg');
test('it works', function(assert) {
let result;
result = mathRadToDeg(2 * Math.PI);
result = parseInt(result, 10);
assert.equal(result, 360, 'Unexpected result.');
res... | true |
f2552b0cd25434fa5cc5de298aa5f1da609db871 | JavaScript | AngieBoiko/goit-js-hw-08-gallery | /js/index.js | UTF-8 | 2,165 | 3.03125 | 3 | [] | no_license | import galleryItems from './gallery-items.js';
const refs = {
galleryList: document.querySelector('.js-gallery'),
lightBox: document.querySelector('.js-lightbox'),
lightBoxImage: document.querySelector('.lightbox__image'),
closeBtn: document.querySelector('[data-action="close-lightbox"]'),
overlay:... | true |
fa3769f51bb7f133a38bc728b7b43a888935e63c | JavaScript | yang123vc/ERP-2 | /vue-express-mysql-master/frontend/src/store/actions.js | UTF-8 | 2,774 | 2.578125 | 3 | [] | no_license | // these files is for vuex but I have not coded in here
// I only make example in moudules because it is more complex
import utils from '../utils'
import { setUserState} from './mutations'
import localstorage from 'localstorage'
import Vue from 'vue'
export const setState = ({ state, commit }, {user, role, features}) ... | true |
494a8b75813e767584c6ff4162f8f980b10a85dd | JavaScript | biliman/TAFBE | /javascript/improvedJsonEncoded.js | UTF-8 | 891 | 3.734375 | 4 | [] | no_license | let data = [
{"username":"ali","hair_color":"brown","height":1.2},
{"username":"marc","hair_color":"blue","height":1.4},
{"username":"joe","hair_color":"brown","height":1.7},
{"username":"zehua","hair_color":"black","height":1.8}
];
function jsonImproved(arrayOfObject) {
let result = {};
// it can b... | true |
d0a602a1dfb3161cf83034cc1801ea22a1fb9d55 | JavaScript | andrewhheller/grace-shopper | /src/reducers/UserReducer.js | UTF-8 | 1,549 | 2.671875 | 3 | [
"MIT"
] | permissive | import {
GET_USERS,
DELETE_USER,
UPDATE_USER,
ADD_USER,
_deleteUser,
_updateUser,
_addUser,
_getUsers,
} from './UserActions';
import axios from 'axios';
const updateUser = user => {
return dispatch => {
return axios
.put(`/api/users/${user.id}`, user)
.then(response => response.data)... | true |
4c26b32faf6bf7c4d8807aa4b5e1c947aeec4231 | JavaScript | projects-and-algos-may-2019/InstructorDevon | /2_Week/2_Day/node.js | UTF-8 | 3,161 | 4.4375 | 4 | [] | no_license | class Node {
constructor(val) {
this.value = val;
this.next = null;
}
}
class SLL {
constructor() {
this.head = null;
}
// listObj.addToFront("pizza");
addToFront(val) {
let newNode = new Node(val);
newNode.next = this.head;
this.head = newNode;
... | true |
09fe83b2ebaae9b4ae99e75a30d28b088c369c24 | JavaScript | aaron-summers/spooksoup-api | /routes/posts.js | UTF-8 | 3,805 | 2.578125 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
const validator = require('validator');
//custom imports
const verification = require('../middleware/verification');
const User = require('../models/User');
const Post = require('../models/Post');
const Like = require('../models/Like');
//create a p... | true |
481a7d39429a9a494083377b35699a29e7f2a0fc | JavaScript | rajeshnaroth/scripter | /src/gamakam/controls.js | UTF-8 | 721 | 2.84375 | 3 | [] | no_license | export const CONTROL_DELAY = 0;
const isControl = (control) => control === CONTROL_DELAY;
// globals
const lengths = ["1/16", "1/8", "1/4", "1/2", "1"];
const lengthList = lengths.map((len, index) => ({ name: len, value: index }));
var length = lengthList[2].value;
// Scripter Plugin definition
export var PluginPara... | true |
7104a8744f716df78dbbe0399523fe7dfccf4289 | JavaScript | AireCoelho/curso-frontend | /workspace-vuejs/my-project/servidor.js | UTF-8 | 2,184 | 2.78125 | 3 | [] | no_license | const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));
let count = 1;
let clientes = [
{
id: count++,
nome:'João da Silva',
email:'js@teste.com',
telefone:'332... | true |
81a82b01d898ed1b82baa0c301284bb8c9da4b33 | JavaScript | sandypockets/codecademy-js | /miniLinter.js | UTF-8 | 2,440 | 4 | 4 | [] | no_license | // A mini linter program to improve the writing quality of a string.
// The text to be linted
let story = 'Last weekend, I took literally the most beautiful bike ride of my life. The route is called "The 9W to Nyack" and it actually stretches all the way from Riverside Park in Manhattan to South Nyack, New Jersey. It\... | true |
acf44502237420b657e18d317d9daa46a2f77f58 | JavaScript | MauriPastorini/i-give-it-to-you-project | /models/user.js | UTF-8 | 5,629 | 2.53125 | 3 | [] | no_license | 'use strict'
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const bcrypt = require('bcrypt-nodejs');
const crypto = require('crypto');
const codes = require('../config/errCodes')
// const countries = require('country-data').countries
const UserSchema = new Schema({
googleId: {
type: Strin... | true |
bddcbcd15ccbab91a3f1616f7f400bb416ecdbd4 | JavaScript | shubhamsharma0003/APLITE | /15-07-2016 TEST 1 - Copy/app/app.js | UTF-8 | 11,070 | 3.109375 | 3 | [] | no_license | // MAIN MODULE OF THE APP
var app = angular.module("app", [])
.controller('mainController', ['$scope', '$log', '$filter', function($scope, $log, $filter) { // MAIN CONTROLLER
// ARRAY FOR HOLDING ALL THE LISTS
$scope.lists = [];
// OBJECT FOR FIELDS WHICH WILL BE PUSHED TO "lists" OBJECT
$sco... | true |
95fc4b6e6c7b625af9838e7e4e234adc14cd6d14 | JavaScript | kpuputti/euler-js | /eulerutils.js | UTF-8 | 2,836 | 3.484375 | 3 | [] | no_license | exports.assert = function (expr) {
if (!expr) {
throw new Error('Assertion failed');
}
return true;
};
exports.toArray = function (a) {
return [].slice.call(a);
};
function add(x, y) {
return x + y;
}
exports.sum = function (arr) {
return arr.reduce(add);
};
exports.range = function ... | true |
34c20040ea91714e9d80fa93e281f60c68bf5891 | JavaScript | SmagaMichael/Formation_Concepteur_developpeur_d-application | /4 Javascript/02-Fonction/02-fonction exo/07 detection Palindrome/script.js | UTF-8 | 536 | 4.28125 | 4 | [] | no_license | // entrée : un nombre entier n
// sortie : le terme de rang n de la suite de Fibonacci
function palin(word){
var reverseIndex;
for(var i = 0; i < word.length; i++){
reverseIndex = (word.length - 1) -i;
console.log(i + ' : ' + word[i]);
console.log(reverseIndex + ' : ' + word[reverseIndex]);
if (w... | true |
7e82f1ad92c9967d93dd7551b91e1a6cb39afd52 | JavaScript | musicrighter/old_projects | /111/js/hello3.js | UTF-8 | 254 | 3.8125 | 4 | [] | no_license | //Define a simple function. Does not return a value.
var hello3 = function(){
var name = prompt("Enter your name", "Anon.");
alert("Hello, " + name + "!");
document.write("Hello, " + name + "!");
}
//register onload handler
window.onload = hello3; | true |
22c4c08ab3e5d806c9d71e8b1f48b3bcf2d7b5c4 | JavaScript | 201402407/MyReact | /src/StateSample.js | UTF-8 | 5,225 | 3.5 | 4 | [] | no_license | import React, { Fragment } from 'react'; // JSX 를 사용하기 위해 반드시 import 해야 함
import './App.css';
// props(속성) : 부모(컴포넌트) 로부터 자식(컴포넌트)에게 전달한 데이터. 정적
// 자식은 데이터를 받기만하고, 수정은 불가능.
// 기본값 설정 및 확인 가능
// state(상태) : 컴포넌트 내부에서 선언한 데이터. 값 변경 가능. 동적
// 컴포넌트 내에서 직접 this.state 를 갱신하는 일은 절대 없도록 하자.
// -> 개발자가 직접 갱신한 상태를 react가 제대로 ... | true |
645783e21f30c52d2bc4ad0550779b1781f0e215 | JavaScript | pandedeva/contact-app | /contacts.js | UTF-8 | 3,583 | 3.109375 | 3 | [] | no_license | const fs = require("fs");
const chalk = require("chalk");
const validator = require("validator");
// membuat folder data jika belum ada
const dirPath = "./data";
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath);
}
// membuat file contacts.json jika belum ada
const dataPath = "./data/contacts.json";
if (!fs.exis... | true |