Skip to content

Instantly share code, notes, and snippets.

@Kodmia
Kodmia / gauge.kt
Created February 22, 2024 10:58
Gauge
private const val indicatorStartAngle = 135
private const val indicatorArcDegrees = 270
@OptIn(ExperimentalTextApi::class)
@Composable
fun Gauge(
canvasSize: Dp = 300.dp,
indicatorValue: Float = 0f,
presetValue: Float = 0f,
showPresetValue: Boolean = false,
@rkam88
rkam88 / MockProxy.kt
Last active April 21, 2023 10:08
A Java dynamic proxy that calls either the real or mocked implementation of an interface
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.lang.reflect.InvocationHandler
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method
import java.lang.reflect.Proxy
import kotlin.coroutines.Continuation
import kotlin.coroutines.cancellation.CancellationException
@SelfFormat
SelfFormat / build.gradle
Last active October 18, 2023 19:11
detekt multi module gradle configuration
plugins {
id "io.gitlab.arturbosch.detekt" version "1.16.0"
}
def projectSource = file(projectDir)
def configFile = files("$rootDir/config/detekt/detekt.yml")
def baselineFile = file("$rootDir/config/detekt/baseline.xml")
def kotlinFiles = "**/*.kt"
def resourceFiles = "**/resources/**"
def buildFiles = "**/build/**"
@objcode
objcode / ConcurrencyHelpers.kt
Last active May 31, 2024 13:31
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,