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
| // Create a new class by subclassing Class | |
| var MyClass = Class.subclass(function(Public, Private){ | |
| Public.implement([Events, Options]); | |
| Public.method = function(arg){ | |
| console.log('grand pappy Method!'); | |
| }; | |
| Public.methodWithAName = methodWithAName; |
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
| // Current MooTools 1.2 Class subclass syntax | |
| // all methods are wrapped | |
| // to provide protected support | |
| // and `this.parent` | |
| var Dude = new Class({ | |
| Extends: Person, | |
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 Person = Class.subclass(function(def, Protected, Generic, Parent){ | |
| // Private | |
| // Available to all methods in this definition | |
| var private_variable; | |
| // Protected | |
| // Available to this Class, its instances, all subclasses and all their instances | |
| // Protected methods are bound to each instance |
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
| // Do some more of the same sort of stuff with another DB search | |
| // Bind the DB to the UI | |
| MyDBDSL("#big") | |
| .change(function(){ | |
| var rows = MyDBDSL(this).rows(); | |
| jQuery("#products #big").removeClass('db-error') | |
| .find("form .db-invalid").removeClass('db-invalid').end() | |
| .find("table").html( rows.html() ); | |
| }) |
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
| /* | |
| --- | |
| source : http://gist.github.com/gists/311328 | |
| provides : getArg | |
| description : Get an array of arguments with accessing `arguments` | |
| version : Rough proof-of-concept | |
| author : Thomas Aylott | |
| site : SubtleGradient.com |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>bundleUUID</key> | |
| <string>4A3012B7-3A3F-4B2A-871C-2E6266BC0A21</string> | |
| <key>fileTypes</key> | |
| <array> | |
| <string>html</string> | |
| <string>htm</string> |
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
| Array.append(array,array2) // MooTools 1.3wip | |
| Array.clean(array) // MooTools 1.3wip | |
| Array.combine(array,array2) // MooTools 1.3wip | |
| Array.concat(array[,item1[,item2[,...]]]) // JavaScript 1.6 | |
| Array.contains(array,item[,from]) // MooTools 1.3wip | |
| Array.empty(array) // MooTools 1.3wip | |
| Array.erase(array,item) // MooTools 1.3wip | |
| Array.every(array,callback[,thisObject]) // JavaScript 1.6 | |
| Array.every(array,fn[,bind]) // MooTools 1.3wip | |
| Array.filter(array,callback[,thisObject]) // JavaScript 1.6 |
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 Person = Class.subclass(function(def, Protected, Generic, Parent){ | |
| // Private | |
| // Available to all methods in this definition | |
| var private_variable; | |
| // Protected | |
| // Available to this Class, its instances, all subclasses and all their instances | |
| // Protected methods are bound to each instance |
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
| // Swap classes onload and domready | |
| $(function(){ $('html').removeClass('not-ready').addClass('ready'); }); // jQuery | |
| $(window).load(function(){ $('html').removeClass('loading').addClass('loaded'); }); | |
| // target a specific version | |
| if (navigator.isIE == 6){ | |
| // do stuff for IE6 | |
| } | |
| // Deliever different behaviour for a group of IE versions |
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 iterations = 999999, control = '', eq_same = '', seq_same = '', eq_diff = '', seq_diff = '', st, en; | |
| setTimeout(function(){ | |
| st = +new Date(); | |
| for (i = 0; i < iterations; i++); | |
| en = +new Date(); | |
| control = en - st; | |
| print(); | |
| },100); |