Skip to content

Instantly share code, notes, and snippets.

View pfgithub's full-sized avatar
💭
Typing a status

pfg pfgithub

💭
Typing a status
View GitHub Profile
@pfgithub
pfgithub / CanvasPanZoom.tsx
Created August 16, 2023 00:28
canvas pan & zoom
import { Accessor, createEffect, createRoot, JSX, onCleanup, untrack } from "solid-js";
import { vec2, Vec2 } from "../util/vec2";
// polyfill roundRect, does not support radius arrays
CanvasRenderingContext2D.prototype.roundRect ??= function (this: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number) {
if (width < 2 * radius) radius = width / 2;
if (height < 2 * radius) radius = height / 2;
this.beginPath();
this.moveTo(x + radius, y);
this.arcTo(x + width, y, x + width, y + height, radius);
# GraphemeBreakTest-16.0.0.txt
# Date: 2024-05-02, 15:02:48 GMT
# © 2024 Unicode®, Inc.
# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
# For terms of use and license, see https://www.unicode.org/terms_of_use.html
#
# Unicode Character Database
# For documentation, see https://www.unicode.org/reports/tr44/
#
# Default Grapheme_Cluster_Break Test
new Array(1000).fill(0).map(q => "╱╲"[Math.random() * 2 |0]).join("")
╲╲╱╱╱╱╱╱╲╱╲╲╱╲╱╲╲╲╱╲╲╲╲╲╲╱╲╱╱╱╱╲╲╲╱╱╲╱╱╱╱╱╲╱╲╲╱╱╱╱╱╲╲╱╱
╲╲╲╲╱╲╱╱╱╲╱╱╲╲╱╱╲╱╲╱╲╲╱╱╲╲╱╲╲╲╱╲╲╱╱╲╲╱╲╱╱╱╲╲╱╱╱╲╱╱╱╱╱╱╲
╲╱╱╲╲╱╲╲╲╱╱╱╱╱╲╲╲╲╲╲╲╱╱╲╲╲╲╲╲╲╱╱╱╱╲╱╱╲╱╱╱╱╱╲╲╲╲╲╲╱╱╱╲╲╱
╱╲╲╲╱╲╲╱╲╱╲╲╱╱╲╲╲╱╱╲╱╲╱╱╱╲╲╱╲╲╲╱╲╱╲╲╱╲╲╱╲╲╲╱╱╱╲╱╲╲╱╱╱╱╱
╱╲╲╲╲╱╱╱╱╲╲╱╱╱╱╲╱╱╲╱╱╱╱╱╲╱╱╲╱╱╱╲╱╱╲╲╲╲╱╲╲╱╲╲╱╱╲╲╱╱╲╱╲╱╲
╲╲╱╱╲╲╲╱╲╲╲╲╱╲╲╱╲╲╱╱╲╲╲╱╱╲╱╱╱╲╱╱╲╱╱╱╱╲╲╱╲╱╲╲╲╱╱╲╱╱╲╲╱╱╲
╱╲╲╲╲╱╱╱╲╲╱╲╲╱╲╱╱╲╲╱╱╱╲╱╲╲╲╲╱╲╲╱╱╲╱╱╱╱╱╲╱╲╲╱╱╱╲╱╱╲╱╱╱╱╲
╲╱╲╲╱╲╲╲╱╱╲╱╲╲╱╱╲╱╲╱╲╲╱╲╲╲╲╱╲╲╱╱╱╱╱╲╱╱╱╲╱╱╱╲╲╱╲╱╲╱╱╲╱╱╲
╲╱╱╲╱╲╱╱╱╲╲╱╱╱╱╲╲╱╲╲╲╲╱╱╱╱╱╲╲╲╲╲╱╱╱╲╲╱╱╲╱╲╲╲╱╲╲╲╲╲╱╱╲╱╲
@pfgithub
pfgithub / zigmirrors.md
Created February 28, 2026 23:43
Support providing a mirror for a tree of packages without changing the hashes of the packages

I migrated all my packages from downloading off random github URLs to downloading off my server (commit)

  • Because github will throttle downloads of random archive files, causing intermittent CI failures
  • To speed up downloading packages, because some dependencies use the slower git+ URLs rather than archive .tar.gz URLs for their dependencies
  • To ensure building continues to work in the future even if some dependency authors delete their repositories, i.e. to prevent a left-pad incident

Unfortunately, this required updating the hashes of many packages even though their source code is identical. This is because some packages have dependencies that need their URLs updated to use the mirror.

Consider the dependency tree:

  • myapp