Skip to content

Instantly share code, notes, and snippets.

View jameswomack's full-sized avatar
📈

James J. Womack jameswomack

📈
View GitHub Profile
@jameswomack
jameswomack / gist:d4b8b760c3c19f122903ccc83be0a2e4
Created July 21, 2023 08:08
Install the gerd-danged pnpm version from the gerd-darned package!
View gist:d4b8b760c3c19f122903ccc83be0a2e4
curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=$(node -e "console.info(require('./package.json').packageManager.match(/[0-9.]+/g)[0])") sh -
@jameswomack
jameswomack / gist:6aa5a5179ba58ffc331e1ebb5db725a7
Created July 21, 2023 07:59 — forked from lonnen/gist:3101795
git grep and git blame. two great tastes that taste great together
View gist:6aa5a5179ba58ffc331e1ebb5db725a7
# from i8ramin - http://getintothis.com/blog/2012/04/02/git-grep-and-blame-bash-function/
# runs git grep on a pattern, and then uses git blame to who did it
ggb() {
git grep -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
# small modification for git egrep bash
geb() {
git grep -E -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
@jameswomack
jameswomack / autoload-for-zshrc.zsh
Created June 2, 2023 20:44
Auto-load correct Node version from directory based on .nvmrc
View autoload-for-zshrc.zsh
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
@jameswomack
jameswomack / History|-1022aafb|entries.json
Last active October 5, 2022 17:37
Visual Studio Code Settings Sync Gist
View History|-1022aafb|entries.json
{"version":1,"resource":"file:///Users/jameswomack/Projects/github/SportsCardInvestor/sci-api/jest.config.js","entries":[{"id":"Xi7a.js","source":"Workspace Edit","timestamp":1663784147251}]}
@jameswomack
jameswomack / instructions.md
Last active February 2, 2022 21:47
Monorepo test iteration. Logging your `lerna run test` output & using that to only re-run packages that haven't passed yet
View instructions.md

usage

start a new test session

lerna-test-resume --init

run your tests w/ tee

@jameswomack
jameswomack / mandrill.js
Created January 13, 2022 21:10
using the for loop paradigm to drill down to a matching shadowRoot
View mandrill.js
function updateState (state) {
return console.dir(state);
}
const thaNode = {};
const host = {
shadowRoot: thaNode
};
@jameswomack
jameswomack / accept-all-invites.scpt
Created November 27, 2021 17:10
Accept every calendar event in Outlook Mac using AppleScript
View accept-all-invites.scpt
tell application "Microsoft Outlook"
repeat with calendarEvent in the every calendar event
accept meeting calendarEvent
end repeat
end tell
@jameswomack
jameswomack / find-and-replace.txt
Created September 2, 2021 18:02
Replacing named function expressions w/ arrow body style
View find-and-replace.txt
Find:
function ([a-zA-Z]+)(\([a-zA-Z, \{\}]+\)) (\{)
Replace:
const $1 = $2 => $3
@jameswomack
jameswomack / _jewel.js
Last active July 15, 2021 00:30
Configurably generating a "jewel" board in which no 3 consecutive jewels are allowed in a given column or row
View _jewel.js
/* eslint-disable no-console, no-param-reassign */
/**
* Returns a filled in board such that there are no 3 consecutive
* jewels (vertically/horizontally) of the same type.
*
* @param widthOfBoard int which provides width of board
* @param heightOfBoard int which provides height of board
* @param jewels array providing valid jewels for board
*/