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 parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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
/*! | |
* ES6 Unicode Shims 0.1 | |
* (c) 2012 Steven Levithan <http://slevithan.com/> | |
* MIT License | |
*/ | |
/** | |
* Returns a string created using the specified sequence of Unicode code points. Accepts integers | |
* between 0 and 0x10FFFF. Code points above 0xFFFF are converted to surrogate pairs. If a provided | |
* integer is in the surrogate range, it produces an unpaired surrogate. Comes from accepted ES6 |
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
package main | |
import "code.google.com/p/go-tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
// Allocate two-dimensioanl array. | |
a := make([][]uint8, dy) | |
for i := 0; i < dy; i++ { | |
a[i] = make([]uint8, dx) | |
} |
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
/* | |
* jquery.autogrow.js | |
* | |
* A plugin written for UserVoice that makes it easy to create textareas | |
* that automatically resize to fit their contents. | |
* | |
* Based on Scott Moonen's original code for Prototype.js: | |
* | |
* <http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/> | |
* |
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
// Turns out this function already exists in Sass: mix(fg, bg, %) (http://d.pr/mGqa) | |
// Alpha blending | |
@function blend($bg, $fg) { | |
$r: red($fg) * alpha($fg) + red($bg) * (1 - alpha($fg)); | |
$g: green($fg) * alpha($fg) + green($bg) * (1 - alpha($fg)); | |
$b: blue($fg) * alpha($fg) + blue($bg) * (1 - alpha($fg)); |
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
// from: http://jsfiddle.net/SubtleGradient/Qfawx/ | |
// copied here only because "gists" are slightly easier for me to read | |
// classic (oldschool) | |
(function(){/*IIFE*/})(); | |
// new standard | |
(function(){/*IIFE*/}()); | |
// lol, square |
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
#!/bin/sh | |
# | |
# convert bitmap to SVG, works well with pen and ink drawings .. | |
# | |
set -e | |
for file in "$@" | |
do | |
# lose suffix to grab file basename | |
suffix=$(echo "$file" | sed 's/.*\.//') | |
svg=$(basename "$file" ".$suffix").svg |
NewerOlder