Skip to content

Instantly share code, notes, and snippets.

View jonchurch's full-sized avatar
♥️

Jon Church jonchurch

♥️
View GitHub Profile
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 / v5_changes.md
Last active May 13, 2020 23:49
Express v5 Changes by System as of 5.0.0-alpha.8
@jonchurch
jonchurch / chars.md
Last active May 2, 2020 00:05
Dune Characters, most of em

Spice / Melange / Geriatric Spice

The stuff that must flow, idk why it has so many names.

Paul Atreides

The protagonist of Dune. Paul is the son of Duke Leto Atreides and is the heir to the House of the Atreides. At the beginning of the novel, Paul is fifteen years old. He has been trained from birth to fulfill the role of duke, and he is adept at combat and strategic thinking.

Jessica

@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
#!/bin/bash
# Basic user preference setup
sudo yum update -y
sudo yum install -y git zsh tmux util-linux-user
cd /home/ec2-user || exit
# oh-my-zsh
@jonchurch
jonchurch / v3.2.0.txt
Created February 28, 2020 23:31
path-to-regexp pack size
npm notice
npm notice 📦 path-to-regexp@3.2.0
npm notice === Tarball Contents ===
npm notice 1.1kB LICENSE
npm notice 10.5kB index.js
npm notice 1.1kB package.json
npm notice 5.5kB History.md
npm notice 9.0kB Readme.md
npm notice 3.7kB index.d.ts
npm notice === Tarball Details ===
@jonchurch
jonchurch / timeoutTest.js
Created February 19, 2020 01:13
Thinking through timeouts
const https = require('https');
const options = {
host: 'exoplanetarchive.ipac.caltech.edu',
path: '/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=*&format=json',
// apply an initial timeout which will apply to the connect event
timeout: 2000,
};
const beforeRequest = Date.now();
@jonchurch
jonchurch / gqlScratch.js
Created January 29, 2020 05:11
Scratch for getting Github Issues from a list of orgs
require('dotenv').config()
const fetch = require('node-fetch')
const GITHUB_GRAPHQL_URL = 'https://api.github.com/graphql'
const headers = { Authorization: `bearer ${process.env.GITHUB_TOKEN}`, 'Content-Type': 'application/json' }
async function getRepoCountForOrg (org) {
const query = `query($org: String!){
organization(login: $org) {
repositories{
totalCount