Avoid and prefer
Two short snippets for one rule: the version to avoid with the problem underlined, and the version to use instead, each with the reason in a line. For style guides.
Filter a day with a rangeMarina bookings · Postgres
SELECT id, berth, starts_at
FROM bookings
WHERE date(starts_at) = '2026-12-05';
SELECT id, berth, starts_at
FROM bookings
WHERE starts_at >= '2026-12-05'
AND starts_at < '2026-12-06';
The code
Plain HTML and CSS on your kit's variables. Put it next to tokens/variables.css from your kit's files and it draws in your look.
<div class="ukc-code-do-dont">
<div class="dd">
<p class="cap"><b>Filter a day with a range</b><span>Marina bookings · Postgres</span></p>
<div class="pair">
<figure class="no">
<figcaption><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg><b>Avoid</b><span>The function hides the column from its index.</span></figcaption>
<pre class="src"><code><span class="l"><span class="k">SELECT</span> id, berth, starts_at</span>
<span class="l"><span class="k">FROM</span> bookings</span>
<span class="l"><span class="k">WHERE</span> <span class="bad"><span class="f">date</span>(starts_at)</span> = <span class="s">'2026-12-05'</span>;</span></code></pre>
</figure>
<figure class="yes">
<figcaption><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg><b>Prefer</b><span>A plain range the index can walk.</span></figcaption>
<pre class="src"><code><span class="l"><span class="k">SELECT</span> id, berth, starts_at</span>
<span class="l"><span class="k">FROM</span> bookings</span>
<span class="l"><span class="k">WHERE</span> starts_at >= <span class="s">'2026-12-05'</span></span>
<span class="l"> <span class="k">AND</span> starts_at < <span class="s">'2026-12-06'</span>;</span></code></pre>
</figure>
</div>
</div>
</div>
.ukc-code-do-dont { position: relative; font-family: var(--uk-font-body, system-ui, sans-serif); color: var(--uk-ink); font-size: 15px; line-height: 1.5;
--tint: color-mix(in srgb, var(--uk-accent) 12%, var(--uk-paper));
--tint-strong: color-mix(in srgb, var(--uk-accent) 22%, var(--uk-paper));
--accent-deep: color-mix(in srgb, var(--uk-accent) 72%, black);
--ink-soft: color-mix(in srgb, var(--uk-ink) 8%, var(--uk-paper));
--line-strong: color-mix(in srgb, var(--uk-ink) 32%, var(--uk-paper));
--danger-tint: color-mix(in srgb, var(--uk-danger) 12%, var(--uk-paper));
--high-tint: color-mix(in srgb, var(--uk-highlight) 28%, var(--uk-paper)); }
.ukc-code-do-dont *, .ukc-code-do-dont *::before, .ukc-code-do-dont *::after { box-sizing: border-box; }
.ukc-code-do-dont :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; }
.ukc-code-do-dont :where(ul, ol) { padding: 0; list-style: none; }
.ukc-code-do-dont :where(button, input, select, textarea) { font: inherit; color: inherit; }
.ukc-code-do-dont :where(a) { color: inherit; }
.ukc-code-do-dont svg { flex: none; }
.ukc-code-do-dont { container-type: inline-size; inline-size: 100%; }
.ukc-code-do-dont .dd { max-width: 680px; }
.ukc-code-do-dont .cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin-bottom: 10px; }
.ukc-code-do-dont .cap b { font-family: var(--uk-font-display, inherit); font-size: 18px; font-weight: 600; line-height: 1.3; }
.ukc-code-do-dont .cap span { color: var(--uk-muted); font-size: 12.5px; }
.ukc-code-do-dont .pair { display: grid; gap: 12px; }
.ukc-code-do-dont .pair figure { min-width: 0; margin: 0; overflow: hidden; border-radius: min(var(--uk-radius-lg), 12px); background: var(--uk-surface); }
.ukc-code-do-dont .no { border: 1.5px dashed color-mix(in srgb, var(--uk-danger) 60%, var(--uk-paper)); }
.ukc-code-do-dont .yes { border: 1.5px solid var(--uk-ink); }
.ukc-code-do-dont figcaption { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 0 8px; padding: 9px 12px; border-bottom: 1px solid var(--uk-line); background: var(--uk-paper); }
.ukc-code-do-dont figcaption svg { grid-row: span 2; align-self: start; width: 20px; height: 20px; padding: 3px; border-radius: var(--uk-radius-full); }
.ukc-code-do-dont .no figcaption svg { background: var(--uk-danger); color: var(--uk-paper); }
.ukc-code-do-dont .yes figcaption svg { background: var(--uk-ink); color: var(--uk-paper); }
.ukc-code-do-dont figcaption b { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.ukc-code-do-dont .no figcaption b { color: color-mix(in srgb, var(--uk-danger) 80%, var(--uk-ink)); }
.ukc-code-do-dont figcaption span { color: var(--uk-muted); font-size: 13px; line-height: 1.4; }
.ukc-code-do-dont .src { margin: 0; overflow-x: auto; font: 12.5px/1.7 var(--uk-font-mono, ui-monospace, monospace); tab-size: 2; }
.ukc-code-do-dont .src code { display: grid; width: max-content; min-width: 100%; font: inherit; }
.ukc-code-do-dont .src .l { min-height: 1.7em; padding: 0 16px; white-space: pre; }
.ukc-code-do-dont .src { padding: 10px 0 12px; }
.ukc-code-do-dont .src .k { color: color-mix(in srgb, var(--uk-accent) 60%, var(--uk-ink)); font-weight: 700; }
.ukc-code-do-dont .src .s { color: color-mix(in srgb, var(--accent-deep) 60%, var(--uk-ink)); background: var(--tint); }
.ukc-code-do-dont .src .n { color: color-mix(in srgb, var(--accent-deep) 60%, var(--uk-ink)); text-decoration: underline dotted; text-underline-offset: 3px; }
.ukc-code-do-dont .src .c { color: var(--uk-muted); font-style: italic; }
.ukc-code-do-dont .src .f { font-weight: 600; }
.ukc-code-do-dont .src .s { background: none; }
.ukc-code-do-dont .bad { background: var(--danger-tint); text-decoration: underline wavy var(--uk-danger); text-underline-offset: 4px; }
@container (min-width: 600px) { .ukc-code-do-dont .pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
More code blocks
All 24Git, the five you use daily
git switch -c fix/late-feesStart a branch and move onto itgit add -pStage your changes one hunk at a timegit commit --amend --no-editFold what is staged into the last commitgit stash push -m wip-feesPark unfinished work under a namegit log --oneline -5See the last five commits, one line each
Swap
fix/late-feesandwip-feesfor your own names.src/pricing/ticket.ts 86% lines8 of 10 branches 18×export function ticketPrice(age: number, member: boolean) { 18× if (age < 5) return 0; 15× if (member) { 6× return age < 16 ? 4 : 9;1 of 2 branches } 9× if (age >= 65) {never true 0× return 8;never run } 9× return age < 16 ? 6 : 12; }- Ran
- Some branches
- Never ran
import { Halden } from "@halden/sdk"; // Reads HALDEN_KEY from your environment const halden = new Halden(); const job = await halden.jobs.get("JS-2207"); const invoice = await job.invoice(); await invoice.send({ to: job.client });from halden import Halden # Reads HALDEN_KEY from your environment halden = Halden() job = halden.jobs.get("JS-2207") invoice = job.invoice() invoice.send(to=job.client)# The same call, straight to the API curl api.halden.example/v2/invoices \ -H "Authorization: Bearer $HALDEN_KEY" \ -d job=JS-2207 \ -d send=true$ npx tsx send-invoice.ts ✓ Drafted INV-0418 from 22.5 h and 3 receipts ✓ Sent to Reyes Framing · $2,140.00 $
- Install with
npm install @halden/sdkpnpm add @halden/sdkyarn add @halden/sdk - halden sync~/crews/reyes
$ halden sync --since monday Syncing 38 job sheets for Reyes Framing 31/38 ✓JS-2207Alder St refit22.5 h ✓JS-2211Garage roof, Pier Ln14.0 h !JS-2214Bathroom, Mill Lnno sign-off ✗JS-2216Back deck rebuildupload failed Uploading receipts, 4 of 9
src/totals.ts +4−1 @@ -12,3 +12,5 @@ function lineTotal export function lineTotal(l: Line) {− return l.qty * l.rate * (1 + TAX);+ const net = round(l.qty * l.rate); + const tax = round(net * l.taxRate); + return { net, tax, total: net + tax }; }@@ -24,2 +26,3 @@ export const round = (n: number) => + // To the cent, half away from zero Math.round(n * 100) / 100;