Last active
September 3, 2016 15:58
-
-
Save rsurjano/8c12d9deb6866c166e19f8445a8352a1 to your computer and use it in GitHub Desktop.
Web Utils
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 getAbsoluteUrl = (function() { | |
var a; | |
return function(url) { | |
if(!a) a = document.createElement('a'); | |
a.href = url; | |
return a.href; | |
}; | |
})(); | |
// Usage | |
getAbsoluteUrl('/something'); |
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.parseHashtag = function() { | |
return this.replace(/[#]+[A-Za-z0-9-_]+/g, function(t) { | |
var tag = t.replace("#","%23") | |
return t.link("http://search.twitter.com/search?q="+tag); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment