Skip to content

Instantly share code, notes, and snippets.

View neworld's full-sized avatar
🇱🇹
Programming

Andrius Semionovas neworld

🇱🇹
Programming
  • Vinted
  • Vilnius, Lithuania
View GitHub Profile
package com.neworldwar
import com.neworldwar.utils.Random
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.RepeatedTest
import org.junit.jupiter.api.TestInstance
const val REQUESTS = 100
const val TOTAL_DEPENDENCIES = 1000
const val DEPENDENCIES_PER_REQUEST = 100
package com.vinted.drawables
import android.content.res.ColorStateList
import android.graphics.*
import android.graphics.drawable.Drawable
import android.text.DynamicLayout
import android.text.Editable
import android.text.Layout
import android.text.TextPaint
@Test(timeout = 10000)
fun secondSubscription_returnsImmediate() {
val subject = PublishSubject.create<Int>()
val cachedSubject = subject.successOnlyCache()
cachedSubject.test() //first subscription
cachedSubject.test() //second subscription
//this method will never finishes if subscription is blocked.
}
@neworld
neworld / BreakDisposeChainObservable.kt
Created March 9, 2021 09:17
RxJava operator written in kotlin which breaks dispose chain
package com.vinted.feature.base.ui.rx
import io.reactivex.Observable
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
/**
*
* Breaks dispose chain. Upstream will be not be disposed.
* This class should be used in cases where you need guarantee upstream will be executed at any price.