This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
@MainActor | |
class PhotoStore: ObservableObject { | |
@Published private(set) var isSaving: Bool = false | |
// Made nonisolated because Playgrounds does not run on | |
// @MainActor. There's probably a cleaner way of doing this | |
nonisolated init() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Crashes when count is set to 683. Works fine if count < 683. | |
// Usage: | |
// func testMessagePassing() throws { | |
// let coordinator = Coordinator() | |
// let expectation = XCTestExpectation() | |
// detach { | |
// await coordinator.simulateMessengers() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIImage { | |
/// Available launch images (as of 12 May 2021): | |
/// [email protected]: 750x1334 | |
/// [email protected]: 828x1792 | |
/// [email protected]: 1242x2208 | |
/// [email protected]: 1125x2436 | |
/// [email protected]: 1242x2688 | |
static var launchImage: UIImage { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Combine | |
func runDelayedInBackground<Output, DelayingScheduler: Scheduler, ReceivingScheduler: Scheduler>( | |
delay: Int = 200, | |
scheduler: DelayingScheduler, | |
receiveOn: ReceivingScheduler, | |
worker: @escaping () -> Result<Output, Never>, | |
completion: @escaping (Output) -> () | |
) -> AnyCancellable { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
final class A { | |
func someMethod() {} | |
} | |
struct B { | |
let a: A | |
func someMethod() {} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import PlaygroundSupport | |
import UIKit | |
enum PassingStructInInit { | |
struct A { | |
let b: B | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License | |
// | |
// Copyright (c) 2020 Manuel Maly | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Whenever Charles is quit unexpectedly (e.g. hard reboot due to kernel panic), | |
# it leaves its proxy settings active, breaking outbound internet connections. | |
# This has happened so often to me recently that I decided I need a script for this. | |
# | |
# Store this in an .sh file, and make it executable with | |
# chmod x+ {PATH_TO_FILE} | |
# I put it in my user's crontab to run every minute (even when logged out): | |
# echo "* * * * * /Users/{YOUR_USERNAME}/{...}/remove_proxies_unless_charles_runs.sh" | crontab - | |
# Since I'm impatient, I want this to run every 30 seconds even, so I also added: | |
# echo "* * * * * sleep 30; /Users/{YOUR_USERNAME}/{...}/remove_proxies_unless_charles_runs.sh" | crontab - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for framework in Frameworks/*.framework; do | |
fname=$(basename $framework .framework) | |
echo $fname | |
otool -v -s __TEXT __objc_methname $framework/$fname | grep advertisingIdentifier | |
done |