Skip to content

Instantly share code, notes, and snippets.

View ghostrocket's full-sized avatar

Keith Fitzgerald ghostrocket

View GitHub Profile
@ghostrocket
ghostrocket / gist:801929
Created January 29, 2011 15:46
javascript curry
Function.prototype.curry = function curry() {
var fn = this, args = Array.prototype.slice.call(arguments);
return function curryed() {
return fn.apply(this, args.concat(Array.prototype.slice.call(arguments)));
};
};
// pulled from this stackoverflow.com post http://stackoverflow.com/questions/4674021/xhr-get-request-url-in-onreadystatechange
@ghostrocket
ghostrocket / gist:799429
Created January 27, 2011 22:30
Cross Browser Date Parse for Twitter created_at
var date = new Date(Date.parse(twitter_response[0].created_at.replace(/( \+)/, ' UTC$1')));
@ghostrocket
ghostrocket / tweet-linkify.js
Created December 31, 2010 16:54
Linkify Tweet in Javascript
String.prototype.linkify_tweet = function() {
var tweet = this.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,"<a href='$1'>$1</a>");
tweet = tweet.replace(/(^|\s)@(\w+)/g, "$1<a href=\"http://www.twitter.com/$2\">@$2</a>");
return tweet.replace(/(^|\s)#(\w+)/g, "$1<a href=\"http://search.twitter.com/search?q=%23$2\">#$2</a>");
};