Skip to content

Instantly share code, notes, and snippets.

@jaredreich
jaredreich / withAsyncErrorHandling.js
Created September 16, 2019 15:46
Scoped component async event error handling in React
const reservedClassMethodNames = {
componentDidCatch: 1,
componentDidMount: 1,
componentDidUpdate: 1,
componentWillMount: 1,
componentWillReceiveProps: 1,
componentWillUnmount: 1,
componentWillUpdate: 1,
constructor: 1,
getDerivedStateFromError: 1,
@jaredreich
jaredreich / git_fetch_fork_upstream.txt
Created May 8, 2019 23:40
Git fetch fork upstream
git fetch upstream
git checkout master
git merge upstream/master
git push
@jaredreich
jaredreich / crypto_browser.js
Created April 11, 2019 14:23
Browser-side JavaScript AES Encryption
const crypto = require('sjcl')
const iter = 1000
const ks = 256
export const decrypt = (password, encrypted) => crypto.decrypt(password, encrypted)
export const encrypt = (password, text) => crypto.encrypt(password, text, { iter, ks })
@jaredreich
jaredreich / fix.sh
Created February 15, 2019 16:21
Fix font issue in macOS Mojave
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
@jaredreich
jaredreich / system-font.css
Created February 7, 2019 04:38
System Font
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
@jaredreich
jaredreich / git_turn_off_pager.bash
Created October 31, 2018 12:56
Git 2.16+ turn off pager mode
git config --global pager.branch false
# OR
git config --global pager false
@jaredreich
jaredreich / system_font_stack.css
Created October 29, 2018 20:36
System Font Stack CSS Style
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
@jaredreich
jaredreich / spacer.bash
Created October 1, 2018 12:03
How to add spaces to your Mac's Dock using Terminal
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
@jaredreich
jaredreich / uninstall_n.md
Created September 6, 2018 17:03
How to uninstall n
sudo n prune
sudo npm uninstall -g n
sudo rm -r /usr/local/n
sudo rm /usr/local/bin/node
@jaredreich
jaredreich / delete_node_modules.sh
Last active July 10, 2018 13:02
Delete all node_modules
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
# or with trash-cli
find . -name node_modules -type d -prune -exec trash {} +