Skip to content

Instantly share code, notes, and snippets.

View stephancasas's full-sized avatar

Stephan Casas stephancasas

View GitHub Profile
@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
@stephancasas
stephancasas / IntelligenceLightView.swift
Created February 12, 2025 23:25
A basic SwiftUI expression of the native Apple Intelligence NSIntelligenceUILightView
//
// IntelligenceLightView.swift
//
// Created by Stephan Casas on 2/12/25.
//
import SwiftUI
import AppKit
struct IntelligenceLightView: NSViewRepresentable {
@stephancasas
stephancasas / Font+Properties.swift
Last active January 31, 2025 21:43
An extension on SwiftUI's font struct adding getters for assigned properties.
//
// Font+Properties.swift
//
// Created by Stephan Casas on 1/31/25.
//
// @depends: https://gist.github.com/stephancasas/4653f98d55a9bfcd7e0830d22e1a3515
import SwiftUI
extension Font {
@stephancasas
stephancasas / Mirror+Extraction.swift
Created January 31, 2025 21:34
An extension providing runtime value extraction and debug utilities for Swift types.
//
// Mirror+Extraction.swift
//
// Created by Stephan Casas on 1/31/25.
//
import Foundation
extension Mirror {
@stephancasas
stephancasas / NSScreen+MenuBarHeights.h
Created July 1, 2024 20:59
An extension on NSScreen providing menubar dimensions across various system states.
//
// NSScreen+MenuBarHeights.h
//
//
// Created by Stephan Casas on 6/26/24.
//
@import Foundation;
@import AppKit;
@stephancasas
stephancasas / Process+InteractiveEscalation.swift
Created June 27, 2024 00:25
Synchronously prompt the user for permission to dispatch a new privilege-escalated Process.
//
// Process+InteractiveEscalation.swift
//
//
// Created by Stephan Casas on 6/26/24.
//
import Foundation;
import OSAKit;
@stephancasas
stephancasas / MachServiceLaunchInfo.swift
Created June 26, 2024 22:20
A type representing a Mach service's launchd info property list
//
// MachServiceLaunchInfo.swift
//
//
// Created by Stephan Casas on 6/26/24.
//
import Foundation;
/// A type representing a Mach service's `launchd` information property list.
@stephancasas
stephancasas / Bundle+EmbeddedData.swift
Created June 26, 2024 22:14
Extract embedded data from a MachO executable at runtime.
//
// Bundle+EmbeddedData.swift
//
//
// Created by Stephan Casas on 6/26/24.
//
import Foundation;
extension Bundle {