Skip to content

Instantly share code, notes, and snippets.

View renanalmeida's full-sized avatar

Renan Diniz de Almeida renanalmeida

  • Campina Grande, Brazil.
View GitHub Profile
@jamiesanson
jamiesanson / ViewLifecycleLazy.kt
Last active May 29, 2024 10:43
A Kotlin lazy implementation which automatically clears itself at appropriate times in the View Lifecycle, with a Fragment example
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.Observer
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
fun <T> Fragment.viewLifecycleLazy(initialise: () -> T): ReadOnlyProperty<Fragment, T> =
object : ReadOnlyProperty<Fragment, T>, DefaultLifecycleObserver {
@jshaw
jshaw / byobuCommands
Last active May 26, 2024 17:26
Byobu Commands
Byobu Commands
==============
byobu Screen manager
Level 0 Commands (Quick Start)
------------------------------
<F2> Create a new window