Skip to content

Instantly share code, notes, and snippets.

View jefisu's full-sized avatar

Jeferson Coutinho jefisu

  • Guarulhos
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. hiltmodule (applicable in top-level)
@dagger.Module
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@jefisu
jefisu / DotsLoaders.kt
Created May 16, 2022 23:44 — forked from EugeneTheDev/DotsLoaders.kt
Dots loading animations with Jetpack Compose
import androidx.compose.animation.core.*
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@jefisu
jefisu / RatingBar.kt
Last active July 16, 2022 18:52 — forked from vitorprado/RatingBar.kt
Jetpack Compose RatingBar (alpha12)
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.GenericShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
// add dependency
implementation "commons-codec:commons-codec:1.15"
import org.apache.commons.codec.digest.DigestUtils
fun generateSHA512(input: String) = DigestUtils.sha512Hex(input)
import io.ktor.http.content.*
import java.io.File
fun PartData.FileItem.save(path: String, fileName: String) {
val fileBytes = streamProvider().readBytes()
val folder = File(path)
folder.mkdir()
File("$path$fileName").writeBytes(fileBytes)
}