This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function clone(o) { | |
| return Object.create( | |
| Object.getPrototypeOf(o), | |
| Object.getOwnPropertyDescriptors(o) | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var chatServer = { | |
| /** | |
| * Invoke function. callback will be invoked with (err, list). error is any server error and list is JSON format | |
| * of some yet to be defined type that basically covers all your contact list rendering need | |
| **/ | |
| getContacts: function (callback) { /* code you don't care about */ }, | |
| /** | |
| * Callback will be invoked with (err, call) | |
| * | |
| **/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Pretty fast - http://jsperf.com/select-vs-natives-vs-jquery | |
| /* | |
| By, shortcuts for getting elements. | |
| */ | |
| var By = { | |
| id: function (id) { return document.getElementById(id) }, | |
| tag: function (tag, context) { | |
| return (context || document).getElementsByTagName(tag) | |
| }, | |
| "class": function (klass, context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var pd = require("npm::pd/src/pd"); | |
| var requestAnimationFrame = | |
| webkitRequestAnimationFrame || | |
| mozRequestAnimationFrame || | |
| oRequestAnimationFrame || | |
| msRequestAnimationFrame || | |
| requestAnimationFrame; | |
| var EventEmitter = pd.Base.make({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mixed_in = extend({ ... }, a, b); | |
| var composited = { | |
| constructor: function () { | |
| this.a = a; | |
| this.b = b; | |
| }, | |
| ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var SubKlass = Klass.make(...mixins); | |
| var SubKlass = Object.create(Klass); | |
| extend(SubKlass, ...mixins); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var slice = Array.prototype.slice | |
| function iterativelyWalk(nodes, cb) { | |
| nodes = slice.call(nodes) | |
| while(nodes.length) { | |
| var node = nodes.shift(), | |
| ret = cb(node) | |
| if (ret) { |