Let's close the ultra-small library cycle with some awesome array-based templating. 323 bytes minified.
Just download the minified version here or include it into your code:
| /** | |
| * Simple localStorage with Cookie Fallback | |
| * v.1.0.0 | |
| * | |
| * USAGE: | |
| * ---------------------------------------- | |
| * Set New / Modify: | |
| * store('my_key', 'some_value'); | |
| * | |
| * Retrieve: |
| # Usage: IE={box} vagrant up | |
| # | |
| # Eg. IE=XPIE6 vagrant up | |
| # | |
| # Password: Passw0rd! | |
| boxes = { | |
| "XPIE6" => "http://aka.ms/ie6.xp.vagrant", | |
| "XPIE8" => "http://aka.ms/ie8.xp.vagrant", | |
| "VistaIE7" => "http://aka.ms/ie7.vista.vagrant", |
| package main | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| ) | |
| func rootHandler(w http.ResponseWriter, r *http.Request) { |
Let's close the ultra-small library cycle with some awesome array-based templating. 323 bytes minified.
Just download the minified version here or include it into your code:
| function sprintf(){ | |
| var args = Array.prototype.slice.call(arguments), f:Array = [], str = args.shift().split("%s"); | |
| while (str.length) { | |
| f.push(str.shift(), args.shift() || ""); | |
| } | |
| return f.join(""); | |
| } | |
| trace(sprintf("Hello %s, how ya %s?", "motherf*cker", "durin")); |
| 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" |