Skip to content

Instantly share code, notes, and snippets.

View joeyred's full-sized avatar

Brian Hayes joeyred

View GitHub Profile
@joeyred
joeyred / syntax-highlighting.md
Last active March 20, 2023 18:43
Color Theming Ideas

Possible data structuring

When assigning importance/priority to semantic tokens, it starts to get muddy fast, however this idea MIGHT help:

Basic Idea

Originally, there was going to be a level or order of priority to each token after they have been sorted into categories.

The original idea was to use an anylogous harmony on the items in each list, which the primary color going to the top item. This ended up very flawed, very quickly.

@joeyred
joeyred / dark-mode.css
Created December 24, 2022 06:01
ao3 dark mode
‎‎​
@joeyred
joeyred / specialties.yml
Last active December 1, 2022 00:59
Bowdie's Cocktails
-
name: Aperol Spritz
category: Basic
glass: Flute
ingredients:
- [1.5, oz, Bombay Sapphire]
- [1, oz, Aperol]
- [0.5, oz, Simple Syrup]
- [top, Prosecco]
instructions:
@joeyred
joeyred / filterObjectByKeys.js
Last active May 31, 2022 04:10
filter object by keys
/**
* Create a new object populated with specifc keys from another object.
* @method specificKeysToNewObject
* @param {Object} object - The original object.
* @param {String[]} keys - The strings to populate the new
* object with.
* @return {Object|Boolean} - The new object with only the passed
* keys in it. If none of the keys
* passed match any of the keys in the
* original object, returns `false`.
@joeyred
joeyred / depdoc.js
Created February 19, 2022 19:31
Better Dependency Documentation Tool Idea
/**
* Dependency Docs
*
* Script for generating a readme for dependecies.
*
* The Goal:
*
* To take the current dependecies in package.json and generate
* a markdown file with each dependency listed, with their descriptions,
* and a section allowing documenting why it was added, and what it's
@joeyred
joeyred / RGBAToHexA.ts
Last active October 9, 2021 04:49
Convert RGB(A) to Hex(A)
interface RGBA {
red: number
green: number
blue: number
alpha?: number
}
const RGBAToHexA = ({ red, green, blue, alpha }: RGBA): string => {
// We are using a system where 16 representations of value
// exist (0-9, a-f) This will give us the hex representation
@joeyred
joeyred / nothing.js
Created October 3, 2021 19:04
nothing.js
‎‎​
@joeyred
joeyred / traverseObject.js
Last active September 30, 2021 21:20
Uses a string representation of an object chain and traverses the actual object.
/**
* Takes a string representaion of an object chain and traverses the real object to the
* last key in the chain.
*
* @method _traverseObject
* @private
* @param {String} chain - String represenation of an object chain.
* @param {Object} object - The object to traverse.
* @return {*} - The new position in the object.
*/
@joeyred
joeyred / addSuffixToNumber.js
Last active September 30, 2021 21:26
Add a suffix to a number. "st", "nd", "rd", and "th".
/**
* Adds suffix to number passed.
*
* @method _addSuffixToNumber
*
* @param {number} number - The number to have a suffix added to.
*
* @return {string} - Number with suffix added.
*/
function addSuffixToNumber(number) {
@joeyred
joeyred / pixels-to-ems.js
Created September 15, 2021 20:12
Coverts pixel values to em based on the font size set to the html tag.
/**
* Converts pixel values to em values based on the `html` level `font-size`.
* @method pixelsToEms
* @param {Number|String} pixels - pixel value to be converted to ems.
* @return {Number} - value in ems.
*/
function pixelsToEms(pixels) {
let html = document.querySelector('html');
return pixels / parseFloat(getComputedStyle(html)['font-size']);
}