Skip to content

Instantly share code, notes, and snippets.

@ericallam
ericallam / onChatEvents.md
Created July 7, 2026 20:21
transport observability events (`onEvent`)

A typed observability hook on useTriggerChatTransport / TriggerChatTransport that emits semantic lifecycle events, so you can build real metrics and alerts on top of chat without wrapping fetch or inferring state from useChat.

  1. Was my message actually sent? sendMessage() from useChat returns no feedback. The fetch override works but is wire-level: you have to know which endpoint means what, correlate requests back to messages yourself, and it misses the headStart first-turn path entirely (that POST goes through your own route handler).
  2. Did my message get answered? The disappearing-message failure mode is: send succeeds, then nothing. Detecting that requires pairing each successful send with the response lifecycle that should follow it, which no current API surfaces.

API

import { useTriggerChatTransport, type ChatTransportEvent } from "@trigger.dev/sdk/chat/react";
@ericallam
ericallam / claude-remote-helpers.zsh
Created January 11, 2026 06:54
Claude Code Remote Session Helpers - Control Claude Code from your iPhone
# ============================================
# Claude Code Remote Session Helpers
# ============================================
# Blog post: [YOUR_BLOG_URL]
#
# Prerequisites:
# - Tailscale installed on Mac + iPhone
# - Blink Shell on iPhone ($20)
# - ntfy app on iPhone (free)
# - jq installed (brew install jq)
GIST_THIS_IS_MY_KEY=1234567890
GIST_ANOTHER_KEY=0987654321
import { client } from "@/trigger"
import { eventTrigger, isTriggerError } from "@trigger.dev/sdk"
import { OpenAI } from "@trigger.dev/openai"
import { Supabase } from "@trigger.dev/supabase"
import { z } from "zod"
import _ from "lodash"
import { write } from "@/lib/neo4j"
FROM sitespeedio/node:ubuntu-22.04-nodejs-18.12.1 AS pruner
RUN apt-get update && apt-get install -y openssl
WORKDIR /app
RUN npm install turbo -g
COPY . .
RUN turbo prune --scope=webapp --docker
RUN find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
# Base strategy to have layer caching
FROM sitespeedio/node:ubuntu-22.04-nodejs-18.12.1 AS base
{
"method": "POST",
"uri": "https://api.airtable.com/...",
"headers": {
"content-type": "application/json"
}
}
type TabProps = {
defaultActiveKey: string;
className?: string;
children: ReactNode;
};
type TabContentProps = {
eventKey: string;
children: ReactNode;
title: string;
@ericallam
ericallam / DOC.md
Created September 2, 2020 10:26
TextureFromFile leak post-mortem

TextureFromFile leak post-mortem

Usages of TextureFromFile in the game to load an image from StreamingAssets could lead to a memory leak of the loaded texture in the case of the TextureFromFile instance being cancelled before it finished.

This would happen in the case of the saga map collection view object reuse (e.g. SagaMapPlayStoryPolaroid) where a view object would be loaded and an initial TextureFromFile instance would get created, and then in the same frame that view object would be recycled and reused for a different section of the map, causing that original TextureFromFile instance to be cancelled.

The TextureFromFile.Cancel method looked like this:

public void Cancel()
@ericallam
ericallam / leak1.cs
Created September 2, 2020 10:00
UnityWebRequest DownloadTexture leak
using System;
using System.Collections.Generic;
using MEC;
using RSG;
using UnityEngine;
using UnityEngine.Networking;
// This is the original implementation
namespace DefaultNamespace
@ericallam
ericallam / keybase.md
Created September 1, 2019 21:01
keybase.md

Keybase proof

I hereby claim:

  • I am ericallam on github.
  • I am eallam (https://keybase.io/eallam) on keybase.
  • I have a public key ASBmNg1iFy8fqoyVlxPpWUjlx_FQi7wvtp0phG5or9ijhAo

To claim this, I am signing this object: