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 androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.ColumnScope | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.material.Button | |
import androidx.compose.material.DrawerDefaults | |
import androidx.compose.material.DrawerState | |
import androidx.compose.material.DrawerValue | |
import androidx.compose.material.MaterialTheme | |
import androidx.compose.material.ModalDrawer |
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
const username = "USER_NAME_HERE"; | |
/** | |
* Initialized like this so we can still run it from browsers, but also use typescript on a code editor for intellisense. | |
*/ | |
let followers = [{ username: "", full_name: "" }]; | |
let followings = [{ username: "", full_name: "" }]; | |
let dontFollowMeBack = [{ username: "", full_name: "" }]; | |
let iDontFollowBack = [{ username: "", full_name: "" }]; |
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
// https://sarunw.com/posts/swiftui-circular-progress-bar/ | |
// | |
// CircularProgressView.swift | |
// SwiftUI30WWDC2021 | |
// | |
// Created by Mateo on 5/6/22. | |
// | |
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 | |
// https://gist.github.com/DougGregor/92a2e4f6e11f6d733fb5065e9d1c880f | |
extension Collection { | |
func parallelMap<T>( | |
parallelism requestedParallelism: Int? = nil, | |
_ transform: @escaping (Element) async throws -> T | |
) async rethrows -> [T] { | |
let defaultParallelism = 2 | |
let parallelism = requestedParallelism ?? defaultParallelism |
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 Combine | |
import Foundation | |
extension Publisher { | |
public func retry<S: Scheduler>( | |
_ max: Int = Int.max, | |
delay: Publishers.RetryDelay<Self, S>.TimingFunction, | |
scheduler: S | |
) -> Publishers.RetryDelay<Self, S> { |
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
// MIT License | |
// | |
// Copyright (c) 2023 Lee Kah Seng | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
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
func animation(from notification: Notification) -> Animation? { | |
guard | |
let info = notification.userInfo, | |
let duration = info[UIResponder.keyboardAnimationDurationUserInfoKey] as? Double, | |
let curveValue = info[UIResponder.keyboardAnimationCurveUserInfoKey] as? Int, | |
let uiKitCurve = UIView.AnimationCurve(rawValue: curveValue) | |
else { | |
return nil | |
} |
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
sealed class AppFailure { | |
/** | |
* Global Failure classes | |
* These failures will be used across all over the app including Data Layer, Domain Layer, Framework Layer | |
*/ | |
class GeneralFailure(var message: String, var errorCode: Int? = null) : AppFailure() | |
class UnauthorizedFailure(var message: String = "Unauthorized", errorCode: Int? = null) : AppFailure() | |
class LoginFailure(var message: String = "Unable to login", errorCode: Int? = null) : AppFailure() | |
class ServerFailure(var message: String = "Unable to connect to the server side", errorCode: Int? = null) : AppFailure() | |
class NoInternetFailure(var message: String = "Device is not connected to the internet", errorCode: Int? = null) : AppFailure() |
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
/* | |
Here's our goal: | |
let localDataStore = UserDataStore() | |
let remoteDataStore = UserApi() | |
let dataStore = CacheBackedDataStore(localDataStore, remoteDataStore) | |
dataStore.fetch(userID) { result in | |
// handle result | |
} |
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 React, { useEffect, useState, useMemo } from "react" | |
import Echo from "laravel-echo" | |
import Pusher from "pusher-js" | |
/** | |
* Pusher configuration | |
*/ | |
const pusherConfig = { | |
key: '<your_pusher_key_here>', | |
cluster: '<pusher_cluster>', |
NewerOlder