Skip to content

Instantly share code, notes, and snippets.

View sebaslogen's full-sized avatar

Sebas LG sebaslogen

View GitHub Profile
@sebaslogen
sebaslogen / RelaySharedWithSingleOnSubscribeAndOnUnSubscribeUsingRxReplayingShare.java
Last active March 15, 2017 00:10
PublishRelay shared with single onSubscribe and onUnSubscribe using RxReplayingShare
PublishRelay<Integer> publishRelay = PublishRelay.create();
Observable<Integer> relayObservable = publishRelay
.doOnSubscribe(() -> {
Log.i("RxExperiments", "ReplayingShare->doOnSubscribe");
// Register to event here...
}).doOnUnsubscribe(() -> {
Log.i("RxExperiments", "ReplayingShare->doOnUnsubscribe");
// Un-register from event here...
})
.compose(ReplayingShare.instance());
@sebaslogen
sebaslogen / RelaySharedWithSingleOnSubscribeAndOnUnSubscribe.java
Last active August 28, 2016 09:04
BehaviorRelay shared with single onSubscribe and onUnSubscribe
BehaviorRelay<Integer> behaviorRelay = BehaviorRelay.create();
Observable<Integer> relayObservable = behaviorRelay
.doOnSubscribe(() -> {
Log.i("RxExperiments", "share->doOnSubscribe");
}).doOnUnsubscribe(() -> {
Log.i("RxExperiments", "share->doOnUnsubscribe");
})
.share();
Log.i("RxExperiments", "share->observer-1 subscribes");
@sebaslogen
sebaslogen / RelaySharedWithMultipleProblematicOnSubscribeAndOnUnSubscribeEvents.java
Last active March 15, 2017 00:31
BehaviorRelay shared with multiple observers produces problematic onSubscribe and onUnSubscribe events
BehaviorRelay<Integer> brelay = BehaviorRelay.create();
Observable<Integer> relayObservable = brelay
.doOnSubscribe(() -> {
Log.i("RxExperiments", "BehaviorRelayProblem->doOnSubscribe");
}).doOnUnsubscribe(() -> {
Log.i("RxExperiments", "BehaviorRelayProblem->doOnUnsubscribe");
});
Log.i("RxExperiments", "BehaviorRelayProblem->observer-1 subscribes");
Subscription subscription1 = relayObservable.subscribe(i -> {
@sebaslogen
sebaslogen / Picasso idlingresource.md
Last active April 27, 2021 22:54 — forked from Maragues/Picasso idlingresource.md
Implementation and usage of an IdlingResource that waits for Picasso actions to finish.

Note that the file lives in the package as Picasso (src/androidTest/java/com/squareup/picasso). Otherwise we don't have access to targetToAction

package com.squareup.picasso;

import android.app.Activity;
import android.os.Handler;
import android.support.test.espresso.IdlingResource;
import android.support.test.runner.lifecycle.ActivityLifecycleCallback;
import android.support.test.runner.lifecycle.Stage;
Verifying that +sebas is my blockchain ID. https://onename.com/sebas
@sebaslogen
sebaslogen / gist:7054935e77002263ca57
Created August 11, 2014 20:44
Verifying that +neoranga55 is my Bitcoin username. You can send me #bitcoin here: https://onename.io/neoranga55
Verifying that +neoranga55 is my Bitcoin username. You can send me #bitcoin here: https://onename.io/neoranga55
@sebaslogen
sebaslogen / gist:9466beeb213cb82804d3
Created August 11, 2014 20:35
Verifying that +sebas is my Bitcoin username. You can send me #bitcoin here: https://onename.io/sebas
Verifying that +sebas is my Bitcoin username. You can send me #bitcoin here: https://onename.io/sebas