Skip to content

Instantly share code, notes, and snippets.

View emmaguy's full-sized avatar

Emma Vanbrabant emmaguy

View GitHub Profile
emmaguy / textcolor-stats.kts
Created February 17, 2020 12:41
Look at all Android layout files and collate what value is set for 'android:textColor' and count the usages of each
val textColorsUsed = mutableMapOf<String, Int>()
File("../").walkTopDown().forEach { file ->
if (file.isFile && file.extension == "xml" && file.path.contains("res/layout")) {
val builder: DocumentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder()
val xmlInput = InputSource(StringReader(file.readText()))
val doc: Document = builder.parse(xmlInput)
val androidViews = XPathFactory.newInstance()
emmaguy / AndroidManifest.xml
Created February 1, 2020 14:01
Click the 'Skip Intro' button on the Android notification from the Netflix app
<action android:name="android.service.notification.NotificationListenerService" />
Process: com.emmaguy.sampleapp, PID: 3053
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.emmaguy.sampleapp/com.emmaguy.sampleapp.MainActivity}: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter $receiver
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invoke(Native Method)

Keybase proof

I hereby claim:

  • I am emmaguy on github.
  • I am emmav ( on keybase.
  • I have a public key ASD8wnfUrFUUxFBAjOv7NTEXc_2OAxTkTJqOH0LIl0awMwo

To claim this, I am signing this object:

import android.os.Build
public fun supportsKitKat(code:() -> Unit){
supportsVersion(code, 19)
public fun supportsLollipop(code:() -> Unit){
supportsVersion(code, 21)
emmaguy / gist:28d91fddf5c9a0d0c434
Last active August 29, 2015 14:28
RxJava debug
RxJavaPlugins.getInstance().registerObservableExecutionHook(new DebugHook(new DebugNotificationListener() {
public Object onNext(DebugNotification n) {
Timber.v("onNext on " + n);
return super.onNext(n);
public Object start(DebugNotification n) {
Timber.v("start on " + n);
return super.start(n);
emmaguy / gist:75e53f4bf980c4f4dfec
Created April 15, 2015 18:51
battery historian
adb shell dumpsys batterystats --enable full-wake-history
adb shell dumpsys batterystats > battery.txt
./ battery.txt > out.html
emmaguy /
Last active August 29, 2015 14:05
Debug builds (inc content provider) side by side with release
public static final String AUTHORITY = BuildConfig.PACKAGE_NAME + ".provider";
emmaguy / gist:81f87b3ceb0721aa509e
Last active July 17, 2020 00:43
public class SeekBarWithIntervals extends LinearLayout {
private LinearLayout mLinearLayout = null;
private SeekBar mSeekBar = null;
private int WidthMeasureSpec = 0;
private int HeightMeasureSpec = 0;
public SeekBarWithIntervals(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
emmaguy / gist:5517492
Last active December 16, 2015 23:59
Useful git commands
git rm --cached `git ls-files -i --exclude-from=.gitignore` >> When updating a .gitignore, remove stuff that's previously added
git diff HEAD^ HEAD >> diff last commit with the version before it
git push origin :abc >> delete remote branch abc
git branch -d abc >> delete local branch abc
git push <origin> <branch name> -- push up new branch
git submodule update --init --recursive
git stash show -p stash@{0} -- diff against stash