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 states = [ | |
{'name':'Alabama', 'abbrev':'AL'}, | |
{'name':'Alaska', 'abbrev':'AK'}, | |
{'name':'Arizona', 'abbrev':'AZ'}, | |
{'name':'Arkansas', 'abbrev':'AR'}, | |
{'name':'California', 'abbrev':'CA'}, | |
{'name':'Colorado', 'abbrev':'CO'}, | |
{'name':'Connecticut', 'abbrev':'CT'}, | |
{'name':'Delaware', 'abbrev':'DE'}, | |
{'name':'Florida', 'abbrev':'FL'}, |
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
console.log('This page is using:', | |
['can', 'Ember', 'Backbone', 'angular', 'ko', 'Ext', 'Spine', 'Batman', 'React'] | |
.filter(function(framework) { return !!window[framework]; }).join(' and ') || 'nothing' | |
); |
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 foo = 'bar'; |
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
module.exports = Object.is || function(x, y){ | |
if (x === y) { | |
// 0 === -0, but they are not identical | |
return x !== 0 || 1 / x === 1 / y; | |
} | |
// NaN !== NaN, but they are identical. | |
// NaNs are the only non-reflexive value, i.e., if x !== x, | |
// then x is a NaN. | |
// isNaN is broken: it converts its argument to number, so |
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 privateThings = new WeakMap(); | |
function Private() { | |
this.data = 'is private'; | |
} | |
Private.prototype.somePrivateFunction = function() { | |
this.foo = 'bar'; | |
}; |
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
<html> | |
<head> | |
<title>Sanity check</title> | |
</head> | |
<body> | |
<script> | |
window.runLater = function() { | |
console.log("Calling runLater"); | |
window.setTimeout(function() { |
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 page = require('webpage').create(); | |
page.onError = function(msg, trace){ | |
console.log(msg, trace); | |
}; | |
page.open('http://localhost/phantom_traceur/test.html', function() { | |
phantom.exit(); | |
}); |
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
exports.translate = function(load) { | |
load.source = 'module.exports = ' + load.source + ';'; | |
}; |
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 httpProxy = require('http-proxy'); | |
var http = require('http'); | |
var proxy = httpProxy.createProxyServer({}); | |
var server = http.createServer(function(req, res) { | |
var url = req.url; | |
console.log(url); | |
proxy.web(req, res, { target: url }); | |
}); |
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 instantiate = loader.instantiate; | |
loader.instantiate = function(load){ | |
var loader = this; | |
var meta = loader.meta[load.name]; | |
var deps = (meta && meta.deps) || []; | |
if(deps.length) { | |
var promises = []; | |
for(var i = 0, len = deps.length; i < len; i++) { | |
promises.push(loader.import(deps[i])); |