View CSV Parser
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
CSVParser = function ( options ) { | |
var defaults, delimiter, rowDelimiter, qualifier, qualified, unqualified; | |
options = options || {}; | |
defaults = { | |
delimiter: ',', | |
rowDelimiter: '\n', | |
qualifier: '"' | |
}; |
View addCommaSeparators.js
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
(function ( global ) { | |
'use strict'; | |
var addCommaSeparators = function ( num, precision ) { | |
var integer, decimal, remaining, result, lastThree; | |
integer = Math.floor( num ); | |
decimal = num - integer; |
View Player.js
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 Player = (function () { | |
var Player, generateGuid, maxCoins, secrets, get, set, cashIn; | |
maxCoins = 100; | |
// via http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
generateGuid = function () { | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
var r, v; |
View linearScale.js
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
(function ( global ) { | |
'use strict'; | |
var linearScale = function ( domain, range ) { | |
var d0 = domain[0], r0 = range[0], multiplier = ( range[1] - r0 ) / ( domain[1] - d0 ); | |
// special case | |
if ( r0 === range[1] ) { | |
return function () { |
View reindex.js
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
// https://gist.github.com/Rich-Harris/5969002 | |
// ------------------------------------------- | |
// | |
// MIT licensed. Go nuts. | |
(function ( global ) { | |
'use strict'; | |
var reindex = function ( array, idField ) { |
View eventListener.js
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
// addEventListener polyfill IE6+ | |
if ( !window.addEventListener ) { | |
(function ( win, doc ) { | |
var Event, addEventListener, removeEventListener, head, style; | |
Event = function ( e, element ) { | |
var property, instance = this; | |
for ( property in e ) { | |
instance[ property ] = e[ property ]; |
View thresholdScale.js
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
(function ( global ) { | |
'use strict'; | |
// Threshold scale generator, similar to D3's | |
// Usage: | |
// | |
// scale = thresholdScale([ 0, 20, 40, 100 ], [ 'red', 'green', 'blue' ]); | |
// scale( 10 ) -> 'red' |
View MutationObserverLogger.js
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
<script type="text/javascript"> | |
// See MDN: https://developer.mozilla.org/en-US/docs/DOM/MutationObserver?redirectlocale=en-US&redirectslug=DOM%2FDOM_Mutation_Observers | |
(function(){ | |
// select the target node | |
var target = document.querySelector('body'); | |
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; | |
var i={}; | |
// create an observer instance | |
var observer = new MutationObserver(function(mutations) { |
View jsonp.js
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
(function ( global ) { | |
'use strict'; | |
var jsonp = function ( url, callback ) { | |
var script, callbackName = 'jsonp_callback_' + Math.floor( Math.random() * 1000000 ); | |
window[ callbackName ] = function ( data ) { | |
callback( data ); | |
delete window[ callbackName ]; |
View GoogleSpreadsheetsParser.js
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
(function ( global ) { | |
'use strict'; | |
var GoogleSpreadsheetsParser; | |
GoogleSpreadsheetsParser = function ( data ) { | |
this.data( data ); | |
}; |
OlderNewer