Skip to content

Instantly share code, notes, and snippets.

View jonchurch's full-sized avatar
♥️

Jon Church jonchurch

♥️
View GitHub Profile
@jonchurch
jonchurch / yoda.js
Last active February 28, 2023 03:22
Yoda style eslint rule example code
/*eslint yoda: "error"*/
const youveBecome = "powerful";
if ("powerful" === youveBecome) {
// yoda style
// value comes before variable
}
if (youveBecome === "powerful") {
// non-yoda
@jonchurch
jonchurch / gist:c4ab048c81b0c0caba2cca4f0cefbf52
Created February 6, 2023 19:13
Get unique filenames from eslint output
# input looks like
# ~/proj/src/some/file/path.tsx(60,9): error jest/no-conditional-expect : Avoid calling `expect` conditionally`
npm run lint -- --quiet | awk 'BEGIN { FS="(" }; {print $1O}' | uniq -u
@jonchurch
jonchurch / erc20token.sol
Last active November 21, 2022 16:00
ERC20 Sample Limted Supply Token
pragma solidity ^0.4.8;
// ----------------------------------------------------------------------------------------------
// Sample fixed supply token contract
// Enjoy. (c) BokkyPooBah 2017. The MIT Licence.
// ----------------------------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
contract ERC20Interface {
@jonchurch
jonchurch / prefs.js
Last active October 5, 2022 15:36
Dracula theme for Chrome Secure Shell, for all of us using crouton!
// Paste this whole file into your Chrome Secure Shell window's inspect console, and run it!
term_.prefs_.set('enable-bold', false)
term_.prefs_.set('background-color', "#282a36");
term_.prefs_.set('foreground-color', "#f8f8f2");
term_.prefs_.set('color-palette-overrides', [
"#000000",
"#ff5555",
"#50fa7b",
function copyBranch() {
navigator.clipboard.writeText(
document.querySelector('.pr-header-branches').children[0].textContent
)
}
@jonchurch
jonchurch / git-blame-ignore-commits.md
Last active August 19, 2022 16:47
Ignoring Formatting Commits in Git Blame with Ignore Revs

Ignoring Formatting Commits in Git Blame

Some commits touch many files at once to do QoL or reformat code, with trivial diffs. These commits infamously muddy the output of git blame.

However, since git v2.23, git allows you to provide a list of commits to ignore in the blame. This feature is called "ignore revision(s)"

You can provide these commits in multiple ways:

  1. the CLI flag --ignore-rev <commit>
  2. the CLI flag --ignore-revs-file which accepts a file in fsck.skipList format (commits seperated by newlines, # prefixed comments allowed as of Git 2.20) NOTE: at time of writing (git v2.25.1) this flag will evaluate the path relative to your repo root, not your current working directory!
@jonchurch
jonchurch / gitPerf.md
Last active July 21, 2022 15:13
Speed up performance of large git repos

Git Perf Improvements

  • Enable git config feature.manyFiles true to opt in to a few settings to help speed up large repos. At time of writing it sets index.version=4 and core.untrackedCache=true
  • Run git gc to garbage collect unreachable objects, clean up reflog. Under the hood this runs git prune && git repack && git rerere
  • Do you have a slow startup time for new shell sessions? Many devs are using some prompt that shows git status in your prompt. After every command it will use git to check the status of your index. When git is slow in general, this will slow down your interactive shells. One quick solution is to disable that status check in your prompt. For zsh you can do that by running git config oh-my-zsh.hide-info true, add a --global flag if you want to set this option globally.
@jonchurch
jonchurch / watch.md
Last active January 24, 2022 15:03
Watch all repos in a github org

Watch All Repos in a Github Organization

Visit your tokens page and generate a new token with the scopes repo, notifications.

Copy it to your clipboard. Keep the page open until you're done watching orgs, in case you need to copy it again.

Then open your terminal and replace TOKEN with your token and YOURORG with the organization or username that you want to watch in the following command:

WATCH_GH_REPOS=TOKEN npx watch-gh-repos -o -w YOURORG
@jonchurch
jonchurch / glitch_vimify.js
Last active April 18, 2021 01:57
Vim Bindings for Glitch.com editor
// Load your Glitch project, paste this into the javascript console of chrome inspect
// Enjoy vim goodness!
(function () {
var makeCursorFat = function() {
var style = document.createElement('style');
style.textContent =
'div.CodeMirror div.CodeMirror-cursor { ' +
'width: auto; ' +
'border: 0; ' +
@jonchurch
jonchurch / v5_changes.md
Last active May 13, 2020 23:49
Express v5 Changes by System as of 5.0.0-alpha.8