Skip to content

Instantly share code, notes, and snippets.

View zbabtkis's full-sized avatar

Zachary Babtkis zbabtkis

View GitHub Profile
@zbabtkis
zbabtkis / DataBind.js
Created January 4, 2014 00:58
Tiny JavaScript data-binder using Object.observe.
var DataBind = function(el, model) {
this.el = el;
this.model = model;
// Bind event handlers to this.
this._updateModel = this._updateModel.bind(this);
this._updateEl = this._updateEl.bind(this);
Object.observe(model, this._updateEl);
this.el.addEventListener('keyup', this._updateModel, false);
@zbabtkis
zbabtkis / easyIndex.js
Last active August 29, 2015 13:56
IndexedDB Made Easy
;(function(exports) {
var IDB = this.indexedDB || this.mozIndexedDB || this.webkitIndexedDB || this.msIndexedDB;
function Database(options) {
if (!options) throw new Database.DatabaseConstructorError;
this.version = options.version;
this.name = options.database;
this.initialize = options.initialize;
}