Skip to content

Instantly share code, notes, and snippets.

String.prototype.template = function (scopeEval) {
// Andrea Giammarchi - WTFPL License
var
re = /\$\{([\S\s]*?)\}/g,
evaluate = [],
i = 0,
m
;
while (m = re.exec(this)) {
evaluate.push(
@bga
bga / z.js
Created February 27, 2012 12:31 — forked from heapwolf/z.js
z
var match = []
var _finalizeExpr = function(match) {
var vs = match[0]
var _iter = match[1]
var _done = match[2]
var i = 0
var _iterWrappper = function() {
if(i === vs.length) {
/* No regexp. indexOf only */
window._queryToJSON = function(query)
{
if(query == null || query.length < 2)
return {};
var p = 0;
if(query.charAt(p) == '?')
++p;