Observable.from(Arrays.array(1, 2, 3, 4, 5))
.groupBy(new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer number) {
return number % 2 == 0;
}
})
.flatMap(new Func1<GroupedObservable<Boolean, Integer>, GroupedObservable<Boolean, Integer>>() {
@Override
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
const { danger, warn } = require("danger"); | |
// No pull request is too small to include a description of why you made a change. | |
if (danger.github.pr.body.length < 10) { | |
warn("Please include a description of your PR changes."); | |
} |
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
import okio.GzipSink | |
import okio.GzipSource | |
import okio.Okio | |
import org.assertj.core.api.Assertions.assertThat | |
import org.junit.Test | |
import java.io.File | |
class OkioTest { | |
@Test | |
fun `should compress file properly`() { |
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
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
/** | |
* NOTE: Please remove this class if we decide to integrate with RoboSpice. | |
* RoboSpice does implement a DefaultNetworkStateChecker class which takes care of everything NetworkUtils does. | |
*/ | |
public class NetworkUtils { |
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
import android.content.Context; | |
import android.test.InstrumentationTestCase; | |
import com.google.gson.Gson; | |
import com.google.gson.reflect.TypeToken; | |
import com.google.gson.stream.JsonReader; | |
import java.io.BufferedInputStream; | |
import java.io.BufferedOutputStream; | |
import java.io.File; |
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
public class GistFetcherTest extends InstrumentationTestCase { | |
public void testFetch() throws IOException { | |
final InputStream mockResponseStream = getInstrumentation().getContext().getAssets().open("mock_response.json"); | |
OkHttpClient httpClient = new OkHttpClient(); | |
httpClient.interceptors().add(new Interceptor() { | |
@Override | |
public Response intercept(Chain chain) throws IOException { | |
return new Response.Builder() | |
.protocol(Protocol.HTTP_2) |
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
public class DbField { | |
public final String name; | |
public final String type; | |
public final String constraint; | |
public DbField(String name, String type) { | |
this(name, type, null); | |
} | |
public DbField(String name, String type, String constraint) { |
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
import rx.Observable; | |
import rx.functions.Action1; | |
import rx.subjects.BehaviorSubject; | |
public class ObservableProperty<T> implements Action1<T> { | |
private final BehaviorSubject<T> valueSubject; | |
private T value; | |
public ObservableProperty() { | |
valueSubject = BehaviorSubject.create(); |
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
import android.os.Handler; | |
import android.os.Looper; | |
import com.squareup.otto.Bus; | |
import com.squareup.otto.ThreadEnforcer; | |
/** | |
* A custom {@link Bus} that posts events from any thread and | |
* lets subscribers receive them on the main thread. | |
*/ |
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
import android.database.Cursor; | |
import java.util.Iterator; | |
public class IterableCursor implements Iterable<Cursor> { | |
private Cursor cursor; | |
public IterableCursor(Cursor cursor) { | |
this.cursor = cursor; | |
this.cursor.moveToPosition(-1); |
NewerOlder