unslopkit

Components / Code blocks

Notebook cells

Three notebook cells in a row: one that has run, one selected with its output underneath, and one still running. For data write-ups and analysis docs.

no_shows.ipynbPython 3.12 · busy

No-shows by weekday

Harlow Street Clinic, bookings from January to October 2026.

[3]
import pandas as pd
 
visits = pd.read_csv("visits_2026.csv", parse_dates=["booked_for"])
visits["weekday"] = visits["booked_for"].dt.day_name()
[4]
rate = visits.groupby("weekday")["no_show"].mean() * 100
rate.round(1).sort_values(ascending=False).head(3)
[4]
weekday
Monday       14.2
Friday       11.8
Wednesday     7.9
Name: no_show, dtype: float64
[*]
visits.to_parquet("visits.parquet")

Running for 4 s

Drawn in your kit, Plain.Change the look

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-notebook-cells">
<div class="nb" role="group" aria-label="Notebook: no-shows by weekday">
  <div class="bar"><span class="nm">no_shows.ipynb</span><span class="kern"><span class="busy" aria-hidden="true"></span>Python 3.12 · busy</span><button class="run" type="button"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M7 5l12 7-12 7z"/></svg>Run all</button></div>
  <div class="cell md"><h4>No-shows by weekday</h4><p>Harlow Street Clinic, bookings from January to October 2026.</p></div>
  <div class="cell" role="group" aria-label="Cell 3, finished">
    <span class="ex">[3]</span>
    <pre class="src"><code><span class="l"><span class="k">import</span> pandas <span class="k">as</span> pd</span>
<span class="l"> </span>
<span class="l">visits = pd.<span class="f">read_csv</span>(<span class="s">"visits_2026.csv"</span>, parse_dates=[<span class="s">"booked_for"</span>])</span>
<span class="l">visits[<span class="s">"weekday"</span>] = visits[<span class="s">"booked_for"</span>].dt.<span class="f">day_name</span>()</span></code></pre>
  </div>
  <div class="cell on" role="group" aria-label="Cell 4, selected" aria-current="true">
    <span class="ex">[4]</span>
    <pre class="src"><code><span class="l">rate = visits.<span class="f">groupby</span>(<span class="s">"weekday"</span>)[<span class="s">"no_show"</span>].<span class="f">mean</span>() * <span class="n">100</span></span>
<span class="l">rate.<span class="f">round</span>(<span class="n">1</span>).<span class="f">sort_values</span>(ascending=<span class="k">False</span>).<span class="f">head</span>(<span class="n">3</span>)</span></code></pre>
    <span class="ex o">[4]</span>
    <pre class="res"><samp><span class="l">weekday</span>
<span class="l">Monday       14.2</span>
<span class="l">Friday       11.8</span>
<span class="l">Wednesday     7.9</span>
<span class="l">Name: no_show, dtype: float64</span></samp></pre>
  </div>
  <div class="cell going" role="group" aria-label="Cell 5, running">
    <span class="ex">[*]</span>
    <pre class="src"><code><span class="l">visits.<span class="f">to_parquet</span>(<span class="s">"visits.parquet"</span>)</span></code></pre>
    <p class="state"><span class="spin" aria-hidden="true"></span>Running for 4 s<button class="stop" type="button">Interrupt</button></p>
  </div>
</div>
</div>

More code blocks

All 24
  • Run 482 · main · a41c9e2

    Fix family ticket rounding

    Failed in 2m 03s

    1. PassedCheck out code2s
    2. PassedInstall dependencies41s
    3. PassedLint12s
    4. 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

    Build log by step

  • 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.

    Merge conflict picker

  • 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';

    Avoid and prefer

  • Git, the five you use daily

    • git switch -c fix/late-feesStart a branch and move onto it
    • git add -pStage your changes one hunk at a time
    • git commit --amend --no-editFold what is staged into the last commit
    • git stash push -m wip-feesPark unfinished work under a name
    • git log --oneline -5See the last five commits, one line each

    Swap fix/late-fees and wip-fees for your own names.

    Command cheat sheet

  • 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

    Coverage gutter

  • 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
    $ 

    Snippet with terminal