Skip to content

Instantly share code, notes, and snippets.

@jaredreich
jaredreich / checkWebPSupport.js
Created February 20, 2019 15:02
Check WebP support browser-side
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 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 {} +
@jaredreich
jaredreich / script.txt
Created April 9, 2018 14:39
Run webpack with more memory space
node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js
@jaredreich
jaredreich / international_ip_addresses.txt
Created March 21, 2018 22:19
International IP Addresses
AU: 103.25.59.108
GB: 159.65.60.201
US: 35.226.78.115