Skip to content

Instantly share code, notes, and snippets.

@erchenger
erchenger / gist:c0c0b1d1ad36594edaa7
Last active February 9, 2016 17:33
Formatting Regex for Single Line Android Logs
//Regex
//Replace 19326 with the PID of your app.
([ADEIVW][\/])(.+?)(19326\)\:)
@erchenger
erchenger / gist:1442dac0dd2277053b24
Created January 4, 2016 20:48
System Alert Window Permission
if (!Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, REQUEST_CODE);
} else {
// You have the ability to add things to the window manually
}
@erchenger
erchenger / LogPid.sh
Last active September 15, 2015 16:44
Start Logcat for a specific PID
function package {
local PCKG=$1
local PID="$(adb shell ps | grep $PCKG | cut -c10-15)"
echo "<<<<<>>>>> PID for $PCKG: $PID <<<<<>>>>>"
adb logcat | grep $PID
}
package $1
@erchenger
erchenger / gist:823226a50bd74b7b07c5
Created September 15, 2015 16:41
Enable AirDrop on Mac where AirDrop is disabled
defaults write com.apple.NetworkBrowser DisableAirDrop -bool NO
sudo killall Finder
@erchenger
erchenger / Merging two data sources with rxJava
Last active August 29, 2015 14:17
How to merge two data sources with rxJava.
restObservable = giphyService.searchGiphy(getGiphyQueryMap("dog")).flatMap(new Func1<GiphySearch, Observable<GiphyGif>>() {
@Override
public Observable<GiphyGif> call(GiphySearch giphySearch) {
return Observable.from(giphySearch.data);
}
}).zipWith(namesService.getPeople().flatMap(new Func1<List<People>, Observable<Person>>() {
@Override
public Observable<Person> call(List<People> people) {
return Observable.from(people);
}