Skip to content

Instantly share code, notes, and snippets.

View nsk-mironov's full-sized avatar

Vladimir Mironov nsk-mironov

  • Lisbon, Portugal
View GitHub Profile
import io.reactivex.Observable
import io.reactivex.ObservableSource
import io.reactivex.Observer
import io.reactivex.internal.fuseable.HasUpstreamObservableSource
import io.reactivex.internal.fuseable.QueueFuseable
import io.reactivex.internal.observers.BasicFuseableObserver
abstract class BaseObservableMap<T : Any, U : Any> protected constructor(private val source: ObservableSource<T>) : Observable<U>(), HasUpstreamObservableSource<T> {
override fun source(): ObservableSource<T> {
return source
@nsk-mironov
nsk-mironov / Delegates.md
Last active December 25, 2017 23:27
Delegated properties

Delegated properties is a really nice feature of Kotlin and we are using them a lot in our code base. The entire project contains more than 500 delegated properties. Unfortunatelly, each property compiles to a class with 6 extra methods. While this can be fine if you're running on JVM, this is absolutely unacceptable in case you're targeting Android.

For example, the following class produces 2 more classes, Delegate$bar$1 and Delegate$foo$1:

public class Delegate(private val values: Map<String, Any>) {
  public val bar: String by values
  public val foo: String by values
}
@nsk-mironov
nsk-mironov / LithoDsl.kt
Last active August 9, 2018 13:32
Litho DSL
import com.facebook.litho.Column
import com.facebook.litho.Component
import com.facebook.litho.ComponentContext
import com.facebook.litho.Row
import com.facebook.litho.fresco.FrescoImage
import com.facebook.litho.sections.widget.RecyclerCollectionComponent
import com.facebook.litho.widget.Card
import com.facebook.litho.widget.CardClip
import com.facebook.litho.widget.EditText
import com.facebook.litho.widget.EmptyComponent