import pandas as pd
visits = pd.read_csv("visits_2026.csv", parse_dates=["booked_for"])
visits["weekday"] = visits["booked_for"].dt.day_name()
Book-style listing
A numbered listing the way a textbook sets one: a caption above, hairlines top and bottom, quiet line numbers, and a short note on the line that matters.
def moving_average(values, window):
if window < 1 or window > len(values):
return []
total = sum(values[:window])
out = [total / window]
for i in range(window, len(values)):
total += values[i] - values[i - window]
out.append(total / window)
return out
Line 7Each step adds the newest reading and drops the oldest, so the loop never sums the whole window again.
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-book-listing">
<figure class="bl">
<figcaption class="cap"><span class="no">Listing 4.2</span><span class="tt">A running mean over tide gauge readings</span></figcaption>
<pre class="src"><code><span class="l"><span class="k">def</span> <span class="f">moving_average</span>(values, window):</span>
<span class="l"> <span class="k">if</span> window < <span class="n">1</span> <span class="k">or</span> window > <span class="f">len</span>(values):</span>
<span class="l"> <span class="k">return</span> []</span>
<span class="l"> total = <span class="f">sum</span>(values[:window])</span>
<span class="l"> out = [total / window]</span>
<span class="l"> <span class="k">for</span> i <span class="k">in</span> <span class="f">range</span>(window, <span class="f">len</span>(values)):</span>
<span class="l mk"> total += values[i] - values[i - window]</span>
<span class="l"> out.<span class="f">append</span>(total / window)</span>
<span class="l"> <span class="k">return</span> out</span></code></pre>
<p class="note"><span class="ref">Line 7</span>Each step adds the newest reading and drops the oldest, so the loop never sums the whole window again.</p>
</figure>
</div>
.ukc-code-book-listing { 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-book-listing *, .ukc-code-book-listing *::before, .ukc-code-book-listing *::after { box-sizing: border-box; }
.ukc-code-book-listing :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; }
.ukc-code-book-listing :where(ul, ol) { padding: 0; list-style: none; }
.ukc-code-book-listing :where(button, input, select, textarea) { font: inherit; color: inherit; }
.ukc-code-book-listing :where(a) { color: inherit; }
.ukc-code-book-listing svg { flex: none; }
.ukc-code-book-listing .bl { max-width: 560px; margin: 0; }
.ukc-code-book-listing .cap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding-bottom: 8px; border-bottom: 2px solid var(--uk-ink); }
.ukc-code-book-listing .no { font-size: 11.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.ukc-code-book-listing .tt { font-family: var(--uk-font-display, inherit); font-size: 17px; font-style: italic; line-height: 1.3; }
.ukc-code-book-listing .src { margin: 0; overflow-x: auto; font: 12.5px/1.7 var(--uk-font-mono, ui-monospace, monospace); tab-size: 2; }
.ukc-code-book-listing .src code { display: grid; width: max-content; min-width: 100%; font: inherit; }
.ukc-code-book-listing .src .l { min-height: 1.7em; padding: 0 16px; white-space: pre; }
.ukc-code-book-listing .src code { counter-reset: ln; }
.ukc-code-book-listing .src .l { padding-left: 0; }
.ukc-code-book-listing .src .l::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 5ch; padding-right: 2ch; text-align: right; color: color-mix(in srgb, var(--uk-ink) 40%, var(--uk-surface)); user-select: none; }
.ukc-code-book-listing .src { padding: 12px 0; border-bottom: 1px solid var(--uk-ink); }
.ukc-code-book-listing .src .l::before { width: 4ch; padding-right: 2.5ch; font-size: 0.82em; }
.ukc-code-book-listing .src .mk { box-shadow: inset 2px 0 0 var(--uk-ink); }
.ukc-code-book-listing .src .mk::before { color: var(--uk-ink); font-weight: 700; }
.ukc-code-book-listing .src .k { color: color-mix(in srgb, var(--uk-accent) 60%, var(--uk-ink)); font-weight: 700; }
.ukc-code-book-listing .src .s { color: color-mix(in srgb, var(--accent-deep) 60%, var(--uk-ink)); background: var(--tint); }
.ukc-code-book-listing .src .n { color: color-mix(in srgb, var(--accent-deep) 60%, var(--uk-ink)); text-decoration: underline dotted; text-underline-offset: 3px; }
.ukc-code-book-listing .src .c { color: var(--uk-muted); font-style: italic; }
.ukc-code-book-listing .src .f { font-weight: 600; }
.ukc-code-book-listing .src .s { background: none; }
.ukc-code-book-listing .note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; margin-top: 10px; font-family: var(--uk-font-display, inherit); font-size: 14.5px; line-height: 1.5; text-wrap: pretty; }
.ukc-code-book-listing .ref { padding-top: 2px; color: var(--uk-muted); font: 600 11px/1.6 var(--uk-font-mono, ui-monospace, monospace); letter-spacing: 0.04em; white-space: nowrap; }
More code blocks
All 24No-shows by weekday
Harlow Street Clinic, bookings from January to October 2026.
[3][4]
[4]rate = visits.groupby("weekday")["no_show"].mean() * 100 rate.round(1).sort_values(ascending=False).head(3)weekday Monday 14.2 Friday 11.8 Wednesday 7.9 Name: no_show, dtype: float64
[*]visits.to_parquet("visits.parquet")Running for 4 s
Run 482 · main · a41c9e2
Fix family ticket rounding
Failed in 2m 03s
- PassedCheck out code2s
- PassedInstall dependencies41s
- PassedLint12s
-
FailedRun tests1m 08s
$ npm test PASS tests/cart.test.ts (14 tests) PASS tests/timeslots.test.ts (19 tests) FAIL tests/pricing.test.ts (9 tests, 1 failed) family ticket covers two adults and three children Expected: 38 Received: 47.5 at tests/pricing.test.ts:27:31 Tests: 1 failed, 41 passed, 42 total Process exited with code 1
- SkippedDeploy to stagingskipped
- src/hours/closed-days.tsConflict 1 of 3
export const closedDays = [ "2026-12-25", <<<<<<< mainkeptdropped "2026-12-31", // stocktake ======= "2027-01-02", // staff day >>>>>>> holiday-hourskeptdropped ];Result keeps the stocktake day from main.Result keeps the staff day from holiday-hours.Result keeps both days, main first.
Filter a day with a rangeMarina bookings · Postgres
AvoidThe function hides the column from its index. SELECT id, berth, starts_at FROM bookings WHERE date(starts_at) = '2026-12-05';PreferA plain range the index can walk. SELECT id, berth, starts_at FROM bookings WHERE starts_at >= '2026-12-05' AND starts_at < '2026-12-06';Git, 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