Skip to content

Instantly share code, notes, and snippets.

Bloder bloderxd

Block or report user

Report or block bloderxd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View consume_flow_extension.kt
sealed class HomeActions {
class ShowPosts(val posts: List<Post>) : HomeActions()
class ShowUsers(val users: List<User>) : HomeActions()
}
data class HomeState(val posts: List<Post> = listOf(), val user: List<User> = listOf())
private val homeActions: ConflatedBroadcastChannel<HomeActions> by lazy { ConflatedBroadcastChannel<HomeActions>() }
View BloderComparable.kt
interface BloderComparable<T> {
fun customCompareTo(b: T) : Int
}
// O(1)
fun <T : BloderComparable<T>> List<T>.firstComparableIsEqualsTo(item: T) : Boolean = this[0].customCompareTo(item) == 0
// O(n)
fun <T : BloderComparable<T>> List<T>.containsComparable(item: T) : Boolean = this.firstOrNull {
it.customCompareTo(item) == 0
View ContextValidation
class ContextValidation(private val validator: FormValidator) : DefaultValidation(validator) {
fun whenBrazil(conditions: BrazilValidations.() -> Unit) {
if (isBrazilApp()) BrazilValidations(validator).conditions()
}
fun whenColombia(conditions: ColombiaValidations.() -> Unit) {
if (isColombiaApp()) ColombiaValidations(validator).conditions()
}
You can’t perform that action at this time.