Skip to content

Instantly share code, notes, and snippets.

@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
@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>

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;
@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?: ({
@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.
@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
@lambda-mike
lambda-mike / kakoune_cheatsheet.md
Last active October 18, 2025 08:31
My Kakoune cheatsheet

Kakoune

set verbose mode (good for learning) :set -add global autoinfo normal

Movement

Goto

10g - go to line 10

@jeremysears
jeremysears / pre-push
Last active September 25, 2023 19:50
An interactive Git pre-push hook to prevent submission of FIXME tags, unless acknowledged.
#!/usr/bin/env bash
matches=$(git diff HEAD~1 HEAD | grep -E '\+.*?FIXME')
if [ "$matches" != "" ]; then
echo >&2 "A 'FIXME' tag has been detected. Please fix all 'FIXME' tags before committing."
echo >&2 ""
echo >&2 "Matching FIXME:"
echo >&2 "${matches}"
echo >&2 ""
@gagarine
gagarine / fish_install.md
Last active September 19, 2025 20:00
Install fish shell on macOS Mojave with brew

Installing Fish shell on MacOS (Intel and M1) using brew

Fish is a smart and user-friendly command line (like bash or zsh). This is how you can instal Fish on MacOS and make your default shell.

Note that you need the https://brew.sh/ package manager installed on your machine.

Install Fish

brew install fish

@josephg
josephg / README.md
Last active June 7, 2024 09:37
Getting Zig compiling to WASM

In case anyone else wants to play with Zig on webassembly, here's what you need to do to make it work on a mac today.

1. Get LLVM 7 compiled with webassembly support.

You'll need LLVM to output to the WASM target. This has just been added by default in trunk, so if LLVM >7 is available, you might be able to just brew install llvm.

If you have wasm support already you should see:

$ llc --version