This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// custom RegEx Class | |
// let string: String = "foo bar baz" | |
// let regex: Regex = "foo" | |
// regex.match(string) // true | |
// "foo".match(string) // true | |
// "foo bar baz" =~ "foo" // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*----------------------- OMG TWITTER -------------------------------------*/ | |
twttr.mediaType('twttr.media.types.Twitter') | |
.matcher(/\b(?:(?:https?\:\/\/)?(?:www\.)?)?twitter\.com\/(?:(?:#|#!)\/)?(?:\w{1,20})\/status\/(\S+)/gi) | |
.icon("generic") | |
.favicon("http://twitter.com/phoenix/favicon.ico") | |
.url('http://twitter.com') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
twttr.klass('twttr.util.Location', function(url) { | |
if (url.match(/^\/\//)) { | |
url = 'http:' + url; | |
} else if (!url.match(/^[a-z]+:\/\//)) { | |
url = 'http://' + url; | |
} | |
var m = url.match(/^([a-z]+:)\/\/([\w\-\.]+)(\:\d+)?(.+)?/); | |
this.href = url; | |
this.protocol = m[1]; | |
this.hostname = m[2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
window.twttr = window.twttr || {}; | |
aug(twttr, { | |
klass: function(ns, init) { | |
var c = function() { | |
init.apply(this, arguments); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new TWTR.Widget({ | |
version: 2, | |
type: 'profile', | |
rpp: 20, | |
interval: 6000, | |
width: 'auto', | |
height: 300, | |
theme: { | |
shell: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* requires twttr.klass | |
*/ | |
twttr.klass('twttr.Throttler', function(interval, callback) { | |
this.interval = interval; | |
this.callback = callback; | |
this._items = []; | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var table = ['i', 'v', 'x', 'l', 'c', 'd', 'm']; | |
var map = { | |
4: "01", | |
5: "1", | |
6: "10", | |
7: "100", | |
8: "1000", | |
9: "02" | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.domain = 'dustindiaz.com'; | |
function fn () { | |
document.write = ""; | |
window.top.location = window.self.location; | |
setTimeout(function() { | |
document.body.innerHTML = ''; | |
}, 0); | |
window.self.onload = function(evt) { | |
document.body.innerHTML = ''; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.supplant = function (o) { | |
return this.replace(/{([^{}]*)}/g, function (a, b) { | |
var r = o[b]; | |
return typeof r === 'string' || typeof r === 'number' ? r : a; | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* replace faux text (sometimes html) into html with paragraphs - or whatever that thing wordpress does to their posts */ | |
function paragraphs(story) { | |
story = story.replace(/<pre>([\s\S]*)<\/pre>/g, function (m, content) { | |
return '<pre>' + content.replace(/\n/g, 'iiiiii') + '</pre>'; | |
}); | |
return _(story.split('\n')).compact().map(function(par, i) { | |
return par == '' || par.match(/^(<p(?:re)?>|\s+)/) ? par : '<p>' + par + '</p>'; | |
}).join('\n').replace(/<p><\/p>/g, '').replace(/(i{6})/g, '\n'); | |
} |
OlderNewer