https://adventofcode.com/2021/day/7
This is two steps. First we have to find the final position of all crabs. Then get the sum of steps each crab had to take.
| ....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................+........................................................... | |
| ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................... |
| <html> | |
| <body> | |
| <p>This is a quick proof of concept that turns any native input into a "private" input when we add `is="wh-secret"`. I may make it more realistic when I have some time. The button is supposed to be an eye icon. </p> | |
| <label for="text">Text:</label | |
| ><input id="text" is="wh-secret" type="text" value="hello world" /><br /> | |
| <label for="date">Date:</label | |
| ><input id="date" is="wh-secret" type="date" value="2022-08-11" /><br /> | |
| <label for="time">Time:</label | |
| ><input id="time" is="wh-secret" type="time" value="12:00" /><br /> |
| // Put this file in a directory where all of the ESLint repos are checked out | |
| import fs from "fs/promises"; | |
| const packages = await fs.readdir("./"); | |
| const scripts = await Promise.all( | |
| packages.map((directory) => | |
| fs | |
| .readFile(`./${directory}/package.json`, "utf-8") |
| import type { ReactiveControllerHost } from "lit"; | |
| import { ClockController } from "../../src/controllers/clock-controller"; | |
| class Host implements ReactiveControllerHost { | |
| updateComplete: Promise<boolean>; | |
| clock: ClockController; | |
| emittedTimes: string[] = []; |
https://adventofcode.com/2021/day/7
This is two steps. First we have to find the final position of all crabs. Then get the sum of steps each crab had to take.
| define(function () { | |
| var log10 = function (val) { | |
| return Math.log(val) / Math.log(10); | |
| }; | |
| var scale = function(domain) { | |
| return Math.pow(10, Math.ceil(log10(domain))); | |
| }; |
| var createPromise = function (wrapper) { | |
| var deferred = $.Deferred(); | |
| wrapper( | |
| function () { deferred.resolve.apply(deferred, arguments); }, | |
| function () { deferred.reject.apply(deferred, arguments); } | |
| ); | |
| return deferred.promise(); | |
| } | |
| /* | |
| requestAnimationInterval() | |
| A sort of replacement for setInterval that uses requestAnimationFrame. | |
| var myFunction = function (timestamp) { | |
| // do some stuff | |
| } |
| /* | |
| map() is cool! | |
| This function essentially loops over each row of a table and puts | |
| its data in an array of objects. | |
| It returns something like this: | |
| [ | |
| {rate: 1.0, apy: 1.0, productLabel: '3 month CD', earnings: 123.45}, | |
| {rate: 1.12, apy: 1.13, productLabel: '6 month CD', earnings: 543.21}, |