Skip to content

Instantly share code, notes, and snippets.

View joeyred's full-sized avatar

Brian Hayes joeyred

View GitHub Profile
@joeyred
joeyred / arraysMatch.js
Created July 23, 2021 19:09
arraysMatch
function arraysMatch(arrayOne, arrayTwo) {
let match = false;
if (arrayOne.length !== arrayTwo.length) {
return false;
}
for (let indexOne = 0; indexOne < arrayOne.length; indexOne += 1) {
// For checking for a match to the current ArrayOne value
let valueMatch = false;
for (let indexTwo = 0; indexTwo < arrayTwo.length; indexTwo += 1) {
@joeyred
joeyred / example.graphql
Last active July 15, 2021 22:39
GraphQL Example Schema
type Tweet {
id: ID!
# The tweet text. No more than 140 characters!
body: String
# When the tweet was published
date: Date
# Who published the tweet
Author: User
# Views, retweets, likes, etc
Stats: Stat
@joeyred
joeyred / reporter.js
Last active December 9, 2020 08:26
Error reporter wrapper for Sentry to prevent reporting to Sentry in dev, but still logging any resulting message or error.
/* eslint-disable no-console */
import * as Sentry from '@sentry/browser';
let production = false;
/**
* Initialize reporter. This should be done as soon as possible.
* @method initReporter
* @param {Boolean} isProduction - If the app is currently running in
* production or not.
@joeyred
joeyred / ratio.js
Last active December 9, 2020 08:20
Utilities for dealing with aspect ratio and scaling of rectangles.
/**
* Copyright (c) 2019-present, Brian J. Hayes.
*
* https://github.com/joeyred
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export function fixedDecimalPlaces(number, places) {
function arraysMatch(arrayOne, arrayTwo) {
let match = false;
if (arrayOne.length !== arrayTwo.length) {
return false;
}
for (let indexOne = 0; indexOne < arrayOne.length; indexOne += 1) {
// For checking for a match to the current ArrayOne value
let valueMatch = false;
for (let indexTwo = 0; indexTwo < arrayTwo.length; indexTwo += 1) {
@joeyred
joeyred / gulpfile.js
Last active December 13, 2016 19:19
Use Jekyll with gulp.js while leveraging the use of a `--production` flag when running `gulp` to set the environment in Jekyll to production as well.
var gulp = require('gulp');
var yargs = require('yargs');
var DEPLOY = Boolean(yargs.argv.production);
/**
* Jekyll Task
*
* Make Jekyll run stuff when told to by gulp.
*
@joeyred
joeyred / debug.js
Created November 30, 2016 19:18
A little debugging object.
/**
* Controls whether debug functions have any output to console.
* @type {Boolean}
*/
var DEBUG_IS_ENABLED = true;
/**
* Debug constructor
* @method Debug
* @param {string} objectName The name of the parent object of all logged data
@joeyred
joeyred / Expandable Search Field.markdown
Created September 13, 2015 22:49
Expandable Search Field