Skip to content

Instantly share code, notes, and snippets.

View Estete9's full-sized avatar

Esteban Palacios Estete9

View GitHub Profile
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$)
@crowjdh
crowjdh / MutableListExtensions.kt
Created May 3, 2016 15:18
Remove items with range from MutableList in Kotlin
inline fun <reified T> MutableList<T>.removeRange(range: IntRange) {
val fromIndex = range.start
val toIndex = range.last
if (fromIndex == toIndex) {
return
}
if (fromIndex >= size) {
throw IndexOutOfBoundsException("fromIndex $fromIndex >= size $size")
}