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 list = ""; | |
var items = [ | |
{name: "Item A", url: "/#item-a"} | |
, {name: "Item B", url: "/#item-b"} | |
, {name: "Item C", url: "/#item-c"} | |
]; | |
$.each( items, function(i, item) { | |
list += '<li><a href="' + item.url + '">'; | |
list += item.name; |
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 Comparator=Comparator||(function(){var c=function(g,f){return this[g]===f};var a=function(f){if(!this.hasOwnProperty(f)){this[f]=undefined}};var b=function(g,m,f){var k=g.prototype,o=(f?f.length:0),j=0,l,h;for(j;j<o;j++){l=f[j];h="is"+l.replace(/^./,l.match(/^./)[0].toUpperCase());if(k[h]===undefined){k[h]=(function(){return c}(m,l))}}};var d=function(g,k,f){var i=g.prototype,h,j;for(h in f){j=f[h];if(i[h]===undefined){i[h]=(function(){return c}(k,j))}}};var e=function(g,h,f){if(g.constructor!=Object){a.call(g.prototype,h);if(Object.prototype.toString.call(f)==="[object Array]"){return b(g,h,f)}return d(g,h,f)}else{throw new Error("Attempting to augment Object prototype")}};return{each:e}}()); |
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
/* | |
* Simple boilerplate Node Minification build for uglify-js | |
* | |
* Install: npm install uglify-js; cd to the this script's dir | |
* $ node <script-name>.js | |
*/ | |
var parser = require( 'uglify-js' ).parser | |
, uglify = require( 'uglify-js' ).uglify | |
, path = require('path') | |
, fs = require( 'fs' ) |
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
// For example, launches 'app/index.html' : launch('app/index.html'); | |
var launch = function(path) { | |
require('child_process' ).spawn('open', [path]); | |
}; |
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
/* | |
* Defines a utility method on the requirejs global which returns a | |
* requirejs module definition dependency so as to circumvent having | |
* to explicitly load test cased (Jasmine, QUnit etc.) as require | |
* dependencies. | |
* | |
* // In a Test/Spec, simply invoke getModule to resolve a require js | |
* // module definition without implementing Tests/Specs as require js | |
* // modules. |
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
// Simply wrap the return value in an immediate function | |
// and return the result. The below example implements // a test for HTML5 WebSocket Feature detection; however, | |
// the same concept applies for any function initializer. | |
var hasWebSockets = ( function (window) { | |
var prefixes = 'ms O Moz Webkit'.split (' ') | |
, n = prefixes.length | |
, i = 0; | |
for (; i < n; ++i) { | |
if ( window [prefixes [i] + 'WebSocket'] ){ | |
return true; |
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
// Initial "getLocation" implementation. Since we only need to test | |
// for Geolocation support once, we perform the initial test and then | |
// overwrite the "getLocation" implementation based on the results of | |
// the test. | |
var getLocation = function (success, fail, options) | |
{ | |
var geolocation = navigator.geolocation; | |
if ( geolocation ) | |
{ |
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
/* | |
* Extends Handlebars with a basic get method for loading external | |
* Handlebars templates. Simply pass an options object which contains | |
* the following properties: | |
* - path (required) : Path to the external template file to be loaded | |
* - success (required) : Callback invoked with the compiled loaded template. | |
* - cache (optional) : true if the template is to be cached, otherwise false. | |
* | |
* In addition to the above arguments, any jQuery/Zepto.ajax options argument | |
* can be specified as well. |
NewerOlder