This file contains 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
extension Collection { | |
func anySatisfy(_ p: (Element) -> Bool) -> Bool { | |
return !self.allSatisfy { !p($0) } | |
} | |
} |
This file contains 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
class Xcutils < Formula | |
desc 'A collection of utilities that aid with the use of the Xcode CLI, packaged as a single SwiftPM Package.' | |
homepage 'https://github.com/JosephDuffy/xcutils' | |
url 'https://github.com/JosephDuffy/xcutils/archive/v0.1.2-rc2.tar.gz' | |
sha256 '82200150a8d6ce1e91f7258724716e52fb1c932e78bafb596d40e32388c39583' | |
license 'MIT' | |
version '0.1.2' | |
def install | |
system 'swift', 'build', |
This file contains 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
class SpmPlayground < Formula | |
desc "Command line tool to create an Xcode project with a Playground and an SPM library ready for use in it" | |
homepage "https://github.com/finestructure/SPMPlayground" | |
url "https://github.com/finestructure/SPMPlayground/archive/0.4.0.tar.gz" | |
sha256 "774868a14a8bc5f5002979613543463fee7f381b7349b865e956a1a44fbf3940" | |
version '0.4.0' | |
depends_on :xcode => ["11.0", :build, :test] | |
def install |
This file contains 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 RxRelay | |
import RxSwift | |
@propertyWrapper | |
public struct BehaviorRelayWrapping<T> { | |
private let subject: BehaviorRelay<T> | |
// MARK: PropertyWrapper | |
public let wrappedValue: Observable<T> |
This file contains 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
found_rbenv='' | |
rbenvdirs=("$HOME/.rbenv" "$HOME/.local/rbenv" "/usr/local/opt/rbenv" "/usr/local/rbenv" "/opt/rbenv") | |
for rbenvdir in "${rbenvdirs[@]}" ; do | |
if [ -z "$found_rbenv" ] && [ -d "$rbenvdir/versions" ]; then | |
found_rbenv=true | |
if [ -z "$RBENV_ROOT" ]; then | |
RBENV_ROOT=$rbenvdir | |
export RBENV_ROOT | |
fi |
This file contains 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 sh | |
set -e | |
fancy_echo() { | |
local fmt="$1"; shift | |
printf "\n$fmt\n" "$@" | |
} |
This file contains 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 wrapper around a repeating timer that does not require invalidation. | |
final class Pendulum { | |
let timer: Timer | |
init(seconds: TimeInterval, closure: @escaping () -> ()) { | |
timer = Timer.scheduledTimer( | |
withTimeInterval: seconds, | |
repeats: true, | |
block: { _ in | |
closure(); |
This file contains 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
extension Request where Response: Decodable { | |
func handle( | |
response: Result<Data, Error>, | |
completion: (Result<Response, Error>) -> Void) { | |
completion(Result { | |
try JSONDecoder().decode(Response.self, from: response.get()) | |
}) | |
} | |
} |
This file contains 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 sh | |
# Xcode sometimes gets sad and won't index or other shenanigans. You can easily cheer up Xcode | |
# and get things happy again by simply removing some files. This little script does just that. | |
# Quit Xcode | |
osascript -e 'tell app "Xcode" to quit' | |
# Remove derived data | |
rm -rf ~/Library/Developer/Xcode/DerivedData/* |
NewerOlder