Skip to content

Instantly share code, notes, and snippets.


Tim Rijckaert timrijckaert

View GitHub Profile
Aidanvii7 / NavGraph.kt
Last active Oct 17, 2021
Navigate with Parcelable arguments in Jetpack Compose
View NavGraph.kt
composable(route = "screen_1") {
onClick = {
route = "screen_2",
args = parcelableArgs {
arg { MyParcelableArgument() }
arg("named") { MyParcelableArgument() }
nomisRev / Example.kt
Last active Sep 13, 2021
Kotlin DI with receivers & interface delegation
View Example.kt
import arrow.core.*
import memeid.UUID
data class User(val email: String, val name: String) {
companion object
data class ProcessedUser(val id: UUID, val email: String, val name: String) {
companion object
raulraja / di.kt
Last active Mar 21, 2021
Simple Kotlin DI
View di.kt
package com.fortyseven.fptraining
import arrow.core.Either
import arrow.core.right
import arrow.effects.IO
data class Account(val balance: Int)
data class AccountEntity(val balance: Int)
gildor / OkHttpDownloader.kt
Last active Jun 19, 2021
Simple non-blocking extension function for OkHttp Call that wraps request to Kotlin Coroutine and saves response to File
View OkHttpDownloader.kt
import kotlinx.coroutines.experimental.*
import okhttp3.*
import okio.Buffer
import okio.Okio
* Custom coroutine dispatcher for blocking calls
LouisCAD / LifecycleCoroutines.kt
Last active May 9, 2021
CoroutineScope and Job integration with Lifecycle for Android. Meant to be used for your coroutines in lifecycle aware components. OUTDATED. See up to date implementation here:
View LifecycleCoroutines.kt
import android.arch.lifecycle.GenericLifecycleObserver
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY
import android.arch.lifecycle.LifecycleOwner
import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.Dispatchers
import kotlinx.coroutines.experimental.Job
fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job {
View home_page.dart
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:url_launcher/url_launcher.dart';
import 'package:intl/intl.dart';
import 'dart:async';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:share/share.dart' as sharing;
import 'package:transparent_image/transparent_image.dart';
yanngx / FragmentArgumentDelegate.kt
Last active Sep 26, 2021
Fragment arguments without hassle !
View FragmentArgumentDelegate.kt
package be.brol
import android.os.Binder
import android.os.Bundle
* Eases the Fragment.newInstance ceremony by marking the fragment's args with this delegate
* Just write the property in newInstance and read it like any other property after the fragment has been created
EarlOfEgo / Rx2SchedulersOverrideRule.kt
Created Jan 31, 2017
A test rule for unit test to override all schedulers with trampoline
View Rx2SchedulersOverrideRule.kt
import io.reactivex.plugins.RxJavaPlugins
import io.reactivex.schedulers.Schedulers
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
* Test rule that overrides all schedulers with the trampoline scheduler.
* This means everything runs on the same thread, when using this rule
jaredsburrows /
Last active Jul 28, 2019
RxAndroid overriding schedulers
import org.junit.After;
import org.junit.Before;
import rx.Scheduler;
import rx.schedulers.Schedulers;
* JUnit Tests.