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
use std::fs::File; | |
use std::io::{BufReader, Read}; | |
use std::iter::Peekable; | |
use std::str::Chars; | |
use std::string::String; | |
use std::vec::Vec; | |
#[derive(Debug, PartialEq, Copy, Clone)] | |
pub struct Location { | |
offset: u64, |
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
// Hat tip to Adam Klein for an explanation. | |
// v8's code generation goes through phases that roughly correspond to: | |
// Parse -> Analyze -> Generate Code | |
// During Parse/analyze, v8 tracks which variables in scope are used by closures in that scope | |
// All closures declared in a function keep references to any variables used by any closure | |
// in that function. | |
// In the following example, each function returned by retainTooMuch will retain bbz, even though | |
// the returned closure doesn't reference that variable, because another closure in the same scope | |
// did reference bbz. | |
function retainTooMuch() { |
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
/** | |
* Find all elements inside `root` that match `selector`, even inside shadow roots. | |
*/ | |
function qsAllDomTreeWalker(root, selector, results){ | |
if (!results) { | |
results = [] | |
} | |
var queue = []; | |
const newWalker = (root) => document.createTreeWalker( |
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
/** | |
* Find all elements inside `root` that match `selector`, even inside shadow roots. | |
*/ | |
function qsAllDom(root, selector, results){ | |
if (!results) { | |
results = [] | |
} | |
var newResults = root.querySelectorAll(selector); | |
for (var result of newResults) { | |
results.push(result); |
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
let tagResponse = await api.gitdata.getTags({owner: org, repo: component}); | |
let allTags = tagResponse.slice(); | |
while (api.hasNextPage(tagResponse)) { | |
tagResponse = await api.getNextPage(tagResponse); | |
allTags = allTags.concat(tagResponse); | |
} |
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
1) Given N endpoints, build map from endpoint -> dependency[] | |
2) Given endpoint -> dep map, build dep -> endpoint[] map | |
3) Apply user-provided function to the results from step 2 to build bundle manifest | |
4) Bundle endpoints according to map from step 3 | |
bundle(["shop-app.html", "shop-list.html", "shop-cart.html"], analyzer, appShellHeuristic("end1.html")) | |
async bundle(url: string|string[], orchestrator?: BundleOrchestrator): Promise<DocumentCollection> {} |
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
const func = () => { | |
return {}; | |
}; | |
// TSLint requires whitespace after ;, clang-format forcibly removes the whitespace. | |
for (let variable; variable = func();) { | |
break; | |
} |
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
while(htmlImportRemaining()) { | |
// Get the first inlinable HTML import | |
let nextImport = getNextImport(); | |
// Resolve the paths relative to the current document URL | |
let resolvedImport = resolvePaths( | |
thisDocument, | |
nextImport.href, | |
nextImport.document | |
) | |
// Replace <link rel="import"> with the document's DOM |
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
<head> | |
<style is="custom-style" include="shared-styles"></style> | |
</head> | |
<body> | |
<div>Content goes here</div> | |
<link rel="vulcanized.html"> | |
<!--<script src="init.js"></script>--> | |
</body> |
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
<link rel="import" href="/components/biz/bizdep.html"> <!-- should be /bower_components/biz/bizdep.html --> | |
<link rel="import" href="../boo.html"> <!-- should be /biz.html--> | |
<link rel="import" href="../../biz/bizdep.html"> <!-- Should be the same as the absolute path above.--> |
NewerOlder