Skip to content

Instantly share code, notes, and snippets.

View cbedoy's full-sized avatar

Bedoy cbedoy

View GitHub Profile
sealed class NewServiceIntent {
object LoadProducts: NewServiceIntent()
data class AddProduct(val product: Product): NewServiceIntent()
}
sealed class NewServiceState {
object ShowLoader: NewServiceState()
data class ReloadProducts(val products: List<Product>): NewServiceState()
data class ReloadCart(val cartList: List<Product>): NewServiceState()
object HideLoader: NewServiceState()
class NewServiceViewModel(
private val useCase: NewServiceUseCase
): ViewModel {
private val _cart: MutableLiveData<List<Product>>
val cart: LiveData<List<Product>> get() = _cart
private val _products: MutableLiveData<List<Product>>
val products: LiveData<List<Product>> get() = _products
@cbedoy
cbedoy / LoginFragment.kt
Last active March 17, 2021 04:38
Common MVI
class LoginFragment {
val viewModel by viewModel<LoginViewModel>()
override fun onViewCreadted(){
with(binding){
action.setOnClickListener{
viewModel.performIntent(
intent = PerformLoginWith(
username = usernameField.textAsString
)
@cbedoy
cbedoy / lane_develop
Created March 16, 2021 03:37
fastlane develop
desc "Submit a new Beta Build to Firebase App Distribution (Develop)🚀🚀"
lane :qa do
changelog = changelog_from_git_commits(
between: ["master", "HEAD"],
pretty: "- %s",
date_format: "short",
match_lightweight_tag: false,
merge_commit_filtering: "exclude_merges"
)
@cbedoy
cbedoy / beautycode.c
Created July 8, 2020 06:37
codeeee amigaaaa
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 5
void showMenu(){
printf("\n\nSelecciona:\n");
printf("1) Crear matrix\n");
printf("2) Sumar matrix\n");
@cbedoy
cbedoy / Bookmarks
Last active May 14, 2020 22:07
Amazing Stuff
https://github.com/Yelp/swagger-gradle-codegen
https://medium.com/@joshuaavalon/migrate-from-gson-to-moshi-in-android-bfc9f357ff17
https://start.insert-koin.io/#/quickstart/kotlin
https://www.androidelements.com/
https://koenig-media.raywenderlich.com/uploads/2019/11/RW-Kotlin-Cheatsheet-1.1.pdf
fun TextView.setCollapseExpand(collapsibleView: View, onCollapse: () -> Unit, onExpand: () -> Unit) {
setCompoundDrawablesWithIntrinsicBounds(null, null, DrawableConstants.ic_expand_section.createDrawable(), null)
setOnClickListener {
when (collapsibleView.visibility) {
View.GONE -> {
collapsibleView.visibility = View.VISIBLE
setCompoundDrawablesWithIntrinsicBounds(null, null, DrawableConstants.ic_collapse_section.createDrawable(), null)
onExpand()
}
View.VISIBLE -> {
@cbedoy
cbedoy / x
Created November 18, 2019 03:11
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layout_constraintEnd_toStartOf="@+id/final_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:background="#999"
@cbedoy
cbedoy / BaseHolder.kt
Last active October 3, 2019 17:24
Common UTILS
abstract class BaseHolder(override val containerView: View) : RecyclerView.ViewHolder(containerView),
LayoutContainer {
abstract fun reload(source: Any)
}
@cbedoy
cbedoy / nuke-deps.sh
Created July 15, 2019 15:51 — forked from jsdario/nuke-deps.sh
Script to clean watchman, remove node_modules, clean cache and restart packager for React Native troubleshooting.
#!/bin/bash
# Stop cached listeners
watchman watch-del-all
# Remove installed modules
rm -rf node_modules
# Remove yarn meta files
rm yarn*