Skip to content

Instantly share code, notes, and snippets.

@haikusw
haikusw / moreFinderTerminal.sh
Created September 20, 2024 22:08 — forked from ldavidh/moreFinderTerminal.sh
alternate sel script
#cd into directory in Finder's front window
function cdf() {
finderPath=`osascript -e 'try
tell application "Finder" to set the source_folder to (folder of the front window) as alias
on error
tell application "Finder" to set source_folder to insertion location as alias
end try
return POSIX path of source_folder as string'`
cd "$finderPath"
@haikusw
haikusw / SwiftUIHostingConfiguration.md
Created August 29, 2024 19:01 — forked from simonbs/SwiftUIHostingConfiguration.md
In iOS 16, Apple added UIHostingConfiguration, making it straightforward to use a SwiftUI view in instances of UICollectionViewCell and UITableViewCell. This project shows how UIHostingConfiguration can be backported to iOS 14 by implementing a type that conforms to the UIContentConfiguration protocol.

SwiftUIHostingConfiguration

In iOS 16, Apple added UIHostingConfiguration, making it straightforward to use a SwiftUI view in instances of UICollectionViewCell and UITableViewCell. This gist shows how UIHostingConfiguration can be backported to iOS 14 by implementing a type that conforms to UIContentConfiguration.

Starting from iOS 16, we can use SwiftUI views in an instance of UICollectionView or UITableViewCell like this:

cell.contentConfiguration = UIHostingConfiguration {
    ExampleCellContentView(color: Color(item.color), text: item.text)
}

Swift Project

cd ~/src/swift-project/swift
./utils/update-checkout --clone-with-ssh --clean

Base build

sccache --start-server
#!/bin/sh
SRC1=$HOME/Library/Safari
SRC2=$HOME/Library/Containers/com.apple.Safari/Data/Library/Safari
HOST=$( hostname | sed 's/\..*//' )
HOUR=$( date +"%H" )
DST=$HOME/Sync/Safari/$HOST/$HOUR
mkdir -p $DST 2>/dev/null
cd $SRC1
@haikusw
haikusw / MeshEntity+GenerateSolidInteriorModel.swift
Created January 25, 2024 05:45 — forked from drewolbrich/MeshEntity+GenerateSolidInteriorModel.swift
A RealityKit ModelEntity extension that replaces its model with a new model with reversed triangle indices
//
// MeshEntity+GenerateSolidInteriorModel.swift
//
// Created by Drew Olbrich on 12/16/23.
//
import RealityKit
extension ModelEntity {
//
// ContentView.swift
// RigelianTagger
//
// Created by Berrie Kremers on 05/03/2022.
//
// This shows how a directory structure can be shown in a sidebar, with dynamic loading
// of additional content as the user drills down in the hierarchy.
//
@haikusw
haikusw / Info.plist
Created November 8, 2023 20:55 — forked from georgebrock/Info.plist
AppleScript to handle URLs
<?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>
<!-- ... -->
<!-- Add this section: -->
<key>CFBundleURLTypes</key>
<array>
<dict>
@haikusw
haikusw / xcbuild-debugging-tricks.md
Created September 17, 2023 23:54 — forked from ddunbar/xcbuild-debugging-tricks.md
Xcode new build system debugging tricks

New Build System Tricks

Command Line

alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole  # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
@haikusw
haikusw / Devices.md
Created September 15, 2023 18:52 — forked from schwa/Devices.md
Metal 3 Availablity & GPU Family Table

Metal 3 Availablity & GPU Family Table

Device OS SOC Metal GPU Family
iPhone 6S & 6S Plus iOS 15 A8 2 Apple2
iPhone SE (1st generation) iOS 15 A9 2 Apple3
iPhone 7 & 7 Plus iOS 15 A10 Fusion 2 Apple3
iPod Touch (7th generation) iOS 15 A10 Fusion 2 Apple3
iPhone 8 & 8 Plus iOS 15, 16 A11 Bionic 2 Apple4
iPhone X iOS 15, 16 A11 Bionic 2 Apple4
@haikusw
haikusw / Best in Class iOS Checklist
Created July 13, 2023 20:10 — forked from DreamingInBinary/Best in Class iOS Checklist
This is a public checklist updated every year after the latest version of iOS and iPadOS are shipped. It's a boiled down version of a "Best in Class" app checklist created by Jordan Morgan.
# A Best in Class Checklist
A boiled down checklist adapted from this [post](https://www.swiftjectivec.com/a-best-in-class-app/), created by @jordanmorgan10.
> To use this, create a Github Issue in your own repo, and simply copy and paste this text.
## iOS Core Technology
_Things any iOS app can benefit from_
- [ ] iCloud Sync
- [ ] Focus Filter Support