Skip to content

Instantly share code, notes, and snippets.

@kara-ryli
kara-ryli / implementation.js
Created July 8, 2011 20:01
Create a singleton class in YUI3. This class can only be instantiated one time. All later instantiations return references to the original.
YUI().use("singleton-class", function (Y) {
var instance1 = new Y.SingletonClass(),
instance2 = new Y.SingletonClass();
Y.log(instance1 === instance2); // true!
window.instance1 = instance1;
});
YUI().use("singleton-class", function (Y) {
@DTrejo
DTrejo / .gitignore
Created April 4, 2011 03:32
How to Readline - an example and the beginnings of the docs
node_modules/
@curtisharvey
curtisharvey / loader.js
Created July 29, 2010 06:55
YUI seed loader
/**
* Light-weight YUI-dependend Script Loader
* - loads YUI 3 if not already loaded
* - then loads your script(s)
*
* Useful for dynamically loaded modules, injected scripts, bookmarklets, etc…
*/
(function() {
// YUI to load if unavailable