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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
3ab8fffb54e92de133e5a47e66b5220764dc2ec2 | JavaScript | ru12k/GOIT | /LESS-02/2.2/homework_2.2.js | UTF-8 | 622 | 3.90625 | 4 | [] | no_license | /**
* Created by Rudik on 15.02.2016.
*
* Задание 2
Используя конструкцию if..else, напишите код, который будет спрашивать: 'Введите любое целое число?'
Затем выведите alert:
1, если значение больше нуля, -1, если значение меньше нуля, 0, если значение равно нулю.
*/
var number=+prompt("Введите любое целое число... | true |
ac557210199eb0430083b7ed8d9b4ecd118801e1 | JavaScript | gonjavi/JavascriptTicTacToe | /modules/player.js | UTF-8 | 152 | 2.875 | 3 | [] | no_license | const Player = (name) => {
const pname = name;
const sayName = () => console.log(`my name is ${name}`)
return{ pname, sayName}
}
export { Player }; | true |
094f632781d49db67811f967021b7d2ea7f72f62 | JavaScript | kaushikrao77/ludo-io | /client/src/Components/Game/Game.js | UTF-8 | 4,669 | 2.859375 | 3 | [] | no_license | import React, { useEffect } from "react";
import Square from "../Square/Square";
import Home from "../Home/Home";
import End from "../End/End";
import Dice from "../Dice/Dice";
import Names from "../Names/Names";
import useBoard from "../../hooks/useBoard";
import "./Game.css";
function Game({
socket,
myColor,
t... | true |
57bc19d5f7af1a2692eac7b515d31d2b04e9d319 | JavaScript | hcoz/sem-cli | /src/look.js | UTF-8 | 1,117 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env node
const constants = require('./constants.json');
const inquire = require('./inquire');
async function execReq() {
// get command parameters
const [, , ...args] = process.argv;
const os = process.platform;
if (!args && !os) {
console.error(constants.MISSING_PARAM);
ret... | true |
523ede45b78d1c0de5381363cdc7d940f027dae9 | JavaScript | ArthurGC/to-do-list-project | /src/utilities/add-remove.test.js | UTF-8 | 5,737 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* @jest-environment jsdom
*/
const { expect, test } = require('@jest/globals');
const Task = require('./task.js');
const LocalStorage = require('./localStorage.js');
describe('Test add', () => {
// Arrange --------------------------------------------------------------------------->
document.body.innerHTML = ... | true |
55c39fe2976bd04b1ae528580288d5eafc42ffad | JavaScript | joyantamondal/js-object-concepts | /compare-object.js | UTF-8 | 656 | 4.375 | 4 | [] | no_license | const first = {a:1, b:2};
const second = {a:1, b:2};
// objects are compareable if they have same reference
const third = first;
if(first===third){
console.log('Objects are equal');
}
else{
console.log('object not equal');
}
// compare two objects
const first2 = {a:1, b:2};
const second2 = {b:2, a:1};
func... | true |
09b9afe229be85f28904ae8bb621309a44d46ec9 | JavaScript | a-hermida/Finanzas | /src/financiera.js | UTF-8 | 2,966 | 2.96875 | 3 | [] | no_license | $(function(){
//Model de un movimiento
var Movimiento = Backbone.Model.extend({
getId: function() {
return this.get('id');
},
getDescripcion: function() {
return this.get('descripcion');
},
getCantidad: function() {
return this.get('cantidad');
},
... | true |
da5c896641f269dc0b3fb1bad48b7820f607e69e | JavaScript | johansatge/passwordbot | /src/js/score.js | UTF-8 | 1,742 | 3.984375 | 4 | [
"MIT"
] | permissive | export function calculatePasswordScore(password) {
const requirements = [{
regex: /[a-z]/g,
count: 4,
}, {
regex: /[A-Z]/g,
count: 4,
}, {
regex: /[0-9]/g,
count: 4,
}, {
regex: /[^a-zA-Z0-9]/g,
count: 4,
}]
let score = 0
for (let index = 0; index < requirements.length; ind... | true |
ce7b56d921f4d1c7a8e6e2a6b171ea89fd79d093 | JavaScript | shaksham08/MatterJsBoilerPlate | /script.js | UTF-8 | 1,409 | 2.71875 | 3 | [] | no_license | //* Matter JS Boiler CODE
const {
Engine,
Runner,
Render,
World,
Bodies,
MouseConstraint,
Mouse,
} = Matter;
//!ENgine tracks changes
//! Render = draw on screen
//! coordinate among World and ENgine
//! Body reference to entire collection on world
const width = 800;
const height = 600;
const engine = ... | true |
a6fa0ab32fa36f909292a0c863f5b835e438ea61 | JavaScript | HarshaKy/live-code-share | /src/index.js | UTF-8 | 1,350 | 2.921875 | 3 | [] | no_license | import React, {useEffect, useState} from "react";
import socketIOClient from "socket.io-client";
import ReactDOM from "react-dom";
import {ControlledEditor} from "@monaco-editor/react";
const ENDPOINT = 'http://localhost:8080'
const BAD_WORD = "eval";
const WARNING_MESSAGE = " <- hey man, what's this?";
function App... | true |
ff12aae2c582c394023378a1e627eb01fdb4f3e7 | JavaScript | diliu92/waterLoc | /waterloc/app/scripts/services.js | UTF-8 | 2,842 | 2.59375 | 3 | [] | no_license | 'use strict';
/* exported ServiceModule */
/* The above comment disables the JSHint warning of ServiceModule being defined but not used. */
var ServiceModule = (function() {
var UWaterlooService = function() {
this.key = 'fd2bc452154992349cf2b7186118715e';
this.urlPrefix = 'https://api.uwaterloo.... | true |
2cc43fb6308540333cad6b7ce7a766c7269ac7a6 | JavaScript | DSutcliffe/cn-week1-cl-and-js | /1-7-js-loops/heating-clock-loop.js | UTF-8 | 716 | 3.671875 | 4 | [] | no_license | let weekDay = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
let weekEnd = ["Saturday", "Sunday"]
let dayOfWeek = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
let currentDay = "Tuesday"
let timeOfDay = 1000
console.log(currentDay)
// while (currentDay != "Monday" && timeOfD... | true |
0bce6a0b8fcfe265179c0adf0c990266b211f0cd | JavaScript | manas3874/data-encryption-experiments | /expt6/script.js | UTF-8 | 5,346 | 2.828125 | 3 | [] | no_license | const t = [
0xad20177d,
0x470678db,
0x31da48d0,
0x47ab5b7d,
0x6c762d20,
0x52c4f80d,
0xe4133523,
0x8ce29268,
0x0a5e4f61,
0x37c6cd99,
];
var j = 0;
const w1 = [0x2475a2b3, 0x34755688, 0x31e21200, 0x13aa5487];
for (let i = 4; i < 44; i++) {
if (i % 4 == 0) {
var temp1 = t[j] ^ w1[i - 4];
w1... | true |
30e051987383974aaf5d29d20d320a057b1e9752 | JavaScript | sungdoolim/node-react_prac | /node_app/mainreal.js | UTF-8 | 4,725 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | var http = require('http');
var fs = require('fs');
var url=require('url');
var qs=require('querystring');
function templateHTML(title,list,body,control){
return `<!doctype html>
<html>
<head>
<title>WEB1 - ${title}</title>
<meta charset="utf-8">
</head>
<body>
<h1><a href="/">${title}</a></h1>
${... | true |
d0f92de03f0a7a2f305375304a47090a6a009459 | JavaScript | patrick-webdev/N320Fall2020 | /labs/Project1/app/classes/gameLogic.class.js | UTF-8 | 4,450 | 3.8125 | 4 | [] | no_license | class gameLogic {
constructor() {
this.playerTurn = -1;
this.winner = 0;
this.board = new board();
}
//Iterate through slots[] array, if user clicks on one, fill it with red.
place() {
for (let i = 0; i < 7; i++) {
let slot = `0${i}`;
let slotElement = document.getElementById(slot);... | true |
465e4fe53972ebfa4715b53d2696efba49ec19e8 | JavaScript | EricRClark/HungryGame | /app.js | UTF-8 | 5,068 | 2.796875 | 3 | [] | no_license | /* 1st Constructer */
function Player(options) {
var options = options || {};
this.energy = options.energy || 900;
this.name = options.name || "Hungry Hal";
this.id = options.id;
this.chewRate /*power*/ = options.chewRate || 5;
this.barfs = 0;
this.eat = function(rival) {
this.dam... | true |
1f49de778963c6df88155b19fcad05739e2f43b4 | JavaScript | scarbine/debugger-dog-walker | /scripts/RegisteredPets.js | UTF-8 | 1,980 | 3.5 | 4 | [] | no_license | import { getPets, getWalkers} from "./database.js"
const pets = getPets()
const walkers = getWalkers()
document.addEventListener(
"click",
(clickEvent) => {
const itemClicked = clickEvent.target
if (itemClicked.id.startsWith("pets")) {
const [,petId] = itemClicked.id.split("--")
... | true |
3a872c9c14f1ff3be69e1574de6a88947f563588 | JavaScript | loongluangkhot/udemy-coltSteele-javascriptAlgorithmsAndDataStructuresMasterclass | /algorithms/searching/linear-search.js | UTF-8 | 322 | 3.71875 | 4 | [] | no_license | function linearSearch(arr, val) {
for(let i = 0; i < arr.length; i++) {
if(arr[i] === val) {
return i;
}
}
return false;
}
let arr = ["Chicago", "Madison", "Milwaukee", "New York", "Philadelphia", "Los Angeles", "San Francisco", "Boston"];
let elem = "Milwaukee";
console.log(linearSearch(arr, elem)... | true |
03d209034b2b6c3cfeaafad9139edc4c2d12ca97 | JavaScript | dilipkumar2k6/design-pattern-problems | /calculator/proposed-design.js | UTF-8 | 2,520 | 4 | 4 | [] | no_license | class IOperation {
constructor(name) {
this.name = name;
}
}
class IUnaryOperation extends IOperation {
constructor(operator) {
super(operator);
}
execute(operand) {
throw new Error("Override this function.");
}
}
class IBinaryOperation extends IOperation {
constructor(operator) {
super(... | true |
68284cb8fcaf68e6c534ed8b9c7cc5264f06d7b8 | JavaScript | Edinson1408/ProyectoBodega | /js/datepicker.js | UTF-8 | 994 | 2.59375 | 3 | [
"MIT"
] | permissive | $(function() {
//Array para dar formato en español
$.datepicker.regional['es'] =
{
closeText: 'Cerrar',
prevText: 'Previo',
nextText: 'Próximo',
monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
monthNamesShort:... | true |
7f93c525ee2abe1af04f2486584dd4247ce0f47d | JavaScript | thomatoh/dark-mode | /src/hooks/useDarkMode.js | UTF-8 | 498 | 2.515625 | 3 | [] | no_license | import { useEffect } from "react";
import { useLocalStorage } from "./useLocalStorage";
export function useDarkMode() {
const [ storedValue, setValue ] = useLocalStorage("darkMode", false);
useEffect(() => {
if (storedValue) {
document.getElementsByTagName("body")[0].classList.add("dark-m... | true |
06246f87812c63d456a2fb19f9177335a7d2fe3c | JavaScript | cortesana/modulo-3-evaluacion-intermedia-cortesana | /src/components/Pokemon.js | UTF-8 | 587 | 2.625 | 3 | [] | no_license | import React from 'react';
function Pokemon(props) {
return(
<div className="pokeContainer">
<img className="pokeImg" alt={props.pokeName} src={props.pokeImg}/>
<h2 className="pokeName">{props.pokeName}</h2>
<ul className="pokeTypes">
{props.pokeTypesArra... | true |
527223fd834ec92c5c92a172508b67f35f121a19 | JavaScript | salmanv/Javascript_fundementals | /js_fundamentals/variables.js | UTF-8 | 3,904 | 4.4375 | 4 | [] | no_license |
////////////////////////FUNCTIONS EXERCISES
//The Fortune teller
// Why pay a fortune teller when you can just program your fortune yourself?
// Write a function named tellFortune that:
// takes 4 arguments: number of children, partner's name, geographic location, job title.
// outputs your fortune to the screen l... | true |
de8a71cb65c1bdaeef89b8a1dc84518a9fc3ea85 | JavaScript | lbxx1984/toys | /tcframe2/lhtsoft/tcframe/controls/Number.js | UTF-8 | 6,249 | 2.59375 | 3 | [] | no_license | var TcFrame=TcFrame||{};
TcFrame.Number=function(param){
this.initializate(param);
if(param&¶m.showBtn!=null){this.showBtn=param.showBtn;}
if(param&¶m.datatype!=null){this.dataType=param.datatype;}
if(param&¶m.max!=null){this.max=param.max;}
if(param&¶m.min!=null){this.min=param.min;}
if(param&&pa... | true |
65578f05e1024bfc30b91531332a412bc7597af7 | JavaScript | MartinoFenu/pomodoroclock | /src/hooks/hooks.js | UTF-8 | 3,761 | 3 | 3 | [] | no_license | import { useState, useEffect, useCallback, useRef } from 'react';
const defaultVal = {
break: 5,
session: 25
}
//from Dan Abramov post
//https://overreacted.io/making-setinterval-declarative-with-react-hooks/
export const useInterval = ( callback, delay ) => {
const savedCallback = useRef();
// Remember the ... | true |
12347a9c343a89023ee2aadcfc304b53750c02a6 | JavaScript | tychon/node-vigenere | /test/test_common.js | UTF-8 | 308 | 2.515625 | 3 | [] | no_license | var test = require('tap').test
, common = require('..').common
test("test number conversion", function (t) {
numbers = common.toNumbers(common.ALPHABET, "ABCZ");
t.equivalent(numbers, [0, 1, 2, 25]);
string = common.toString(common.ALPHABET, numbers);
t.equal(string, 'ABCZ');
t.end();
})
| true |
8219d2622578f3056c537c6ef360bcbf59719a4a | JavaScript | nord-ine/Fullstack-movie-app | /front-end/movie-app/src/App.js | UTF-8 | 2,479 | 2.828125 | 3 | [] | no_license | import './App.css';
import { Button, Container, Heading, HStack,Input, VStack,Tag} from '@chakra-ui/react';
import MovieCard from './components/MovieCard';
import {useState,useEffect} from 'react';
function App() {
const [searchMovie, setsearchMovie] = useState("")
const [movies, setmovies] = useState([]);
con... | true |
4dedad26a498b8cf92c9ca1b351088e3afb984a4 | JavaScript | WASdev/lib.rtcomm.clientjs | /src/rtcomm/connection/Transaction.js | UTF-8 | 5,393 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2014 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in wri... | true |
f36a7e38a528e1a10cd2a34cc206517dd0f86462 | JavaScript | IngloriousCoderz/inglorious-portfolio | /17-js-objects/tasks/hello-object.js | UTF-8 | 163 | 2.96875 | 3 | [
"MIT"
] | permissive | let user = {};
user.name = 'John'; // Create
user['surname'] = 'Smith';
user.name = 'Pete'; // Update
delete user.name; // Delete
console.log(user.name); // Read
| true |
10bad2271334ab6cadda7b110d1b1d92b2ff2d18 | JavaScript | ReveWeber/utilities | /ga-boilerplate/generic-product-list-tracking-code.js | UTF-8 | 7,188 | 2.75 | 3 | [] | no_license | /*
GA Product List Tracking
*/
// GTM setup: https://developers.google.com/tag-manager/enhanced-ecommerce#product-impressions
// set up clicks and adds likewise (accommodates adding to cart from list)
// we are assuming product list data is not being sent with page load
// doing so will save you hits; waiting for ... | true |
eaba588be9cb49fb34c26aade07145b1fb8d9ff7 | JavaScript | gihankarunarathne/node-schedule-forecaster | /test/NextTime_test.js | UTF-8 | 2,307 | 2.65625 | 3 | [
"MIT"
] | permissive | 'use strict';
let assert = require('assert');
let NextTime = require('../index').NextTime;
let debug = require('debug')('ScheduleForecaster:test:NextTime');
describe('NextTime ', () => {
let nextTime = null;
before(done => {
nextTime = NextTime;
done();
});
describe('NextDate ', () =... | true |
8836fa3fd7ae45420216d254af3f6c6d040ef482 | JavaScript | alexe8/mobile | /zao-mobile/scripts/main.js | UTF-8 | 4,600 | 2.546875 | 3 | [] | no_license |
// Wait for Apache Cordova to load
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is ready
function onDeviceReady() {
//var object = {value: "value", timestamp: new Date().getTime()}
//localStorage.setItem("key", JSON.stringify(object));
}
var zaoApp = function(){... | true |
06c0850a469a28a60fd973783f6e9f79117314b7 | JavaScript | FullstacksOfTrash/grace-shopper | /server/api/reviews.js | UTF-8 | 1,668 | 2.515625 | 3 | [] | no_license | const router = require('express').Router()
const { Review } = require('../db')
const loggedIn = (req, res, next)=> {
next( req.user ? null: { status: 401 })
}
const isMe = (paramKey)=> {
return (req, res, next)=> {
next( req.user.id == req.params[paramKey] ? null : { status: 401 })
}
}
const isAdmin = (p... | true |
5d016559ad96e7eed866c3037db47409b3407080 | JavaScript | fracmak/react-relay-network-layer | /src/createRequestError.js | UTF-8 | 2,257 | 2.59375 | 3 | [
"MIT"
] | permissive | /**
* Formats an error response from GraphQL server request.
*/
function formatRequestErrors(request, errors) {
const CONTEXT_BEFORE = 20;
const CONTEXT_LENGTH = 60;
if (!request.getQueryString) {
return errors.join('\n');
}
const queryLines = request.getQueryString().split('\n');
return errors
... | true |
d0c0ee87616ceb622f04d08db47a0c2b72ee9e14 | JavaScript | zaq158/zaq158.github.io | /canvas/js/function.js | UTF-8 | 11,851 | 2.84375 | 3 | [] | no_license | function Palette(obj,ctx,mask) {
this.obj=obj;
this.ctx=ctx;
this.mask=mask;
this.obj.width=obj.width;
console.log(obj.width);
// this.width=obj.width;
// this.height=obj.height;
this.obj.height=obj.height;
this.ctx.lineWidth=10;
this.fillStyle='orange';
this.strokeStyle='ora... | true |
7da2b911fe3e10ccbbd88f50676734fac0461765 | JavaScript | mdheller/chest.store | /src/libs/Encryption.js | UTF-8 | 938 | 2.71875 | 3 | [
"MIT"
] | permissive | import crypto from 'crypto'
import fs from 'fs'
import bcrypt from 'bcrypt'
// import config from '../config'
export default class Encryption {
static fileToHash(filePath, hashAlgo="sha256") {
return new Promise((resolve, reject) => {
const md5Sum = crypto.createHash(hashAlgo)
const readStream = fs.... | true |
1fa51bd63e29288fdf17f4e3b06f70a99c01c82f | JavaScript | boolean-classe13/js-live-coding | /esempio-if-not/main.js | UTF-8 | 223 | 3.84375 | 4 | [] | no_license | var numero = 3;
if( (numero > 4) == false ) { // equivalente a if( !(numero > 4) )
console.log('il numero ' + numero + ' non è maggiore di 4');
} else {
console.log('il numero ' + numero + ' è maggiore di 4');
}
| true |
7389adadd28f3f8a7a64db17ed3235798252926a | JavaScript | Charlene-bot/fullstack-hw | /hw3/05-form.js | UTF-8 | 701 | 3.234375 | 3 | [] | no_license | //function handleSubmit(event) {
// Add your code here
let form = document.querySelector("form");
form.addEventListener("submit", event => {
event.preventDefault();
console.group('Form Submission');
console.log('Name: ', form.elements.name.value);
console.log('Email', form.elements.email.value);... | true |
9b90dfb1d84b2e9e9262cf50e25312eaa7678440 | JavaScript | BrandonLim8890/calculator | /logic.js | UTF-8 | 2,853 | 3.828125 | 4 | [] | no_license | var display_num = ''; // current display number
var num1 = '';
var num2 = '';
var operation = '';
var continuity = true; // variable allows calculator to keep working after = sign is clicked
function initializeButtons() {
const numbers = document.querySelectorAll('.number');
numbers.forEach((number) => {
... | true |
77d7e883a8117f964fe5733d9034f68e12d6acbc | JavaScript | dested/BingoProject | /Client/js/utils/clickManager.js | UTF-8 | 3,172 | 2.734375 | 3 | [] | no_license | define(
'utils.clickManager',
[
],
function () {
function ClickManager(gameBoard) {
this.clickRects = [];
this.element = undefined;
this.gameBoard = gameBoard;
}
ClickManager.prototype.pushClickRect = function (clickRect) {
this.c... | true |
d1fbca734c090052768ef3eda0949e379c85cd37 | JavaScript | SFmonkey/js2048 | /animation.js | UTF-8 | 638 | 3.09375 | 3 | [] | no_license | //动画展示新生成的数字
function showNumberWithAnimation(x,y,randNum){
var numCell = $('#number-cell-'+x+'-'+y);
numCell.css('background-color',getTheNumberBackground(randNum));
numCell.css('color',getTheNumberColor(randNum));
numCell.text(randNum);
numCell.animate({
width:"100px",
height:"100p... | true |
3ae75f4d5508253523a226007d0173db75e4c646 | JavaScript | royc67/Snake-Game | /main.js | UTF-8 | 3,830 | 3.453125 | 3 | [] | no_license | // consts
const GRID_LENGTH = 30;
const APPLE = "fa fa-apple apple";
const SPEED = 100;
const vectors = [
[0, -1],
[-1, 0],
[0, 1],
[1, 0],
];
// Elements Declaration
const difficultySelector = document.getElementById("difficultySelector");
const boardSizeSelector = document.getElementById("boardSizeSelector")... | true |
214a14aef24bc23f19b0cf79d1bcb6fd0379f065 | JavaScript | future4code/caio-gomes | /Semana-17/Aula - Arquitetura/build/business/entities/Frame.js | UTF-8 | 1,743 | 2.78125 | 3 | [] | no_license | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Frame {
constructor(size, type) {
if (!(size in FrameSize)) {
throw new Error('Tamanho moldura invalido');
}
if (!(type in FrameType)) {
throw new Error('Tipo moldura invalido');
... | true |
c034437d652664179fb56a159541d35f11fbc747 | JavaScript | Janpot/fantastiq | /test/Queue.removeN.spec.js | UTF-8 | 1,483 | 2.609375 | 3 | [
"MIT"
] | permissive | /* eslint-env mocha */
'use strict';
var assert = require('chai').assert;
module.exports = function (createQueue) {
return function () {
var queue = null;
before(() => {
queue = createQueue();
});
it('should remove multiple jobs', function () {
return queue.addN([1, 2, 3])
.th... | true |
0c764c4c9002a5eeb13d72390189e4ddd8d68178 | JavaScript | brunadl/curso-fundamentos-js | /Capitulo01/demo06-booleanos.js | UTF-8 | 483 | 3.375 | 3 | [] | no_license | const podeDirigir = true
if (podeDirigir) {
console.log('Ela pode dirigir <3');
}
const saldoEmConta = 0
if(!saldoEmConta) {
console.log('Não tem saldo :(');
}
// força o valor true or false
// de acordo com a tabela
const boolComString = 'ae hackerzona!!'
console.log('boolComString', !!boolComString);
... | true |
9e610e171027f3f2b0683235da5ffeed48f82e58 | JavaScript | sfreeman422/raspiqueue | /src/components/VideoContent/Children/ThumbsButton.js | UTF-8 | 744 | 2.59375 | 3 | [] | no_license | import React from "react";
import PropTypes from "prop-types";
import "./ThumbsButton.css";
// Renders a thumbsUp or thumbsDown button based on the props passed in.
const ThumbsButton = props => (
<div
className="thumbs"
role="button"
tabIndex="0"
onClick={() => props.action()}
onKeyUp={event => ... | true |
69c4a4f3021a480884022e57584b15081cfd6721 | JavaScript | avinash112233/es6-and-asychroncity | /task22.js | UTF-8 | 330 | 3.15625 | 3 | [] | no_license |
let arr1=[];
function fun(char){
return new Promise(resolve=>{
setTimeout(()=>{
resolve(char);
},1000);
});
}
async function adding(array){
for(let i=0;i<array.length;i++){
arr1.push(await fun(array[i]));
}
return arr1;
}
module.exports={
push:... | true |
f124f5fdf66f116f408fcce2851918bee491e03d | JavaScript | ahnaf22/covid_checker | /src/components/Step2.jsx | UTF-8 | 2,192 | 2.625 | 3 | [] | no_license | import React from 'react';
import '../cssfiles/step2style.css';
function Step2({ set_step, set_points }) {
const submitSecond = () => {
const checkboxes = document.querySelectorAll(`input[name="first_symtomps"]:checked`);
let points = parseInt(window.localStorage.getItem('points'));
if ... | true |
87febeb34485e5a6547cc149b5f672c6cdf7e4da | JavaScript | matthewogrosso/API | /ChatLogAPI.js | UTF-8 | 2,893 | 2.75 | 3 | [
"CC0-1.0"
] | permissive | var fs = require('fs')
var http = require('http')
const {writeAccessLog, writeFaviconLog, writeHeaderLog} = require('./WriteAccessLog')
var { SanitizeUrl } = require('./../Utilities/SanitizeUrl')
function LogMessage (room, user, message) {
var dateTime = new Date()
var logFile = './room/' + room + '.log'
... | true |
b09f57924e1d634599b494574158e84d9b444bbe | JavaScript | FedeHR/rock-paper-scissors | /script.js | UTF-8 | 2,435 | 4.125 | 4 | [] | no_license | let win = 0;
let lose = 0;
let draw = 0;
function computerPlay() {
let choice = Math.random() * 3;
if (choice >= 2) {
computerSelection = 'rock';
} else if (choice > 1) {
computerSelection = 'paper';
} else {
computerSelection = 'scissors'
}
return computerSelection;
}
... | true |
0349ec22cec4bcc8cf092fd5cc86d38b52779cf1 | JavaScript | isophp/isophp | /FrontDevelopEnv/src/helpers/pages.js | UTF-8 | 760 | 2.5625 | 3 | [] | no_license | import { merge, each, isArray } from '../helpers/util'
import { pick } from 'lodash'
export function mergeProps (compProps, pageProps) {
// we only want to pick declared props
let pickedProps = pick(compProps, Object.keys(pageProps))
// merge the new properties
const props = merge({}, pickedProps, pageProps)
... | true |
8ffc757ba1e5466a0381d48e1ac5fcb1f6dcd87d | JavaScript | hackmcgill/hackerAPI | /middlewares/search.middleware.js | UTF-8 | 1,718 | 2.640625 | 3 | [
"MIT"
] | permissive | "use strict";
const Services = {
Search: require("../services/search.service")
};
const Middleware = {
Util: require("../middlewares/util.middleware")
};
/**
* @function parseQuery
* @param {JSON} req
* @param {JSON} res
* @param {JSON} next
* @description parses the json in the parameter
*/
function par... | true |
3f6dd0092caae1a51301f244b07bd9fa254fba81 | JavaScript | MFTECH-code/Estudos-Desenvolvimento-web | /Objetos/NotaçãoLiteral.js | UTF-8 | 364 | 3.890625 | 4 | [] | no_license | const a = 1;
const b = 2;
const c = 3;
// Antigamente...
const obj1 = { a: a, b: b, c: c };
console.log(obj1);
// Colando funções dentro de objetos
const obj3 = {
funcao1: function () {
}
}
// ES6
const obj2 = { a, b, c };
console.log(obj2);
// Colocando funções dentro de objetos
const obj4 ... | true |
92a3cf322531fab86d4c3d6350d6da5d91cd5637 | JavaScript | zino1187/korea202102_nodeworkspace | /shoppingmall/lib/mymodule.js | UTF-8 | 1,532 | 3.5625 | 4 | [] | no_license | /*모듈은 변수 ,함수 등의 코드를 모아놓고 파일로 저장한 단위
개발자가 모듈을 정의할때는 내장객체 중 exports 객체를 사용하면 됨
*/
//getMsg 메서드를 현재 모듈안에 정의한다!!
exports.getMsg=function(){
return "this message is from my module";
}
//랜덤값 가져오기
exports.getRandom=function(n){
var r=parseInt(Math.random()*n); // 0.000xxxx ~ 1미만 사이의 난수발생시켜줌 일이못된 *3
//console... | true |
4ae76346a81b0ffb9fc918b82ed6bbb5f799369b | JavaScript | asopian/qiciengine-examples | /projects/Project/JumpingBrick/Scripts/LevelAdapter.js | UTF-8 | 1,809 | 2.625 | 3 | [
"MIT"
] | permissive | // define a user behaviour
var LevelAdapter = qc.defineBehaviour('qc.engine.LevelAdapter', com.qici.extraUI.TableViewAdapter, function() {
var self = this;
// 载入配置和游戏世界
self.config = JumpingBrick.gameConfig;
self.world = JumpingBrick.gameWorld;
}, {
});
LevelAdapter.prototype.awake = function() {
var self... | true |
0ab4fe8271846f1872ff04ea92dcdb9d6b4ba514 | JavaScript | Iamdavidonuh/react-photo-search | /src/components/Search.js | UTF-8 | 1,897 | 2.71875 | 3 | [] | no_license | import React, {useState} from 'react';
import Unsplash, {toJson} from 'unsplash-js';
import Checkbox from './CheckBox';
import SearchResults from './searchresults/SearchResults';
const unsplash = new Unsplash({
accessKey:process.env.REACT_APP_UNSPLASH_ACCESS_KEY,
})
export default function Search(){
const [qu... | true |
9be94c8b987cdd748d927db490ed46587c3b86db | JavaScript | ayonghosh/intellisolblog | /public/js/jsQwerty.js | UTF-8 | 4,700 | 3.140625 | 3 | [] | no_license |
/*
* jsQwerty - a reusable virtual keyboard plugin
* Author: Ayon Ghosh
* Version: 1.0
* Date: 30 October 2013
*/
/* A key */
var Key = function (charc) {
this.charc = charc;
this.key = document.createElement('button');
this.key.className = 'key';
this.key.innerHTML = this.charc;
};
Key.prototype.toggleCase... | true |
f9562f903b2d6b5aac69d5fc533252841bb07128 | JavaScript | cesargon92/Curso-JavaScript | /hola-mundo/js/12-ejercicio2.js | UTF-8 | 528 | 4.125 | 4 | [] | no_license | "use strict"
/*
Utilizando un bucle, mostrar la suma y la media de los números ingresados
hasta introducir un número negativo y ahí mostrar el resultado
*/
var suma = 0;
var contador = 0;
do{
var numero = parseInt(prompt("Introduce algún número", 0));
if(isNaN(numero)){
numero = 0;
}
else... | true |
7277e5d81e9384c1d98cab3e12b6ee15bd45c76e | JavaScript | LipchanskiyVadim/dispex-test | /src/redux/sortFunctions.js | UTF-8 | 660 | 2.96875 | 3 | [] | no_license | /* street sorting */
export const sortStreets = (array)=> {
const uniqueData = [];
const uniqueStreets = [];
array.forEach(list => {
if(!uniqueData.includes(list.streetName)) {
uniqueData.push(list.streetName);
uniqueStreets.push({name: list.streetName, id: list.streetId});
}})
return uniqueStreets;
}... | true |
3854a962b13fae662f7b22f1b2845d5d6cf934ab | JavaScript | meloman370/evolution-nodejs | /src/redux/actions/profile.js | UTF-8 | 707 | 2.515625 | 3 | [] | no_license | import axios from 'axios'
import {userGetToken} from '../../helpers/user-helper'
export const REQUEST_PROFILE = 'REQUEST_PROFILE'
export const RECEIVE_PROFILE = 'RECEIVE_PROFILE'
function requestProfile() {
return {
type: REQUEST_PROFILE
}
}
function receiveProfile(json) {
return {
type: RECEIVE_PROFIL... | true |
79ba5a880aea01a551edd4b15e66d1024b7659c1 | JavaScript | xiaoniainiu/hiui | /components/date-picker/Calender.js | UTF-8 | 8,652 | 2.5625 | 3 | [
"MIT"
] | permissive | import React, {Component} from 'react'
import {deconstructDate, getYearWeek} from './util'
import Provider from '../context'
import {
getDaysInMonth,
subMonths,
getDay,
startOfMonth,
isWithinRange,
isSameDay,
compareAsc,
addMonths,
startOfDay,
endOfDay
} from './dateUtil'
import {DAY_MILLISECONDS} ... | true |
ee314c7a2188a923f828b269ad11be94ac050c1f | JavaScript | Felipecrj12/aulajavascript | /aula javaScript if for/script.js | UTF-8 | 1,977 | 4.0625 | 4 | [
"Apache-2.0"
] | permissive | // ||| EXERCICIO 1|||
//var lista = ["maça","pêra", "laranja"];
//console.log(lista);
//||| EXERCICIO 2|||
//*var lista = ["maça", "pêra", "laranja"];
//console.log(lista[1]);
//alert(lista[1]);*/
// ||| EXERCICIO 3|||
//var lista = ["maça","pêra", "laranja"];
//lista.push("uva")
//conso... | true |
039fda3290cefaa89eaa14774799d3f6027b6156 | JavaScript | gala1234/rest-api | /routes/product.route.js | UTF-8 | 766 | 2.578125 | 3 | [] | no_license | const express = require('express');
const router = express.Router();
// Require the controller
const product_controller = require('../controllers/product.controller');
// a simple test url to check that all of our files are communicating correctly.
router.get('/test', product_controller.test);
module.exports = router... | true |
20e16a30d829004a06f680eb449f36ce47570c40 | JavaScript | YangH34/WebGL-Forward-Plus-and-Clustered-Deferred-Rendering | /src/wireframe.js | UTF-8 | 3,946 | 2.75 | 3 | [] | no_license | import { gl } from './init';
import { mat4 } from 'gl-matrix';
import { loadShaderProgram } from './utils';
import vsSource from './shaders/wireframe.vert.glsl';
import fsSource from './shaders/wireframe.frag.glsl';
// LOOK: use the Wireframe class to draw arbitrary lines in your scene.
// This can be helpful for visu... | true |
5703124ee2e9cbd2871cac9dbe69eee1cab5b0f0 | JavaScript | naganeo/chatspace | /app/assets/javascripts/search.js | UTF-8 | 2,287 | 2.828125 | 3 | [] | no_license | $(function() {
var list = $("#user-search-result");
// build list html
function buildList(user) {
// does not duplicate usernames that are already added
var names = $(".chat-group-user__name").text()
if (names.indexOf(`${user.name}`) < 0) {
var html = `
<div class="chat-group-user clea... | true |
0ae5d5fd91682610fa8316ecd037b8fb243bd762 | JavaScript | KaHcTpykTap/dcoya_challenge | /src/action/userAction.js | UTF-8 | 5,366 | 2.5625 | 3 | [] | no_license | export const SET_COLOR = 'SET_COLOR';
export const SET_MAIN_TEXT = 'SET_MAIN_TEXT';
export const SET_SECONDARY_TEXT = 'SET_SECONDARY_TEXT';
export const SET_COUNTER = 'SET_COUNTER';
export const CHANGE_ANIMATION = 'CHANGE_ANIMATION';
export const CHANGE_LOG = 'CHANGE_LOG';
export const setUserColor = (color) => ({
... | true |
2e7e202106d75392eeca11e155312c9cc662edd7 | JavaScript | radchr/HW2021-js | /HW09102021-js/CW-code/script/test.js | UTF-8 | 296 | 3.59375 | 4 | [] | no_license | function concat30words(str){
if (str.length === 0) {
return "Введите слова"
}
let a = str.length;
let b = "";
while (b.length < 30) {
b = b.concat(str);
console.log(b.length)
}
return b.slice(0,30)
}
let aaa = concat30words("222 445555555");
console.log(aaa, aaa.length) | true |
c3b93f05800d1c6be3e2b50f55f054e4d6311fbe | JavaScript | fadhilachmadi/photorder-front-end-website | /js/index.js | UTF-8 | 1,198 | 3.328125 | 3 | [] | no_license | function emailIsValid (email) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
}
function phoneIsValid(phone)
{
return /^\d{12}$/.test(phone)
}
function nameValidation(){
const name = document.getElementById("orderName").value
if(!name){
alert("Please insert your name")
return false
}
return true... | true |
23b50783fbc9fcc3f1a51dd2f7e8b68af25b23be | JavaScript | itsjustbrian/AOS-Map-Downloader | /download.js | UTF-8 | 5,399 | 2.5625 | 3 | [] | no_license | /**
* Author: Brian Ferch (https://github.com/itsjustbrian)
* Date: December 2019
*
* Bulk downloads map files and images from aos.party
*/
const rp = require('request-promise');
const r = require('request');
const cheerio = require('cheerio')
const fs = require('fs');
const path = require('path');
const del = ... | true |
0027e7edf2cc7619e2bde38b762b31df3fe7aefc | JavaScript | XccelerateTech/gurmansandhusaab | /node1/e/app.js | UTF-8 | 712 | 2.734375 | 3 | [] | no_license | let personame = require("./pname.js");
let number = require("./pno.js");
let rectarea=require("./rectanglearea.js")
let hello = require("./assign.js")
// rectarea(2,6);
// personame();
// number();
// console.log(hello(7));
var Start = require("./timerutils.js").start;
var pause = require("./timerutils.js").pause;
va... | true |
31a66a00ba14420bd6943281076b71ffb9b3416c | JavaScript | timelaps/fn | /bind/index.test.js | UTF-8 | 817 | 2.90625 | 3 | [] | no_license | var bind = require('.');
var b = require('@timelaps/batterie');
var toArray = require('@timelaps/to/array');
var obj = {};
b.describe('bind', function () {
b.it('creates new functions when it binds', function (t) {
t.expect(bind(noop, obj)).notToEqual(noop);
});
b.describe('allows functions to be ru... | true |
9995061fb741dd47af05be27c9c1f757afea9c50 | JavaScript | monsevela8/Actividad_6 | /tarjetas/js/Script.js | UTF-8 | 2,771 | 2.671875 | 3 | [] | no_license | document.getElementById('tipo').addEventListener("change",tipoTarSeleccionado);
document.getElementById('fondo').addEventListener("change",colorFondo);
document.getElementById('mostrar_tarjeta').addEventListener("click",function(){mostrarTarjeta();});
function tipoTarSeleccionado(){
capasImg=document.getEleme... | true |
179ed0efb0bac13e1cee0eaa5320a1ac07029f52 | JavaScript | onesynergyti/avaliacao | /API/helpers/validacaoJWT.js | UTF-8 | 645 | 2.59375 | 3 | [] | no_license | const env = process.env.NODE_ENV || 'development';
const config = require(__dirname + '/../config/config.json')[env];
const jwt = require('jsonwebtoken');
exports.validaJWT = function (req, res, next){
const token = req.headers['x-access-token'];
if (!token) return res.status(401).json({ auth: false, message: ... | true |
66220d1c045b63de57cd74eb4d4388e418337a08 | JavaScript | pranjli-singh/Projects | /bb.js | UTF-8 | 701 | 3.21875 | 3 | [] | no_license |
function check(){
var question1 = document.quiz.question1.value;
var question2 = document.quiz.question2.value;
var question3 = document.quiz.question3.value;
var question4 = document.quiz.question4.value;
var question5 = document.quiz.question5.value;
var correct = 0;
if (question1 == "Venus")... | true |
15651f3dd55300af6e21e27370adfeece3f5cbbc | JavaScript | jsalamanca2/liri-node-app | /liri.js | UTF-8 | 4,078 | 2.890625 | 3 | [] | no_license | var fs = require('fs');
var keys = require('./key.js');
var Twitter = require('twitter');
var spotify = require('spotify');
//For OMDB movie Api
var request = require('request');
//commands to get data from twitter, spotify or movie
var action = process.argv[2];
// made for the movie and spotify selection
var value = ... | true |
4abe31e54b8db3fbed1b2d32250a5b362b39d985 | JavaScript | shchodro/serverless-workshop | /Slack/SlackService.js | UTF-8 | 5,621 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | /* == Imports == */
var AWS = require('aws-sdk');
var qs = require('querystring');
var https = require('https');
/* == Globals == */
var API = {
region: 'INSERT YOUR REGION HERE', // the region code where you launched the stack, e.g. eu-west-1
endpoint: 'INSERT YOUR API GATEWAY FQDN HERE INCLUDING THE HTTPS://... | true |
687f32199d5edad7a537e125333d8db9090847cb | JavaScript | dimasgardenia/tugas | /main.js | UTF-8 | 4,093 | 3.171875 | 3 | [] | no_license | //PSEUDOCODE
// BACA dan SIMPAN [
//["PERTANYAAN1", "PERTANYAAN2", "PERTANYAAN3"]
//["JAWABAN1", "JAWABAN2", "JAWABAN3"]
// BACA dan SIMPAN
//[NILAI (0 sebagai nilai awal)]
// buat FUNGSI untuk pertanyaan PERTANYAAN1 dengan memanggil index [PERTANYAAN1]
// buat pemberitahuan ALERT "kalimat selamat datang" untuk memul... | true |
4a951f3d680da70c478e3e6cc34e825c0c81ec06 | JavaScript | neytrowd/mern-facebook-clone | /client/src/redux/reducers/authReducer.js | UTF-8 | 574 | 2.75 | 3 | [] | no_license | export const LOGIN = 'USER_LOGIN';
export const LOGOUT = 'USER_LOGOUT';
const initial = {
id: undefined,
token: undefined
}
const authReducer = (state = initial, action) => {
switch (action.type) {
case LOGIN: {
return {
id: action.payload.id,
token: act... | true |
07fce8fef06fbbefda9570674b162629a5dd20a9 | JavaScript | friedeggbae/Art-by-a-Non-Programmer | /IGME102/firefly_object-array/Main.js | UTF-8 | 1,043 | 3.359375 | 3 | [] | no_license | "use strict";
/*
Description:
ICE 1-2: Adding another parameter to the object. I added size.
Author:
Christine Van
Class:
IGME 102, Prof Al Biles
*/
/* setup() runs once before starting the animation loop
*/
let d1;
let drunks = [];
let drunks2 = [];
let num = 1000;
let num2 = 100;
function setup() {
createCan... | true |
dbd94ec45beb87011b957e34f3f136b06a796ffd | JavaScript | AryRosvall/logCreator | /src/index.js | UTF-8 | 498 | 2.6875 | 3 | [
"MIT"
] | permissive | const { generateLogs } = require('../utils/');
const intervalTime = 5;
const greetings = ['Buenos días', 'good morning', 'Bonjour', 'Buon Giorno', 'Guten Tag', 'Bon dia', 'Bom día'];
const dir = './logs';
let counter = 1;
const interval = setInterval(async () => {
try {
res = await generateLogs(dir, greetings);... | true |
105cc442d3a2fbad021f180fb5a3ab1651dab87d | JavaScript | ifatoki/hng-wonderwoman-task-1 | /scripts/05240-Riyike.js | UTF-8 | 250 | 2.75 | 3 | [] | no_license | let full_name = 'Odusanya Iyanuoluwa';
let id = 'HNG-05240';
let language = 'JavaScript';
let email_address = 'odusanyaiyanuoluwa@gmail.com';
let hello = `Hello World, this is ${full_name} with HNGi7 ID ${id} using ${language} for stage 2 task ${email_address}`;
console.log(hello);
| true |
e146e302458e9812e05be2a759121499c1871604 | JavaScript | duchij/dapp | /js/comm_class.js | UTF-8 | 18,754 | 2.578125 | 3 | [
"MIT"
] | permissive | /**
* Ajax Communcation Class definition for Studio2 .....
* Author Duch v0.1
*/
/**
* Trieda workerProcess sluzi na pracu s Workerom
* @todo Velmi vela roboty t.c. len zaciatok prace...
*/
//var __nativeST = window.setTimeout;
//var __nativeSI = window.setInterval;
//window.setTimeout = function (vCallback, n... | true |
85f6ef716bfa7f53f98dd822b7d05446f2d391ce | JavaScript | briceyokoyama/mouse_tracking | /src/server/player.js | UTF-8 | 203 | 2.984375 | 3 | [] | no_license |
export default class Player {
constructor(username) {
this.username = username;
this.score = 0;
}
incrementScore() {
this.score += 1;
}
getScore() {
return this.score;
}
}
| true |
782459de61d0f0506680fab6fdb307dc8d3488a7 | JavaScript | Paulbtest/Fun-With-JS | /html academy/36_HTML_squareRoots.js | UTF-8 | 2,133 | 4.625 | 5 | [] | no_license | // HTML Academy. Испытание: "Квадратные корни"
let calculateRoots = function (a, b, c) {
let discriminant = Math.round(b * b - 4 * a * c);
let result;
if (discriminant < 0) {
result = 'Корней нет';
} else if (discriminant === 0) {
result = 'Корень равен ' + Math.round(-b / (2 * a));
... | true |
0b845bdf94d3f19a2fe31777b007bf9d8e77a278 | JavaScript | tmpUsername/js | /public_html/JS/app.js | UTF-8 | 1,246 | 3.828125 | 4 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//var obj = {
// titre: "Kung Fu Panda",
// anneeProd: 2000,
// nbLiens: 20,
// realisateurs: [{nom: "Pixar"}, {nom: "Disn... | true |
5ec18e2178c122899eec6306958009ae5453bcbb | JavaScript | Turanchoks/miniature-eureka | /router.js | UTF-8 | 1,509 | 2.6875 | 3 | [] | no_license | import { h, render } from './src/render';
// const root = document.getElementById('root');
// const data = [[123, 'fsdfsdf'], [4325, 'sdajfklasdf'], [432543, 'sdjfklasfd']];
// const exampleTemplate = document.getElementById('tg-example');
// // for (const d of data) {
// // const
// // }
// // root.appendChild()
/... | true |
4e30dff125957198a695dd6bc99c8952ab0fa7ac | JavaScript | JamCode/autoGenerator | /utility/imixXML2Json.js | UTF-8 | 4,061 | 2.625 | 3 | [] | no_license | var parser = require('xml2json');
var fs = require('fs');
//xml file to json
exports.getIMIXJson = function(xmlName){
var xml = fs.readFileSync(xmlName);
var imixJsonStr = parser.toJson(xml);
var imixJson = JSON.parse(imixJsonStr);
return imixJson;
}
//return head + body + trailer fields ,and body's co... | true |
785d7008250988363e547609e16d5a303a13fad8 | JavaScript | rstar2/js_tetris-multi-player | /public/js/Tetris.js | UTF-8 | 5,987 | 2.9375 | 3 | [] | no_license | import * as matrix from './matrix.js';
import Player from './Player.js';
export default class Tetris {
constructor(controller, canvas, arenaW, arenaH, scale, score, keys = [37, 39, 40, 81, 87]) {
this._controller = controller;
this._canvas = canvas;
this._context = canvas.getContext('2d');
... | true |
c409a3d4542c1b09114ced0251fcac213ba2135a | JavaScript | thomas-sivilay/Sketch-Pal | /Pal.sketchplugin/Contents/Sketch/Source/Export/Swift/swiftUtils.js | UTF-8 | 3,975 | 2.53125 | 3 | [
"MIT"
] | permissive | // Helper methods for swift output
var SwiftUtils = {
importe: function(framework) {
return "import " + framework;
},
extension: function(extension) {
return "extension " + extension + " {";
},
struct: function(struct) {
return "struct " + struct + " {";
},
methodSignature: function(name) ... | true |
25f38682bcaeeff91775d21c9e264fe73342474a | JavaScript | adclleva/The-Photo-Shop-App | /src/pages/Photos.js | UTF-8 | 1,147 | 2.703125 | 3 | [] | no_license | import React, { useContext } from "react" // we need this
import Image from "../components/Image"
import { getClass } from "../utilities"
import { Context } from "../context/Context"
function Photos() { // this Photos component is to show all the image photos
const { photos } = useContext(Context) // this grab... | true |
6eec2f568f207ba802442605927bf574b2ae0edf | JavaScript | JapanYoshi/node | /www/script.js | UTF-8 | 1,378 | 2.765625 | 3 | [] | no_license | var hash = exports
$(document).ready(function(){
$("#loginform").submit(function(event){
event.preventDefault();
ajaxPost();
});
function ajaxPost(){
var formData = {
email: $("#email").val(),
hash : hash.hashCode($("#email").val() + "||" + $("#password").val() + "||")
}
$.ajax({
... | true |
479d207d78c0a4a7988248842e1bb3f935198431 | JavaScript | Arikca/Node.js | /Node-First-App/fs-app.js | UTF-8 | 288 | 2.890625 | 3 | [] | no_license | const fs= require('fs');
const files= fs.readdirSync('./');//returns all the files and directories in this folder
console.log(files);
//Asynchronously
fs.readdir('./', function(err, files){
if(err){
console.log('Error', err);
}else{
console.log(files);
}
}); | true |
d3bacad82c0c7b0dfce68407c4307cc1ede13853 | JavaScript | spatterson1551/OurTrack | /js/refuseSearch.js | UTF-8 | 195 | 2.578125 | 3 | [] | no_license | $(document).ready( function () {
$("#searchForm").submit( function(event) {
var searchInput = $("#searchInput").val();
if (searchInput == '') {
event.preventDefault();
}
});
}); | true |
50c896cb7f34fe914473227886137f9523e5215f | JavaScript | VarunSatvara/mousemove-event-animation | /js/script.js | UTF-8 | 1,417 | 2.828125 | 3 | [] | no_license | window.addEventListener("mousemove", animate);
function animate(event) {
var x = event.clientX;
var y = event.clientY;
var randomNum, randomColor, size, el;
randomColor = "#" + Math.random().toString(16).slice(-6);
// randomColor = "rgb(" + Math.random() * 255 + "," + Math.random() * 255 + "," +... | true |
eaa6434418670518b8ad02a9bb354eaf1e62b811 | JavaScript | M0hamedGamal/JavaScript | /03-Basics/Advanced/arrow-function.js | UTF-8 | 246 | 3.5625 | 4 | [] | no_license | const people = [{
name: 'Mohamed',
age: 24
},{
name: 'Gemy',
age: 22
},{
name: 'Gembo',
age: 27
}]
const findAge22 = people.find((person) => person.age === 22) // Advanced of regular function
console.log(findAge22.name)
| true |
62df69bfe5061622738bb30e3846aa5a40ee8823 | JavaScript | NathaliaRiascos/cen-alum-frontend | /src/components/hooks/useValidator.js | UTF-8 | 745 | 2.78125 | 3 | [] | no_license | import { useState } from 'react';
const useValidacion = (stateInicial, validar) => {
const [values, setValues ] = useState(stateInicial);
const [errores, guardarErrores ] = useState({});
// Función que se ejecuta conforme el usuario escribe algo
const handleChange = e => {
setValues({
... | true |
6b1c9e4debe3dbdd7b5893aaaf685c3877e6fd9b | JavaScript | Satjr/current-redux-exercice | /src/reducers.js | UTF-8 | 1,306 | 3.25 | 3 | [] | no_license |
// export const cards = (state, action) => {
// switch(action.type) {
// case 'ADD_CARD':
// let newCard = Object.assign({}, action.data, {
// score: 1,
// id: +new Date
// });
// return state.concat([newCard]);
// default:
// ... | true |
ed7c0e455f6dde1de0e30e605299f0c0dda71586 | JavaScript | mckade-hermansen/Assessing-Texas-Hold-em-Risk-Strategies | /helpers/hands/royalFlush.js | UTF-8 | 888 | 2.5625 | 3 | [] | no_license | let royalStraightFile = require('./royalStraight');
let flushFile = require('./flush');
let base = require('./baseHand');
class RoyalFlush extends base.BaseHand {
constructor() {
super();
this.name = 'royal flush';
this.royalStraight = new royalStraightFile.RoyalStraight();
this.flush = new flushFil... | true |
74fe3df7d10560e1813191759532e98aece08dc3 | JavaScript | nastyaseptilko/LeverX-Courses-Node.js | /Homework-1/Task-7/index.js | UTF-8 | 555 | 4.1875 | 4 | [] | no_license | //Write a JavaScript function to count the occurrence of a substring in a string.
function countSubstring(sourceString, substring) {
sourceString += "";
substring += "";
if (substring.length <= 0) {
return "Empty substring";
}
let subStr = substring.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')... | true |
b8b26640d41362da8c92483d34e44fdfadb2353b | JavaScript | LibertyBlackLotus/js_test | /scope.js | UTF-8 | 8,132 | 3.984375 | 4 | [] | no_license | /**
* scope 作用域与闭包
*/
/* LHS与RHS */
// RHS 查询与简单地查找某个变量的值别无二致,而LHS查询则是试图找到变量的
// 容器本身,从而可以对其赋值。从这个角度说,RHS并不是真正意义上的“赋值操作的右侧”,
// 更准确地说是“非左侧”。
// 例如
/*console.log(a); // RHS
a = 2; */ // LRS
// 在概念上最好将LRS/RHS理解为“赋值操作的目标是谁(LHS),以及”谁是赋值操作的源头(RHS)".
/*function foo(a){ //调用foo(2)时会隐式地给a分配值,a=2,这需要一次LHS询查
con... | true |