Skip to content

Instantly share code, notes, and snippets.

View edmundhung's full-sized avatar
🦥
Slow response: relocating to a new country

Edmund Hung edmundhung

🦥
Slow response: relocating to a new country
View GitHub Profile
@edmundhung
edmundhung / worker.ts
Created December 29, 2021 11:12
Using remix-auth 2 with Cloudflare Workers
// ./worker/index.{js,ts}
import { createEventHandler } from "@remix-run/cloudflare-workers";
import { Authenticator } from 'remix-auth/build/authenticator';
import {
GitHubProfile,
GitHubStrategy,
} from 'remix-auth/build/strategies/github';
import * as build from "../build";
function createAuthenticator() {
@edmundhung
edmundhung / Progress.tsx
Last active March 14, 2023 15:25
Setting up a global loading indicator in Remix
import type { ReactElement, MutableRefObject } from 'react';
import { useEffect, useRef } from 'react';
import { useTransition } from 'remix';
export function useProgress(): MutableRefObject<HTMLElement> {
const el = useRef<HTMLElement>();
const timeout = useRef<NodeJS.Timeout>();
const { location } = useTransition();
useEffect(() => {