- Supported
allow-
values iniframe
sandbox
attribute.
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
JS: | |
function makeDoubler() { | |
var a = 1 | |
return function() { | |
a = a * 2; | |
return a; | |
} | |
} | |
Java: |
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 seed = Math.random() + ''; | |
/** | |
* Call this early in your program and only once and only if you are | |
* paranoid about the amount of entropy in Math.random(). | |
*/ | |
exports.srand = function(newSeed) { | |
seed = newSeed + ''; | |
} |
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
final boolean[] ok = new boolean[]{true}; | |
final int[] returnCount = new int[]{0}; | |
NodeTraversal.traverse(compiler, block, new AbstractShallowCallback() { | |
@Override | |
public void visit(NodeTraversal t, Node n, Node parent) { | |
if (n.isName() && "arguments".equals(n.getString())) { | |
ok[0] = false; | |
} | |
if(n.isReturn()) { | |
returnCount[0]++; |
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
alert('Hello') |
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 COLS = { | |
name: 0, | |
title: 11, | |
summary: 12, | |
imageSrc: 10 | |
}; | |
var TEMPLATE = '---\n\ | |
layout: main\n\ |
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 sessions = [].map.call($$('tr[dir]'), function(row, i) { | |
if (i < 6) { | |
return; | |
} | |
row = [].map.call(row.children, function(td) { | |
return td.textContent; | |
}); | |
var s = [{},{}]; | |
s[0].time = row[1] | |
s[0].speaker = row[5] |
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
npm i doesnt-exist | |
npm ERR! Darwin 14.5.0 | |
npm ERR! argv "node" "/usr/local/bin/npm" "i" "doesnt-exist" | |
npm ERR! node v0.10.33 | |
npm ERR! npm v2.14.1 | |
npm ERR! code E404 | |
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/doesnt-exist | |
npm ERR! 404 | |
npm ERR! 404 'doesnt-exist' is not in the npm registry. |
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
--angular_pass : Generate $inject properties for | |
AngularJS for functions annotated | |
with @ngInject | |
--charset VAL : Input and output charset for all | |
files. By default, we accept UTF-8 as | |
input and output US_ASCII | |
--checks-only : Don't generate output. Run checks, | |
but no compiler passes. | |
--closure_entry_point VAL : Entry points to the program. Must be | |
goog.provide'd symbols. Any goog.provi |
Current ES6 module usage (and general JS usage) in the browser relies on transpilation (due to non-widepread support in browsers) and bundling (to limit HTTP request count and HTTP waterfalls) for performance (module count easily goes into the 1000s which even with HTTP2 cannot be efficiently loaded in a module-per-request strategy; even when using Push to avoid HTTP waterfalls).
The bundlers use 2 large classes of strategies to bring N modules into a single JS file:
- (require.js, browserify, webpack): Each module gets put into a function that can be addressed by name. There is typically an export object per module where all exports are properties of that object.
- (closure compiler, rollup): Modules get compiled away and exported symbols become essentially global variables (at least within compilation unit) and directly accessed by other modules.