Skip to content

Instantly share code, notes, and snippets.

View jacob-ebey's full-sized avatar

Jacob Ebey jacob-ebey

View GitHub Profile
@jacob-ebey
jacob-ebey / use-list.ts
Last active January 26, 2026 08:12
useList hook for optimistic server action based modifications
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
@jacob-ebey
jacob-ebey / firestream.ts
Last active October 3, 2025 03:56
Cloudflare ATProto DO PDS
import { DurableObject } from "cloudflare:workers";
import type { Lexicons } from "@atproto/lexicon";
import {
XrpcClient as BaseXrpcClient,
FetchHandler,
FetchHandlerOptions,
} from "@atproto/xrpc";
import {
createTemporaryReferenceSet,
@jacob-ebey
jacob-ebey / atproto-example.ts
Last active September 29, 2025 12:12
An ATProto OAuth client for cloudflare workers.
const oauthClient = new AtprotoOAuthClient({
AtpBaseClient,
callbackPathname: oauthCallbackPathname,
clientMetadataPathname: oauthClientMeatadataPathname,
clientMetadata: {
client_name: "AtprotoTest",
client_uri: new URL("/", request.url).href,
scope: "atproto transition:generic",
},
namespace: env.OAUTH_STORAGE,
@jacob-ebey
jacob-ebey / scan-pass.ts
Created March 21, 2025 02:39
A Vite plugin that introduces a "scan" pre-pass with composition support with user-provided `builder.buildApp`.
import { walk } from "estree-walker";
import * as Vite from "vite";
export default function scanPass(): Vite.PluginOption {
let buildMode: "build" | "scan" = "build";
return [
{
name: "scan-pass",
enforce: "post",
@jacob-ebey
jacob-ebey / n-bottles.neva
Last active January 13, 2025 08:15
Neva n-bottles (99 bottles with input)
import { fmt, strconv, strings }
def Main(start any) (stop any) {
print For<int>{Next2Lines}
wait Wait
readInt ReadInt
range Range
printErr fmt.Println
---
// Notify the range and readInt actions to start
type OptionsOrString<TOptions extends string> = (string & {}) | TOptions
type ElementOrArray<T> = T | T[]
interface PromptGenerationConsole {
log(...data: any[]): void
warn(...data: any[]): void
debug(...data: any[]): void
error(...data: any[]): void
}
@jacob-ebey
jacob-ebey / use-transition-on-value-change.ts
Last active February 3, 2025 13:25
useTransitonOnValueChange
import { useEffect, useRef } from "react";
export function useTransitonOnValueChange(value: unknown) {
if (!document.startViewTransition) return;
const lastValueRef = useRef(value);
const deferredRef = useRef<Deferred<void> | null>(null);
const viewTransitionRef = useRef<ViewTransition | null>(null);
if (lastValueRef.current !== value) {
@jacob-ebey
jacob-ebey / rsc-bundler-integration-api.md
Created October 14, 2024 18:14
React RFC: RSC Bundler Integration API

React RFC: RSC Bundler Integration API

Summary

We are interested in building a react-server integration for Remix (and Vite). We've noticed a coupling between the React internals and the bundler API, and we’d like to propose a few small changes that would invert control to provide hooks that can be used by any flight runtime. As a result, all `react-server-dom-*` runtimes should be able to implement the touchpoints in a concise manner allowing the individual packages to focus on what to serialize for references, and how to deserialize/load references.

Background

Today, each individual `react-server-dom-*` package (`react-server-dom-webpack`, `react-server-dom-turbopack`, etc.) essentially concatenates shared runtime modules with the entry points for that package. Each package implements a few functions that are opaquely called in the shared runtime source, including `resolveClientReferenceMetadata`, `resolveServerReference`, `preloadModule`, `requireModule`, etc.

@jacob-ebey
jacob-ebey / chat-app-element.ts
Created October 12, 2024 05:22
Micro HTMX Streaming Chat App
customElements.define(
"chat-app",
class extends HTMLElement {
connectedCallback() {
if (!this.isConnected) return;
const form = window.querySelectorExt(
this,
"find form",
) as HTMLFormElement;
@jacob-ebey
jacob-ebey / worker.ts
Created June 20, 2024 21:27
Workerd Durable Object Vite Proxy POC
import { DurableObject } from "cloudflare:workers";
class TestDO extends DurableObject {
exp: string;
constructor(ctx: DurableObjectState, env: any) {
super(ctx, env);
this.exp = "exp";
}
sayHello() {
return "Hello, " + this.exp + "!";