This file contains hidden or 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
// without reflection | |
ClassName className = new ClassName(); | |
className.unsubscribe(); | |
// with reflection | |
Object className = ClassName.class.newInstance(); | |
Method m = className.getClass().getDeclaredMethod("unsubscribe", new Class[0]); | |
m.invoke(className); | |
This file contains hidden or 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
-Xms512m | |
-Xmx3g | |
-XX:MaxPermSize=2g | |
-XX:ReservedCodeCacheSize=1g | |
-XX:+UseCompressedOops |
This file contains hidden or 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
#!/usr/bin/env bash | |
for file in *; do mv "$file” "`echo $file | tr "[:upper:]" "[:lower:]"`"; done |
This file contains hidden or 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
/** | |
* The calculation (value * scale + 0.5f) is a widely used to convert from dps to pixel units | |
* based on density scale | |
* see developer.android.com (Supporting Multiple Screen Sizes) | |
*/ | |
public static int convertDpToPixels(int dp, DisplayMetrics displayMetrics) { | |
return Math.round(dp * ((displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT))); | |
} | |
Note: to get the display metrics do: getContext().getResources().getDisplayMetrics(); |
This file contains hidden or 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
// Rather than going one by one and unchecking each and every one, run this JS query from | |
//the console on chrome or firefox that shows up after "inspecting the code" and then just | |
// check the ones that you want after wards. | |
switches = document.getElementsByClassName("M0PRCSC-Rc-g M0PRCSC-Rc-h"); | |
for(i = 0; i < switches.length; i++) { | |
if (switches[i].getAttribute("aria-checked") == "false") { | |
switches[i].click() | |
} |
This file contains hidden or 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 EventBus { | |
private final Subject<Boolean, Boolean> eventBus = new SerializedSubject<>(PublishSubject.<Boolean>create()); | |
private EventBus() { | |
} | |
private static class SingleTonHelper { | |
private static final EventBus INSTANCE = new EventBus(); | |
} |
NewerOlder