View A_KN_1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface LoginViewModel { | |
/* Inputs */ | |
val userName: Subject<String> | |
val password: Subject<String> | |
val passwordRepetition: Subject<String> | |
val login: Trigger | |
/* Outputs */ |
View helpmeplease.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof kotlin === 'undefined') { | |
throw new Error("Error loading module 'output'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'output'."); | |
} | |
var output = function (_, Kotlin) { | |
'use strict'; | |
var throwUPAE = Kotlin.throwUPAE; | |
var Unit = Kotlin.kotlin.Unit; | |
var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init; | |
var toString = Kotlin.toString; | |
var println = Kotlin.kotlin.io.println_s8jyv4$; |
View Disposing on Android 1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyActivity { | |
var fetchDataDisposable: Disposable? = null | |
/* ... */ | |
fun onCreate() { | |
super.onCreate() | |
/* stuff */ | |
View Disposing on Android 3.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
private lateinit var textView: TextView | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
textView = findViewById(R.id.text_view) | |
} |
View Disposing on Android 2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyActivity: AppCompatActivity() { | |
private val lifecycleProvider = AndroidLifecycle.createLifecycleProvider(::getLifecycle) | |
fun onCreate() { | |
super.onCreate() | |
fetchData() | |
.flatMap(::prepareData) | |
.compose(lifecycleProvider.bindToLifecycle()) |
View CbI-PatternDetektorConnector.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class PatternDetectorConnector( | |
private val first: PatternDetector, | |
private val second: PatternDetector): PatternDetector { | |
override fun findPatterns(data: List<Weight>): List<Pattern> { | |
val firstPatterns = first.findPatterns(data) | |
val secondPatterns = seconnd.findPatterns(data) | |
return firstPatterns + secondPatterns | |
} |
View CbI-PatternDetector+combine.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun PatternDetector.combine(other: PatternDetector): PatternDetector { | |
return PatternDetectorConnector(this, other) | |
} |
View CbI-compose1.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val patternDetector: PatternDetector = TrendDownPatternDetector() | |
.combine(TrendUpPatternDetector()) | |
.combine(CheatDayPatternDetector()) | |
.combine(DietPatternDetector()) | |
.combine(SelfLyingPatternDetector()) | |
.combine(MotivationBoostPatternDetector()) | |
.combine(...) | |
... |
View CbI-compose2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val patternDetector: PatternDetector = (TrendDownPatternDetector().combineWithoutOverlap(TrendUpPatternDetector())) | |
.combine(CheatDayPatternDetector().combineWithoutOverlap(SelfLyingPatternDetector()) | |
.combine(DietPatternDetector()) | |
.combine(MotivationBoostPatternDetector()) | |
.combine(...) | |
... |
View PatternDetector+combineWithoutOverlap.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun PatternDetector.combineWithoutOverlap(other: PatternDetector): PatternDetector { | |
return OverlapFreePatternConnector(this, other) | |
} |
NewerOlder