Skip to content

Instantly share code, notes, and snippets.

View emaleavil's full-sized avatar

Emanuel emaleavil

View GitHub Profile
sealed interface UserProfileEvent {
data object DeleteAccount : UserProfileEvent
data object ConsumeEffect : UserProfileEvent
}
sealed interface UserProfileEffect {
data class ShowError(val message: String) : UserProfileEffect
data object NavigateToLogin : UserProfileEffect
}
@milnak
milnak / garlic-os-tips.md
Last active February 19, 2026 19:16
My set of GarlicOS tips #rg35xx

Garlic OS Tips (Windows-based)

GarlicOS Cookbook

Follow these instructions for an easy way to get up and going quickly! These are complete instructions, and will be the easiest way to get started on a new RG35XX.

Set up SD Card

Get a high quality SD (e.g. SanDisk Extreme) card, 128GB or larger, 256GB is recommended. Don't skimp here, they're cheap, and don't use the card that comes with the RG35XX as it's crap.

@iurysza
iurysza / ktlint.gradle
Last active February 24, 2025 13:58
Gradle task that runs ktlint only over changed files
configurations { ktlint }
dependencies { ktlint "com.pinterest:ktlint:$ktlintVersion" }
task ktlintCi(type: JavaExec, group: "verification") {
description = "Run Kotlin linter on changed files."
group = "CI"
main = "com.pinterest.ktlint.Main"
classpath = configurations.ktlint
doFirst {
@alexvanyo
alexvanyo / jacoco.gradle.kts
Last active August 29, 2024 09:09
Kotlin DSL JaCoCo configuration for Android
import com.android.build.gradle.internal.tasks.factory.dependsOn
plugins {
id("com.android.application")
jacoco
}
// Register the main JaCoCo task to later depend on the per-variant tasks
val jacocoTestReport = tasks.register("jacocoTestReport")
@HiddenJester
HiddenJester / UnitTestingSceneDelegateGist.md
Last active December 1, 2025 22:29
Mocking SceneDelegate for Unit Tests on iOS 13

Replacing the SceneDelegate When Running Unit Tests

Overview

I've been working through the exercises in the excellent iOS Unit Testing by Example book by Jon Reid, which I highly recommend. However, the book is in beta at the moment and there are some curveballs thrown by iOS 13 that aren't handled in the text yet. Specifically, when I hit the section about using a testing AppDelegate class I thought "This is very good. But what about the SceneDelegate?"

In Chapter 4 the recommendation is to remove the @UIApplicationMain decoration and make a manual top-level call to UIApplicationMain. To wit:

import UIKit
@gmazzo
gmazzo / jacoco.gradle
Created December 16, 2018 17:09
Jacoco script for Android unit and instrumentation tests coverage report, supporting Kotlin
apply plugin: 'jacoco'
jacoco {
toolVersion = '0.8.2'
}
android {
buildTypes {
debug {
@bharatdodeja
bharatdodeja / Robot Pattern.md
Last active December 17, 2023 12:21
Android UI testing using Espresso and Robot pattern

Android UI Testing using Espresso, Rotton Pattern and Kotlin DSL

Espresso allow UI tests to have stable interactions with your app, but without discipline these tests can become hard to manage and require frequent updating. Robot pattern allows you to create stable, readable, and maintainable tests with the aid of Kotlin’s language features.

Test Excecution

Let's say there is a login screen and user needs to login access dashboard by entering email and password and clicking on the login button. This is what we want the test to validate. But there’s also the how. Really, what we are looking for is the what.

Traditional Testing (Problem)

A way that you might write the test is something like this:

@illuzor
illuzor / .gitlab-ci.yml
Last active November 28, 2025 22:21
Config for gitlab ci android with unit tests and instrumented tests
image: ubuntu:22.04
variables:
ANDROID_COMPILE_SDK: "33"
ANDROID_BUILD_TOOLS: "33.0.2"
EMULATOR_IMAGE: "24"
SDK_TOOLS: "9477386" # from https://developer.android.com/studio/#command-tools
before_script:
@dekzitfz
dekzitfz / .gitlab-ci.yml
Created June 18, 2018 08:24
Gitlab CI for Firebase Test Lab
image: jangrewe/gitlab-ci-android
stages:
- build
- test
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew