Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lwansbrough on github.
  • I am loch (https://keybase.io/loch) on keybase.
  • I have a public key whose fingerprint is 6E9E 3263 B559 E193 A881 B536 2A39 05A0 09ED 9401

To claim this, I am signing this object:

//
// ObjectStore.h
//
// Created by Lochlan Wansbrough on 2015-06-06.
// Copyright (c) 2015 Facebook. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ObjectStore : NSObject
@lwansbrough
lwansbrough / untemplate.js
Last active December 20, 2015 00:28
"Un-templates" a DOM element which has been templated with a known *Mustache* template. Essentially, given the HTML content of a DOM element and the template used to create it, this function will return the object that was applied to the template.
var untemplate = (function() {
this.tokenize = function(html, template) {
var names = [],
obj = {},
encodedHtml = escape(html);
var templateRegex = new RegExp(escape(template).replace(/[\\\/\.\-\*]/g, function(match) {
return '\\' + match;
}).replace(/%7B%7B([^(?:%7B)]+?)%7D%7D/g, function(match, name) {
names.push(name);