Skip to content

Instantly share code, notes, and snippets.

View ajinkya5130's full-sized avatar
🏠
Working from home

Ajinkya Kalaskar ajinkya5130

🏠
Working from home
  • Bengaluru
  • 11:24 (UTC +05:30)
View GitHub Profile
@ajinkya5130
ajinkya5130 / Dimensions.kt
Created September 29, 2025 15:59
Dimension Information
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
val LocalDim = compositionLocalOf { Dimensions() }
val LocalFont = compositionLocalOf { FontDimensions() }
@ajinkya5130
ajinkya5130 / HttpClientNetworking.android.kt
Last active September 28, 2025 19:19
Generic HttpResponse converter
package com.ajinkya.core.data.networking
import com.ajinkya.core.domain.utils.DataError
import com.ajinkya.core.domain.utils.Result
import io.ktor.client.plugins.HttpRequestTimeoutException
import io.ktor.client.statement.HttpResponse
import io.ktor.network.sockets.SocketTimeoutException
import io.ktor.util.network.UnresolvedAddressException
import kotlinx.coroutines.ensureActive
import kotlinx.serialization.SerializationException
@ajinkya5130
ajinkya5130 / ObserveAsEvent.kt
Created September 28, 2025 15:22
One time Event Observer
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.repeatOnLifecycle
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.withContext
@Composable
@ajinkya5130
ajinkya5130 / UiText.kt
Created September 28, 2025 14:41
String resource in composeable
import androidx.compose.runtime.Composable
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.getString
import org.jetbrains.compose.resources.stringResource
sealed interface UiText {
data class DynamicString(val value: String) : UiText
class Resource(
@ajinkya5130
ajinkya5130 / DataError.kt
Created September 28, 2025 10:11
Result Wrapper class
sealed interface DataError: Error {
enum class Remote: DataError{
BAD_REQUEST,
UNAUTHORIZED,
REQUEST_TIMEOUT,
FORBIDDEN,
CONFLICT,
TOO_MANY_REQUESTS,
NO_INTERNET_CONNECTION,
PAYLOAD_TOO_LARGE,