Skip to content

Instantly share code, notes, and snippets.

View omkar-tenkale's full-sized avatar
☸️
Planning

Omkar Tenkale omkar-tenkale

☸️
Planning
View GitHub Profile
-----FRUIT BASKET--------
-----MANGO BASKET-------- PUT ANY MEMBER TO FRUIT BASKET AS MANGO - OK, GET ANY MEMBER FROM FRUIT AS MANGO - NOT OK
-----MANGO BASKET-------- PUT ANY MEMBER TO KESHAR-MANGO BASKET AS MANGO - NOT OK, GET ANY MEMBER FROM KESHAR-MANGO AS MANGO - OK
-----KESHAR-MANGO BASKET--------
@omkar-tenkale
omkar-tenkale / ModularInheritance.kt
Created September 13, 2022 07:56
Inheritance for multi module project in kotlin, android
import kotlinx.coroutines.*
fun main() {
BaseAPIImpl().endpoint1()
ModuleAPIImpl().endpoint1()
ModuleAPIImpl().endpoint2()
(ModuleAPIImpl() as ModuleAPI).endpoint1()
(ModuleAPIImpl() as ModuleAPI).endpoint2()
}
@omkar-tenkale
omkar-tenkale / R.anim.anim_press.xml
Last active November 16, 2022 06:20
View extensions with click/press effect
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillAfter="true" android:fillBefore="true">
<scale
android:duration="100"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
@omkar-tenkale
omkar-tenkale / VaragrNonNullCheckTest.kt
Created October 5, 2022 08:15
Vararg not null check
//approach 1
fun main(){
val a = Unit
val b = null
if(listOf(a,b).all{ it != null }){
println("Not null")
}else{
print("Please check inputs")
}
}
1. In navigation toolbar, A new ICON ![Sequence Diagram ...](imges/sequence.svg){:height="24px" width="24px"} added.
@omkar-tenkale
omkar-tenkale / build.gradle
Created November 15, 2022 09:51
Gradle keystore configuration
apply plugin: ...
def debugKeystorePropertiesFile = rootProject.file("env/debug-keystore.properties");
def debugKeystoreProperties = new Properties()
debugKeystoreProperties.load(new FileInputStream(debugKeystorePropertiesFile))
def releaseKeystorePropertiesFile = rootProject.file("env/release-keystore.properties");
def releaseKeystoreProperties = new Properties()
if(releaseKeystorePropertiesFile.exists()) {
releaseKeystoreProperties.load(new FileInputStream(releaseKeystorePropertiesFile))
@omkar-tenkale
omkar-tenkale / build.gradle
Created November 15, 2022 09:53
Change gradle android apk name
android{
...
def changeApkName = { variant ->
variant.outputs.each { output ->
def apk = output.outputFile;
def addBrand = true
def addTime = false
def addGitBranch = true
def addVersionCode = true
def addVersionName = true

This is a draft, a note to myself to understand dagger

Understanding Dagger2

It all starts with a messy code, or its early realization if your're well prepared As projects starts to become large, they will have lots of classes referencing lots of dependencies

Retrofit instance, logger instance, DB instance, SharedPreferenceManager instance Generally we declare them singleton and move on, accessing them directly This is fine in the beginning but it hampers testability in long term as those singletons are hard to mock

@omkar-tenkale
omkar-tenkale / ControlledExplosion.kt
Last active April 6, 2024 04:43
Compose Explosion Animation Snippets
@Composable
fun ControlledExplosion() {
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
var progress by remember { mutableStateOf(0f) }
Explosion(progress)
import kotlin.coroutines.Continuation
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.intrinsics.createCoroutineUnintercepted
fun main() {
// Define a suspend lambda that returns "Hello World!"
val suspendingLambda: suspend () -> String = suspend {
"Hello World!"
}