Skip to content

Instantly share code, notes, and snippets.

View WowbaggersLiquidLunch's full-sized avatar
🗿
living in your walls

冀卓疌 WowbaggersLiquidLunch

🗿
living in your walls
  • subsistence phd
View GitHub Profile
@DougGregor
DougGregor / macros-dashboard.md
Last active December 7, 2023 05:28
Swift Macros Dashboard

Swift Macros Dashboard

Macros are a power feature in a number of programming languages that make the language more extensible. Swift has always sought to enable expressive libraries through its use of type inference, generics, and general approach toward clarity of use. Macros in Swift are intended to improve expressiveness without sacrificing clarity.

This gist provides a "dashboard" with links to the various documents and example projects that are part of the Swift Macros effort. Head on over to the Swift Forums if you have questions!

Overview and examples:

  • Macros vision document: lays out the overall motivation, goals, and approach we're taking in the implementation of macros in Swift.
  • Example macros repository: contains a number of example macros that demonstrate the capabilities of the macro system and how it integrates into the language. This
@username0x0a
username0x0a / Safari15StableBackFwdButtons.m
Created October 2, 2021 18:01
Safari 15 Stable Back & Forward buttons in the single-line Unified tab bar
#import <Cocoa/Cocoa.h>
#import <objc/runtime.h>
@interface Injector: NSView @end
@implementation Injector
+ (void)load {
@zhuowei
zhuowei / safariinject.m
Last active October 22, 2021 17:15
Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// clang -fmodules -shared -Wall -Os -o libsafariinject.dylib safariinject.m
//
// If SIP off:
// DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib /Applications/Safari.app/Contents/MacOS/Safari
//
// If SIP on, you can demo this by manually removing Safari's code signing signature, but many
// features (eg saved logins) won't be readable by the resigned app:
// cp -a /Applications/Safari.app ./
// codesign --remove Safari.app/Contents/MacOS/Safari
@zhuowei
zhuowei / Ensemble.plist
Last active September 18, 2023 06:26
Put this file as /Library/Preferences/FeatureFlags/Domain/Ensemble.plist and reboot to (hopefully) turn on Universal Control on macOS 12
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- not sure which one it is, so set both -->
<key>Ensemble</key>
<dict>
<key>Enabled</key>
<true/>
</dict>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UnifiedBar</key>
<dict>
<key>DisclosureRequired</key>
<string>ace440ac-b4f6-4b43-aade-02bba1589aef</string>
<key>Enabled</key>
<false/>
@import Darwin;
@import ObjectiveC;
@import CloudKit;
extern bool GEOConfigGetBOOL(int feature, void* something);
// Hooks feature flags in a resigned Maps.app to return true.
// Usage:
// clang -shared -fmodules -o libmaps_inject.dylib maps_inject.m \
// "$(xcrun
@steipete
steipete / TouchBarSwiftUIHack.swift
Created April 19, 2021 15:17
Your SwiftUI app crashes in *** Assertion failure in -[NSTouchBarLayout setLeadingWidgetWidth:], NSTouchBarLayout.m:78 ? Use this hack to work around the problem!
import Foundation
import InterposeKit
import OSLog
/// Hack tow work around Assertion failure in -[NSTouchBarLayout setLeadingWidgetWidth:], NSTouchBarLayout.m:78
/// This sometimes happens when macOS restores a window.
/// This even runs if there is no OS-level touch bar.
class MacOSWorkarounds {
static let logger = Logger(category: "MacOSWorkarounds")
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
import SwiftUI
import PlaygroundSupport
// constants
let deviceWidth: CGFloat = 320
let deviceHeight: CGFloat = 568
let hasFaceID = true // false for TouchID
struct Device: View {
var body: some View {
@jordansinger
jordansinger / macOS.swift
Last active February 14, 2024 03:41
macOS SwiftUI Playgrounds code
import SwiftUI
import PlaygroundSupport
struct Desktop: View {
var body: some View {
ZStack {
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG"))
Color(UIColor.systemBlue)
macOS()
}