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
/** | |
* Return the string repeated {multiplier} times. | |
* | |
* @param {Number} multiplier Number of times to repeat the string. | |
* @returns {String} The repeated string. | |
*/ | |
if (!String.prototype.repeat) { | |
String.prototype.repeat = function (multiplier) { | |
return new Array(multiplier + 1).join(this); | |
}; |
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
/** | |
* Pad a string to a certain length with another string. | |
* | |
* @param {Number} size The resulting padded string length. | |
* @param {String} [str=" "] String to use as padding. | |
* @returns {String} The padded string. | |
*/ | |
if (!String.prototype.leftPad) { | |
String.prototype.leftPad = function (length, str) { | |
if (this.length >= length) { |
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
/** | |
* Create a string from a template. | |
* | |
* Returns a new string with all "<%variables%>" replaced with their corresponding | |
* properties from the given object argument. | |
* | |
* Example: | |
* <code> | |
* var data = { | |
* name: 'Scott', |
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
/** | |
* Removes whitespace from both ends of the string. | |
* | |
* @returns {String} The trimmed string. | |
*/ | |
if (!String.prototype.trim) { | |
String.prototype.trim = function () { | |
return this.replace(/^\s+|\s+$/g, ''); | |
}; | |
} |
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
#!/usr/bin/env bash | |
# Usage: goo.gl [URL] | |
# | |
# Shorten a URL using the Google URL Shortener service (http://goo.gl). | |
goo.gl() { | |
[[ ! $1 ]] && { echo -e "Usage: goo.gl [URL]\n\nShorten a URL using the Google URL Shortener service (http://goo.gl)."; return; } | |
curl -qsSL -m10 --connect-timeout 10 \ | |
'https://www.googleapis.com/urlshortener/v1/url' \ | |
-H 'Content-Type: application/json' \ | |
-d '{"longUrl":"'${1//\"/\\\"}'"}' | |
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.css | |
* WebKit Inspector styles for Google Chrome | |
* | |
* by Scott Buchanan <[email protected]> | |
* http://wafflesnatcha.github.com | |
* | |
* Fugue Icons by Yusuke Kamiyamane | |
* http://p.yusukekamiyamane.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
/** | |
* JSONView.css | |
* Custom Stylesheet for the JSONView Chrome extension | |
* | |
* by Scott Buchanan <[email protected]> | |
* http://wafflesnatcha.github.com | |
*/ | |
html, body { | |
margin: 0; |