Skip to content

Instantly share code, notes, and snippets.

@tadfisher
tadfisher / config.gz
Created October 28, 2020 19:52
reMarkable 2 linux configuration
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 4.14.78 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_ARM_HAS_SG_CHAIN=y
CONFIG_MIGHT_HAVE_PCI=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_STACKTRACE_SUPPORT=y
@tadfisher
tadfisher / build.nix
Last active April 13, 2024 10:31
Simplified Nix integration with Gradle
{ lib
, stdenv
, jdk
, gradle
, mavenRepo
}:
stdenv.mkDerivation {
pname = "built-with-gradle";
version = "0.0";
@tadfisher
tadfisher / BaselineText.kt
Created June 8, 2021 18:30
BaselineText.kt
/**
* Wrapper for the [Text] element which adds additional padding after the last baseline
* such that the height of the last line of text matches the style's
* [lineHeight][TextStyle.lineHeight].
*/
@Composable
fun BaselineText(
text: String,
modifier: Modifier = Modifier,
color: Color = Color.Unspecified,
@tadfisher
tadfisher / LinkedText.kt
Created June 12, 2021 20:51
LinkedText.kt
import androidx.compose.animation.animateColorAsState
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor
import androidx.compose.material.LocalTextStyle
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.runtime.Composable
@tadfisher
tadfisher / BottomSheet.kt
Created April 29, 2022 22:43
BottomSheetHost
object BottomSheetDefaults {
@Stable
val Elevation = 16.dp
@Stable
val OuterPadding: PaddingValues = PaddingValues(top = 48.dp)
@tadfisher
tadfisher / AndroidUpdaterState.kt
Created June 1, 2022 18:00
In-app updates for Jetpack Compose
package com.mercury.app.updater
import android.app.Activity
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.IntentSenderRequest
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
@tadfisher
tadfisher / PageLoadStates.kt
Last active January 9, 2024 10:28
Basic paging
sealed class PageLoadState(val endOfDataReached: Boolean) {
   data class Error(val error: Throwable) : PageLoadState(false) {
       override fun toString(): String = "Error(error=$error"
   }
   sealed class NotLoading(endOfDataReached: Boolean) : PageLoadState(endOfDataReached) {
       object Complete : NotLoading(true) {
           override fun toString(): String = "Complete"
       }