Skip to content

Instantly share code, notes, and snippets.

View paulz's full-sized avatar
🍐
pairing is caring

Paul Zabelin paulz

🍐
pairing is caring
View GitHub Profile
@paulz
paulz / NameGenerator.swift
Last active March 20, 2020 04:26
Test date dependent code
public class NameGenerator: NSObject {
@Inject var now: () -> Date
public func nextName() -> String {
now().description
}
}
@paulz
paulz / ChainedResolver.swift
Created March 20, 2020 21:09
Dependency Injection For Objective C and Swift hybrid project
public struct ChainedResolver: ResolveDependency {
public func resolve<Service>(_: Service.Type, name: String?) -> Service? {
child.resolve(name: name) ?? parent.resolve(name: name)
}
let child, parent: ResolveDependency
public init(child: ResolveDependency, parent: ResolveDependency) {
self.child = child
self.parent = parent
@paulz
paulz / Breakpoints_v2.xcbkptlist
Last active March 31, 2020 08:25
Expect Exception without breaking in debugger
objc_exception_throw:
console command:
script lldb.process.Continue() if (lldb.frame.GetThread().GetName() == "skip-objc_exception_throw") else None
@paulz
paulz / open-with-app.scpt
Created June 28, 2020 07:25
Finder Service Open Application
# Open File or Folder with an application
#
# Create Automator new Quick Action workflow with these 3 actions:
# 1. Workflow receives "files or folders" in "any application
# 2. Get Specified Finder Items - used for debugging
# 3. Run Apple Script
#
# Paste script below and change Atom.app to any other appp
# Test shell script command works in terminal
# Test Automator workflow by adding items in step 2
@paulz
paulz / TimeIntervalParsing.swift
Last active May 15, 2021 21:29 — forked from Odie/gist:e26bc299bfc1f020e636
Parse user friendly time duration string in Swift
extension DateComponents {
subscript(unit: String) -> Int {
get {
switch unit {
case "month":
return self.month!
case "day":
return self.day!
case "hour":
return self.hour!
@paulz
paulz / instructions.md
Created April 19, 2022 05:29
macOS Screen Share to GitHub hosted runner
@paulz
paulz / apply-patch.zsh
Last active May 21, 2022 03:40
How to fix python errors from Xcode bitcode-build-tool
#!/bin/zsh
cd /Applications/Xcode.app/Contents/Developer/usr/lib/bitcode_build_tool/
sudo patch < ${0:a:h}/buildenv.patch
@paulz
paulz / ci_post_clone.sh
Created June 7, 2022 06:20
Xcode Cloud Hardware
#!/bin/zsh
system_profiler SPHardwareDataType
system_profiler SPDisplaysDataType
@paulz
paulz / first.md
Created March 8, 2023 17:34
Daniel and Paul create an article

first idea, can we both edit this?

@paulz
paulz / build-and-test.yml
Last active April 4, 2023 02:57
GitHub Actions workflows
name: test on Simulator
on:
workflow_dispatch:
schedule:
# At every 10th minute past every hour from 9 through 13.
# which is 1 am PST
- cron: '*/10 9-13 * * *' # https://crontab.guru/#*/10_9-13_*_*_*
pull_request:
branches: