Skip to content

Instantly share code, notes, and snippets.

View jameswomack's full-sized avatar
📈

James J. Womack jameswomack

📈
View GitHub Profile
@jameswomack
jameswomack / nvm.zsh
Created October 16, 2023 14:47
Auto-load correct Node version in directory via nvm
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 / gist:d4b8b760c3c19f122903ccc83be0a2e4
Created July 21, 2023 08:08
Install the gerd-danged pnpm version from the gerd-darned package!
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
# 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
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 December 22, 2023 18:39
Visual Studio Code Settings Sync Gist
{"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

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
function updateState (state) {
return console.dir(state);
}
const thaNode = {};
const host = {
shadowRoot: thaNode
};
@jameswomack
jameswomack / meta
Created January 5, 2022 21:34
meta
meta
@jameswomack
jameswomack / accept-all-invites.scpt
Created November 27, 2021 17:10
Accept every calendar event in Outlook Mac using AppleScript
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
Find:
function ([a-zA-Z]+)(\([a-zA-Z, \{\}]+\)) (\{)
Replace:
const $1 = $2 => $3