Skip to content

Instantly share code, notes, and snippets.

View arohim's full-sized avatar
😋

a-rohim arohim

😋
View GitHub Profile
@kafri8889
kafri8889 / DashedDivider.kt
Created June 12, 2022 02:49
Dashed divider in Jetpack Compose
@Preview
@Composable
private fun DashedDividerPreview() {
DashedDivider(
color = Color.Black,
thickness = 1.dp,
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
)
1. hiltvm (applicable in top-level)
@dagger.hilt.android.lifecycle.HiltViewModel
class $NAME$ @javax.inject.Inject constructor(
$PARAM$
) : androidx.lifecycle.ViewModel() {
$END$
}
2. vmstatefunc (applicable in class)
private val _$NAME$ = androidx.compose.runtime.mutableStateOf<$TYPE$>($INITIAL_VALUE$)
$ awk -v ORS='\\n' '1' karnov-review.2019-01-21.private-key.pem | pbcopy
package com.trendyol.inventorycenterapi.helper
import com.trendyol.inventorycenterapi.domain.inventory.CurrencyCode
import java.lang.reflect.*
import java.time.Instant
import kotlin.random.Random
import kotlin.reflect.full.createType
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.KTypeProjection
import org.junit.jupiter.api.Test
import kotlin.random.Random
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.reflect.KTypeParameter
import kotlin.test.assertEquals
import kotlin.test.assertTrue
// Take getKType from https://gist.github.com/udalov/bb6f398c2e643ee69586356fdd67e9b1
@LouisCAD
LouisCAD / GooglePlayServices.kt
Created November 23, 2017 16:19
Allows using Google Play Services Task API in Kotlin Coroutines, plus Play Services availability check made easier.
import com.google.android.gms.common.GoogleApiAvailability
import com.google.android.gms.tasks.Task
import splitties.init.appCtx
import kotlin.coroutines.experimental.suspendCoroutine
val googleApiAvailability = GoogleApiAvailability.getInstance()!!
inline val playServicesAvailability get() = googleApiAvailability.isGooglePlayServicesAvailable(appCtx)
@JvmName("awaitVoid")
suspend fun Task<Void>.await() = suspendCoroutine<Unit> { continuation ->