diff --git a/html/common.tsx b/html/common.tsx index f16f8bc..f7cf299 100644 --- a/html/common.tsx +++ b/html/common.tsx @@ -8,6 +8,8 @@ import { } from "preact"; import { render } from "preact-render-to-string"; import { writeText } from "copy-paste"; +// i know it's out of date; i just want something simple +import { randomInt } from "https://deno.land/std@0.146.0/node/internal/crypto/random.ts"; export function Main({ children, @@ -216,8 +218,9 @@ export const randirect = (...urls: string[]) => // could do some [T, ...T[]] shenanigans for totality but meh // kinda bad name -export const pick_random = (xs: T[]): T => - xs[Math.floor(Math.random() * xs.length)]; +// unhappy with the randomness so i'm going way overkill lol +export const pick_random = (xs: readonly T[]): T => + xs[randomInt(xs.length - 1)]; export const jitter = (n: number) => n * (Math.random() - 0.5); @@ -284,6 +287,7 @@ export const Filler = ({ height }: { height: string }) => ( ); +/// nonfunctional, deno's toplevel await (:D) is generally the best workaround export function make_sync_no_matter_the_cost(promise: Promise): T { let done = false; let out; diff --git a/html/this-is-not-a-chost.tsx b/html/this-is-not-a-chost.tsx new file mode 100644 index 0000000..2ba373a --- /dev/null +++ b/html/this-is-not-a-chost.tsx @@ -0,0 +1,50 @@ +import { render_and_copy } from "./common.tsx"; + +const ThisIsNotAChost = ({ + depth = 1, + max_depth, +}: { + depth?: number; + max_depth: number; +}) => ( + + + {depth < max_depth ? ( + + ) : ( + hi lol + )} + + + + + Ceci n'est pas une chost + + + +); + +render_and_copy();