Skip to content

Instantly share code, notes, and snippets.

@krage
krage / embark.lua
Created April 27, 2021 01:00
Embark Lualine
local colors = {
deep_space = '#100E23',
space = '#1e1c31',
eclipse = '#3E3859',
red = '#F48FB1',
dark_red = '#ff5458',
green = '#A1EFD3',
dark_green = '#62d196',
fun <A : Any, B : Any> LiveData<A>.pairLatest(b: LiveData<B>): LiveData<Pair<A, B>> =
object : MediatorLiveData<Pair<A, B>>() {
private var aReceived = false
private var lastA: A? = null
private var bReceived = false
private var lastB: B? = null
init {
addSource(this@pairLatest) {
aReceived = true
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software