Skip to content

Instantly share code, notes, and snippets.

Mike Nakhimovich digitalbuddha

Block or report user

Report or block digitalbuddha

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chrisbanes
chrisbanes / CoroutineLifecycleObserver.kt
Last active May 20, 2019
LifecycleObserver which allows easy cancelling of coroutines
View CoroutineLifecycleObserver.kt
/*
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@chrisbanes
chrisbanes / KotterKnife.kt
Last active Sep 10, 2019
LifecycleAware KotterKnife
View KotterKnife.kt
package kotterknife
import android.app.Activity
import android.app.Dialog
import android.app.DialogFragment
import android.app.Fragment
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.LifecycleObserver
import android.arch.lifecycle.LifecycleOwner
import android.arch.lifecycle.OnLifecycleEvent
@aahlenst
aahlenst / RxIdlingResource.java
Last active Feb 26, 2019
IdlingResource that makes Espresso 2 wait until all RxJava 2 tasks have finished
View RxIdlingResource.java
/*
* The MIT License
*
* Copyright (c) 2016 Andreas Ahlenstorf
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@RoryKelly
RoryKelly / MirroredSource.java
Last active Feb 7, 2018
Mirrored Source for OKIO.
View MirroredSource.java
/**
* Takes a bytes source and streams it to parallel sources. I.E Streaming bytes to two server in parallel.
*/
public final class MirroredSource {
private final Buffer buffer = new Buffer();
private final Source source;
private final AtomicBoolean sourceExhausted = new AtomicBoolean();
private boolean closed = false;
@lenguyenthanh
lenguyenthanh / Dagger 2.md
Last active Jul 6, 2018
Dagger 2 configuration
View Dagger 2.md

Small gist shows how to config Dagger 2 to an Android project

@lukaspili
lukaspili / LoginScreen.java
Last active Aug 29, 2015
Dagger 2 / Mortar / Flow
View LoginScreen.java
@Layout(R.layout.view_login)
@WithComponent(LoginScreen.Component.class)
public class LoginScreen extends Path {
@dagger.Component(dependencies = RootActivity.Component.class)
@PerScreenScope(Component.class)
public static interface Component extends RootActivity.Component {
void inject(LoginView view);
}
@dustin-graham
dustin-graham / ApiService.java
Created Feb 15, 2015
Infinite Scrolling Android RecyclerView with RxJava
View ApiService.java
public static Observable<List<String>> paginatedThings(final Observable<Void> onNextObservable) {
return Observable.create(new Observable.OnSubscribe<List<String>>() {
@Override
public void call(final Subscriber<? super List<String>> subscriber) {
onNextObservable.subscribe(new Observer<Void>() {
int latestPage = -1;
@Override
public void onCompleted() {
subscriber.onCompleted();
@JakeWharton
JakeWharton / gist:f50f3b4d87e57d8e96e9
Created Feb 7, 2015
Rise and Shine™, unlock and wake up your device automatically when you deploy from the IDE. Put this somewhere in your `src/debug/` code and run it when the application or main activity starts. Apache 2.
View gist:f50f3b4d87e57d8e96e9
/**
* Show the activity over the lockscreen and wake up the device. If you launched the app manually
* both of these conditions are already true. If you deployed from the IDE, however, this will
* save you from hundreds of power button presses and pattern swiping per day!
*/
public static void riseAndShine(Activity activity) {
activity.getWindow().addFlags(FLAG_SHOW_WHEN_LOCKED);
PowerManager power = (PowerManager) activity.getSystemService(POWER_SERVICE);
PowerManager.WakeLock lock =
@JakeWharton
JakeWharton / README.md
Last active Aug 26, 2019
A JUnit @rule which launches an activity when your test starts. Stop extending gross ActivityInstrumentationBarfCase2!
View README.md
You can’t perform that action at this time.