Skip to content

Instantly share code, notes, and snippets.

View hnordt's full-sized avatar
😃

Heliton Nordt hnordt

😃
View GitHub Profile
@hnordt
hnordt / 01-under-one-minute.md
Last active September 23, 2026 16:30
Apple Studio Display on Omarchy / Intel MacBook Pro: 5K60 working with forced HBR3 and DSC off, reboot verified — investigation and handoff

Apple Studio Display on Omarchy: 5K/60Hz working with forced HBR3

Part 1 — Under one minute

Updated September 23, 2026: Native 5120×2880/60Hz now works on this 2019 Intel MacBook Pro / Radeon Pro 5300M with an original 2022 Studio Display under Omarchy.

Working change: Force a four-lane HBR3 DisplayPort link. The resulting desktop uses DSC off, with 250% scaling. A boot service reapplies the link preference before graphical login; Hyprland saves the 5K mode and scale.

Evidence: A 30-second trial and a verified two-minute trial succeeded, including YouTube playback. The setup then survived a reboot with the display attached. Live diagnostics confirmed 5K/60Hz, HBR3, and DSC off; the owner confirmed a complete, stable picture with no blinking or noise.

@hnordt
hnordt / MODEL.md
Last active February 13, 2026 20:10
Use a Structural UML Diagram to Improve AI Code Generation (https://x.com/hnordt/status/2022402880733315372)

Model

This file defines the structural abstraction of the system. It includes the main entities, their attributes, relationships, and key operations. The model serves as a blueprint for implementation and guides the design of the database schema, API endpoints, and business logic.

classDiagram
  class Workspace {
import { render } from "preact";
import { signal } from "@preact/signals";
function createEventSource(url: string) {
const source = new EventSource(url);
const status = signal(source.readyState);
function updateStatus() {
status.value = source.readyState;
}
@hnordt
hnordt / AGENTS.md
Last active January 14, 2026 13:33

Cognitive Model & Design Principles

This codebase follows a rule-driven, semantic-first design model. The goal is to reduce ambiguity, minimize cognitive load, and keep the system easy to reason about as it grows.

Do not introduce new structure without a clear, deliberate reason.

When writing or changing code, follow these principles strictly.

@hnordt
hnordt / counter.tsx
Created November 16, 2025 19:04
A type-safe, semantic custom counter element built with Custom Elements, the Invoker Commands API, and preact-render-to-string.
import { renderToStaticMarkup } from "preact-render-to-string";
declare global {
namespace preact.JSX {
interface IntrinsicElements {
"el-counter": preact.HTMLAttributes<HTMLElement>;
}
}
}
type TMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
type THandler = (
req: Request,
match: URLPatternResult | null,
) => Response | Promise<Response>;
class Route {
constructor(
private pattern: URLPatternInput,
@hnordt
hnordt / deno.json
Last active November 12, 2025 22:29
{
"compilerOptions": {
"lib": ["dom", "deno.ns"],
"jsx": "precompile",
"jsxImportSource": "preact"
},
"tasks": {
"dev": "deno run --allow-net --watch server.tsx",
},
"imports": {
import React from "react";
function usePress(onEnd: (isCancelled: boolean) => void, onStart?: () => void) {
return {
onPointerUp(e: React.PointerEvent<Element>) {
const rect = e.currentTarget.getBoundingClientRect();
onEnd(
!(
e.clientX >= rect.left &&
@hnordt
hnordt / Router.tsx
Last active September 17, 2025 00:33
import { useReducer, useEffect } from "react";
// pathToRegexp can be replaced with URLPattern once browser support improves
// https://developer.mozilla.org/en-US/docs/Web/API/URLPattern
import pathToRegexp from "path-to-regexp";
const Router = {
PushStateEventType: "pushstate",
ReplaceStateEventType: "replacestate",
PopStateEventType: "popstate",
import React from "react"
import { useLocation, useLoaderData, useFetcher } from "remix"
export default function useLoaderDataWithWindowFocusRefetching<LoaderData>() {
const loaderData = useLoaderData<LoaderData>()
const fetcher = useFetcher<LoaderData>()
const location = useLocation()
const pathnameRef = React.useRef(location.pathname)
React.useEffect(() => {