Inspired By: grafana/loki#333
- docker-compose.yml
version: "3"
networks:
loki:
Inspired By: grafana/loki#333
version: "3"
networks:
loki:
/* | |
* Copyright 2018 Google LLC | |
* | |
* 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 |
fun <E : Any, R> ReceiveChannel<E>.switchMap(context: CoroutineContext = DefaultDispatcher, | |
transform: suspend (E) -> ReceiveChannel<R>): ReceiveChannel<R> = | |
produce(context) { | |
var originChannel: ReceiveChannel<E>? = this@switchMap | |
var itemChannel = this@switchMap.receiveOrNull()?.let { transform(it) } ?: return@produce | |
var itemToSend: R? = null | |
whileSelect { | |
originChannel?.onReceiveOrNull?.invoke { newItem -> | |
if (newItem == null) originChannel = null // origin closed |
@file:Suppress("PackageDirectoryMismatch") | |
/* | |
* Copyright (c) 2018 Intrepid Pursuits,Inc. All rights reserved. | |
*/ | |
package kotlinx.coroutines.experimental.intrepid | |
import kotlinx.coroutines.experimental.* | |
import java.util.concurrent.PriorityBlockingQueue | |
import java.util.concurrent.TimeUnit |
// Largely borrowed from Jake Wharton's Kotterknife (https://github.com/JakeWharton/kotterknife) | |
// and paweljaneczek's PR for resetting cached views (https://github.com/JakeWharton/kotterknife/pull/37) | |
package com.bluelinelabs.conductor.butterknife | |
import android.view.View | |
import com.bluelinelabs.conductor.Controller | |
import java.util.Collections | |
import java.util.WeakHashMap | |
import kotlin.properties.ReadOnlyProperty |
[Android Transition Framework][transition-framework] can be used for three main things:
/** | |
* Show the activity over the lockscreen and wake up the device. If you launched the app manually | |
* both of these conditions are already true. If you deployed from the IDE, however, this will | |
* save you from hundreds of power button presses and pattern swiping per day! | |
*/ | |
public static void riseAndShine(Activity activity) { | |
activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED); | |
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE); | |
PowerManager.WakeLock lock = |
This test rule is now in the 'test-rules' support repository. Use that one!
https://developer.android.com/reference/android/support/test/rule/ActivityTestRule.html
This gist has graduated to a full-fledged repo @ https://github.com/JakeWharton/ProcessPhoenix