unslopkit

Components / Code blocks

Command cheat sheet

A quiet list of one-line commands, each with what it does and its own copy button. For a README, an onboarding page, or the top of a runbook.

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.

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-command-list">
<section class="cl" aria-labelledby="ukc-code-command-list-title">
  <h3 id="ukc-code-command-list-title">Git, the five you use daily</h3>
  <ul class="rows">
    <li><code>git switch -c fix/late-fees</code><span class="d">Start a branch and move onto it</span><button class="cp" type="button" aria-label="Copy: start a branch"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="1"/><path d="M16 8V4H4v12h4"/></svg></button></li>
    <li><code>git add -p</code><span class="d">Stage your changes one hunk at a time</span><button class="cp" type="button" aria-label="Copy: stage by hunk"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="1"/><path d="M16 8V4H4v12h4"/></svg></button></li>
    <li><code>git commit --amend --no-edit</code><span class="d">Fold what is staged into the last commit</span><button class="cp" type="button" aria-label="Copy: amend the last commit"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="1"/><path d="M16 8V4H4v12h4"/></svg></button></li>
    <li><code>git stash push -m wip-fees</code><span class="d">Park unfinished work under a name</span><button class="cp" type="button" aria-label="Copy: stash with a name"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="1"/><path d="M16 8V4H4v12h4"/></svg></button></li>
    <li><code>git log --oneline -5</code><span class="d">See the last five commits, one line each</span><button class="cp" type="button" aria-label="Copy: short log"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="1"/><path d="M16 8V4H4v12h4"/></svg></button></li>
  </ul>
  <p class="note">Swap <code>fix/late-fees</code> and <code>wip-fees</code> for your own names.</p>
</section>
</div>

More code blocks

All 24
  • 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

  • Install with
    npm install @halden/sdkpnpm add @halden/sdkyarn add @halden/sdk

    v3.2.018 kB gzippedNode 18 and up

    Install command

  • 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

    Terminal mid-run

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

    Unified diff

  • .halden.yml+4−3
    Changes to .halden.yml. Version 3.1 on the left, version 3.2 on the right.
    v3.1v3.2
    1invoices:1invoices:
    2 prefix: INV2 prefix: INV
    3− due_days: 143+ due_days: 30
    4 rounding: line4 rounding: line
    5− tax: 0.08255+ tax:
    6+ rate: 0.0825
    7+ labor: false
    6− legacy_pdf: true
    7 reminders: on8 reminders: on

    Side-by-side diff