Skip to content

Instantly share code, notes, and snippets.

type QueryState = {
// ...
}
const [queryState, queryStateUpdate] = useReducer(
(prevState: QueryState, partialStateCb: Partial<QueryState> | ((prevState: QueryState) => Partial<QueryState>)) => {
const partialState = partialStateCb instanceof Function ? partialStateCb(prevState) : partialStateCb
if (prevState === partialState) return prevState
const nextState = {
...prevState,
function elementToString(el: Element): string {
  return prettyDOM(el, Infinity, { highlight: false })
  const str = prettyFormat(el, {
    plugins: [prettyFormat.plugins.DOMElement, prettyFormat.plugins.DOMCollection],
    highlight: true,
  })
  return str
}
const { logDOM, prettyDOM, prettyFormat } = require('@testing-library/react')
<!doctype html>
<html lang="en" class="">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./style.css" />
</head>
<body class="">
<!-- https://www.youtube.com/watch?v=QaS5GFJkuzc -->
@reyronald
reyronald / adb-tailscale-android-use.md
Created February 1, 2026 10:47 — forked from shehbajdhillon/adb-tailscale-android-use.md
Setup guide for letting AI agents (Claude Code, Cursor, etc.) control your Android remotely via ADB + Tailscale

ADB over Tailscale

Securely connect to Android over the internet using ADB + Tailscale.

You can also copy paste this gist into your agent of choice and have it explain you what to do.

This guide sets up remote ADB access so you can run android-use — an agent skill that lets AI interact with your Android device over ADB.


@reyronald
reyronald / README.md
Last active January 20, 2026 12:02
OTP Generator
node index.mjs secrethere

To run using Logitech's Action Ring on Mac OS, you'll need to create an Application instead of a script because Logi Options+ cannot run scripts even when granted permissions.

  1. Open Automator
  2. Create a new Workflow
  3. Search for Run Shell Script
  4. Paste the command, e.g.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function promisifycall<T extends (...args: any) => any>(callback: T) {
type Request = Parameters<T>[0]
type _Metadata = Parameters<T>[1]
type Callback = Parameters<T>[3]
type Response = Parameters<Callback>[1]
type ReturnTuple = [grpc.ServiceError, null] | [null, Response]
import { mediaQueryListSet } from "client/src/hooks/useMediaQuery";
import { useEffect } from "react";
const modifiedCSSRules: Map<CSSMediaRule, string> = new Map();
export function useEmulateMediaPrint() {
useEffect(() => {
for (const styleSheet of document.styleSheets) {
for (const cssRule of styleSheet.cssRules) {
if (cssRule instanceof CSSStyleRule) {
@echo off
setlocal enabledelayedexpansion
echo Starting git pull for all directories...
echo.
for /d %%i in (*) do (
if exist "%%i\.git" (
echo Pulling updates for: %%i
cd "%%i"
import type { NextFunction, Request, Response } from "express"
import { ctx } from "~/app/.server/async-context"
export interface TimingOptions {
header?: string
decimals?: number
log?: (ms: number, req: Request, res: Response) => void
}
// Uses 'prefinish' (emitted by Express) to set header just before flush and 'finish' to optionally log.
@reyronald
reyronald / prefetch-all-routes.tsx
Created September 8, 2025 01:02
Utility for React Router Framework Mode
import { useEffect } from "react"
/**
* Opportunistically preloads all route modules after initial render.
* Simplified to satisfy strict lint rules (no type assertions / conditionally skipped hooks).
*/
export function PreloadAllRoutes() {
useEffect(() => {
if (import.meta.env.SSR) return