Skip to content

Instantly share code, notes, and snippets.

View wafflesnatcha's full-sized avatar
💭
what the fuck is this prompt

Scott Buchanan wafflesnatcha

💭
what the fuck is this prompt
View GitHub Profile
@wafflesnatcha
wafflesnatcha / JSONView.css
Last active November 21, 2016 07:02
JSONView.css - Custom Stylesheet for the JSONView Chrome extension
/**
* JSONView.css
* Custom Stylesheet for the JSONView Chrome extension
*
* by Scott Buchanan <buchanan.sc@gmail.com>
* http://wafflesnatcha.github.com
*/
html, body {
margin: 0;
@wafflesnatcha
wafflesnatcha / Custom.css
Created September 11, 2012 01:07
Custom.css - WebKit Inspector styles for Google Chrome
/**
* Custom.css
* WebKit Inspector styles for Google Chrome
*
* by Scott Buchanan <buchanan.sc@gmail.com>
* http://wafflesnatcha.github.com
*
* Fugue Icons by Yusuke Kamiyamane
* http://p.yusukekamiyamane.com
*/
@wafflesnatcha
wafflesnatcha / goo.gl.sh
Last active March 13, 2018 04:49
Bash: goo.gl # Shorten a URL using the Google URL Shortener service (http://goo.gl).
#!/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//\"/\\\"}'"}' |
@wafflesnatcha
wafflesnatcha / String.trim.js
Created September 10, 2012 22:06
JavaScript: String.trim()
/**
* 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, '');
};
}
@wafflesnatcha
wafflesnatcha / String._template.js
Created September 10, 2012 22:05
JavaScript: String._template()
/**
* 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',
@wafflesnatcha
wafflesnatcha / String.leftPad.js
Last active June 10, 2024 12:49
JavaScript: String.leftPad()
/**
* 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) {
@wafflesnatcha
wafflesnatcha / String.repeat.js
Created September 10, 2012 22:02
JavaScript: String.repeat()
/**
* 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);
};