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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9c414634712188a243a336a75ff5fdddb67e8ded | JavaScript | amalyuhin/chart | /src/scene.js | UTF-8 | 3,660 | 3.0625 | 3 | [] | no_license | const defaultConfig = {
width: 500,
height: 300,
style: {
backgroundColor: '#fff',
zIndex: 1,
border: 'none'
}
};
const ZOOM_FACTOR = 1.1;
export class Scene {
constructor(config = defaultConfig) {
this.mousePushed = false;
this.objects = [];
this.width = config.width;
this.heigh... | true |
02154eb2b2d8271a8909bf6a9dd1388d4c4e0a9a | JavaScript | tomersimis-zz/diggit | /graph.js | UTF-8 | 2,980 | 2.875 | 3 | [] | no_license | function Graph(){
this.graph = {};
};
Graph.prototype.existsEdge = function(node_a, node_b){
return this.graph[node_a].adj.indexOf(node_b) >= 0;
}
Graph.prototype.nodes = function(){
return Object.keys(this.graph);
}
Graph.prototype.get = function(label){
return this.graph[label];
}
Graph.prototype.... | true |
87e464e8bd70b2a3833d4ee996be38bbd5b803a4 | JavaScript | eLoner/RIA_NEW | /lesson3/lib/users.js | UTF-8 | 1,901 | 2.625 | 3 | [] | no_license | 'use strict';
var users = [],
//usersContent = validation(users),
controller = require("../controllers/usersController");
/*function validation(arrayObjects) {
for (var i = 0; i < arrayObjects.length; i++) {
if ((arrayObjects[i].nick == undefined) || (arrayObjects[i].name == undefined)) {
} else {
}
}
}... | true |
833f55f9d1ab8056f71438367678ff0b6afd11c1 | JavaScript | chec/cli | /src/helpers/spawner.js | UTF-8 | 4,439 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | const ora = require('ora')
const logUpdate = require('log-update')
const {spawn} = require('child_process')
/**
* Factory class for spawning child processes with various options
*/
class Spawner {
constructor(...spawnArgs) {
this.spawnArgs = spawnArgs
this.spinner = null
this.completeMessage = null
... | true |
4005e2235c8975c7ec0c555960eff6e4c11c7cce | JavaScript | AKBarcenas/COGS-120-Project | /set.js | UTF-8 | 608 | 2.78125 | 3 | [
"MIT"
] | permissive | var data = require("../data/preferences.json");
var fs = require("fs");
exports.setPreference = function(req, res) {
var preferenceCategory = req.query.category;
//var newPreference = req.query.preference;
console.log(data);
//data[preferenceCategory] = newPreference;
console.log(data);
/*if(data[preference])... | true |
6b134a885dc97f7ba42c02806c5e715ee8320313 | JavaScript | hullerdaniel89/andras921.github.io | /Async-WeatherApp/geocode/geocode.js | UTF-8 | 848 | 2.734375 | 3 | [] | no_license | const request = require('request');
var geocodeAddress = function (address,callback) {
var encode = encodeURIComponent(address);
//console.log(encode);
request({
url:'http://maps.googleapis.com/maps/api/geocode/json?address='+encode,
json: true
},function(error,response,body){
if(error){
ca... | true |
918f12597d31c88d5f57174cc81397df8724a03e | JavaScript | BUGBOUNTYchrisg8691/front-end | /better-weather/src/components/Geolocation.js | UTF-8 | 1,267 | 2.640625 | 3 | [
"MIT"
] | permissive | import { useEffect } from "react";
const options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0,
};
export default function Geolocation({ setLoc }) {
const success = (pos) => {
const coords = pos.coords;
setLoc({ latitude: coords.latitude, longitude: coords.longitude });
};
const erro... | true |
2cb42c7d2dbba875e38ad33196a05a0c3a6e89c3 | JavaScript | cypress-io/cypress | /packages/driver/src/dom/dimensions.js | UTF-8 | 3,159 | 2.859375 | 3 | [
"MIT"
] | permissive | // NOTE: Non-JQuery version of getElementDimensions is at app/runner/dimensions.
// This duplication of code has been created when migrating legacy runner to app.
// When migrating `driver`, we might need to remove this function and use the `app` version instead.
import _ from 'lodash'
const getElementDimensions = ($... | true |
915b180700e5ccd8f6966428650517370ccc391a | JavaScript | VicenteSebastianAlvarezOlvera/Curso-node-RestServer | /controllers/usuarios.js | UTF-8 | 2,378 | 2.71875 | 3 | [] | no_license | const { response, request } = require('express');
const fs = require('fs');
const bcryptjs = require('bcryptjs');
const Usuario = require('../models/usuario');
const path = require('path');
const usuariosGet = async(req = request, res = response) => {
//muestra todos los usuarios en grupos de 5 en 5
const { li... | true |
84ec4cd87421ad23c0913736650563343548c009 | JavaScript | guhanMurugesan/wordBrain | /script.js | UTF-8 | 6,170 | 2.984375 | 3 | [] | no_license | var matrix = [ ['A','B','C','D'] , ['E','F','G','H'] , ['I','J','K','L'], ['M','N','O','P'] ];
var solution = [ [0,0,0,0] , [0,0,0,0] , [0,0,0,0], [0,0,0,0] ];
var visitedNodes = [ ["","","",""] , ["","","",""] , ["","","",""], ["","","",""] ];
var list = [];
var FormedWord = "";
var wordlength = 7;
var g_width =... | true |
5927c16e189be2f13c6c75f4c07278d7f4f08dab | JavaScript | mrtequino/JSW | /nodejs/asincronia1/observadores1.js | UTF-8 | 298 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | var Rx = require('rxjs/Rx');
var obs = Rx.Observable.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).map(x => x);
obs.subscribe(x => {
setTimeout(() => {
console.log("primero" + x);
}, 1000 * 10);
});
obs.subscribe(x => {
setTimeout(() => {
console.log("segundo" + x);
}, 0);
}); | true |
2e6109fd43a0d32fab4502af396338b4eeaae6eb | JavaScript | bcmrcool/LoanApp | /loan-app/src/components/ApprovalPage/ApprovalPage.js | UTF-8 | 2,184 | 2.734375 | 3 | [] | no_license | import React from 'react'
import './ApprovalPage.css'
class ApprovalPage extends React.Component {
constructor(){
super()
this.state = {
created: false,
errors: {
email: false,
passwordShort: false,
passwordUnsafe: false,
passwordNotSame: false
}
}
}
headerText(){
const { created ... | true |
b29e0a40b91dec77f7d0e56229731282d0119854 | JavaScript | IamSSam/Stack_Backend | /async_sample/async_sample.js | UTF-8 | 2,131 | 3.609375 | 4 | [
"Apache-2.0"
] | permissive | var async = require('async');
function mysquare(number, callback) {
var result = number*number;
var err = null;
if (result > 30) err = 'this is error';
callback(err, result);
}
var data = [1,2,3,4,5,6,7,8,9,10];
async.map(data, mysquare, function(err, result) {
console.log('ASYNC.MAP()', result)... | true |
cacf16c83518eb7b65295e20c471ae3b593c2671 | JavaScript | kbell28k/Portfolio | /weather_dashboard/script.js | UTF-8 | 6,937 | 2.9375 | 3 | [] | no_license | $(document).ready(function () {
$(document).keypress(
function (event) {
if (event.which == '13') {
event.preventDefault();
}
}
);
const m = moment();
console.log(moment());
console.log(m.format('l'));
var APIKey = "0abab7784e1c82cec0681... | true |
2a0d20239480325d9e98d83c2fbfb3a236d7b9ed | JavaScript | ElenaSamanchuk/html-css-js-course | /VasiliPatapovich_JS_HW/1006/1106.js | UTF-8 | 1,705 | 3.328125 | 3 | [] | no_license | //1 Задания - Как найти
// Таблицу с id="table".
let elem = document.getElementById('table');
alert(elem.innerHTML); //скрипт вызыват таблицу
//или
document.getElementById('table')
// Все элементы td внутри этой таблицы.
document.querySelectorAll('table td')
// Последний td в этой т... | true |
e0291c0ff0c4cb04c38db81da028803076bf9805 | JavaScript | mister-ard97/LatihanReact | /src/components/button.jsx | UTF-8 | 791 | 2.765625 | 3 | [] | no_license | // FUNCTIONAL COMPONENT
import React from 'react';
export function Button () {
return(
<input type='button' value='Submit'/>
);
}
export function Inputan () {
return (
<input type="text" placeholder='Ketik Nama Anda'/>
);
}
// - Ada dua macam Export
// -- Export Defa... | true |
d18b78070d08c54c4ac118d53dd0942c996b383f | JavaScript | InnovateUKGitHub/innovation-funding-service | /ifs-web-service/ifs-web-core/src/main/resources/static/js/ifs_modules/template.js | UTF-8 | 1,210 | 2.703125 | 3 | [
"MIT"
] | permissive | IFS.core.template = (function () {
'use strict'
/*
used to replace placeholders in a template for example:
var template = '<li class="success">' +
'<div class="file-row">' +
'<a href="$href" target="_blank">$text (Opens in a new window)</a>' +
... | true |
95dc1e41c6cbbd7e59d449cf15fa134e9c457b8b | JavaScript | Schoonology/readstream-watcher | /test/readstream-watcher.js | UTF-8 | 4,572 | 2.8125 | 3 | [
"MIT"
] | permissive | 'use strict';
var fs = require('fs');
var stream = require('stream');
var getRawBody = require('raw-body');
var test = require('tape');
var tmp = require('tmp');
var createReadStreamWatcher = require('../');
/**
* Creates a new, temporary file with the provided `contents`, returning the
* file's path.
*/
function ... | true |
ce82539c1ff72c7ce7d303ece88ad1a2ba153606 | JavaScript | Baiid/Bridging-loan-website | /script.js | UTF-8 | 2,509 | 3.171875 | 3 | [] | no_license | const next = document.querySelector(".next")
const next1 = document.querySelector('.next-1')
const prev1 = document.querySelector(".prev-1")
const prev2 = document.querySelector(".prev-2")
const submit = document.querySelector(".submit")
const page1 = document.querySelector(".page")
const page2 = document.querySelector... | true |
45783101870f1967218479e4113ae3966a708c20 | JavaScript | harzack/HTML5Dev | /img/dodmimetypes.js | UTF-8 | 6,583 | 2.6875 | 3 | [] | no_license | //var checkMark = '\u2714';
//var removeMark = '\u2718';
var checkMark = '+';
var removeMark = 'x';
var selectCats = "";
var selectMIMETypes = "";
function SetMIMETypeCats()
{
var categoryList = GetCatsSelection( selectCats );
var mimeTypeList = selectMIMETypes;
if( -1 == categoryList )
... | true |
aff9acde7e30946a50fbbe76d2fdacd5c0082c4a | JavaScript | sjw0608/nodeProject | /utils/validate.js | UTF-8 | 1,696 | 3.015625 | 3 | [] | no_license | /* eslint-disable prettier/prettier */
/**
* @description: 正则校验
* @author: 宋江伟
* @time: 2020-08-24
*/
/**
* @description: 错误提示
* @param {reg} reg 正则表达式
* @param {value} value 校验数据
* @param {String} text 错误提示简称
* @param {Function} callback
*/
const errorMessage = (reg, value, text, callback) => {
if (... | true |
17bd4e54c5fddbf88de07da28f503fa01be30615 | JavaScript | AAI-USZ/FixJS | /input/100+/after/9804313c21b4708707dc9d3c33f6d4e1172b67ad_0_1.js | UTF-8 | 993 | 2.9375 | 3 | [
"MIT"
] | permissive | function(baseUrl, relativeUrl) {
// summary:
// This takes a base url and a relative url and resolves the target url.
// For example:
// resolveUrl("http://www.domain.com/path1/path2","../path3") ->"http://www.domain.com/path1/path3"
//
if (relativeUrl.match(/\w+:\/\//))
... | true |
6de57b98c720b87171c7349c32a7782041bee2f8 | JavaScript | nzelenina/1198927-kekstagram-21 | /js/util.js | UTF-8 | 773 | 2.609375 | 3 | [] | no_license | 'use strict';
(function () {
const errorHandler = function (errorMessage) {
const node = document.createElement(`div`);
node.style = `z-index: 100; margin: 0 auto; text-align: center; background-color: red;`;
node.style.position = `absolute`;
node.style.left = 0;
node.style.right = 0;
node.st... | true |
c98a7b4aa71150048a4e043eef5cfa31d88fa34f | JavaScript | newLoki/StarshipMayflower | /game-server/app/src/world/ShipRegistry.js | UTF-8 | 5,194 | 2.796875 | 3 | [] | no_license | var _ = require('lodash'),
pomelo = require('pomelo'),
Channel = require('../channel'),
CustomError = require('../customError');
var channel = new Channel();
/**
* Registry of all ships
*
* @constructor
*/
var ShipRegistry = function()
{
var me = this;
me._ships = {};
me._players = {};
... | true |
f18c94868ca19dd25cf1abed6d597584ebc1d68c | JavaScript | bemrdo/CTF-2019 | /watevrCTF-2019/challenges/misc/hjärnknull/solve.js | UTF-8 | 3,289 | 2.828125 | 3 | [
"MIT"
] | permissive | const fs = require("fs");
const util = require("util");
function assemble(input) {
input = input.replace(/;[^\n]*/g, "");
input = input.split(/\r?\n/);
let program = [];
let macros = {};
let macro = null;
let dataIndex = 0;
let globals = {};
function expandMacros(code) {
for (let i=0; i<code.length; i++... | true |
629aa4993f85c73d31a175a5eaf2a9bb89fa1082 | JavaScript | Butonix/react-django-blog-example | /frontend/src/reducers/authReducer.js | UTF-8 | 606 | 2.625 | 3 | [
"MIT"
] | permissive | import * as types from "../types/actionTypes";
const initialState = {
authenticated: false,
message: ""
};
const message =
"Please verify your email address to complete the registration process.";
function authReducer(state = initialState, action) {
switch (action.type) {
case types.AUTHENTICATED:
... | true |
79f45cbb3a3c78a622c7ec7598ea4fa867066884 | JavaScript | nk8170/monaka | /js/main.js | UTF-8 | 1,426 | 2.859375 | 3 | [] | no_license | /* jshint curly:true, debug:true */
/* globals $, firebase, location */
var customerName = "";
$(document).ready(function() {
console.log("成功");
});
$(document).ready(function() {
$(".addButton").click(function() {
customerName = $(".customerName").val();
var customerData = {... | true |
7c1ec687e22aff4ab46a7612351fb3cbcbf40bd3 | JavaScript | facultyai/dash-bootstrap-components | /src/components/alert/__tests__/Alert.test.js | UTF-8 | 2,755 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | /**
* @jest-environment jsdom
*/
import React from 'react';
import {act, render} from '@testing-library/react';
import Alert from '../Alert';
jest.useFakeTimers();
describe('Alert', () => {
test('renders a div with class "alert"', () => {
const alert = render(<Alert />);
expect(alert.container.querySele... | true |
2785062323bb70c4bd4b437ed853666f8dd4ebe6 | JavaScript | OfficialRain/Precipitation | /modules/help.js | UTF-8 | 3,260 | 2.515625 | 3 | [
"MIT"
] | permissive | module.exports.run = async (client, message, args) => {
const Discord = require("discord.js");
const config = require("../config.json");
function isStaff(message) {
if (message.member != null) {
if (message.member.roles.find("name", "Admin") || message.member.roles.find("name", "Admins") || message... | true |
6a3aa57fab18f26ef82f875c44c3142202c8916b | JavaScript | Ehsanul-Karim-Pappu/html_css_js | /fun/dx_ball/explained_version/script.js | UTF-8 | 5,522 | 2.84375 | 3 | [] | no_license |
/*****************************************************************************
******************************************************************************
____ _ _ _____ _
| _ \ | | | | / ____| |
| |_) |_ __ ___ __ _| | _____ _ ... | true |
087812eddab574cc00b93b113f13ed4e94ffa6ed | JavaScript | chunyenHuang/ravelp | /modules/search.js | UTF-8 | 4,337 | 2.796875 | 3 | [] | no_license | var _ = require('underscore');
function filterInt(value) {
if (/^(\-|\+)?([0-9]+|Infinity)$/.test(value)){
return Number(value);
}
return NaN;
}
function search(){
function target(name, location, stores, foundStores){
var space = ' ';
var searchNameArray = name.split(space);
var searchLocation... | true |
3a55f53b9e070b2198198e896fee03cf24fb6ac9 | JavaScript | kenethM1/aprendiendoReact | /src/bases/02-templateString.js | UTF-8 | 261 | 3.671875 | 4 | [] | no_license | const nombre = 'Keneth';
const apellido = 'Perez';
const nombreCompleto = `${nombre} ${apellido}`;
function getTextConcatenado(nombre, apellido) {
return `${nombre} ${apellido}`
}
console.log(`El nombre es ${getTextConcatenado('Keneth', 'Rodriguez')}`);
| true |
6cfb67c27f631d8618e1df634ad94340cec9955f | JavaScript | appsngen/bootstrap-builder | /extensions/js/dropdown.ext.js | UTF-8 | 4,940 | 2.578125 | 3 | [
"MIT"
] | permissive | //global:$
(function () {
'use strict';
var DropdownOld = $.fn.dropdown.Constructor;
var Dropdown = function (element) {
var self = this;
this.element = $(element);
this.element.parent().on('shown.bs.dropdown', function (e) {
var items = $(e.target).find('li').not('.f... | true |
a4f8543cb66d88df881b551764b5bd5def27f5f2 | JavaScript | charlottesoderstrom/IT2810-P2 | /src/main.js | UTF-8 | 8,890 | 2.859375 | 3 | [] | no_license | import React, { Component } from "react";
import './index.css';
import Retriver from './components/Retriver.jsx';
import Tab from "./components/Tab";
import Form from "./components/Form";
import SetFavorite from "./components/SetFavorite";
import ViewFavorite from "./components/ViewFavorite";
import MusicPlayer from ".... | true |
fece78c91dd44803337fa747511d5793115a72b2 | JavaScript | UO270656/SEW | /PRACTICA-3/Ejercicio-13/Tarea-1/MapaKML.js | UTF-8 | 2,636 | 2.75 | 3 | [] | no_license | class Documento{
constructor(){
if (window.File && window.FileReader && window.FileList && window.Blob){
//alert("Este navegador soporta el API File");
}else {
alert("¡¡¡ Este navegador NO soporta el API File y este programa puede no funcionar correctamente !!!");
}... | true |
504e3f811630919df89611a4aa26c6a69ecfdd36 | JavaScript | TheJP/MightyHomeAutomation | /wwwroot/js/site.js | UTF-8 | 3,326 | 3.09375 | 3 | [] | no_license | 'use strict';
class Loader {
/**
* Callback that receives loaded data.
*
* @callback loadCallback
* @param {string} data New sensor data received from the server.
*/
/**
* Represents a dataentry that can be loaded regularely.
*
* @param {string} value Sensor data to ... | true |
c95f8d0973ef4c3b4fc75b97ccc35e3040bcbb3a | JavaScript | afrijaldz/youtube-title-remover-chrome-extension | /popup.js | UTF-8 | 779 | 2.921875 | 3 | [] | no_license | let button = document.getElementById("remove-button");
function YouTubeGetID(url) {
var ID = "";
url = url
.replace(/(>|<)/gi, "")
.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
if (url[2] !== undefined) {
ID = url[2].split(/[^0-9a-z_\-]/i);
ID = ID[0];
} else {
ID = url;
}
return ID;... | true |
af19dfa27d23f55bed810492b8d2b97f4e91dd8c | JavaScript | ibjohansen/chrome-extension-blog | /popup.js | UTF-8 | 2,411 | 3.015625 | 3 | [] | no_license | 'use strict';
// funksjon som henter alle cookies basert på et filter,
// i dette tilfellet domenet skatteetaten og cookie-navnet
// funksjonen tar en callback, som trigges når chrome.cookies.getAll
// returnerer med en eller flere cookies
// chrome.cookies.getAll tar et config-object, og en callback
function getCooki... | true |
4c3c1b5671a9685dd71e501735dd2106c13d6369 | JavaScript | eMahtab/node-request-module | /handling-callbacks.js | UTF-8 | 1,215 | 2.6875 | 3 | [] | no_license | var request=require('request');
var URL="http://localhost:3000";
var getRanking=function get_rank(error,response,body){
if(error){
handleError(error);
}else{
if(response.statusCode != 200){
handleError(response);
}
else{
console.log("Response 1 "... | true |
92ff2acde7d1dc7c40027e6dc356ee1e1efae23c | JavaScript | anexi97400/Discord-Bot | /commands/fun/rps.js | UTF-8 | 1,412 | 2.765625 | 3 | [] | no_license | module.exports = {
name: 'rps',
description: 'play a game of rock, paper and scissors',
category: 'fun',
run: async (client, message, args) => {
const msg = await message.channel.send({
embed: {
title: 'RPS GAME',
description: 'React to play!',
timestamp: new Date()
}
});
await msg.react('🗻... | true |
7eb84b955b350dee40627c0092ffb2a6690429f7 | JavaScript | nitromannitol/nitromannitol.github.io | /aggregate/plot_script.js | UTF-8 | 18,946 | 2.734375 | 3 | [] | no_license |
function copy(aObject) {
if (!aObject) {
return aObject;
}
let v;
let bObject = Array.isArray(aObject) ? [] : {};
for (const k in aObject) {
v = aObject[k];
bObject[k] = (typeof v === "object") ? copy(v) : v;
}
return bObject;
}
function unique ( array ) {
return array.filter(functio... | true |
a6e634d22cf93ae813dbf30634fb46d20120f01c | JavaScript | andygnewman/katas | /string-character-frequency/kata.js | UTF-8 | 1,553 | 3.859375 | 4 | [] | no_license | const solve = (str) => {
// create a count of each character in the string
const characterObject = Array.from(str).reduce((counts, char) => {
counts[char] = (counts[char] || 0) + 1;
return counts;
}, {});
// set monitor for testing validity
let valuesEqual = false;
// get array of unique character... | true |
d0970787233c035cf6e46d1892afacb68538249e | JavaScript | ddzmitry/ReactScraper | /server.js | UTF-8 | 2,910 | 2.875 | 3 | [] | no_license | // Include Server Dependencies
var express = require("express");
var bodyParser = require("body-parser");
var logger = require("morgan");
var mongoose = require("mongoose");
// Require Click schema
var Article = require("./models/articleSchema");
// Create a new express app
var app = express();
// Sets an initial por... | true |
b52c724182df8c5b35b47549d7376322d47ee314 | JavaScript | AppianZ/Desert-or-Ocean | /DemoFactory/16_Vue图片上传Base64/base64.js | UTF-8 | 1,167 | 2.5625 | 3 | [] | no_license | /**
* Created by appian on 2017/6/23.
*/
Vue.component('upload',{
template : '#uploadTpl',
data() {
return {
cantReadFile: false,
result: '',
};
},
mounted() {
if (typeof (FileReader) === 'undefined') {
this.cantReadFile = true;
alert('抱歉,你的浏览器不支持 FileReader,请使用其他浏览器!');
} else {
this.$ref... | true |
f7834df8d9c46774e1e6d5b1729daae855aaebc0 | JavaScript | uriyang/Algorithm | /Section6/7.js | UTF-8 | 613 | 3.703125 | 4 | [] | no_license | // 현수는 1년 과정의 수업계획을 짜야 합니다.
// 수업중에는 필수과목이 있습니다. 이 필수과목은 반드시 이수해야 하며, 그 순서도 정해져 있습니다.
// 필수과목순서가 주어지면 현수가 짠 N개의 수업설계가 잘된 것이면 “YES", 잘못된 것이면 ”NO“를 출력하는 프로그램을 작성하세요.
function solution(need, plan) {
let queue = need.split("");
for (let x of plan) {
if (queue[0] === x) queue.shift();
}
return !queue.length ? "Y... | true |
2607d3b6f08156b2e61187aa5ef88ada1705daa9 | JavaScript | angelilton/cursoDevMean | /javascript-basico/aula15-Exclarecendo-Membros-Privados/scripts.js | UTF-8 | 176 | 2.609375 | 3 | [] | no_license | var pessoa = (function(nome, idade, sexo)
{
return{
nome: nome,
idade: idade,
sexo: sexo
}
})('angelo', 19, 'masc');
console.log(pessoa);
| true |
9053a8c4eb9164a895839a6308bdd710fc4b6720 | JavaScript | hxxy2003/ymc-2 | /ymc-mms/src/main/webapp/js/yitiansystem/commoditymgmt/commodityinfo/add_childCat.js | UTF-8 | 5,318 | 2.59375 | 3 | [] | no_license | //分类验证
var boo=true;
//排序验证
var sortBoo=false;
var path;
var b=true;
//验证添加分类----子类分类名称是否存在
function validateCateName(){
var catName=$.trim($("#catNameId").val());
if(catName==""){
b=false;
return;
}
var strutName1=$("#rootCattegory").val();
var strutName2=$("#secondCategory>option:selected").val()==undefined... | true |
319ef2db695968750df8011d504ab93a78ac290f | JavaScript | UPye/shop-shop | /client/src/utils/GlobalState.js | UTF-8 | 1,335 | 2.5625 | 3 | [] | no_license | import React, { createContext, useContext } from "react";
// createContext is used to create the container to hold the global state data
// and functionality so data can be provided throughout the app
// useContext is used to allow use of the state created in createContext
import { useProductReducer } from './reducers'... | true |
6c1b5a92cc665e4ea55b918029a7560efa5a9cef | JavaScript | tanbir-create/Web-Development-Submissions | /Arshia/Milestone-14/Flipkart/Javascript/app.js | UTF-8 | 854 | 3.140625 | 3 | [] | no_license | //product slider
/*
const prev = document.querySelector('.prev');
const next = document.querySelector('.next');
const allProducts = document.querySelectorAll('.product');
const focus = document.querySelector('.focus');
const size = allProducts[0].clientWidth;
const firstItem = document.getElementById('first-ite... | true |
ad183411e11db597aa5b0c1de18e5cc452180d62 | JavaScript | futurebound/whiteboard-challenges | /w6d4/__test__/solution.test.js | UTF-8 | 716 | 2.96875 | 3 | [] | no_license | 'use strict';
const solution = require('../lib/solution');
require('jest');
describe('#solution', function () {
describe(`valid input/output`, () => {
});
describe(`invalid input/output`, () => {
this.testInvalid = 'array';
this.testInvalidTwo = [[], [], [], 'array'];
this.testInvalidThree =
... | true |
06c0467c5f3e6e80bf2ec54b0d8cbc3ccec1cb13 | JavaScript | 74flame47/Dominos | /src/components/App.js | UTF-8 | 9,308 | 3.390625 | 3 | [] | no_license | import React, {Component} from 'react';
import {deck} from './deck';
import Board from './board';
import Hand from './hand';
import Search from './search';
import '../css/App.css';
class App extends Component {
state = {
dafault: true,
newGame: true,
board: [],
player1: [],
player2: ... | true |
d999bc68da0cce6b223be1f8329a429d5fda1c7e | JavaScript | zbthompson93/portfolio-website | /js/menu.js | UTF-8 | 642 | 3.296875 | 3 | [] | no_license | // Select the whole mobile navigation bar list
var mobileNavBar = document.querySelector(".nav-mobile ul");
// Select the hamburger button
var hamburgerButton = document.querySelector("#ham");
// Define the mobile navigation bar's style element
var inlineStyle = mobileNavBar.style;
// If the mobile menu is hidden, r... | true |
8c861aa2fe495c714f60090ee1b717ba0b13c7b2 | JavaScript | timelyportfolio/remiotic | /inst/htmlwidgets/spiotic.js | UTF-8 | 1,051 | 2.59375 | 3 | [
"MIT"
] | permissive | HTMLWidgets.widget({
name: 'spiotic',
type: 'output',
factory: function(el, width, height) {
return {
renderValue: function(x) {
var width = el.offsetWidth
var height = el.offsetHeight
// if x.data is array assume it is in proper form
// as an array of objects or... | true |
59792aecdd3066d4a5185199b7f14106ff516461 | JavaScript | Maks2090/goit-js-hw-07 | /js/task-08.js | UTF-8 | 1,481 | 3.15625 | 3 | [] | no_license |
const refs = {
containerControls: document.querySelector("#controls"),
containerBoxes: document.querySelector("#boxes"),
widthBox: 30,
heightBox: 30,
marginBox: 5,
getRandomColor(min, max) {
return Math.random() * (max - min) + min;
},
createBoxes(amount) {
this.destr... | true |
cddd47a2b4c2e6b8de6dbb2473c4431a38dc0ee8 | JavaScript | legraeff/a-tad-of-data | /src/components/scatter-plot/ScatterPlot.jsx | UTF-8 | 4,692 | 2.546875 | 3 | [] | no_license | import React, { Component } from 'react';
import './ScatterPlot.css'; // Tell Webpack that ScatterPlot.js uses these styles
import { scaleLinear } from 'd3-scale';
import { select, selectAll, event } from 'd3-selection';
import { axisLeft, axisBottom } from 'd3-axis';
import { extent } from 'd3-array';
class ScatterPl... | true |
214c6a5dd7c4fbc6ba502d215534011cb33c55f2 | JavaScript | Mojzeszele/First-React-App-PilotRoster | /src/App.js | UTF-8 | 5,829 | 2.625 | 3 | [] | no_license | import React, {useState, useEffect} from "react";
import './App.css';
const API = "http://localhost:3005"
const API2 = "http://localhost:3006"
const Roster = () => {
const [pilot, setPilot] = useState(false)
const [records, setRecords] = useState([])
const [text, setText] = useState(false)
const [new... | true |
25450477f87e924d3bab060ba9314d1b0c2e4ad0 | JavaScript | amrelnagar286/CMJ | /javascripts/solver.js | UTF-8 | 41,585 | 2.984375 | 3 | [] | no_license | //-------------------------------------------------------------------
// SimplexJS
// https://github.com/
// An Object-Oriented Linear Programming Solver
//
// By Justin Wolcott (c)
// Licensed under the MIT License.
//-------------------------------------------------------------------
/*global describe*/
/*global re... | true |
997422d6977373bc81acd33e4f3534c47bd4a29d | JavaScript | ihgazni2/neggen | /BAK/html/html.old.js | UTF-8 | 2,401 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | const fs = require("fs")
const path = require('path')
const HTML_STYLE_OUT_TEM = `<html>
<head>
<link type="text/css" rel="styleSheet" href="./#name#.css" />
</head>
<body>
<@z@ class="z">
@entries@
</@z@>
</body>
</html>`
const HTML_STYLE_INLINE_TEM = `<html>
<head>
</head>
<body>
<@z@ class="z" s... | true |
5595f8364d690112e84527974a2cd07179053cfe | JavaScript | rickeyd1/Javascript | /myJavascript.js | UTF-8 | 119 | 3.1875 | 3 | [] | no_license | let name = "Ric";
function hello(name){
console.log("Hi my name is " + name);
}
hello(name);
console.log("Hi");
| true |
44deb50388a8ff3e5855a714ecaef9e27a1a26bf | JavaScript | AaryanshShukla/express-test | /index.js | UTF-8 | 1,047 | 2.703125 | 3 | [] | no_license | // const { json } = require('body-parser')
// const { json } = require('body-parser')
// const { v4: uuidv4 } = require('uuid');
// var express = require('express')
import { v4 as uuidv4 } from 'uuid';
import express, { query } from 'express';
var app = express()
var mylist = []
app.use(express.json())
app.get('/',... | true |
57e30fbf8f4112593565a9de03018e3840683d12 | JavaScript | brycedugger/budget | /routes/users.js | UTF-8 | 2,248 | 2.65625 | 3 | [
"MIT"
] | permissive | var db = require("../models");
module.exports = function(app) {
// get all the user's info passing in the id
app.get("/api/user/:id", (req, res) => {
db.User.findOne({
where: { id: req.params.id }
})
.then(data => {
res.status(200).json(data);
})
.catch(err => {
cons... | true |
2733adaab644315d4ca241c7b7f4b85ed545e47a | JavaScript | 5272vision5272/sem4pro | /final project/js/loginfirebase.js | UTF-8 | 779 | 2.90625 | 3 | [
"MIT"
] | permissive | firebase.auth().onAuthStateChanged(function(user) {
if(user) {
document.getElementById("user_div").style.display="block";
document.getElementById("login_div").style.display="none";
// User is signed in.
} else {
document.getElementById("user_div").style.display="none";
document.getElementById("login_div").st... | true |
c9e292a387c449b75ece231aed7306a21c9fb37b | JavaScript | matt22881/chatty-matt | /scripts.js | UTF-8 | 1,479 | 3.234375 | 3 | [
"MIT"
] | permissive | const socket = io('http://localhost:5555')
// const io = require('socket.io-client');
// const socket = io.connect('https://chatty-matt-the-matt-made-chat-app-o7mv8ccve.vercel.app:5555');
const getLocalTime = () => {
const d = new Date()
var t = d.toLocaleString()
return t
}
const messageContainer = docum... | true |
f31c77ab2430a36e8ff94eec2afb3548767e9148 | JavaScript | Peteypete/polotrack | /frontend/src/utils/importParser.js | UTF-8 | 2,237 | 3.125 | 3 | [] | no_license | //! Contains functions for parsing the uploaded user deposit and trade history CSVs
const _ = require('lodash');
/**
* Given a file, attempts to parse it into a string. If successful, provides the result to `successCallback` and
* provides any error to `errorCallback`.
*/
function parseFile(file, successCallback,... | true |
4b8e5c453206f7220eb6e3275a9c5050c024cc57 | JavaScript | samism/react-frontend-homework | /src/components/HotelFilters/filters.js | UTF-8 | 327 | 2.59375 | 3 | [] | no_license | const filterByName = (
{ target: { value: textTyped } },
hotels,
listHandler
) => {
const results = hotels.filter(hotel => {
const {
hotelStaticContent: { name }
} = hotel;
return name.toLowerCase().startsWith(textTyped.toLowerCase());
});
listHandler(results);
};
export default filterB... | true |
1a87cd1976dfe482fa12d3076e547c282de505eb | JavaScript | Kinjalc/tourist_attractions | /public/app.js | UTF-8 | 12,843 | 2.828125 | 3 | [] | no_license | $(document).ready(function() {
var map;
var position;
var markersArray = [];
// var url = "https://salty-fortress-4270.herokuapp.com/cities"
var url = "/cities/";
function initialize() {
var mapOptions = {
center: {
lat: 41.8369,
lng: -87.6847
},
zoom: 12
};
m... | true |
b1983f217fe68e2d3617330765c95fcebcaba7d4 | JavaScript | semmypurewal/BeginningJavaScript | /09-poker-simulation/practice.js | UTF-8 | 3,128 | 3.671875 | 4 | [] | no_license | var suits = ["clubs", "diamonds", "hearts", "spades"];
var ranks = ["two", "three", "four", "five", "six", "seven", "eight",
"nine", "ten", "jack", "queen", "king", "ace"];
// return true if the input is a suit, false otherwise.
var isSuit = function () {
};
// return true if the input is a rank, false o... | true |
7e282ee394795849c4169208696241730c05e925 | JavaScript | dangtiendat288/task-manager-api-expressjs-mongodb | /promises.js | UTF-8 | 1,737 | 3.046875 | 3 | [] | no_license | // const add = (a, b) => {
// return new Promise((resolve, reject) => {
// setTimeout(() => {
// resolve(a + b);
// }, 2000);
// });
// };
// add(2, 3)
// .then((sum) => {
// console.log(sum);
// return add(sum, 4);
// })
// .then((sum2) => {
// console.log(sum2);
// })
// .catc... | true |
ceec3686235cb54b3524f6522567775ae8ea5815 | JavaScript | VladMeleshko/sudoku | /src/index.js | UTF-8 | 1,637 | 3.609375 | 4 | [
"MIT"
] | permissive | module.exports = function solveSudoku(matrix) {
// your solution
return sudokuSolution(matrix);
}
//решение
function sudokuSolution(matrix) {
for (let row = 0; row < 9; row++) {
for (let col = 0; col < 9; col++) {
if (matrix[row][col] === 0) {
for (let num = 1; num < 10; num++) {
if (c... | true |
f93d853c672b4b74968c99f7e53e4356c2b0b65c | JavaScript | lalofcaunam/serviciosocial_app | /backend/services/LicenciaturaService.js | UTF-8 | 4,049 | 2.578125 | 3 | [] | no_license | const logger = require('log4js').getLogger('LicenciaturaService');
const { FcaDto } = require('../dtos');
const { Licenciatura } = require('../models')
module.exports = {
// Crear muchas licenciaturas
creacionMasiva: async (req) => {
try {
logger.info('> Inicia servicio creacionMasiva');
... | true |
5bb38aa58aa649b69255891e8ab75f5bd6af9cc7 | JavaScript | amurad77/E-commerce | /static/js/api.js | UTF-8 | 1,925 | 2.828125 | 3 | [
"MIT"
] | permissive | // let form = document.getElementById('subscribe-form')
// form.addEventListener('submit', function (e) {
// e.preventDefault();
// let form_data = {
// 'email':form.email.value,
// }
// let res = await fetch('http://localhost:8000/api/subscribe/',{
// headers: {
// 'content... | true |
ada580c16aff1478f257c2ea19d9f55b58e3efc3 | JavaScript | tositeru/kanji-assembly | /db/models/usertmp.js | UTF-8 | 3,459 | 2.515625 | 3 | [] | no_license | 'use strict'
const crypto = require('crypto')
const moment = require('moment')
const { TABLE_DEFINETION } = require('../tables/user-tmps.js')
const Logger = require('../../src/log')
const commonCrypt = require('./commonCrypt')
const CommonValidator = require('./userValidateCommon')
const logger = new Logger('DB UserTm... | true |
6feedd24a363c687c4e662b613d33ae26d7f5734 | JavaScript | AlveeM/data-structures-js | /02-linked-lists/05-remove-duplicates.js | UTF-8 | 929 | 3.5 | 4 | [] | no_license | const LinkedList = require('./LinkedList');
const removeDuplicates = list => {
let currentNode = list.head;
let prevNode = list.head;
let visitedNodes = new Set();
if (!list.isEmpty() && currentNode.next !== null) {
while (currentNode !== null) {
let value = currentNode.data;
... | true |
896cc5a7c86f34646854490c6d1291fe6cd5546c | JavaScript | jjrush/codingdojo | /00_web_fundamentals/13_foundations/challenge_5.js | UTF-8 | 507 | 4.46875 | 4 | [] | no_license | // Find max - Given an array with multiple values, write a function that returns the maximum number in the array. (e.g. for [-3,3,5,7] max is 7)
function findMax(array)
{
var max = -1000;
if ( array.length > 0 )
{
max = array[0];
}
else
{
return max;
}
for( va... | true |
3aac8746b45df6ac559ac9f393c9e7edae4f9a36 | JavaScript | GothamCityyy/Voice-cntrol | /src/main.jsx | UTF-8 | 784 | 2.703125 | 3 | [] | no_license | import * as React from 'react';
import {VoiceSelection } from './voice-selection';
export class MainView extends React.Component {
state = {
}
onEnterPhrase = (event) => {
const speak = event.target.value;
this.setState({ speak });
}
onSpeak = (voice) =>{
const speak = this.state.speak;
... | true |
de7f8bf0eae9c0f2a336355134abc9b840c802e4 | JavaScript | azala/soundboard | /examples/audio/main.js | UTF-8 | 455 | 2.65625 | 3 | [] | no_license | $(document).ready(function(){
function play(n) {
var audio = $('audio');
audio.attr('src', n+'.mp3');
audio[0].play();
}
ws = new WebSocket("ws://localhost:7777/audio");
ws.onopen = function(e) {
$('#message').text('Connected!');
}
ws.onmessage... | true |
c208764d1d6f40a71c56ef5326d054c1f50c1bf2 | JavaScript | Nangxif/game | /src/rpf/un/shallowEqual.js | UTF-8 | 709 | 3.296875 | 3 | [] | no_license | const hasOwn = Object.prototype.hasOwnProperty;
function is(A, B) {
if (A === B) {
return A !== 0 || B !== 0 || 1 / A === 1 / B; //+0 !== -0
}
return A !== A && B !== B; //NaN
}
export default function shallowEqual(objA, objB) {
if (is(objA, objB)) return true;
if (
typeof objA !== 'object' ||
... | true |
17b582ab2934d2a6d8a9aa8709f8483722d04262 | JavaScript | Ehtesham25/ReactWebsite | /src/Website/Contact.jsx | UTF-8 | 2,759 | 2.6875 | 3 | [] | no_license | import react, { useState } from "react";
const Contact = ()=>{
const[data, setData]= useState({
name:'',
city :'',
contact :'',
email:'',
message :''
});
const inputEventFunc =(e)=>{
const{name, value}= e.target;
setData((preVal)=>{
retu... | true |
f184091dbae5c055af78f5e1f59feafc8d45a2bd | JavaScript | beekman/data-structures-and-algorithms | /array/pivotIndex.js | UTF-8 | 1,119 | 4.15625 | 4 | [] | no_license | /* Given an array of integers nums, calculate the pivot index of this array.
The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right.
If the index is on the left edge of the array, then the left sum is 0 becaus... | true |
2fc53ad16fd74145ae53de1111f55699bf7efbbb | JavaScript | elijahstr/react-1-afternoon | /src/components/Topics/FilterString.js | UTF-8 | 1,400 | 3.125 | 3 | [] | no_license | import React, { Component } from 'react'
export default class FilterString extends Component {
constructor() {
super();
this.state = {
unFilteredArray : ["42Dugg", "LilBaby", "LilUzi", "Gunna", "DaBaby", "LilWayne"],
userInput: "",
filteredArray: []
}
... | true |
9cd3ff69d4816cbb04fcaf46bedd4daf994ccddd | JavaScript | gustavocastrow/rocketseat-discover | /guia-javascript/manipulando-dados/index.js | UTF-8 | 594 | 4.25 | 4 | [] | no_license | //Manipulando arrays
let techs = ["html", "css", "js"]
//Adicionando um item no fim do array
techs.push("nodejs")
//Adicionado um item no começo do array
techs.unshift("SQL")
//Removendo um item do final do array
techs.pop()
//Removendo um item do começo do array
techs.shift()
//Pegando somente alguns elementos d... | true |
532a6749cc97dc0356ea185d2a7be1f4c132b216 | JavaScript | KenYHT/Goalkeeper | /public/javascripts/vendor/facebook-login.js | UTF-8 | 386 | 2.625 | 3 | [
"MIT"
] | permissive | FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
FB.login(function(response) {
if (response.status === 'connected') {
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
} else {
// The person is not logged into Facebook, so ... | true |
33a2be27203a19fd91530d2296ace7b08e2125eb | JavaScript | gabrielrufino/gr-tools | /src/helpers/check-for-update.js | UTF-8 | 541 | 2.5625 | 3 | [
"MIT"
] | permissive | 'use strict'
const { isRequired } = require('@gabrielrufino/is-required')
const compareVersions = require('compare-versions')
const latestVersion = require('latest-version')
const checkForUpdate = async ({
name = isRequired({ param: 'name' }),
version = isRequired({ param: 'version' })
}) => {
const newVersion ... | true |
acd005d4c8750d4c35904d369ee689de0ab2a7ca | JavaScript | wslasecki/dAssist | /devLogger/console/scripts/alert.js | UTF-8 | 303 | 2.5625 | 3 | [] | no_license | var Alert = {
// State
isActive: true,
init: function() {
//
$(window).focus(function() {
if( !Alert.isActive ) {
Alert.isActive = true
}
});
$(window).blur(function() {
if( Alert.isActive ) {
Alert.isActive = false
}
});
}
}
$(document).ready( function() {
Alert.init()
});
| true |
5cbb5542588376213d492392537cbba54cdbccc4 | JavaScript | youzelle/afrobeat_sequencer | /js/helper.js | UTF-8 | 488 | 3.359375 | 3 | [] | no_license | //BUTTON HELPERS
function swapButtons(hide, show) {
document.getElementById(show).classList.remove("hidden");
document.getElementById(hide).classList.add("hidden");
}
function toggleDisable(button) {
let ele = document.getElementById(button)
if (ele.disabled) {
console.log("Enabling button", b... | true |
5738e1661536b3ccf8a6b97a5745eea8a89067b4 | JavaScript | 21mooie/Cracking-the-Coding-Interview-ed.-6 | /spec/chapter01/1.4palindromePermutation.spec.js | UTF-8 | 1,628 | 2.84375 | 3 | [] | no_license | const {
palindromePermSort,
palindromePermMap,
palindromePermBit
} = require('../../Interview_Questions/chapter01/1.4palindromePermutation');
describe('Palindrome Permutation', () => {
describe('sort', () => {
it('should return true for a permutation of palindrome.', () => {
expect(... | true |
470427ccc26499d3ae9f8f95ee86d9e1bb3bc919 | JavaScript | albanm/node-pre-gyp-hosting-github | /index.js | UTF-8 | 5,431 | 2.515625 | 3 | [] | no_license | var path = require('path');
var fs = require('fs');
var request = require('request');
var log = require('npmlog');
// initialize options for a HTTP request
var requestOpts = function(opts, config) {
var requestOpts = {
headers: {
'User-Agent': 'node-pre-gyp-github-hosting'
}
};
if (config.githubToken) reques... | true |
92336906c09de4d3e7c9f44310f891e560eaedeb | JavaScript | keffri/top-restaurant-page | /src/modules/footer.js | UTF-8 | 821 | 2.875 | 3 | [] | no_license | function createAnchor(type, href) {
let anchor = document.createElement(type);
anchor.setAttribute("href", href);
anchor.setAttribute("target", "_blank");
return anchor;
}
function createIcon(type, ...classes) {
const icon = document.createElement(type);
icon.classList.add(classes[0]);
icon.classList.add... | true |
35dae6003dc1c8c6be23197cbb4761e4076cdc8e | JavaScript | toannguyen17/chuong-trinh-the-hien-su-tuong-tac-giua-hai-doi-tuong-cong-tac-va-bong-den | /SwitchButton.js | UTF-8 | 499 | 3.296875 | 3 | [] | no_license |
let SwitchButton = function(electricLamp, btn) {
this.electricLamp = electricLamp;
this.elCheckBox = document.querySelector('#'+btn);
this.elCheckBox.addEventListener('change', this.onChanger.bind(this));
}
SwitchButton.prototype.onChanger = function() {
if (this.elCheckBox.checked) {
this.turnOn();
}else{
t... | true |
ccf13bc350f5195ddc98b91033f04cd93daf1d01 | JavaScript | CooLNuanfeng/node-some-script | /readStream.js | UTF-8 | 765 | 3.265625 | 3 | [] | no_license | // process.stdin.on('readable', function () {
// var buf = process.stdin.read(3);
// console.dir(buf);
// process.stdin.read(0);
// });
// var Readable = require('stream').Readable;
// var rs = new Readable();
// // rs.push('beep ');
// // rs.push('boop \n');
// var c = 97-1;
// rs._read = functio... | true |
a5fdab5fc1af5b52af7bf3bf1df43f3097578f60 | JavaScript | snehiljain34/flip-a-coin | /Flip.js | UTF-8 | 449 | 3.453125 | 3 | [] | no_license | var randomNumber1 = Math.floor(Math.random()*6) + 1;
var randomNumber2 = Math.floor(Math.random()*6) + 1;
if (randomNumber1>randomNumber2){
document.querySelector("h1").innerHTML = "🚩Heads Up!";
}
else if (randomNumber1<randomNumber2){
document.querySelector("h1").innerHTML = "🚩Tails Up!";
}
else{
... | true |
50884a21e1c426e0c5c80537a1cca2fa089e8eb3 | JavaScript | bhatiachahat/ReactResortApp | /resorts/src/components/Roomsfilter.js | UTF-8 | 4,722 | 2.625 | 3 | [] | no_license |
import React, { Component } from 'react'
export default class Roomsfilter extends Component {
constructor(props){
super(props);
this.initialstate={
type:"all",
capacity:1,
minprice:0,
maxprice:600,
price:600,
breakfast:false... | true |
e627204420771cb6d4b463542fc24f6c39f50878 | JavaScript | SGEdutech/eduatlas-react | /src/redux/reducers/notification.js | UTF-8 | 926 | 2.703125 | 3 | [] | no_license | import dateToMoment from '../../scripts/dateToMoment';
const initState = {
notifications: []
};
function notificationReducer(state = initState, action) {
switch (action.type) {
case 'FETCH_ALL_FULFILLED':
const notifications = action.payload.data.notifications;
dateToMoment(notifications);
return { ...st... | true |
9290327977360a6543241c9af25062b566eef80b | JavaScript | sarawarnock/tictactoe | /index.js | UTF-8 | 922 | 3.40625 | 3 | [] | no_license | //store all DOM elements as attributes inside of an object for DRY (do not repeat yourself)
//then access all DOM elements by calling properties from this object
function getTilesDom() {
return Array.from(document.querySelectorAll("td"));
}
const DOM = {
tiles: getTilesDom(),
x: 'blue', //image
o: 'gr... | true |
ad68b2858351b38cf4b934841255864cda7062b8 | JavaScript | kgofweb/React-Crash-Course-1st | /src/components/TodoItem.js | UTF-8 | 981 | 2.59375 | 3 | [] | no_license | import React, { Component } from 'react';
import PropTypes from 'prop-types';
class TodoItem extends Component {
// Style
getStyle = () => {
return {
textDecoration: this.props.data.completed ? 'line-through' : 'none',
background: '#F4F4F4F4',
padding: '10px',
borderBott... | true |
2c12c1fd78c6d500497692539dadc751e5cc836e | JavaScript | vagabond0079/lab-15-stacks-and-queues-and-modal | /lab-derek/test/queue-test.js | UTF-8 | 1,020 | 2.90625 | 3 | [] | no_license | 'use strict';
const expect = require('expect');
const Queue = require('../model/queue.js');
describe('testing queue.js', () => {
let testQueue;
beforeEach(() => {
testQueue = new Queue();
});
afterEach(() => {
testQueue = null;
});
it('should return a new Queue', () => {
expect(testQueue).toEx... | true |
aa1fd7eb99d33b18421c849ffcaad1768f8a44f4 | JavaScript | mattthompson22/assignments | /notes/recursive.js | UTF-8 | 489 | 4.34375 | 4 | [] | no_license | // const factorial = num => {
// if (num === 1)
// return 1;
// else
// return num * factorial(num-1);
// }
// console.log(factorial(6));
//GAME OF THREES
const gameOf3 = (n, counter = 0) => {
if (n === 1)
return counter;
else if (n % 3 === 0)
return gameOf3 (n/3, coun... | true |
3622e422645ea004b882e94ae3fbc4b2bb9aff80 | JavaScript | zacharyparikh/AdventOfCode2020 | /day1.js | UTF-8 | 485 | 3.546875 | 4 | [] | no_license | const fs = require('fs')
fs.readFile("inputs/input1.txt", 'utf8', (err, data) => {
const entries = data.split("\n").map(x => Number(x));
console.log(entries);
const [e1, e2] = findTwo(entries);
console.log(e1 * e2);
})
function findTwo(entries) {
for (let i = 0; i < entries.length; i++) {
for (let j = i... | true |
8cf5f6841c9bf46090857c82d4099ba6a6f9c0de | JavaScript | BigBush3/nextjs-test-task | /public/fuck.js | UTF-8 | 251 | 2.796875 | 3 | [] | no_license | document.getElementById("myinput").oninput = function () {
var value = (this.value - this.min) / (this.max - this.min) * 100
this.style.background = 'linear-gradient(to right, #82CFD0 0%, #82CFD0 ' + value + '%, #fff ' + value + '%, white 100%)'
};
| true |
180a64ac0c27863511320fbad7d2a02d69c10e4f | JavaScript | bh300603/diamond-generator | /sketch.js | UTF-8 | 2,341 | 2.9375 | 3 | [
"MIT"
] | permissive | var x;
var y;
var outsideRadius = 60;
var insideRadius = 20;
function setup() {
createCanvas(windowWidth, windowHeight);
d = select('.div-block');
d.position(0,0);
gui = new Gui();
let gui_setup = new dat.GUI();
noFill();
fill(0,0,0,0);
gui_setup.add(gui,"numpoints",0,500);
gui_setup.add(gui,"stroke"... | true |