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
#!/bin/bash | |
# This script is going to generate .gif from .MP4 and .mov in the Downloads directory | |
echo 'Checking tools that are needed in this script...' | |
# Checking Homebrew for installing ffmpeg | |
if !(type 'brew' > /dev/null); then | |
echo 'Installing Homebrew...' | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
if !(type 'brew' > /dev/null); then |
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 Publishers { | |
struct Previous<Upstream: Publisher>: Publisher { | |
typealias Output = (Upstream.Output?, Upstream.Output) | |
typealias Failure = Upstream.Failure | |
private let upstream: Upstream | |
init(upstream: Upstream) { | |
self.upstream = upstream | |
} |
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 DeliveryProgressView(context: Context, attributeSet: AttributeSet) : FrameLayout(context, attributeSet) { | |
private val progressBar: ProgressBar | |
private val notDeliveredCircleImageView: ImageView | |
private val deliveringCircleImageView: ImageView | |
private val deliveredCircleImageView: ImageView | |
init { | |
View.inflate(context, R.layout.delivery_progress_view, this) | |
progressBar = findViewById<ProgressBar>(R.id.progress_bar).apply { | |
progress = 50 |
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 Foundation | |
import Apollo | |
public extension ApolloClient { | |
func asyncFetch<Q: GraphQLQuery>(query: Q, cachePolicy: CachePolicy, queue: DispatchQueue) async throws -> Q.Data { | |
try await withCheckedThrowingContinuation({ [weak self] continuation in | |
guard let self = self else { | |
continuation.resume(throwing: NSError(domain: "Apollo.NoSelfError", code: -1, userInfo: nil)) | |
return | |
} |
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
@propertyWrapper | |
struct Query<Query: GraphQLQuery>: DynamicProperty { | |
enum NetworkState { | |
case notFetching | |
case fetching | |
case success(Query.Data) | |
case failure | |
} | |
@State var wrappedValue: NetworkState = .notFetching |
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
@propertyWrapper | |
struct CollectionListener<Document: Codable>: DynamicProperty { | |
final class FirestoreDocumentsListener { | |
typealias OnUpdate = ([Document]) -> Void | |
private var onUpdate: OnUpdate? | |
private var listenerRegistration: ListenerRegistration? | |
func listen(path: String, firestore: Firestore, onUpdate: OnUpdate? = nil) { | |
self.onUpdate = onUpdate | |
guard listenerRegistration == nil else { return } |
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 SwiftUI | |
struct SpreadsheetView<ColumnView: View, RowView: View, ContentView: View, Column: Hashable, Row: Hashable>: View { | |
init( | |
columns: [Column], | |
rows: [Row], | |
columnWidth: CGFloat, | |
columnHeight: CGFloat, | |
rowWidth: CGFloat, | |
rowHeight: CGFloat, |