Skip to content

Instantly share code, notes, and snippets.

View nickmerwin's full-sized avatar

Nick Merwin nickmerwin

View GitHub Profile
@nickmerwin
nickmerwin / pr-359-qa.md
Created May 15, 2026 05:37
PR #359 — Bulk Job Undo + Reports — QA plan (review app staging-pr-359)
@nickmerwin
nickmerwin / alterations-qa-andy.md
Created May 14, 2026 00:52
Alterations Queue — Staging QA (less technical) for Andy

Alterations Queue — QA on Staging

Hi Andy! The first build of the Alterations Queue is live on staging for you to kick the tires before we ship to prod. Below is a walkthrough — about 15 minutes start to finish.

Where: https://staging.pima.io Log in with: your normal PIMA account.

This is staging, so any emails that go out land in a sandbox — feel free to click freely.


@nickmerwin
nickmerwin / ios-spec.txt
Last active June 17, 2026 03:08
Mediagraph iOS/iPad app spec — universal SwiftUI, OAuth via Devise, 5-phase plan
Mediagraph iOS/iPad app spec — universal SwiftUI, OAuth via Devise, 5-phase plan
<@UTW1FF5U6> here's a v1 spec for an iOS/iPad app, built against the existing API surface (~800 routes under the API namespaces, ~1,050 total), the auth stack (Devise + JWT + Doorkeeper OAuth + entity-level scopes), and the web app's primary feature set. Tradeoffs and open questions called out inline. Technical claims below were verified against the codebase on 2026-06-16 — see the verification note at the end.
*Stack & approach*
• Single *universal* SwiftUI app, iOS/iPadOS 17+, App Store + TestFlight
• SwiftUI first; drop to UIKit for hot paths — asset grid (`UICollectionView` compositional layout), video (AVKit + trimmer), drag-and-drop
• Auth: OAuth 2.0 + PKCE via `ASWebAuthenticationSession` against the existing Devise + Doorkeeper flow — gets us SAML/SSO/2FA for free. *Confirmed:* Doorkeeper already runs `force_pkce` with `grant_flows %w[authorization_code client_credentials]` and `use_refresh_token`, so PKCE is the server
@nickmerwin
nickmerwin / postmortem-2026-04-08.md
Last active April 8, 2026 13:48
Mediagraph Production Outage Post-Mortem — 2026-04-08 (ES license + DB cascade)

Production Outage Post-Mortem — 2026-04-08

TL;DR

Production was down ~2 hours (7:30–9:30 AM ET). No data loss.

Cause: ES license expired → web workers hung → thundering herd on recovery → exposed latent N+1-style COUNT queries in the asset show endpoint that couldn't survive 130 concurrent connections. DB pinned at 100% CPU. Compounded by ~100K queued Sidekiq jobs and a Kintzing API client hitting us at 140 req/s.

Fix: Shipped 5 targeted fixes during the incident — eliminated 6+ expensive COUNT queries per asset show (upload progress counts, contribution counts, requirement checks). These now use cached counter columns or are skipped entirely for done uploads and API traffic.

Saved Meals — New Feature

Great news — we just built out the Saved Meals feature you asked about! Here's what you can do now:

Create a saved meal by telling the coach:

"Create a meal called Cold Cereal: 3/4 cup Bob's Old Country Style Muesli, 1/4 cup granola, 1/4 cup trail mix, 1/2 cup unsweetened hemp milk, 1/2 cup kefir, and 1 scoop whey protein powder"

The coach will look up the macros for each ingredient and save it as a reusable template.

@nickmerwin
nickmerwin / databody_api_payload.md
Created February 28, 2026 18:05
DataBody: Claude API payload & calorie discrepancy post-mortem (2026-02-27)

DataBody — Claude API Payload: Thread 877 (2026-02-27)

Last message sent at 2026-02-27 23:54 UTC (3:54 PM PST).
User: Apple private relay, timezone: America/Los_Angeles
This is the session showing the 1,357 (header) vs 1,170 (AI) calorie discrepancy.


Root Cause (discovered via post-mortem)

@nickmerwin
nickmerwin / Dockerfile
Created June 30, 2016 02:18
Softcover.io publishing system Docker installation
FROM phusion/baseimage:0.9.11
# https://github.com/phusion/baseimage-docker
MAINTAINER Nick Merwin <nick@softcover.io>
ENV HOME /root
RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
CMD ["/sbin/my_init"]
# ==============================================================================
# install deps
@nickmerwin
nickmerwin / out
Created July 25, 2015 16:59
nickmerwin @Nicks-MacBook-Pro.local : ssh -i tmp/coveralls_backup.pem ubuntu@52.2.26.93
yo yo yo yo\n yo yo yo
@nickmerwin
nickmerwin / keybase.md
Created February 25, 2014 21:02
keybase.md

Keybase proof

I hereby claim:

  • I am nickmerwin on github.
  • I am mer (https://keybase.io/mer) on keybase.
  • I have a public key whose fingerprint is 24AE 1631 875E 8746 1B75 23D7 449A B548 4E59 8A2B

To claim this, I am signing this object:

@nickmerwin
nickmerwin / sunspot_session_proxy.rb
Created September 13, 2011 23:16
Tandemstock.com Sunspot Session Proxy
module Sunspot
module SessionProxy
class TandemSessionProxy < AbstractSessionProxy
attr_reader :search_session
delegate :new_search, :search, :config,
:new_more_like_this, :more_like_this,
:delete_dirty, :delete_dirty?,
:to => :search_session