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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
98f7da05bf9919bc0283e1899624d500d17aa751 | JavaScript | Thirunavukkarasu/nodejs-workshop | /05-mocha-unit-testing/req-headparser-microservice.js | UTF-8 | 327 | 2.5625 | 3 | [] | no_license | var express = require("express");
var app = express();
app.get('/api/whoami',function(req,res){
res.send({
ipaddress : req.ip,
software : req.headers['user-agent'],
language : req.headers['accept-language'].split(",")[0]
});
});
app.listen(3000,function(){
console.log("Server is listening in port 3000!... | true |
f367396bab68577c758829bb2f0d32a9327d82d5 | JavaScript | dongliang1993/leetcode | /150.逆波兰表达式求值.js | UTF-8 | 1,051 | 3.234375 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=150 lang=javascript
*
* [150] 逆波兰表达式求值
*/
// @lc code=start
/**
* @param {string[]} tokens
* @return {number}
*/
var evalRPN = function (tokens) {
const stack = []
for (let i = 0; i < tokens.length; i++) {
const currentChar = tokens[i]
let a = 0
let b = 0
switch... | true |
76905aae3beb03b4946e13372e00986f7c4af822 | JavaScript | dalime/nodecustomapi | /gravatar.js | UTF-8 | 657 | 2.71875 | 3 | [] | no_license | const PORT = 8001;
const http = require('http');
const _ = require('lodash');
const md5 = require('md5');
let server = http.createServer((request, res) => {
let urlParts = request.url.match(/[^/]+/g) || [];
let strGravatar = urlParts[0];
if (strGravatar.toUpperCase() !== "GRAVATAR") {
console.log("You don't... | true |
1c800e4914ee2e7c00fff996e343b3da655fa034 | JavaScript | dikimeip/online-shop-react-native | /src/configs/Redux/Reducer/index.js | UTF-8 | 795 | 2.71875 | 3 | [] | no_license | const initialState = {
cart : 0,
produk :[]
}
const reducer = (state = initialState ,action) => {
if (action.type === "ADD_CART") {
return {
...state,
cart : state.cart + 1,
}
}
if (action.type === "ADD_PRODUK"){
//console.log(action.value)
ret... | true |
a7b7adf7d6b9966cdee3643e16f2622dee18e764 | JavaScript | seebigs/webpack-size-budgets-plugin | /src/numbers.js | UTF-8 | 793 | 2.65625 | 3 | [] | no_license | const bytes = require('bytes');
function parseBytes(str) {
return bytes.parse(str);
}
function readableBytes(num) {
return bytes(num, {
decimalPlaces: 2,
unitSeparator: ' ',
});
}
function tableBytes(num, decimals) {
if (num) {
return bytes(num, {
decimalPlaces: de... | true |
e5c80918afec95d33261549d29224b826a9384c1 | JavaScript | Veer-Khatri/Whole_Javascript_Tuts | /loops.js | UTF-8 | 1,384 | 3.21875 | 3 | [] | no_license | console.log('loops');
// Types of loops
/*
1. for loop
2. while loop
3. do while loop
*/
/*
for (let i = 0; i < 100; i++) {
console.log(i);
}
let k = 0;
while (k!=100) {
console.log(k);
k++;
}
let l=0;
do {
console.log(l);
l++;
} while (l!=100);
*/
// for (let i = 0; i < 10; i++) {
// if... | true |
9824af393d82c72d70ba1c57d87c6a1d953a5a61 | JavaScript | demensdeum/SpaceJaguarActionRPG | /project/resources/scripts/com.demensdeum.spacejaguaractionrpg.spaceStationController.js | UTF-8 | 1,865 | 2.5625 | 3 | [
"MIT"
] | permissive | function SpaceStationController(delegate, gameplayData) {
this.delegate = delegate;
this.gameplayData = gameplayData;
this.step = function() {
print("TODO! This controller suppose to be ingame map");
var action = prompt("Spacestation Menu:\
1. Buy 5 snacks for 100B\
2. Buy 1 repairbot for 200B\
... | true |
66971f67e78415929acc4018aacc02ef7364f39f | JavaScript | marcel-lipczynski/Advanced-Internet-Applications | /AIA_LAB5_NODEJS/controllers/shop.js | UTF-8 | 3,394 | 2.90625 | 3 | [] | no_license | const Product = require("../models/product");
const Cart = require("../models/cart");
exports.getProducts = (req, res, next) => {
req.session.isLoggedIn = true;
req.session.success = false;
Product.fetchAll()
.then(([products]) => {
res.render("shop", {
prods: products,
pageTitle: "Figh... | true |
dd2544850df18452e147f83d62325f94d64218dc | JavaScript | Zilula/promise-http | /lib/services/rickAndMortyApi.js | UTF-8 | 764 | 2.765625 | 3 | [] | no_license | const request = require('superagent');
const charById = id => {
return request
.get(`https://rickandmortyapi.com/api/character/${id}`)
.then(res => {
return {
name: res.body.name,
status: res.body.status,
species: res.body.species
... | true |
2fe08580e5ca60ed46f4c4be6917eefb4ecab1fa | JavaScript | samuelclerod/ListaJS | /js/ordered_linked_list.js | UTF-8 | 575 | 3.25 | 3 | [] | no_license | class OrderedLinkedList extends LinkedList {
append(value) {
this._checkValue(value);
let current = this.head,
previous = null;
while (current != null && current.content < value) {
previous = current;
current = current.next;
}
const newNode = new Node(value);
if (!previous)... | true |
410d7247d9e2d0ee75a5a3e1d50c9cd2aa6c4294 | JavaScript | pablonolasco/Curso-JavaScript | /Creacion-Objetos/js/app.js | UTF-8 | 1,121 | 4.3125 | 4 | [
"MIT"
] | permissive | // object literal
/*const cliente={
nombre:'Pablo',
saldo:2000,
tipoCliente:function(){
let tipo;
if(this.saldo>100){
tipo='gold'
}else{
tipo='Normal'
}
return tipo;
}
}*/
/*
function Cliente(nombre,saldo){
this.nombre=nombre;
this.... | true |
cf7a7d7905674c92cfaec0c515d81141f62e6bc4 | JavaScript | dmvstar/ugb-vuejs-meest | /src/bankid/exam/buildSenderInfo.js | UTF-8 | 1,824 | 2.546875 | 3 | [] | no_license | var oper = require('./transgen-addsender-1.json')
/*
NAME;
ПАСПОРТ (ID-КАРТА);
ФФ;
21436587;
Выдан 2133,01/01/2015;
18/02/2000;
02000, Киев, ул. Правды, 25-233;
0;
000000000;
*/
function toReDate(aData) {
var ret = '';
if (aData !== undefined && aData.length == 10)
... | true |
f7ef0277b86b339924637d12b910642751bfa468 | JavaScript | goodido/cumulus | /packages/common/util.js | UTF-8 | 5,739 | 3.03125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | 'use strict';
/**
* Simple utility functions
* @module
*
* @example
* const { isNil } = require('@cumulus/common/util');
*
* isNil(undefined); // => true
*/
const curry = require('lodash.curry');
const flow = require('lodash.flow');
const fs = require('fs');
const omitBy = require('lodash.omitby');
const os =... | true |
5dd67d0f6380c61a0262b180f2649460fe16d08a | JavaScript | rangapin/php-budget | /local.js | UTF-8 | 914 | 2.828125 | 3 | [] | no_license | let userEmail = localStorage.getItem("email");
let content = document.getElementById("").innerHTML = userEmail;
let i = 0;
setInterval(function(){
if (userEmail) {
fetch('email')
.then(function(response) {
return response.formData();
})
... | true |
3224e5f9b2c4eed9ebb2f7ff0ddc9340a7a2185d | JavaScript | Jbony1988/Mobile-FlashCards | /Mobile-FlashCards/utils/api.js | UTF-8 | 1,159 | 2.71875 | 3 | [] | no_license | import { AsyncStorage } from "react-native";
export const DECK_STORAGE_KEY = "MobileFlashcards:decks";
export function getDecks() {
return AsyncStorage.getItem(DECK_STORAGE_KEY).then(results => {
console.log("results", JSON.parse(results));
return JSON.parse(results);
});
}
export function generateID() {... | true |
f9de342c55e4d51323cef281691bbe70f527d94a | JavaScript | famousfrankts/triangulator | /__tests__/reducers/triangle.test.js | UTF-8 | 1,991 | 2.65625 | 3 | [] | no_license | import { triangle as triangleReducer } from '../../src/store/reducers/triangle';
import * as types from '../../src/store/types';
describe('triangleReducer', () => {
test('initial state', () => {
const action = { type: 'lorem' };
const initialState = {
a: 10,
b: 10,
c: 10,
invalid: fal... | true |
ef77af84641e053a2fc0e3e944d23f1d74ccdab1 | JavaScript | carolinadutras/projeto-todolist | /js/script.js | UTF-8 | 4,699 | 3.25 | 3 | [] | no_license | // -colocar texto do input como tarefa a fazer, (embaixo - como comentario)
// -no botão add inserir um event listener para o click
const formulario = document.getElementById ('insiraTarefa');// aonde coloquei meu event listener
const inputTarefa = document.getElementById('inputTarefa');// aonde eu escrevo texto da mi... | true |
42b533a3d30f8a5c48d30e7693ac8f0483699144 | JavaScript | kimgostring/2021BoilerPlate | /client/src/components/views/LoginPage/LoginPage.js | UTF-8 | 3,507 | 2.8125 | 3 | [] | no_license | // LoginPage.js
import React, { useState } from 'react';
import { useDispatch } from 'react-redux';
import { loginUser } from '../../../_actions/user_action';
import { withRouter } from 'react-router-dom';
import { useForm } from 'react-hook-form';
import { Button, Input } from 'antd';
function LoginPage(props) { // ... | true |
35c496348b602a7e6db51f20eb54b9a160e4fba2 | JavaScript | EmmanuelleHC/IM-Sanbercode-Nodejs-Adonis-Backend | /Tugas-Harian-Bagian-1/Tugas-6/dist/compiledTest.js | UTF-8 | 3,267 | 3.15625 | 3 | [] | no_license | "use strict";
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array obje... | true |
c1035ce6bcf28448c141c5f2d9428d2678be7aa7 | JavaScript | vicveloso/maratona-rocketseat | /starter/INTRO/1_4.js | UTF-8 | 400 | 3.890625 | 4 | [] | no_license | //Aula: Operações matematicas
var y = 5; //declarar variaveis
var a = 2, b = 15; //declarar variaveis uma após a outra:
var soma = y + a + b;
console.log(soma);
var modulo = y % a;//modulo, resto de uma divisão
console.log(modulo);
y+=b;//incrementar pode alterar ... | true |
c24edcdbb6cceac5c19d79bf114851378c43f005 | JavaScript | donaldshen/log-viewer | /test/utils/index.test.js | UTF-8 | 2,299 | 2.71875 | 3 | [
"MIT"
] | permissive | /**
* 日志输出测试
* 参考字符串来源:https://api.travis-ci.com/v3/job/196515104/log.txt
*/
import {
split2Lines,
removeControlTags,
removeEraseInLineFlag
} from '@/utils/index.js'
describe('src/utils/index.js', () => {
it('根据换行符切割字符串', () => {
const str =
'It should be split two lines.\n' + 'It should be split... | true |
93c332e5c68f9eec13efbe19df66eccdfbc334b9 | JavaScript | andreitudos/PizzaDellaMama | /js/scripts.js | UTF-8 | 617 | 2.6875 | 3 | [] | no_license | function setActive(itemID) {
let item = document.getElementById(itemID);
let text = document.getElementsByClassName("activo")[0];
let divId = document.getElementById(itemID).id + "div";
let hdiv = document.getElementById("homediv").className.trim();
if (text) {
document.getElementById(text.id).cla... | true |
b2007caa234f9e9cc8d69a90ab943b9bcff21216 | JavaScript | bailu666/eventemitter | /src/Util.js | UTF-8 | 600 | 2.875 | 3 | [] | no_license | export function assign(target, ...args) {
if (target == null) {
throw new Error('Cannot convert undefined or null to object')
}
let i = -1, len = args.length;
while (++i < len) {
const source = args[i];
if (source != null) {
for (const key in source) {
... | true |
33bab1a4f1c4560a962b1d9640a51aa5372433f6 | JavaScript | Ste-Mar/API_Xmen_Animated_Series | /FrontEnd/about.js | UTF-8 | 464 | 2.9375 | 3 | [] | no_license | let speakerState = 0;
const Volume = (id) => {
if (speakerState % 2 == 0) {
document.getElementById(id).className = "speaker fas fa-volume-up";
document.getElementById("play").play();
document.getElementById("play").muted = false;
speakerState++;
} else {
document.ge... | true |
fabaa3da33e253705bf7d2de859f61f4beb34115 | JavaScript | jrmarqueshd/Search-In-Realtime | /public/script.js | UTF-8 | 359 | 2.78125 | 3 | [
"MIT"
] | permissive | window.addEventListener("load", ()=>{
document.querySelector(".lds-circle").classList.add("off");
// Variaveis JS
let date = new Date();
let year = date.getUTCFullYear(-3);
let since = 2019;
// Variaveis Browser
let $year = document.getElementById("year");
$year.innerText = since==year... | true |
4a8d0ea7a79dbba43310603b91ffdbc8846bcbc5 | JavaScript | epsileeranu/assignment | /frontend/src/store/reducers/subcategory.js | UTF-8 | 1,765 | 2.578125 | 3 | [] | no_license | import * as actionTypes from '../actions/actionTypes';
import subcategories from '../../fixtures/subcategory';
const addSubcategory = (state, action) => {
const updatedSubcategories = state.subcategories.contact(action.subcategory);
return {...state, subcategories: updatedSubcategories};
};
const editSubcategor... | true |
e3af70a53df9ef8e8bc15c5b1a20b4570f38dc19 | JavaScript | Rameshwarjha/Dev | /Dev_pp/Lec4chatapp_socket-io/server/public/script.js | UTF-8 | 702 | 3.234375 | 3 | [] | no_license |
let chatinput= document.querySelector(".chat-input");
let chatwindow = document.querySelector(".chat-window");
let username = prompt(" Enter your name ?");
console.log("hello");
chatinput.addEventListener("keypress", function(e){
// console.log(e);
if(e.key=="Enter" && chatinput.value){
let chatdiv=d... | true |
b9978f41171ce5f76a406f7cab3b521e59275b1e | JavaScript | m-r-r/yin-pitch | /index.mjs | UTF-8 | 2,947 | 3.171875 | 3 | [] | no_license | const DEFAULT_THRESHOLD = 0.2;
/**
* Detect the fundamental frequency of an audio signal.
*
* This class is an implementation of the [YIN algorithm](http://audition.ens.fr/adc/pdf/2002_JASA_YIN.pdf).
*/
export class Yin {
/**
* Create a new instance
* @param {number} bufferLength Length of the input buffer... | true |
6d8578f78daba92bbb7aa4b1623e15b5ad878951 | JavaScript | wakeupmypig/node8 | /14.cookie&session/2.cookie.js | UTF-8 | 1,962 | 2.78125 | 3 | [] | no_license | /*
* cookie是web服务器 向浏览器发送的一段ASCII文本
* 客户端一旦收到cookie,浏览器会很开心的保存在本地 key=value
* 以后每次客户端向服务器发请求,都需要把之前发给他的cookie发回给服务器
*
*
* */
/*
* 设置cookie的时候还需要设置一些额外的参数
* Set-Cookie:name=zfpx; path=/foo; domain=.baidu.com
* key=value名称值 这个必须的
* path
* 控制访问哪些路径可以发送cookie
* domain
* 指定cookie会发送到哪些域名
* expires
* max-age... | true |
611e94c9c228ddb25833a41a976fdfcacbf84a07 | JavaScript | backspace1990/project1-socialnetwork | /src/redux/profile-reducer.js | UTF-8 | 1,141 | 2.78125 | 3 | [] | no_license | const ADD_POST='ADD-POST';
const UPDATE_NEW_POST_TEXT='UPDATE-NEW-POST-TEXT';
let initialState={
posts: [
{id: 1, message: 'Hi, how are you?', likesCount: '12'},
{id: 2, message: 'It\'s my first post.', likesCount: '30'},
{id: 3, message: 'Blabla?', likesCount: '35'},
{id: 4, message... | true |
5243058302ee925d33e21584b1f5b791bb02c61e | JavaScript | Utkarshbhimte/smallnote | /src/state/reducers/notes.reducer.js | UTF-8 | 2,020 | 2.53125 | 3 | [
"MIT"
] | permissive | import { noteActions } from "../actions/notes.actions"
import { generateId, getWindow } from "../../utils"
const defaultNotesState =
getWindow() &&
getWindow().localStorage.getItem("notesReducer") &&
JSON.parse(getWindow().localStorage.getItem("notesReducer"))
export const notesReducer = (
state = defaultNote... | true |
e7dda24618dc33f3dc1fdf416dab59190e84aefe | JavaScript | GALubenov/SoftUni-Software-Engineering | /JS basics-april.2020-Lab-and-Exercise/Exam-20-21.4.2019/01.easterBakeri.js | UTF-8 | 544 | 2.828125 | 3 | [] | no_license | function bakeri(args) {
let priceBra6no = Number(args[0]);
let brKgBra6no = Number(args[1]);
let brKgSugar = Number(args[2]);
let brKoriEggs = Number(args[3]);
let brMaq = Number(args[4]);
let priceSugar = priceBra6no * 0.75;
let priceKori = priceBra6no * 1.1;
let priceMaq = priceSugar * 0.2;
let sumBra6no = brKgBra... | true |
1b0570c90f87da8230fe51601f2176f4cffb1e9a | JavaScript | zukelwa20/bootcamp-tests | /isFromLimpopo.js | UTF-8 | 239 | 2.609375 | 3 | [] | no_license | const assert = require("assert");
var isFromLimpopo = function(Limpopo){
registrationPlate = Limpopo.endsWith("DRT");
return registrationPlate;
}
console.log(isFromLimpopo("DRT 122 L"));
assert.equal(isFromLimpopo("DRT 122 L",false));
| true |
706805b976107914fc09667d990faeedd5e2fdef | JavaScript | TheWizOfAWS/LocalHTTPSServer | /simpleSSLserver.js | UTF-8 | 2,716 | 2.734375 | 3 | [
"MIT"
] | permissive | var fs = require('fs');
var https = require('https');
var options = {
key: fs.readFileSync('LocalHostRootCA.key'),
cert: fs.readFileSync('LocalHostRootCA.pem'),
ca: fs.readFileSync('LocalHostRootCA.srl'),
};
https.createServer(options, function (req, res) {
console.log(new Date() + ' ' +
req.con... | true |
af9164b10aa1f44f428941b683ee45c53b17869b | JavaScript | Eltonrod/tomvirtual.github.io | /js/eventos.js | UTF-8 | 1,591 | 3.15625 | 3 | [] | no_license |
function trocaImg(){
//apenas para cunho de testes
setTimeout(function () {
if (num == 1)
{
img.src = "img/whatsCor.png";
}
else if (num == 2)
{
img.src = "img/whats.png";
}
//garante que num fique alternando entre 1 e 2
num = (num % 2) + 1;
}, 1700);
}
funct... | true |
f71f4b0fa6952500707753894d858995f0cd377e | JavaScript | sibinbhaskaran/eventsfinder | /src/components/NewsRender.jsx | UTF-8 | 1,831 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react'
import axios from 'axios'
// import Carousel from 'react-bootstrap/Carousel'
// import { Container } from 'react-bootstrap'
// import {Carousel} from 'react-bootstrap';
let baseUrl;
if (process.env.NODE_ENV === "development") {
baseUrl = "http://localhost:3003";
} else {
... | true |
c348005aaa38f538de3b0a4b4a6bb8af331f1c22 | JavaScript | Nams2/IncomeExpenseTracker | /client/react_spa/src/Location.js | UTF-8 | 1,625 | 2.6875 | 3 | [] | no_license | import React, { Component } from "react";
class Location extends React.Component {
constructor(props) {
super(props);
this.state = {
error: null,
isLoaded: false,
items: []
};
}
componentDidMount() {
fetch("http://localhost:8080/invoices/1000")
.then(res => res.json())
... | true |
fc35a93f1fbd4d8437555da75670c84e73f8fc4b | JavaScript | Vxee/jquery-learn | /代码片段.js | UTF-8 | 836 | 2.859375 | 3 | [] | no_license | // 从一个未排序的集合中找出某个元素的索引号
$("ul>li").click(function(){
var index = $(this).prevAll().length; // prevAll([expr]);查找当前元素之前所有的同辈元素
});
// 选中页面上所有的复选框
var tog = false;
$('a').click(function(){
$("input[type=checkbox]").attr("checked",!tog);
tog = !tog;
});
// 查找已经被选中的option元素
$('#someElement').find('option:sele... | true |
277484448fa34a3541bcfd08ff3e76b231073c02 | JavaScript | BongHoLee/Mulcam_FinalProject | /src/main/webapp/resources/js/signupRegex.js | UTF-8 | 3,623 | 3.203125 | 3 | [
"MIT"
] | permissive | /**
*
*/
// email checker
function email_check( email ) {
var regex = /([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
return (email != '' && email != 'undefined' && regex.test(email));
}
// password checker
... | true |
8928223c96c91738f06dc5110feb502a460afdef | JavaScript | migace/express-session-sample | /public/js/user.js | UTF-8 | 2,419 | 2.921875 | 3 | [] | no_license | const addBtn = document.getElementById('add-user'),
loginBtn = document.getElementById('login-user');
addBtn.addEventListener('click', event => {
event.preventDefault();
const loginEl = document.getElementById('login'),
passwordEl = document.getElementById('password'),
login ... | true |
1fecc76fe244519fcbb81aa731053239b1609a3c | JavaScript | fbgis/ITAcademy-FEAngular | /M7.1/coets/Nivell2i3/controllers/controller.js | UTF-8 | 2,754 | 3.1875 | 3 | [] | no_license | "use strict";
let rockets = [];
//Funció per a crear un nou coet
function createRocket(code, propellers, rocketNum) {
let rocket = new Rocket(code, propellers);
rockets.push(rocket);
console.log(rocket.showRocket());
//Activo els botons de control i mostro el rocket
let rocketButtons = document.getE... | true |
d4e81485743201e15460daea6c6b820f464236db | JavaScript | thedenatured/site | /summaryScript.js | UTF-8 | 7,259 | 3.390625 | 3 | [] | no_license | /* step 1/2 create a "var" for your new article, put it above the first var. use the existing as an example the name can be anything as long as it is unique
you'll have to remember it for when you create the actual page that the article is on. the name goes after var for example
var name = { etc...
title: t... | true |
044ee953aca8ca9b5ba7f0f1c72f83adb2d2c8de | JavaScript | Qaaj/adastra | /src/server/models/user.js | UTF-8 | 2,105 | 2.796875 | 3 | [] | no_license | /**
* Created by Jaaq on 9/21/2016.
*/
import Models from './index.js';
var uuid = require('node-uuid');
var Checkit = require('checkit');
var validationRules = new Checkit({
email: ['required', 'email'],
identifier: ['required', 'uuid'],
});
function User(bookshelf){
return bookshelf.Model.e... | true |
b198b1caa0782cfc432b935e4c4a23066aaf1da4 | JavaScript | marsh5/fullstackopen | /part1/anecdotes/src/index.js | UTF-8 | 2,655 | 3.28125 | 3 | [] | no_license | import React, { useState } from 'react';
import ReactDOM from 'react-dom';
const Button = (props) => (
<button onClick = {props.handleClick}>
{props.text}
</button>
)
const Anecdote = ({ selected, anecdotes }) => (
<>
{anecdotes[selected]}
</>
)
const Votes =({ points, selected }) => {
i... | true |
90c17ada73035e1217a98c9522931ca1cbb9730a | JavaScript | PositivePeriod/crownize.io | /src/client/render.js | UTF-8 | 1,813 | 2.875 | 3 | [] | no_license | import escape from 'lodash/escape';
import { GAME_OPTION } from '../shared/constants';
export function processGameUpdate(update) {
if (update.turn % 10 === 0) {
console.info(`Update | ${update.turn}`);
}
updateTurn(update.turn);
updateLeaderboard(update.leaderboard);
var colorMap = new Map... | true |
b1f3cec7c6cff5a940c603f96a8f768b3629ec07 | JavaScript | Ashutosh-27/TODOs | /src/MyComponents/Todos.js | UTF-8 | 4,391 | 2.734375 | 3 | [] | no_license | import React, { useState } from 'react'
import { TodoItem } from './TodoItem'
export const Todos = (props) => {
let Todos = props.todos
let typeArr = [];
Todos.map((todo) => {
if (todo.status === 'TO Start') {
typeArr.push(todo)
}
})
const [status, setStatus] = useSta... | true |
c48b193c7f30e8a59a0cc49200a53212ffecf51e | JavaScript | SangMeeSpecht/phase-0-tracks | /web_dev/client_side_js/script.js | UTF-8 | 891 | 3.359375 | 3 | [] | no_license | console.log("Connecting files");
// Release 1
// Add another list element
var addItems = document.createElement("li");
var node = document.createTextNode("Lunges");
addItems.appendChild(node);
var addExercise = document.getElementById("home_exercises");
addExercise.appendChild(addItems);
// Release 2
// Add another ... | true |
2237d74abf11c5a6fd67a8c6ebc62460950d75d2 | JavaScript | gradikay/animal-database | /src/Components/aside.js | UTF-8 | 6,003 | 2.578125 | 3 | [] | no_license | import React from 'react';
import {
BrowserRouter as Router,
Switch,
Route,
NavLink, Link,
useParams,
useRouteMatch
} from "react-router-dom"
/* DATABASE */
import { mammalList, databaseList, total } from '../Components/datalist.js'
/* CSS */
import styles from '../css/factopedia.module.css'
im... | true |
ee8c78a934dd65414eca6e4c35699d4a36687514 | JavaScript | quemsah/itmo-labs-1 | /fetch-audio/index.js | UTF-8 | 2,527 | 3.21875 | 3 | [] | no_license | const drawBuffer = (width, height, context, buffer) => {
let data = buffer.getChannelData(0);
let step = Math.ceil(data.length / width);
let amp = height / 2;
for (let i = 0; i < width; i++) {
let min = 1.0;
let max = -1.0;
for (let j = 0; j < step; j++) {
let datum =... | true |
e147c57b8f80326fb49b6e7cd8752d3059cd48ca | JavaScript | AlvGreat/Noodle-Official | /commands/currency/search.js | UTF-8 | 2,170 | 2.78125 | 3 | [] | no_license | const mysql = require("mysql");
const { prefix } = require('../../config.json');
module.exports = {
name: 'search',
description: 'Search for a random amount of coins from 1-200! 0.01% chance to find 20% of the coins you currently have!',
aliases: [],
guildOnly: true,
cooldown: 1.5,
execute(message, a... | true |
7350b82c48c58e49072bd88dec28684b204081af | JavaScript | JoaoGabrielDamasceno/JS | /Objetos/heranca5.js | UTF-8 | 370 | 3.421875 | 3 | [] | no_license | //toda função tem um atributo .prototype
String.prototype.reverse = function(){
return this.split('').reverse().join('') //split separa, reverse inverte e join junta dnv
}
console.log('João é legal')
Array.prototype.first = function(){
return this[0]
}
console.log([1,2,3].first())
//Observação: ter cuidad... | true |
29a2464c8ee0aabee992223885e3e7c4b5a75735 | JavaScript | AVu120/tree-match | /server/controllers/answers.js | UTF-8 | 9,582 | 2.765625 | 3 | [] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.answerQuestion = void 0;
var answerQuestion1 = function (answer) {
if (answer === "courtyard")
return {
question: {
step_id: 2,
question: "Do you like cooking?",
a... | true |
c68496a3468e567b97298031a3e0ea99180c32ea | JavaScript | MuriloVS/PalpiteBox | /pages/pesquisa.jsx | UTF-8 | 3,916 | 2.6875 | 3 | [
"MIT"
] | permissive | import React, { useState } from 'react';
import PageTitle from '../components/PageTitle';
function PesquisaPage() {
const notas = [0, 1, 2, 3, 4, 5];
const [form, setForm] = useState({
Nome: '',
Whatsapp: '',
Email: '',
Nota: 0,
});
const [sucess, setSucess] = useState(false);
const [retorn... | true |
fdb2e9eda7a309763e1a0df46cd294fab2f74f80 | JavaScript | Rushikesh-Bhujbal/Backup | /mmc/MMC/LocalData/WebResource/GenerateAttendance/new_GenerateStudentAttendanceJS.js | UTF-8 | 8,872 | 2.515625 | 3 | [] | no_license | var allStudents;
var retrieveReq = new XMLHttpRequest();
//Step 1: Get all active students
function getActiveStudents() {
var odataSelect = window.parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.0/new_studentmasters?$filter=statuscode eq 1";
retrieveReq.open("GET", odataSelect, false);
retrieveReq.s... | true |
6b678148b5bb993bb421d9db71ccdc258026b253 | JavaScript | shadowvzs/area-map-vs-svg-polygon | /js/controller.js | UTF-8 | 2,753 | 2.546875 | 3 | [] | no_license | ((global) => {
const nav = document.querySelector('nav');
const main = document.querySelector('main');
const megyeTitle = document.querySelector('ins');
const imageData = {
url: './assets/img/hu.png',
width: 1872,
height: 1172
};
const megyeList = [...megye];
nav.on... | true |
f47418948ff52b4aeba61f9d5faa5def2ba25ebd | JavaScript | wenhai03/JS_demo | /async/请求超时提示.js | UTF-8 | 502 | 3.296875 | 3 | [] | no_license | //请求
function request () {
return new Promise(function (resolve, reject) {
setTimeout(() => {
resolve('请求成功')
}, 4000)
})
}
//请求超时提醒
function timeout () {
return new Promise(function (resolve, reject) {
setTimeout(function () {
reject('网络不佳')
// resolve('网络可以')
}, 3000)
})
}
... | true |
1aac09002a01614fdf7aa9a301aba2dad79f9807 | JavaScript | Koziar/Period5 | /WebSocket.js | UTF-8 | 4,282 | 3.125 | 3 | [] | no_license | /*
HTTP and WebSockets aren't competing technologies, so it's a bit hard to compare them. We probably shouldn't be even
comparing them at all. Oh well, here we go.
HTTP is based around the concept of 'requesting' a file and then receiving a 'response'. This works really well when
you are following links and sendin... | true |
ab203f66a4df16816d2486bdfb7ac414efac27db | JavaScript | morriscodez/sprinkles-of-joy-jawa-juice-cakes | /scripts/products/ProductList.js | UTF-8 | 1,583 | 2.5625 | 3 | [] | no_license | import { getProducts, useProducts } from "./ProductProvider.js"
import { getCategories, useCategories } from "../categories/CategoryProvider.js"
import { Product } from "./Product.js"
import { getReviews, useReviews } from "../reviews/ReviewProvider.js"
import { getCustomers, useCustomers } from "../customers/CustomerP... | true |
b36d2909bac8a4918fcefb604d86fb09bd97c7d5 | JavaScript | dhogeland/javascript_toy_problems | /6kyu/Reverse_every_other_word_in_the_string.js | UTF-8 | 192 | 3.109375 | 3 | [] | no_license | function reverse(str){
let x = str.split(' ');
for (var i = 1; i < x.length; i++) {
if (i % 2 != 0) {
x[i] = x[i].split('').reverse().join('');
}
}
return x.join(' ');
}
| true |
69c3a8056d00ff2a9b2f85ab53cb4f895eddfc6d | JavaScript | henrique770/Tests-node | /__tests__/example.test.js | UTF-8 | 238 | 3.828125 | 4 | [] | no_license | function soma(a, b) {
return a + b;
}
test('se eu chamar a função soma com os valores 4 e 5 ela deve retornar 9', () => {
const result = soma(4, 5);
// pega o resultado da função e mostra no teste
expect(result).toBe(9);
});
| true |
f927e7686fb7dc4d75117ccc26f9dca8d2276046 | JavaScript | v-giorgio/mini-projects | /2-habit-tracker/js/main.js | UTF-8 | 1,639 | 3.421875 | 3 | [] | no_license | var habito = document.querySelector("#habito");
var descricao = document.querySelector("#descricao");
var freq = document.querySelector("#freq");
var botaoAdicionar = document.querySelector(".adicionar-habito");
var tabela = document.querySelector("tbody");
botaoAdicionar.addEventListener("click", function (event) {
... | true |
8eda0e63a95ba7d82260eca35a5f32e87561ff04 | JavaScript | pyoroichi/java | /spring-boot-js-submit/demo/src/main/resources/static/demo.js | UTF-8 | 429 | 2.9375 | 3 | [] | no_license | 'use strict';
// 引数で指定されたパスでサブミットする
function formSubmit(path){
if(!path){
alert('パスを指定してください');
return;
}
let form = document.getElementsByTagName('form')[0];
if(!form){
alert('フォームが取得できませんでした');
return;
}
form.action=path;
form.method="post";
... | true |
bb2856458a53fa41512c4c17287de71845d53654 | JavaScript | Nopik/frozen_ostrich | /ui/test/e2e/scenarios.js | UTF-8 | 4,110 | 2.578125 | 3 | [] | no_license | describe('Frozen Ostrich App', function() {
it('should redirect index.html to index.html#/products', function() {
browser.get('index.html');
browser.getLocationAbsUrl().then(function(url) {
expect(url.split('#')[1]).toBe('/products');
});
});
describe('Product list view', function() {
beforeEach(functi... | true |
f1459b8d75e9b5f6da9460175ea70e39e3e3fe5f | JavaScript | Trentdjorgensen/assignments | /exercises/multiple array methods practice part 1/app.js | UTF-8 | 786 | 3.5625 | 4 | [] | no_license | var people = ([
{
firstName: "Sarah",
lastName: "Palin",
age: 47
},{
firstName: "Frank",
lastName: "Zappa",
age: 12
},{
firstName: "Rick",
lastName: "Sanchez",
age: 78
},{
firstName: "Morty",
lastName: "Smith",
age: 13
},{
... | true |
d32d0bee0d03cafef43e0de59a2b01a655c5f511 | JavaScript | LiLeisFine/annualMeeting | /javascript/index_m.js | UTF-8 | 1,113 | 2.515625 | 3 | [] | no_license | $(function () {
var colLi = $('.midColBox li'),closeBtn = $('.closeBtn'),flag = true;
colLi.on('click',function () {
var liIndex = $(this).index();
if(flag){
flag = !flag;
if($(this).hasClass('unChosenLi')){
$(this).removeCl... | true |
568d314483de6caa2790c5f93a3d3aa8f6890a55 | JavaScript | ArchiVDK/frontend-project-lvl1 | /src/index.js | UTF-8 | 1,012 | 3.203125 | 3 | [] | no_license | import readlineSync from 'readline-sync';
import { car, cdr } from '@hexlet/pairs';
export const random = () => Math.floor(Math.random() * 100);
export const randomElement = (array) => array[Math.floor(Math.random() * array.length)];
export const gameLaunch = (discription, gameData) => {
console.log(`Welcome to th... | true |
230d981fc804fcbbb03fe1e67c3034b909a7f964 | JavaScript | karmapa17/pedurma-catalog | /djmapping_test.js | UTF-8 | 10,340 | 2.734375 | 3 | [] | no_license | // djmapping_test.js // read jinglu, construct DJ, search dLineId, return jLineId
function deepEqual(A,B){
return equal(JSON.stringify(A),JSON.stringify(B))
}
/////////////////////////////////////////////////////////////////////////////
// var djmapping=require("djmapping");
// djmapping('1@1b1') ==> 'J1:1@1b1'
// sea... | true |
fb10f720ae8ba3913166a64142057a56456ad079 | JavaScript | dariososa/Jack-Build | /public/js/lightbox.js | UTF-8 | 798 | 2.9375 | 3 | [] | no_license | const imagenes = document.querySelectorAll(".img-gallery");
const imagenesLight = document.querySelector(".add-image");
const contenedorLight = document.querySelector(".image-light");
const burguer1 = document.querySelector(".burguer");
imagenes.forEach((imagen) => {
imagen.addEventListener("click", () => {
addI... | true |
343710eb4248ad6cb13449e5506f0c813fa1df5a | JavaScript | ashishjsharda/JavaScript | /forof.js | UTF-8 | 113 | 3.015625 | 3 | [] | no_license | let emp={
name:"Sai",
age:100,
num:1
}
for(let val of Object.values(emp))
{
console.log(val);
}
| true |
e7bcf602b91f1b5c6ce4274b60754b20d3b982e2 | JavaScript | rgirodon/tse_nosql_js | /mongo/index.js | UTF-8 | 821 | 2.609375 | 3 | [] | no_license | const MongoClient = require('mongodb').MongoClient;
// Connection URL
const url = 'mongodb://localhost:27017';
// Database Name
const dbName = 'mydb';
// find posts
const findPosts = function(db, callback) {
// Get the posts collection
const postsCollection = db.collection('posts');
// Find some pos... | true |
9b78159d53d263b66bac2b188399f33680535b4f | JavaScript | lpzhi/vueElment | /src/vuex/template/search.js | UTF-8 | 685 | 2.796875 | 3 | [
"MIT"
] | permissive | /**
* Created by Administrator on 2017/4/26 0026.
*/
// 应用初始状态
const state = {
name: ''
}
// 然后给 actions 注册一个事件处理函数,当这个函数被触发时,将状态提交到 mutaions中处理
const actions = {
NAME_SY(state, name) {
store.commit('NAME_SY', name) // 提交到mutations中处理
}
}
// 定义所需的 mutations
const mutations = {
NAME_SY(state... | true |
b3f416a99657d2ff7f1df667b907e4bf2e872564 | JavaScript | a-spasov/SoftUni-JavaScript-Programming-Basics-June2020 | /05. Nested Loops/03.combinations.js | UTF-8 | 441 | 3.453125 | 3 | [] | no_license | function combinations(arg1) {
let sum = Number(arg1);
let combinationsCounter = 0;
let a;
let b;
let c;
for (a = 0; a <= sum; a++) {
for (b = 0; b <= sum; b++) {
for (c = 0; c <= sum; c++) {
if ( (a+b+c) == sum) {
combinationsCoun... | true |
95d7010d94c67f6f0c78f9d23d2fca7b59767b95 | JavaScript | devonhackley/algorithms | /coding challenges/LeetCode/sort_by_frequency.js | UTF-8 | 413 | 3.53125 | 4 | [] | no_license | const frequencySort = (s) => {
// time: O(nlogn)
// space: O(n)
let charHash = new Map();
for (let i=0; i<s.length; i++) {
charHash.set(s[i], (charHash.get(s[i]) || 0) + 1);
}
let keys = Array.from(charHash.keys());
keys.sort((a, b) => charHash.get(b) - charHash.get(a));
keys = keys.map((key) => key... | true |
fc1acd45687cc96628eea6b2f3b0cf13240681e7 | JavaScript | weppleafso/leetcode | /answer/998.js | UTF-8 | 1,280 | 3.484375 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @param {number} val
* @return {TreeNode}
*/
var insertIntoMaxTree = function(root, val) {
if(root == null){
return new TreeNode(val);... | true |
8a63b57c806c3cc687b89bd921248f6df8fe95d9 | JavaScript | akarande777/see-algorithms-wasm | /www/src/events/convex-hull.js | UTF-8 | 3,524 | 2.515625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import $ from 'jquery';
import { distance, withOffset } from '../common/utils';
import { Colors } from '../common/constants';
export function randomize(context) {
const { Graph, Point } = context;
for (let i = 0; i < 30; i++) {
let x = Math.floor(Math.random() * 600 + 50);
let y = Math.floor(Ma... | true |
4a6d7c3db90a15508cc0090786b1e8fd7535c02c | JavaScript | mlkc1996/your-task-manager | /public/js/note-app.js | UTF-8 | 1,705 | 2.78125 | 3 | [] | no_license | // const { v4: uuidv4 } = require('uuid');
const notes = getNotes()
const searchFilters = {
text: "",
sort: "byCreated",
hideCompleted: ""
}
renderNotes(notes, searchFilters)
const addNote = document.querySelector("#addNote")
const newNote = document.querySelector("#newNote")
const due = document.getEleme... | true |
5d6db862f7f63a9b5d3f68b222306eae2793e750 | JavaScript | AmXLoVE/SemestrovkaHistory | /HTML Coding/js/login.js | UTF-8 | 730 | 2.546875 | 3 | [] | no_license | window.onload = function () {
const form = document.getElementsByClassName('form-add')[0];
const inputs = document.querySelectorAll('input[data-rule]');
for (let inp of inputs){
inp.value = "";
}
form.addEventListener('submit', (e) => {
let check = true;
for (let inp o... | true |
ee30421de8ae0b407169addfbe6532011a5372ab | JavaScript | Valdemird/pug-template | /pdf-generator/index.js | UTF-8 | 615 | 2.515625 | 3 | [] | no_license | const puppeteer = require('puppeteer');
const margin = '0cm'
const generatePdf = async (template) => {
try{
const browser = await puppeteer.launch({
headless:true,
args:['--no-sandbox','--disable-setuid-sandbox']
});
const page = await browser.newPage();
await page.setContent(template);
await page... | true |
e814278f4f86d084722624628ab595a96bf985ca | JavaScript | vigdorov/algorithm | /_old/isSimpleNumber.js | UTF-8 | 660 | 3.671875 | 4 | [] | no_license | let isSimpleNumber = function(number) {
if (number < 0) number = -number;
let divider = 2;
while (divider < number) {
if (number % divider === 0) {
return false;
}
divider++;
}
return true;
};
// testing function
let numbers = [2, 89, -13, 52, 40, 103, 180, 463, -701];
let expectedResult =... | true |
5ce708b91489f6ee5631279cd98186e0abb08cb1 | JavaScript | isabella232/nodejs-multi-language-site | /app.js | UTF-8 | 3,058 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | "use strict";
// Module dependencies
const prismic = require('@prismicio/client');
const prismicDom = require("prismic-dom");
const app = require("./config/app-config");
const prismicConfig = require("./config/prismic-configuration");
const siteConfig = require("./config/site-config")
const port = app.get("port");
co... | true |
9cdd53b512e67731b274da2e94fc6e8dbe9403be | JavaScript | DarkLicornor/unicode-codefest-defi3 | /src/components/molecules/PaletteList.js | UTF-8 | 3,956 | 2.578125 | 3 | [] | no_license | import React, { Component } from 'react'
class PaletteList extends Component {
constructor(props){
super(props);
this.state = {
loading: true,
active: 1,
selected: 1,
}
this.toggleActive = this.toggleActive.bind(this)
}
componentDidMount(){
this.setState({ loading: false}... | true |
3ca6dae92e4e2e512a66e066a47bf9bd2eab1e46 | JavaScript | njbair/sudoku2 | /js/main.js | UTF-8 | 11,048 | 2.703125 | 3 | [] | no_license | var sudoku2 = {
gameBoard: (
$('<table></table>')
.addClass('gameBoard')
.attr({
'id' : 'gameBoard',
'border' : '0',
'cellpadding' : '0',
'cellspacing' : '0'
})
.append($('<tbody></t... | true |
0d0fb3e605f3ac73cfb8afbc4a36f7a8d7a7a979 | JavaScript | incoqnito/healthstorage-odm | /examples/calendar/src/app/utils/helpers.js | UTF-8 | 1,283 | 2.75 | 3 | [] | no_license | import moment from 'moment'
export const getDateRange = (date, view) => {
switch (view) {
case 'month':
return {
start: moment(date).startOf('month').startOf('week').startOf('day').toDate(),
end: moment(date).endOf('month').endOf('week').endOf('day').toDate()
}
case 'week':
... | true |
eaaf27a2af0feb873232969bb97d50fef1e5be87 | JavaScript | African-Marketplace-Sauti-Africa/frontEnd | /front-end/src/components/EditItem.js | UTF-8 | 2,420 | 2.53125 | 3 | [
"MIT"
] | permissive | import React, {useState} from 'react';
import {axiosWithAuth} from '../utils/axiosWithAuth'
const EditItem = (props) => {
const {item} = props
const [editForm, setEditForm] = useState({
name: '',
price: 0,
description: '',
location: ''
})
const onChange = (e) => {
... | true |
461be141ea43b33a773949749c9d50db2e967052 | JavaScript | wkcaeser/video-study | /src/main/webapp/static/js/employeePage.js | UTF-8 | 4,944 | 2.84375 | 3 | [
"MIT"
] | permissive | //格式化时间
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": th... | true |
82d6fd5bca3caa687cf67c3dbbd18854e1b021dd | JavaScript | andydlin/des157 | /project/proto2/scripts.js | UTF-8 | 3,044 | 3.828125 | 4 | [] | no_license | /*
1. Detect object drag
a. Track mouse position
b. Determine mouse distance moved
c. If distance is further than X, move object
2. Determine direction
3. Animate object in direction
*/
document.addEventListener('DOMContentLoaded', function() {
// global variables within this scope
var mouseX, mous... | true |
8293feb125a1cdb953e4088cecba45c68f200b0e | JavaScript | wwwshayronen/home-assigment | /client/src/AdminPanel.js | UTF-8 | 1,793 | 2.515625 | 3 | [] | no_license | import React, { useState } from "react";
import { Button, Form, Input } from "antd";
import FetchHook from "./handlers/FetchHook";
import BookList from "./BookList";
const AdminPanel = () => {
const [newBook, setNewBook] = useState([]);
const [bookName, setBookName] = useState("");
const [bookAuthor, setBookAuth... | true |
179b8623d5f797f786ff401793d9f61daa8ee633 | JavaScript | mlensment/guide-the-ball | /js/vector.js | UTF-8 | 580 | 3.5625 | 4 | [] | no_license | var Vector = function(x, y) {
this.x = x;
this.y = y
this.isub = function(other) {
this.x -= other.x;
this.y -= other.y;
}
this.iadd = function(other) {
this.x += other.x;
this.y += other.y;
}
this.length = function() {
return Math.sqrt(this.x * this.x + this.y * this.y);
}
t... | true |
548b8cbb627aba5da23f494d57afd8fb179e1437 | JavaScript | shivasaicharan/practise | /17-01-2019/Guess a number/guess.js | UTF-8 | 272 | 2.953125 | 3 | [
"MIT"
] | permissive | function num(){
var b=document.getElementById("num1").value;
var a=Math.floor(Math.random()*10);
if(b==a){
document.getElementById("result").innerHTML="Good Work";
}
else{
document.getElementById("result").innerHTML="Not Matched";
}
} | true |
e203cbd616318a14a8e767323868074d8dc94afc | JavaScript | NikolaiKotikov/sborka-test | /src/components/basket/basket.js | UTF-8 | 339 | 2.515625 | 3 | [] | no_license | const basket = document.querySelector('[data-target="basket"]');
export default {
updateUi() {
const products = document.querySelectorAll('[data-target="product"]');
const circle = basket.querySelector('.basket__circle');
circle.innerHTML = products.length;
},
init() {
basket.addEventListener('remove', this... | true |
de058199829d66b69759f6e359e6478a4536e44e | JavaScript | UlisesCabrera/voting-app | /controllers/authenticateController.js | UTF-8 | 2,471 | 2.71875 | 3 | [] | no_license | var mongoose = require('mongoose');
var User = mongoose.model('User');
var bCrypt = require('bcrypt-nodejs');
// Generates hash using bCrypt
var createHash = function (password) {
return bCrypt.hashSync(password, bCrypt.genSaltSync(10), null);
};
exports.checkUserState = function(req, res){
// sends response back to... | true |
380e268ff607b9f870e5b91bc753577ba64406c3 | JavaScript | mlincoln1205/Project_01_JS | /Conta/Conta.js | UTF-8 | 1,222 | 3.390625 | 3 | [] | no_license | // Abstract Class
export class Conta{
constructor(saldoInicial, cliente, agencia){
if(this.constructor == Conta){
throw new Error("You should not use this class to instantiate a new account, please use the specific ones.")
}
this._saldo = saldoInicial;
this._cliente = cli... | true |
755ebd613454aa408d868811b6d671077a42cbac | JavaScript | DanielRichardsWebDesign/JavaScriptPractice | /Day&Time/script.js | UTF-8 | 528 | 3.953125 | 4 | [] | no_license | function dateAndTime(){
var date = new Date();
var dayOfWeek = new Array(7);
dayOfWeek[0] = "Sunday";
dayOfWeek[1] = "Monday";
dayOfWeek[2] = "Tuesday";
dayOfWeek[3] = "Wednesday";
dayOfWeek[4] = "Thursday";
dayOfWeek[5] = "Friday";
dayOfWeek[6] = "Saturday";
var today = dayOfWeek[date.getDay()];
var hour ... | true |
f3eda70ea3e6073c926c7d53c27ce90d2547f5a9 | JavaScript | adamgymrat/AcornsTakeHomeTest | /src/components/post.js | UTF-8 | 855 | 2.734375 | 3 | [] | no_license | import React from 'react';
import styled from 'styled-components';
const Wrapper = styled.div`
text-align: center;`
const Title = styled.h1`
text align: center;`
const Stats = styled.h3`
text align: center;
text-transform: capitalize;`
const Post = (props) => {
const name = props.data.name;
... | true |
b74e84e44d0ebef26459c11c5dd0f1a7f356b741 | JavaScript | Irena-jane/17099-Pink | /src/js/slider.js | UTF-8 | 3,626 | 2.71875 | 3 | [] | no_license | function Slider(options){
var self = this;
this.selector = options.selector;
this.elem = document.querySelector(this.selector);
this.items = this.elem.children;
var inner_clss = 'slider__inner';
var list_clss = 'slider__list';
var item_clss = 'slider__item';
var controls_clss = 'slider__controls';
... | true |
56814e9a7918abd475ef8b55282d49e8681ceb93 | JavaScript | thisisDom/project-mathcraft | /app/assets/javascripts/boss_battle_phaser.js | UTF-8 | 8,969 | 2.546875 | 3 | [
"MIT"
] | permissive | var boss;
var explode;
var deadboss;
var background;
var explode_audio;
gon.level_multiplier = 2;
game = new Phaser.Game($("#gameArea").width(), $("#gameArea").height(), Phaser.CANVAS, 'gameArea', {
preload: preload,
create: create,
update: update,
render: render,
});
var worldScale = 1;
function pre... | true |
dbc5645614c30b6a85480cecf17af752e160652c | JavaScript | phantomxc/Boom | /client/player.js | UTF-8 | 4,880 | 2.8125 | 3 | [] | no_license | function Player(id, x, y, rot) {
//----------------------------
// Initialization
//----------------------------
this.id = id;
this.top = new jaws.Sprite({'image':"images/tanktop.png", x:x, y:y,'anchor_x':0.5, 'anchor_y':0.75});
this.bottom = new jaws.Sprite({'image':"images/tankbot.png", x:x, ... | true |
409be4b1df1d3212a28753924dcee317d2a73ce0 | JavaScript | BartlomiejKar/Hangman-js | /App/Game.js | UTF-8 | 2,935 | 3.40625 | 3 | [] | no_license |
import { Sentences } from "./Sentences.js"
class Game {
step = 0
lastStep = 8
quotes = [{
text: "Terminator",
category: "Tytuł filmu"
}, {
text: "Johnny Deep",
category: "Aktor"
}, {
text: "Robert Lewandowski",
category: "piłkarz"
}, {
... | true |
bf521900169977be7882c26c41ccb766eb43d87c | JavaScript | mattyhansen/server-dashboard | /monitor.js | UTF-8 | 660 | 2.640625 | 3 | [] | no_license | /**
* loadMonitor
*/
function loadMonitor(){
$.getJSON("/monitor.json",
function(data) {
//console.log('data:', data);
$('.value', '#cpuUsage').html(data.cpu);
$('.value', '#cpuCount').html(data.cpu_count);
$('.value', '#diskFreeSpace').html(data.disk);
... | true |
87af364f11cb1b43b05a993a90dfe3b7e31901ee | JavaScript | oguzhangoller/movies-ember | /app/utils/camelize-keys.js | UTF-8 | 832 | 2.96875 | 3 | [] | no_license | import { isArray } from '@ember/array';
let camelizeKeys;
function camelizeArray(array) {
return array.map(item => camelizeKeys(item));
}
function camelizeProperties(input) {
let camelized = {};
for (let key in input) {
if (input.hasOwnProperty(key)) {
let camelizedName = key.camelize();
let va... | true |