function* range() {
yield 1;
yield 2;
yield 3;
}
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
// Inspiration: https://www.abeautifulsite.net/posts/querying-through-shadow-roots/ | |
/* | |
* Acts like querySelectorAll, except you can pass a list of selectors... | |
* Each selector is evaluated within the shadowRoot of the previous NodeList | |
*/ | |
function* shadowQuerySelectorsAll(selectors, rootNode = document, depth = 0) { | |
const nodes = rootNode?.querySelectorAll(selectors[depth]); | |
if (depth >= selectors.length - 1) { | |
yield* nodes; |
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
import firstOnly from './Promise.firstOnly.polyfill.js'; | |
// Always unblocks next-render... but can leave main thread idle time while waiting for next frame. | |
function doubleRaf(cb) { | |
requestAnimationFrame(() => { | |
requestAnimationFrame(cb); | |
}); | |
} | |
// Always unblocks next-render... but gets scheduled at the back of the main thread task queue |
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
/* Usage: | |
await Promise.firstOnly([ | |
(signal) => { | |
return new Promise((resolve, reject) => { | |
// ...do work and resolve(); | |
signal.addEventListener("abort", () => { | |
// ...cancel and reject(); | |
}); | |
}); | |
}, |
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
/* | |
* Re-implement based on conventions from: | |
* https://source.chromium.org/chromium/chromium/src/+/master:cc/trees/layer_tree_host_impl.cc;l=160-176 | |
* | |
* With help from github.com/dontcallmedom and his library: | |
* https://github.com/dontcallmedom/metaviewport-parser (MIT https://github.com/dontcallmedom/metaviewport-parser/blob/master/LICENSE) | |
*/ | |
function HasFixedPageScale() { | |
// Simpler variant: |
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
/** | |
* A bookmarklet for viewing shifted elements while debugging | |
* Cumulative Layout Shift (web.dev/cls). Works in Chrome 84+ | |
* Shows the previous position of shifted elements in yellow, | |
* and the new position in red. | |
* | |
* To install: | |
* 1. Copy the code starting from the line beginning `javascript:` | |
* 2. Add a new bookmark in Chrome, and paste the code in as the 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
Verifying that +mmocny is my blockchain ID. https://onename.com/mmocny |
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 cordova = require('cordova-lib'); | |
var INPUT_WEBAPP = 'path/to/my/project/dist/app'; | |
var CDV_CONFIG = 'path/to/my/project/src/config.xml'; | |
var OUTPUT_CDVROOT = 'path/to/my/project/dist/cordova'; | |
var platforms = [ | |
require(‘cordova-android’), | |
require(‘cordova-ios’), | |
// ... |
function foo() {
return "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
# This file is automatically generated by Android Tools. | |
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | |
# | |
# This file must be checked in Version Control Systems. | |
# | |
# To customize properties used by the Ant build system use, | |
# "ant.properties", and override values to adapt the script to your | |
# project structure. | |
# Indicates whether an apk should be generated for each density. |