Skip to content

Instantly share code, notes, and snippets.

View adamgreg's full-sized avatar

Adam Gregory adamgreg

  • Aguila Engineering
  • Bristol, UK
View GitHub Profile
@adamgreg
adamgreg / preact-compat.d.ts
Created October 8, 2023 16:03
Additional types for preact/compat . Used by Radix UI.
import { ComponentClass, VNode } from "preact";
import "preact/compat";
declare module "preact/compat" {
export type ElementType = JSX.ElementType;
export type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<
ComponentProps<T>
>;
@adamgreg
adamgreg / show_in_native_window.py
Created November 18, 2021 12:29
Presents a Dash app as a native application, like an Electron app. Pops up a minimal window locally and shuts down the server when that window is closed.
from dash import Dash, html
def show_in_native_window(app: Dash) -> None:
"""
Modify the application to launch a minimal browser window, and shut down when this window is closed,
to give the look & feel of a native application.
"""
from threading import Timer