This file contains 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 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 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 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 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 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
/* Matches all <em> elements which are the next sibling of a <strong> element */ | |
strong + em { | |
/* declarations */ | |
} |
This file contains 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 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
// Short-hand convenience functions for Jasmine and jasmine-jquery | |
/* | |
* Shorthand convenience for: | |
* | |
* expect( $( '#some-id' ) ).toHaveClass( 'someClassName' ); | |
* expectClass( '#some-id', 'someClassName'); | |
*/ | |
var expectClass = function( selector, className ) |
This file contains 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 Model which adapts the representation of the relationship | |
* between two variables defined as x and y, to specific named properties | |
* which represent 'x' and 'y'. | |
* | |
* For example, a data point which models Temperature may represent time | |
* on the x-axes as x, and degrees on the y-axes as y. A Model can extend | |
* DataPoint to map x and y to their corresponding named properties defined | |
* as time and degrees, respectively. | |
* |
This file contains 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
/* | |
* basic node program for js/css minification using yuicompressor | |
* | |
* Compress the file test.js: | |
* $ node compress.js ../js/test.js | |
* Created Minified File: ../js/test.min.js | |
* | |
* Compress the file test.css | |
* $ node compress.js ../css/test.css | |
* Created Minified File: ../css/test.min.css |
OlderNewer