Skip to content

Instantly share code, notes, and snippets.

View gumil's full-sized avatar
🌚
No Activity

Miguel Panelo gumil

🌚
No Activity
View GitHub Profile
@alexjlockwood
alexjlockwood / PlayingWithPaths.kt
Last active June 18, 2021 18:42
Implementation of a 'Playing with Paths' polygon animation
package com.alexjlockwood.playingwithpaths
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.animation.animatedFloat
import androidx.compose.animation.core.AnimationConstants
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.repeatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
@Ghedeon
Ghedeon / Test.kt
Created February 1, 2019 18:58
Coroutine Test
class AccountOwnerTypeViewModelTest {
@Rule
@JvmField
val rule = InstantTaskExecutorRule()
val mainThreadSurrogate = newSingleThreadContext("UI thread")
@Before
fun setUp() {
@ZakTaccardi
ZakTaccardi / ExampleActivity.kt
Last active October 20, 2023 02:27
Example MVI Implementation with Coroutines
import kotlinx.coroutines.experimental.android.Main
import kotlinx.coroutines.experimental.CoroutineScope
class ExampleActivity : Activity(), CoroutineScope by CoroutineScope(Dispatchers.Main) {
override fun onCreate(savedInstanceState: Bundle?)
super.onCreate(savedInstanceState)
val ui = Ui(this) // bind views, etc
package statemachine
import debug
import fail
import io.reactivex.Observable
import kotlinx.coroutines.experimental.channels.Channel
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.experimental.runBlocking
@markusfisch
markusfisch / README.md
Last active October 8, 2022 06:21
Generate an annual commit report

Generate an annual commit report

Prints something like this:

In 2018 you made 2488 commits in 134 projects.
The average length of a commit message was 62 characters.

Commits per weekday
    Monday     334 ******************************************
@ultraon
ultraon / build.gradle
Last active August 19, 2020 18:10
Good example of the merged Jacoco code covarage Gradle configuration
apply plugin: 'com.android.application'
apply from: "$rootDir/coverage.gradle"
//...
android {
//...
buildTypes {
//...
debug {
@andymatuschak
andymatuschak / States-v3.md
Last active April 12, 2024 16:06
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,