Skip to content

Instantly share code, notes, and snippets.

@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 / get.js
Last active March 28, 2018 23:44
Check and return nested javascript object via key (array support)
const get = (obj, target, fallback) => {
try {
return eval(`obj${target}`)
} catch (e) {
return fallback
}
}
const obj = {
a: {
@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
@jaredreich
jaredreich / full_path_macos_finder_title_bar.txt
Last active March 18, 2018 14:06
Show full path in macOS finder title bar
ON:
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true; killall Finder
OFF:
defaults write com.apple.finder _FXShowPosixPathInTitle -bool false; killall Finder
@jaredreich
jaredreich / client.js
Created February 27, 2018 20:51
iframe scroll to bottom detection (cross browser, including mobile safari)
window.addEventListener('scroll', handleScroll);
window.addEventListener('message', handleMessage);
handleMessage = (event) => {
if (event.data === 'scrolledToBottom') handleScrolledToBottom();
}
handleScroll = () => {
if ((window.innerHeight + window.pageYOffset) >= window.document.body.scrollHeight) {
this.handleScrolledToBottom();

Keybase proof

I hereby claim:

  • I am jaredreich on github.
  • I am jaredreich (https://keybase.io/jaredreich) on keybase.
  • I have a public key ASCnzRC35EEGKbWFMBYHVcj6t97dtlr8DzS2_Mj7lqc16go

To claim this, I am signing this object:

@jaredreich
jaredreich / index.html
Created September 30, 2017 12:16
Text gradient with CSS
<h1>
The quick brown fox jumped over the lazy dog.
</h1>
@jaredreich
jaredreich / uuid-v4.js
Last active March 7, 2017 17:08
Generate an RFC4122 version 4 compliant UUID
const generateUUID = () => (
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = Math.random() * 16 | 0
const v = c === 'x' ? r : (r & 0x3 | 0x8)
return v.toString(16)
})
)
@jaredreich
jaredreich / countries.json
Created October 13, 2016 22:21
JSON Country List
[
{
"value":"AF",
"text":"Afghanistan"
},
{
"value":"AX",
"text":"Åland Islands"
},
{
const cookies = {
set: (name, value, days) => {
const date = new Date()
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000))
const expires = 'expires=' + date.toUTCString()
document.cookie = name + '=' + value + '; ' + expires
},
get: () => {
console.log('get')
}