Skip to content

Instantly share code, notes, and snippets.

extension Dictionary {
/// Transforms dictionary keys without modifying values.
/// Deduplicates transformed keys.
///
/// Example:
/// ```
/// ["one": 1, "two": 2, "three": 3, "": 4].mapKeys({ $0.first }, uniquingKeysWith: { max($0, $1) })
/// // [Optional("o"): 1, Optional("t"): 3, nil: 4]
/// ```
@stripes
stripes / loadAllAndPrint.js
Last active May 6, 2025 15:19
scroll to each unloaded image until all images are “complete”, trigger a print
console.log("v11 starting..")
var incomplete = [...document.querySelectorAll('img')].filter((img) => !img.complete);
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
const statusId = "df4bc682879a9ba2a29f";
var div = document.createElement("div");
div.id = statusId;
div.style = "position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 200px; height: 100px; background-color: lightblue; text-align: center; line-height: 100px;";
var h = document.createElement("H1");