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 | |
#warning("TODO: <Connor> Make handles generic views so they are customizable rather than assuming what people want. (Provide defaults)") | |
#warning("TODO: <Connor> Use my custom @StateBinding property wrapper to allow consumers to optionally pass a binding to the bools for isExpanded, isMoving, isResizing. Then they can react in the parent, or they can not pass a binding and let the view handle the state internally.") | |
#warning("TODO: <Connor> General cleanup of calculations and code density.") | |
// MARK: - ViewManipulation | |
struct ViewManipulation: OptionSet { |
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 | |
import Dependencies | |
import AsyncExtensions | |
public struct Setting<Value:Sendable>: Sendable { | |
let id: String | |
let name: String | |
let fallback: Value | |
let load: @Sendable (String) -> Value? |
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
struct OverflowLayout: Layout { | |
var spacing = CGFloat(10) | |
func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { | |
let containerWidth = proposal.replacingUnspecifiedDimensions().width | |
let sizes = subviews.map { $0.sizeThatFits(.unspecified) } | |
return layout(sizes: sizes, containerWidth: containerWidth).size | |
} | |
func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) { |
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 | |
extension CollectionView { | |
typealias UIKitCollectionView = CollectionViewWithDataSource<SectionIdentifierType, ItemIdentifierType> | |
typealias DataSource = UICollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> | |
typealias Snapshot = NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType> | |
typealias UpdateCompletion = () -> Void | |
} | |
struct CollectionView<SectionIdentifierType, ItemIdentifierType> |
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
// MARK: - TCAView | |
public protocol TCAView: View where Body == WithViewStore<ScopedState, ScopedAction, Content> { | |
associatedtype ViewState | |
associatedtype ViewAction | |
associatedtype ScopedState | |
associatedtype ScopedAction | |
associatedtype Content |
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
/// The authentication state. | |
enum AuthenticationState: StateType { | |
// A list of events. | |
enum Event { | |
case userSignIn(email: String, password: String) | |
case accessTokenReceived(AccessToken) | |
case userReceived(User) | |
case userSignedOut | |
} |
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 notifierQueue from "~/queues/notifier.server.ts"; | |
export const loader = async () => { | |
await notifierQueue.add("test", { emailAddress: "mokhtar@remixtape.dev" }); | |
return null; | |
}; |
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 AVKit | |
class VideoHelper { | |
static func getThumbnail(from player: AVPlayer, at time: CMTime) -> CGImage? { | |
do { | |
guard let currentItem = player.currentItem else { return nil } | |
let asset = currentItem.asset | |
let imgGenerator = AVAssetImageGenerator(asset: asset) |
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 parallelMap<T>( | |
parallelism requestedParallelism: Int? = nil, | |
_ transform: @escaping (Element) async throws -> T | |
) async throws -> [T] { | |
let defaultParallelism = 2 | |
let parallelism = requestedParallelism ?? defaultParallelism | |
let n = self.count | |
if n == 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
Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
ActivityTweet | |
generic_activity_highlights | |
generic_activity_momentsbreaking | |
RankedOrganicTweet | |
suggest_activity | |
suggest_activity_feed | |
suggest_activity_highlights | |
suggest_activity_tweet |
NewerOlder