Skip to content

Instantly share code, notes, and snippets.

View tylor's full-sized avatar

Tylor Sherman tylor

View GitHub Profile
@tylor
tylor / gist:e1ebf330dd4d1797d6a6
Last active August 29, 2015 14:03
EAST VAN logo generator in bash
VAN=`egrep -i "^...$" /usr/share/dict/words | perl -MList::Util=shuffle -e "print shuffle<STDIN>" | head -n 1 | tr "[:lower:]" "[:upper:]"` && \
LETTER=${VAN:1:1} && \
EAST=`egrep -i "^.${LETTER}..$" /usr/share/dict/words | perl -MList::Util=shuffle -e "print shuffle<STDIN>" | head -n 1 | tr "[:lower:]" "[:upper:]"` && \
echo " ${EAST:0:1}" && \
echo $VAN && \
echo " ${EAST:2:1}" && \
echo " ${EAST:3:1}"
@tylor
tylor / gist:dfb1a9b4fc40db80935a
Last active August 29, 2015 14:05
Such sign in
I always forget I'm signed in with my personal GMail account, and want
to access our businesses Google Analytics, so here's what happens:
1. Load up http://www.google.com/analytics/
2. Click 'Access Google Analytics'
3. Woops, wrong account. Click 'Sign out'
4. Choose business account
5. Enter password
6. Takes me to 'Personal Info - Account Settings'
7. Load up http://www.google.com/analytics/
@tylor
tylor / index.js
Last active November 1, 2016 00:40
Pumpkin Patch Code
/**
* Handy commands for setting everything up:
*
* Get Particle access token:
* $ curl https://api.particle.io/oauth/token -u particle:particle -d grant_type=password -d username={Your Particle email address} -d password={Your Particle password}
*
* Get list of devices from Particle:
* $ curl "https://api.particle.io/v1/devices?access_token={Your Particle access token}"
*
### Keybase proof
I hereby claim:
* I am tylor on github.
* I am tylorsherman (https://keybase.io/tylorsherman) on keybase.
* I have a public key ASCzt3oU8N8wUbRji-ONxVuvuHS0Ox2x48oqm5kNnnOSAwo
To claim this, I am signing this object:
@tylor
tylor / word_wrap.js
Created April 9, 2020 17:49
JavaScript JS port of Ruby word_wrap
// Port of Rails word_wrap(): https://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/text_helper.rb#L260
// rstrip using: https://stackoverflow.com/a/1418059
const word_wrap = (text, line_width, break_sequence) => {
line_width = line_width || 80
break_sequence = break_sequence || "\n"
return text.split("\n").map((line) => {
return line.length > line_width ? line.replace(new RegExp(`(.{1,${line_width}})(\\s+|$)`, 'gm'), `$1${break_sequence}`).replace(/^\s+|\s+$/g, '') : line
}).join("\n")
}