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
function Template(str, data) { | |
return str.replace(/\${([^}]+)}/g, (_, name) => data[name]); | |
} | |
var answer = 42; | |
(function () { | |
var answer = 60; | |
console.log(Template('Answer is ${answer}', {answer})); | |
})(); |
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
declare module chrome.usb { | |
type Direction = 'in' | 'out'; | |
interface Device { | |
device: number, | |
vendorId: number, | |
productId: number, | |
productName: string, | |
manufacturerName: string, | |
serialNumber: string |
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
// consider the following code | |
// a.js | |
class A extends Component { | |
static B = undefined; | |
state = { B : A.B }; | |
componentWillMount() { | |
A.B || import('./b.js').then(B => { |
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
// -Wglobals Clang plugin | |
// | |
// Based on example plugins and searching Clang's API documentation. | |
// BEWARE! This is my first ever attempt at a Clang plugin. | |
// | |
// Written by John Bartholomew <[email protected]> | |
#include "clang/Frontend/FrontendPluginRegistry.h" | |
#include "clang/AST/AST.h" | |
#include "clang/AST/ASTConsumer.h" |