Skip to content

Instantly share code, notes, and snippets.

import android.content.Context
import io.reactivex.Maybe
import io.reactivex.Observable
import io.reactivex.Single
class VkPhotoRepository(private val vkPhotosApi: VkPhotosApi, private val context: Context) {
fun getAlbums(): Single<List<AlbumItem>> {
val token = context.getString(R.string.vk_service_key)
val owner = context.getString(R.string.vk_owner_id).toLong()
class ConfigManager() {
@Volatile private var isDirty = true
@Volatile private var cachedConfig: String? = null
private var replay: ReplaySubject<String>? = null
fun getConfig(): Single<String> = Observable.concat(fromCache().toObservable(), fromServer().toObservable()).firstOrError()
private fun fromCache(): Maybe<String> = Maybe.create {
if (isCacheExists()) it.onSuccess(cachedConfig) else it.onComplete()
-keep public class org.example.native.** { *; }
@pavelshackih
pavelshackih / gist:9708680
Created March 22, 2014 15:09
Android gradle build error
G:\github\another-yet-bash-client>gradlew.bat tasks --stacktrace
:tasks
------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------
:tasks FAILED
FAILURE: Build failed with an exception.
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.util.List;
@JacksonXmlRootElement(localName = "doc")
@XmlAccessorType(XmlAccessType.FIELD)
package org.sample;
import java.util.ArrayList;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
public class Sample {