Skip to content

Instantly share code, notes, and snippets.

View dieseltravis's full-sized avatar
🆗
I'm ok

Travis Hardiman dieseltravis

🆗
I'm ok
View GitHub Profile
@dieseltravis
dieseltravis / twitter tweets not tweeted.txt
Last active August 29, 2015 13:57
Tweets for @twitter for whenever my account (@travis) gets unsuspended #freetravis
2014-02-28 Hey @support, why is my @twitter account suspended? #freetravis
2014-03-01 I can't believe it's March already! I'm still writing SUSPENDED on all my checks! #freetravis
2014-03-02 I have a great idea for the opening of these #Oscars: Queen Latifah, superbike burnout, & U.N.I.T.Y.
2014-03-03 Still suspended, was it something I said @support? #freetravis
2014-03-04 Still suspended, did I block too many people @support? #freetravis
2014-03-05 Still suspended, is it because of #poopin' @support? #freetravis
2014-03-06 Come on @twitter at least let me have my stuff http://mlkshk.com/p/XP9E @support #freetravis
2014-03-06 Maybe I ran out of stars @support? http://mlkshk.com/p/XPZG #freetravis
2014-03-07 Still suspended, but TGIF @support amirite?? #freetravis
2014-03-08 Still suspended, but don't worry @support, I'm getting my jig on tonight. #freetravis
@dieseltravis
dieseltravis / toBaseX.js
Last active August 29, 2015 13:57
js custom number base
// base 10 integer to custom any base string
var toBaseX = function (value, baseChars) {
var result = "";
var targetBase = baseChars.length;
do {
result = baseChars[value % targetBase] + result;
value = Math.floor(value / targetBase);
} while (value);
@dieseltravis
dieseltravis / shortChecksum.js
Last active August 29, 2015 13:57
short date checksum for getting a short string to use to version static assets by date last edited
// custom any base
var baseChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~-_.".split("");
toBaseX = function (value) {
var result = "";
var targetBase = baseChars.length;
do {
result = baseChars[value % targetBase] + result;
value = Math.floor(value / targetBase);
} while (value);
@dieseltravis
dieseltravis / getIndex.js
Created April 4, 2014 04:50
get the index of an item in an array for a certain property's value
var getIndex = function (list, prop, val) {
for (var l = list.length; l--;) {
if (list[l][prop] === val) {
return l;
}
}
return -1;
};
// e.g.
@dieseltravis
dieseltravis / getFilteredList.js
Created April 4, 2014 04:58
get an item in an array for a particular property value, and also return a subset of the array for a given length, the item will be in the middle, if possible
var getFilteredList = function (list, max, prop, val) {
var rows = [],
mid = Math.floor(max / 2),
found = false;
for (var i = 0, l = list.length; i < l && (mid > 0 || rows.length < max); i++) {
rows.push(list[i]);
if (rows.length > max) {
rows.shift();
}
@dieseltravis
dieseltravis / keybase.md
Created April 5, 2014 18:01
keybase.io

Keybase proof

I hereby claim:

  • I am dieseltravis on github.
  • I am trav (https://keybase.io/trav) on keybase.
  • I have a public key whose fingerprint is 42A6 0F1B D344 4EF0 50F1 DAC0 CE6A B86B 0140 C4EA

To claim this, I am signing this object:

@dieseltravis
dieseltravis / tabs.css
Created April 6, 2014 03:38
tab width css
* {
tab-size: 2;
}
@dieseltravis
dieseltravis / favicon.css
Created April 17, 2014 19:02
favicon images for links using the getfavicon.appspot.com service
a.favicon {
display: inline-block;
padding-left: 1.5em;
background-size: 1.25em 1.25em;
background-repeat: no-repeat;
background-position: left center;
}
@dieseltravis
dieseltravis / templates.xsl
Created April 17, 2014 23:13
a bunch of stupid xsl templates that should've been built-in for xslt but aren't
<xsl:template name="break">
<xsl:param name="text" select="."/>
<xsl:call-template name="replace">
<xsl:with-param name="text" select="$text" />
<xsl:with-param name="match" select="'&#xa;'" />
<xsl:with-param name="replacement" select="'\n'" />
</xsl:call-template>
</xsl:template>
@dieseltravis
dieseltravis / cloudcat.coffee
Created May 23, 2014 20:39
this is a plugin script for hubot, I'd like to share it, but I'm too lazy to fork and build a whole module just to share a few lines of code
# Description:
# clouds, cats, etc.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands: