Skip to content

Instantly share code, notes, and snippets.

{
"html": "<body>\n <!-- comment one -->\n <script id=tf1></script>\n <script id=tf2 nonce='hs-random-nonce'></script>\n\n <div>\n text\n <!-- comment two -->\n </div>\n\n <link rel=\"stylesheet\" nonce=\"hs-random-style-nonce\" href=\"https://gist.githubusercontent.com/eirikbakke/1059266/raw/d81dba46c76169c2b253de0baed790677883c221/gistfile1.css\" />\n </body>",
"staticAssets": []
}
<div>
<p>Biscuit marshmallow brownie macaroon. wafer caramels topping lollipop.
jelly beans bear claw marshmallow candy licorice powder bear claw icing
muffin tart gingerbread croissant cookie.
</p>
<!-- Comment one -->
<ul>
<li>One</li> <!-- Comment two -->
</ul>
@timmfin
timmfin / big-query.sql
Created May 4, 2023 15:07
Emulating crux technology calculation - BigQuery source
CREATE TEMP FUNCTION IS_GOOD(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
good / (good + needs_improvement + poor) >= 0.75
);
CREATE TEMP FUNCTION IS_NON_ZERO(good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
good + needs_improvement + poor > 0
);
SELECT
date,
// In another file as utility function
export function makeRandomColor() {
return /* ... */;
}
// Your partial or module file
function PartialOrModule({ numBoxesToStart = 2 }) {
const serverBoxColors = new Array(numBoxesToStart).fill().map(makeRandomColor);
return <Island module={ManyBoxesIsland} startingBoxColors={serverBoxColors} />
This file has been truncated, but you can view the full file.
9254835974458887629672873635789957411886024698554157393849494864228024962939550688297074527198420261051675205999609689838587412
7948702662533481896767559573369920938242346354580061545409242090168773727371802699309443935396635866263937828773324526334321892
7929250312741837331511829643632683169694074912332726993582394725302853411901337696207186358524323117172520907433878952968176465
9486937364148093931718552300016332142708943190856638524388888569011747617956915519539025796115901484762122047712200094207683584
This file has been truncated, but you can view the full file.
9254835974458887629672873635789957411886024698554157393849494864228024962939550688297074527198420261051675205999609689838587412
7948702662533481896767559573369920938242346354580061545409242090168773727371802699309443935396635866263937828773324526334321892
7929250312741837331511829643632683169694074912332726993582394725302853411901337696207186358524323117172520907433878952968176465
9486937364148093931718552300016332142708943190856638524388888569011747617956915519539025796115901484762122047712200094207683584
0703675740855407318047361595661595146837376373951978537785605481083388906490085533348547865459237835407372374738389274773789264
3524314516560200536698529022539598732463389124803873184044464663165630452635665559603483233341839268186056673186867104904449866
3388466377320953222057779182433549144340237502432464295061371141084500222833875925546082542869030852833895137466510262849050187
2359980877010447170873386178573828860442255448874794721230413368694441497441338856684036949118353204002591974711928301953002372
@timmfin
timmfin / my-plugin-2.js
Last active December 3, 2015 17:47
Another thought experiement on broccoli v1 changes to more easily hook into and/or compose inputNodes
function MyPlugin(inputNodes, options) {
this.options = options;
// In this example, let's say we need to do something special with the first
// inputNode as compared to the others.
[this.firstNode, ...this.otherNodes] = inputNodes;
this.firstNode.appendChildNode(this.options.startCallback); // pre-firstNode hook
this.wrapChildNode(0, this.options.secondCallback); // post-firstNode hook
@timmfin
timmfin / my-plugin.js
Last active December 2, 2015 23:49
Thought experiement on broccoli v1 changes to more easily hook into and/or compose inputNodes
function MyPlugin(inputNodes, options) {
this.options = options;
// In this example, let's say we need to do something special with the first
// inputNode as compared to the others.
[this.firstNode, ...this.otherNodes] = inputNodes;
// Make sure we re-create event handlers new for every build (at least the ones
// that require state be reset between builds)
this.on('newBuild', () => {
function beforeBuild(node, cb, options) {
// Get the last "child node" from our passed node's array of "children" inputNodes
// (see https://github.com/broccolijs/broccoli-plugin/blob/master/index.js for
// more context)
var lastChildNode = node._inputNodes.pop();
// Take that child node and wrap it with our own, new plugin. Using
// timmfin/broccoli-quick-plugin as a shortcut we don't have to create a new
// contructor with all the broilerplate to extend broccoli-plugin inline.
var wrappedChildNode = QuickPlugin([lastChildNode], {
@timmfin
timmfin / example-plugin.js
Last active December 1, 2015 15:02
Silly example of using the readTree promise in the previous broccoli API
function MyPlugin(inputNodes, options) {
this.options = options;
// In this example, let's say we need to do something special with the first
// inputNode as compared to the others.
[this.firstNode, ...this.otherNodes] = inputNodes;
}
MyPlugin.prototype.read = function(readTree) {
let outputPaths = [];