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 LazySingleton { | |
private LazySingleton() { | |
} | |
private static volatile LazySingleton sInstance; | |
public static LazySingleton getInstance() { | |
if (sInstance == null) { |
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 com.jakewharton.rx.ReplayingShare; | |
import com.jakewharton.rxrelay2.PublishRelay; | |
import com.jakewharton.rxrelay2.Relay; | |
import io.reactivex.Observable; | |
import java.util.concurrent.TimeUnit; | |
public class HotReactiveData { | |
// Problems to solve: |
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 com.jakewharton.rx.ReplayingShare; | |
import com.jakewharton.rxrelay2.PublishRelay; | |
import com.jakewharton.rxrelay2.Relay; | |
import io.reactivex.Observable; | |
import java.util.concurrent.TimeUnit; | |
public class HotReactiveDataExpiration { | |
// Problems to solve: |
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 com.jakewharton.rxrelay2.BehaviorRelay; | |
import com.jakewharton.rxrelay2.Relay; | |
import io.reactivex.Observable; | |
import java.util.concurrent.TimeUnit; | |
public class ColdReactiveDataExpiration { | |
// Problems to solve: | |
// 1- UI components should be notified when data is updated |
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 BaseFragment extends Fragment { | |
private boolean fragmentResume=false; | |
private boolean fragmentVisible=false; | |
private boolean fragmentOnCreated=false; | |
@Override | |
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
super.onViewCreated(view, savedInstanceState); |
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
#### cd to the path of the front Finder window | |
cdf() { | |
target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'` | |
if [ "$target" != "" ]; then | |
cd "$target"; pwd | |
else | |
echo 'No Finder window found' >&2 | |
fi | |
} |
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 RetryWithDelay implements Func1<Observable<? extends Throwable>, Observable<?>> { | |
private int numberOfTry; | |
private int delay; | |
private int retryCount = 1; | |
private final TimeUnit timeUnit; | |
public RetryWithDelay(int numberOfTry, int delay, TimeUnit timeUnit) { | |
this.numberOfTry = numberOfTry; | |
this.delay = delay; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<!-- Dark Text Color for Light Background --> | |
<color name="textDarkPrimary">#DE000000</color> <!--DE for %87 opacity--> | |
<color name="textDarkSecondary">#8A000000</color> <!--8A for %54 opacity--> | |
<color name="textDarkDisabled">#61000000</color> <!--61 for %38 opacity--> | |
<!-- White Text Color for Dark Background --> | |
<color name="textLightPrimary">#FFFFFF</color> <!--%100 opacity--> |
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 HttpStatusCodeHelper { | |
/** | |
* Gets Http Status Code Information for given Code. No Reflection, No Enum | |
* @param code | |
* @return type + text | |
*/ | |
public static String getHttpTypeAndTextByCode(final int code) { | |
//region 1xx |
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.util.Log | |
fun emptyMPStateMachineLogger(tag: String, message: String) { | |
// NoOp | |
} | |
fun defaultMPStateMachineLogger(tag: String, message: String) { | |
Log.d(tag, message) | |
} |
OlderNewer