Skip to content

Instantly share code, notes, and snippets.

View devinrhode2's full-sized avatar
😀

Devin Rhode devinrhode2

😀
View GitHub Profile
@devinrhode2
devinrhode2 / idea.md
Last active January 24, 2022 17:06
post-rewrite git hook - validate every commit?

Something tells me it wouldn't be insurmountable to help facilitate running quality checks on each commit. While it would be nice for git rebase --continue to simply run the normal git hooks when running pick 12498y feature bug fix (i.e. - treat it like an edit plus undo+redo commit. while also maybe preserving date+author information) - OR maybe there's a good argument to add new hooks around rebase-continue.....

What could absolutely be done, I believe without modifications to git core, would be a pre-push hook that basically creates a worktree in the background, steps though each commit, running the quality checks on each commit. However, if a commit has an issue, you'll have to rebase -> edit that commit anyway.

So, here's something I would consider implementing: 1. pre-push check requires clean git status (seems pretty reasonable to me) 2. pre-push hook will somehow automatically rebase whole branch... but run the commit hooks for each commit for you. It's possible some simple checks could be invoked w

@devinrhode2
devinrhode2 / breakout-small-pr.md
Created January 18, 2022 16:23
breakout small PR

Add to your .gitconfig:

[alias]
  breakout-small-pr = "!runit() { CURRENT_BRANCH=`git branch --show-current`; echo checkout $1 && git checkout $1 && echo delete $2 locally && git branch -D $2 || true && echo create fresh $2 && git checkout -b $2 && echo force publish && git publish-branch --force && echo back to original branch && git checkout $CURRENT_BRANCH; }; runit"

Then:

git break<TAB> 
git breakout-small-pr
/** @type {(...args: any[]) => never} */
const fail = (...args) => {
console.error(...args)
throw new Error(args.join(''))
}
@devinrhode2
devinrhode2 / smart-auto-rebase.sh
Last active December 16, 2021 02:19
this pre-push check just throws you into rebasing :)
#!/bin/sh
GIT_ROOT="$(git rev-parse --show-toplevel)"
. "$GIT_ROOT/.husky/common/colors.sh"
REMOTE_NAME="$1"
# REMOTE_URL="$2"
STDIN=$(cat -)
echo "REMOTE_NAME: $REMOTE_NAME"
echo "STDIN: $STDIN"
@devinrhode2
devinrhode2 / git stash release notes changelog.txt
Created December 9, 2021 20:40
git stash release notes/changelog
git clone --depth=1 https://github.com/git/git
Searched "stash" in `Documentation/RelNotes/*.txt`
```
190 results - 74 files
Documentation/RelNotes/1.5.3.2.txt:
13 talking over svn:// protocol.
14
15 * git-send-email re-issued the same message-id about 10% of the
@devinrhode2
devinrhode2 / prettier not recusing issue.md
Last active November 24, 2021 19:15
Prettier not recursing into files/folders when given "."

Prettier not recursing into files/folders when given "."

I had a really odd prettier issue.. Using prettier v2.4.1, node 16.13.0, yarn 1.22.15, M1 mac, zsh/iTerm2, with ARM version of zsh..

For some reason prettier was not recursing into all files/folders. I had to change it to "**/*" instead of .

I don't know if reinstalling node_modules would have fixed the issue

@devinrhode2
devinrhode2 / update-your-mustache.js
Created July 8, 2012 20:25
Why not hookup mustache templates to auto-update?
/* by Devin Rhode (@Devinrhode2)
Mustache templates are a one-time operation.
I realized this doesn't have a to be, and having them auto-update is *extremely trivial*
So, we have this mustache:
<p>Hello, {{username}}</p>
@devinrhode2
devinrhode2 / cloudSettings
Last active November 9, 2021 21:46
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-11-05T18:07:14.610Z","extensionVersion":"v3.4.3"}
@devinrhode2
devinrhode2 / cloudSettings
Last active November 5, 2021 18:07
cloudSettings
{"lastUpload":"2021-11-05T18:07:14.610Z","extensionVersion":"v3.4.3"}
import { globby } from 'globby'
import pMap from 'p-map'
import execa from 'execa'
// typical high end is about 350mb (based on watching "xo" processes inside Activity Monitor)
// ~~lets go with 400mb to be safe~~
// Since we are grouping files together - we should have less oveerhead
// (node, yarn, xo wrapper, eslint wrapper, 1 ts process?) - lets go with just 350.
const TYPICAL_XO_MEMORY_USAGE = 0.35