Skip to content

Instantly share code, notes, and snippets.

View cloudshooterhuman's full-sized avatar

cloudshooterhuman

View GitHub Profile
/*
* Any array may be viewed as a number of "runs" of equal numbers.
* For example, the following array has two runs:
* 1, 1, 1, 2, 2
* Three 1's in a row form the first run, and two 2's form the second.
* This array has two runs of length one:
* 3, 4
* And this one has five runs:
* 1, 0, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0
* Your task is to implement the runs() function so that it returns the number
@cloudshooterhuman
cloudshooterhuman / KCO-NOTES.txt
Last active April 17, 2019 12:37
Kotlin Coroutines
API (class) Key words : Job, Scope, Context, Dispatchers
- Suspending functions do not block the caller thread.
- Job (is a Element is a Context)
- A background job
- Can be cancled else a CancellationException is rised
- Had a lifecycle
- A Job had childs and can be a parent
- Cancelling a parent Job leads to cancel it's childs
@Test
fun testSuccessfulLogin() {
// Agange
val vm = LoginViewModel(environment())
val loginSuccess = TestSubscriber<Void>()
vm.outputs.loginSuccess().subscribe(loginSuccess)
vm.inputs.email("hello@kickstarter.com")
vm.inputs.password("danisawesome")
// Act
plugins {
id "org.sonarqube" version "2.7"
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
/**
* toggleAutoDownflow() : method triggered by remote config, should
* be used when notifications based downflow is broken.
*/
private fun toggleAutoDownflow() {
automaticDownflowDisposable?.dispose()
isAutomaticDownflowActivated = remoteConfig.automaticDownflow.activated
automaticDownflowIntervalInMinutes = remoteConfig.automaticDownflow.intervalInMinutes
if (isAutomaticDownflowActivated) {