Skip to content

Instantly share code, notes, and snippets.

Jared Reich jaredreich

View GitHub Profile
View git_cli_reset_password.sh
git config --global credential.helper osxkeychain
@jaredreich
jaredreich / mac_mouse_acceleration.sh
Created Nov 29, 2019
Turn off mac mouse acceleration
View mac_mouse_acceleration.sh
defaults write -g com.apple.mouse.scaling -1
defaults write -g com.apple.trackpad.scaling -1
@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";
}
You can’t perform that action at this time.