Skip to content

Instantly share code, notes, and snippets.

View stephancasas's full-sized avatar

Stephan Casas stephancasas

View GitHub Profile
@stephancasas
stephancasas / InteractiveDumbShapeView.swift
Created November 16, 2026 23:30
An interactive playground for understanding SwiftUI/CoreGraphics' stroke geometry
//
// InteractiveDumbShapeView.swift
//
// Created by Stephan Casas on 3/4/26.
//
import SwiftUI
struct InteractiveDumbShapeView: View {
@stephancasas
stephancasas / ViewfinderShape.swift
Created November 16, 2026 23:29
A stroke-aware reconstruction of a viewfinder shape, compensating for Core Graphics’ rounded stroke geometry
//
// ViewfinderShape.swift
//
// Created by Stephan Casas
//
import SwiftUI
struct ViewfinderShape: Shape {
@stephancasas
stephancasas / TextLayoutComposer.swift
Created November 16, 2026 23:24
An adaptation around `NSLayoutManager` for composing custom text runs
//
// TextLayoutComposer.swift
//
// Created by Stephan Casas
//
import SwiftUI
// MARK: - TextLayoutComposer
@stephancasas
stephancasas / symbolichotkeynames.txt
Created August 13, 2026 00:38
macOS SymbolicHotKey Names
0: ProcIntr
1: SwitchFwd
2: SwitchBack
3: SessionIntr
4: ScreenSaver
5: DiskEject
6: ProcKill
7: AccessMenu
8: AccessDock
9: AccessWindow
@stephancasas
stephancasas / InteractiveDumbShapeView.swift
Created May 18, 2026 21:44
A playground-style SwiftUI view for experimenting with rounded rectangle stroke styles/behaviors in CoreGraphics
//
// InteractiveDumbShapeView.swift
// StupidRoundedRectangleStroke
//
// Created by Stephan Casas on 3/4/26.
//
import SwiftUI
struct InteractiveDumbShapeView: View {
@stephancasas
stephancasas / NSAlert+NSTextField.swift
Last active March 3, 2026 10:25
An extension on `NSAlert` for `NSTextField` drawing/management
//
// NSAlert+NSTextField.swift
//
// Created by Stephan Casas for OpenAI on 2/26/26.
//
import Foundation
import AppKit
extension NSAlert {
@stephancasas
stephancasas / logprefs.sh
Created February 21, 2026 09:29
macOS zsh utility for logging preference keys of a given process
logprefs () {
LOG_PROCESS="${*}"
log stream \
--level debug \
--style compact \
--predicate '((process == "'"$LOG_PROCESS"'") AND (subsystem == "com.apple.defaults") AND (eventMessage contains[cd] "for key")) AND NOT ((eventMessage contains[cd] "AppleLanguages") OR (eventMessage contains[cd] "cursorIsCustomized") OR (eventMessage contains[cd] "AppleReduceDesktopTinting") OR (eventMessage contains[cd] "reduceMotion"))' \
| perl -ne 'printf "%-70s %-70s\n", $1, $2 if /key (\S+) .*?Domain: ([^,]+)/'
}
@stephancasas
stephancasas / WKWebView+UserIgnoreEvents.h
Last active April 22, 2025 02:22
macOS: Ignore `WKWebView` events
//
// WKWebView+UserIgnoreEvents.h
// EventEavesdropper
//
// Created by Stephan Casas on 4/21/25.
//
#import <WebKit/WebKit.h>
@interface WKWebView (UserIgnoreEvents)
@stephancasas
stephancasas / UnsafeCGWindowListCreateImage.swift
Created March 10, 2025 23:26
Warning-free bindings for the legacy CoreGraphics screenshot/window-capture functions.
//
// UnsafeCGWindowListCreateImage.swift
//
// Created by Stephan Casas on 3/10/25.
//
import Foundation
import CoreGraphics
func UnsafeCGWindowListCreateImage(
@stephancasas
stephancasas / IntelligenceUIPlatterView.swift
Created February 14, 2025 23:49
A SwiftUI expression of Apple Intelligence' NSIntelligenceUIPlatterView — used to accent intelligence-enabled UI components.
//
// IntelligenceUIPlatterView.swift
//
// Created by Stephan Casas on 2/13/25.
//
import SwiftUI
import AppKit
import Combine