Skip to content

Instantly share code, notes, and snippets.

View w0rm's full-sized avatar
🧘
ヨガの呼吸

Andrey Kuzmin w0rm

🧘
ヨガの呼吸
View GitHub Profile
@w0rm
w0rm / state.js
Created May 16, 2016 12:29 — forked from WebReflection/state.js
Prototypal inheritance used to define states.
/*! (c) 2016 Andrea Giammarchi - MIT Style License */
// simple state-like objects handler
// based on prototypal inheritance
function State() {'use strict';}
// States are serializable dictionaries
// toJSON and toString are the only reserved keywords
// every other name can be used as name (included __proto__)
@w0rm
w0rm / callbackhell.js
Last active August 29, 2015 13:57 — forked from keriati/callbackhell.js
var AwesomeObject = function() {
this.init()
};
AwesomeObject.prototype = {
init: function() {
_.bindAll(this, 'onSuccess', 'onError', 'onComplete')
// or
this.onSuccess = $.proxy(this.onSuccess, this)