Skip to content

Instantly share code, notes, and snippets.

Jared Reich jaredreich

Block or report user

Report or block jaredreich

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jaredreich
jaredreich / withAsyncErrorHandling.js
Created Sep 16, 2019
Scoped component async event error handling in React
View withAsyncErrorHandling.js
const reservedClassMethodNames = {
componentDidCatch: 1,
componentDidMount: 1,
componentDidUpdate: 1,
componentWillMount: 1,
componentWillReceiveProps: 1,
componentWillUnmount: 1,
componentWillUpdate: 1,
constructor: 1,
getDerivedStateFromError: 1,
View git_fetch_fork_upstream.txt
git fetch upstream
git checkout master
git merge upstream/master
git push
@jaredreich
jaredreich / crypto_browser.js
Created Apr 11, 2019
Browser-side JavaScript AES Encryption
View crypto_browser.js
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 / checkWebPSupport.js
Created Feb 20, 2019
Check WebP support browser-side
View checkWebPSupport.js
const supportsWebP = () => new Promise(resolve => {
const webP = new Image();
webP.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='; // 1x1 black pixel
webP.onload = webP.onerror = () => resolve(webP.height === 1);
})
supportsWebP().then(hasWebP => console.log(hasWebP));
@jaredreich
jaredreich / fix.sh
Created Feb 15, 2019
Fix font issue in macOS Mojave
View fix.sh
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
View system-font.css
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 Oct 31, 2018
Git 2.16+ turn off pager mode
View git_turn_off_pager.bash
git config --global pager.branch false
# OR
git config --global pager false
@jaredreich
jaredreich / system_font_stack.css
Created Oct 29, 2018
System Font Stack CSS Style
View system_font_stack.css
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 Oct 1, 2018
How to add spaces to your Mac's Dock using Terminal
View spacer.bash
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
View uninstall_n.md
sudo n prune
sudo npm uninstall -g n
sudo rm -r /usr/local/n
sudo rm /usr/local/bin/node
You can’t perform that action at this time.