Skip to content

Instantly share code, notes, and snippets.

@leaysgur
leaysgur / next-preact.d.ts
Created September 1, 2020 10:02
Use nextjs Link component w/ Preact + TypeScript
import type { VNode, JSX } from "preact";
declare module "react" {
export = React;
export as namespace React;
declare namespace React {
type DetailedReactHTMLElement<
P extends JSX.HTMLAttributes<T>,
T extends HTMLElement
@thecodewarrior
thecodewarrior / App Icon Template.svg
Last active October 28, 2025 19:00
An SVG template for creating macOS app icons, including guides and the standard drop shadow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jckw
jckw / variants.ts
Last active February 23, 2023 18:42
Stitches-inspired variant helper function for Tailwind. Complete with TypeScript autocomplete for variant fields.
type Classnames = string[] | string
type VariantConfig = {
[variant: string]: { [option: string]: Classnames }
}
type Config<V extends VariantConfig> = {
base: Classnames
variants: V
compoundVariants?: ({

Is there a way to share SplitSink between two different threads?

Yes

The best way to do this is to create an mpsc channel that forwards messages to the SplitSink. In the example below you can see that multiple threads can send to the sink using sender.clone(). Both send_task and recv_task are doing this, and in theory you can make as many senders as you like.

use std::net::SocketAddr;
use std::sync::Arc;
@greneholt
greneholt / QWERTY no option.keylayout
Created June 30, 2023 19:17
Mac QWERTY keyboard layout without bindings for the option key. This disables the annoying default behavior of key combinations like option+i that enters diacritic mode and prevents using such shortcuts in VS Code.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<keyboard group="0" id="5000" name="QWERTY no option" maxout="1">
<layouts>
<layout first="0" last="0" modifiers="48" mapSet="312" />
</layouts>
<modifierMap id="48" defaultIndex="0">
<keyMapSelect mapIndex="0">
<modifier keys="" />
</keyMapSelect>
@hiepnp1990
hiepnp1990 / accessibility_notifications.swift
Created October 10, 2024 13:55
MacOS Accessibility API Notifications
//
// MacOS Accessibility Notifications
// Notice: this version doesn't take into account new apps after this code is executed
// Created by Phi Hiep Nguyen and AI on 2024-10-08.
//
import Cocoa
import Foundation
// AppObserver: Monitors and reports application activation events on macOS