Skip to content

Instantly share code, notes, and snippets.

View arpitdalal's full-sized avatar
💻
Making software

Arpit Dalal arpitdalal

💻
Making software
View GitHub Profile
@arpitdalal
arpitdalal / ingest.$.tsx
Last active October 30, 2025 21:55
A reverse proxy for PostHog using react-router
import { type LoaderFunctionArgs, type ActionFunctionArgs } from "react-router";
const API_HOST = "us.i.posthog.com"; // use eu.i.posthog.com for EU
const ASSET_HOST = "us-assets.i.posthog.com"; // use eu-assets.i.posthog.com for EU
type RequestInitWithDuplex = RequestInit & {
duplex?: "half"; // https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/1483
};
async function posthogProxy(request: Request) {
@arpitdalal
arpitdalal / phone-number-regex.txt
Last active February 2, 2021 18:29
Regular Expression to remove spaces, both round brackets, hyphens, and full stops from a text. Mainly used to remove these characters from a phone number to use it in an anchor tag.
/([ ()-.])/g