Skip to content

Instantly share code, notes, and snippets.

View Smona's full-sized avatar

Mel Bourgeois Smona

View GitHub Profile
@Smona
Smona / advanceFocus.ts
Created December 6, 2019 19:37
Replicates tabbing behavior with a function
/**
* Moves focus to the next focusable element on the page, similar to pressing <Tab>
*
* Does not currently honor tab-indexes
*/
export function advanceFocus() {
//Isolate the node that we're after
const currentNode = document.activeElement;
//find all tab-able elements
@Smona
Smona / formatters.ts
Created December 6, 2019 19:35
Common text formatters
export function formatPlural(count: number, singular: string) {
return `${singular}${count === 1 ? "" : "s"}`;
}
export function formatQuantity(count: number, singular: string) {
return `${count}${formatPlural(count, singular)}`;
}
#! /bin/bash
SOURCE=$1
TARGET=$2
# Do not run for file checkouts, preventing recursion
if [ $3 == 0 ]; then exit 0; fi
# Only run on dev machines
if [[ $(uname) != 'Darwin' ]]; then exit 0; fi

Keybase proof

I hereby claim:

  • I am smona on github.
  • I am smona (https://keybase.io/smona) on keybase.
  • I have a public key ASA5D3XxByYwkRHTAbx0-rEuj9NqcLn2hamv1rgkaelZ3wo

To claim this, I am signing this object: