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
if (/android/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent)) { | |
this.on('click', function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
}); | |
} else { | |
this.on('touchend', function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
}); |
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
if (this.player_.muted()) { | |
return 0; | |
} else { | |
return this.player_.volume(); | |
} |
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
// loadScript :: String, function, predicate [, arg1 [, arg2 [, ...]]] -> undefined | |
// The optional arguments will get passed to the callback | |
var loadScript = (function() { | |
var scripts = {}; | |
return function(url, callback, predicate) { | |
var | |
body = document.body, | |
script = document.createElement('script'), | |
loaded = false, |
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 Ctor = (function(window, undefined) { | |
var private = 5; | |
var Ctor = function() { | |
// ... | |
} | |
Ctro.protoype.foo = function() { | |
return private; | |
} |
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 foo = {}; | |
var bar = Object.create(foo); |
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 Toggleable = function(a, b) { | |
this._a = a; | |
this._b = b; | |
}; | |
Toggleable.prototype.valueOf = function() { return this._a; }; | |
Toggleable.prototype.toggle = function() { | |
if (this.valueOf() == this._a) { |
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
define(function(require, exports, module) { | |
var $ = require('jquery'); | |
}); |
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 foo(id) { | |
var deferred = q.defer(); | |
bar(id) | |
.then(function(obj) { | |
var anotherDeferred = q.defer(); | |
log('fail'); |
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 http = require('http'); | |
var server = http.createServer(function(req, res) { | |
console.log('foo'); | |
res.end('foo'); | |
}, function(req, res) { | |
console.log('bar'); | |
res.end('bar'); | |
}); | |
server.listen(5555); |
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 readTep(evt) { | |
var three; | |
taps.push((new Date()).getTime()); | |
taps = taps.slice(-3); | |
if (taps.length === 3) { | |
three = taps.reduce(function(p, c, i) { | |
return p && Math.abs(c - (taps[i - 1] || c)) < 50; | |
}, true); | |
if (three) { |