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
extension AsyncSequence where Self.Element : Equatable & Sendable { | |
func first( | |
_ search: Self.Element, | |
timeout: TimeInterval = 1.0 | |
) async throws { | |
do { | |
try await _until(where: { $0 == search }, timeout: timeout) | |
} catch is CancellationError { | |
print("cancelled before element was emitted or timeout was reached.") | |
throw CancellationError() |
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
final actor ActorIsolatedExpectation<Value: Sendable & Equatable> { | |
/// The actor's expected value | |
let expectedValue: Value | |
/// The actor's current value (initially `nil`) | |
var currentValue: Value? | |
let id = UUID() | |
/// Initializes the actor with an expexted value. |
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 | |
#if targetEnvironment(simulator) | |
@_silgen_name("UIAnimationDragCoefficient") func UIAnimationDragCoefficient() -> Float | |
func simulatorDragCoefficient() -> CFTimeInterval { | |
let drag = UIAnimationDragCoefficient() | |
if drag > 1 { | |
return CFTimeInterval(drag) | |
} | |
return 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
#!/usr/bin/ruby | |
# It's so annoying that the 'Ready for Sale' status on AppStoreConnect doesn't mean that the app | |
# is available for your users, since the cache might not have been invalidated yet. | |
# This is why I created this script to run and scrape the App Store page of an app and its currently live version. | |
# Once the expected version is live, a local notification is sent. This can be easily extended to send a Slack message via a web hook. | |
require 'open-uri' | |
require 'nokogiri' |
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 | |
import Foundation | |
public protocol LoadStateIndicating { | |
/// Shows a blur view over the current context with an animated activity indicator. | |
func startLoading() | |
/// Hides blur view and activity indicator. | |
func stopLoading() |