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
#!/usr/bin/env bash | |
TAR_OPTS=( | |
# Rename file(s) | |
-s ':string/in/path:replacement:g' | |
--exclude 'Contents/Frameworks' | |
) | |
# non-GNU tar | |
tar "${TAR_OPTS[@]}" \ |
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
join_by() { | |
# https://stackoverflow.com/a/17841619/6053417 | |
local IFS="$1" | |
shift | |
echo "$*" | |
} |
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 | |
import SwiftUI | |
@available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) | |
class ObservablePublisher<Output>: ObservableObject { | |
var bag: [AnyCancellable] = [] | |
@Published public internal(set) var value: Output? | |
init(erased publisher: AnyPublisher<Output, Never>) { |
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
Fixes for common macOS Bamboo issues: | |
1. codesign: | |
/usr/bin/codesign --force --sign "HASH" --verbose file.dylib | |
file.dylib: replacing existing signature | |
file.dylib: errSecInternalComponent | |
Fix | |
Open keychain containing codesign certificate: | |
security unlock-keychain |
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
# As the first command in a script | |
exec 1> >(logger -is -t "$(basename "$0")") 2>&1 | |
# Alternatively, output everything to a file | |
#exec 1> "$PWD/out.log" 2>&1 |
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
// let contentView = NSHostingView(rootView: ContentView()) | |
visualEffect.addSubview(contentView) | |
contentView.translatesAutoresizingMaskIntoConstraints = true | |
contentView.autoresizingMask = [.width, .height] | |
window.contentView = visualEffect |
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
protocol CaseEquatable { | |
associatedtype Case: Equatable | |
var `case`: Case { get } | |
static func ~=(lhs: Self, rhs: Self) -> Bool | |
} | |
extension CaseEquatable { | |
static func ~=(lhs: Self, rhs: Self) -> Bool { | |
return lhs.case == rhs.case |
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
/** | |
A type-erased encodable value. | |
Useful in generic contexts or collections that | |
require mixed types conforming to | |
[Encodable](apple-reference-documentation://hsh65KLP6K). | |
*/ | |
public struct AnyEncodable: Encodable { | |
/// The underlying object. | |
public let base: Encodable |
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
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) | |
extension Binding { | |
/** | |
Creates a new `Binding` focused on `Subject` using a key path. | |
*/ | |
public subscript<Subject> | |
(keyPath keyPath: KeyPath<Value, Subject>, setter: @escaping (Subject) -> Void) | |
-> Binding<Subject> { | |
.init(get: { | |
self.wrappedValue[keyPath: keyPath] |