Skip to content

Instantly share code, notes, and snippets.

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

Axrorxoja

🏠
Working from home
  • Hungerstation
  • Ar-Riyadh
View GitHub Profile
@Axrorxoja
Axrorxoja / Main.kt
Created December 27, 2020 16:49
Coroutine sequence launch
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
fun main() {
runBlocking {
launch {
val result1 = fun1()
println(result1)
val result2 = fun2()
@Axrorxoja
Axrorxoja / Main.kt
Created December 27, 2020 16:53
Coroutine parallel launch
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
fun main() {
runBlocking {
launch {
val resultDeferred1 = async { fun1() }
val resultDeferred2 = async { fun2() }
@Axrorxoja
Axrorxoja / VinValidator2.kt
Created January 28, 2021 12:10
VinValidator2
object VinValidator2 {
private val values = intArrayOf(1, 2, 3, 4, 5, 6, 7, 8, 0, 1,
2, 3, 4, 5, 0, 7, 0, 9, 2, 3,
4, 5, 6, 7, 8, 9)
private val weights = intArrayOf(8, 7, 6, 5, 4, 3, 2, 10, 0, 9,
8, 7, 6, 5, 4, 3, 2)
fun isValid(vin: String): Boolean {
var s = vin
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitWrapper {
private Retrofit retrofit;
private String baseUrl;
public RetrofitWrapper(String baseUrl) {
this.baseUrl = baseUrl;
@Composable
fun ListItems(
modifier: Modifier = Modifier,
fastFiltersSelectDelegate: ItemsDelegate,
isAutoScroll: Boolean = false,
) {
val items by fastFiltersSelectDelegate.filterItems.collectAsStateWithLifecycle()
val listState = rememberLazyListState()
LazyRow(
modifier = Modifier