Skip to content

Instantly share code, notes, and snippets.

Daniel Lew dlew

Block or report user

Report or block dlew

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
tyvsmith /
Created Jul 22, 2013
"`classes.dex` method count helpers. Requires smali/baksmali from and dexdump from the build-tools in the Android SDK be on your PATH." Use this to keep track of methods and fields in your apk. They are both limited to 65536. Example use: $ source; $ dex-field-count classes.dex; Original method scrip…
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
dmarcato / strip_play_services.gradle
Last active Jun 19, 2019
Gradle task to strip unused packages on Google Play Services library
View strip_play_services.gradle
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
return result
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
benjchristensen /
Last active May 14, 2018
DebounceBuffer: Use publish(), debounce() and buffer() together to capture bursts of events.
import java.util.List;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.Subscriber;
import rx.schedulers.Schedulers;
public class DebounceBuffer {
public static void main(String args[]) {
jakeouellette / resourceinjection.gradle
Last active Aug 29, 2015
Inject XML resources after variants are merged
View resourceinjection.gradle
// Here's a trick to get XML injected into the APK.
// Be careful not to merge-conflict with existing parameters, as this occurs after the mergeResources step, and the behavior is likely undefined.
// was added to app/build.gradle after applying android plugin.
android.applicationVariants.all { variant ->
// Supports both 0.12.+ and 1.+ of Android gradle plugin by getting all processResourceTasks:
def tasks = []
// Multidex has multiple process resource tasks
if (variant.hasProperty('outputs')) {
for (output in variant.outputs) {
pyricau /
Last active Oct 18, 2019
"Fix" for InputMethodManager leaking the last focused view:
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Bundle;
import android.os.Looper;
import android.os.MessageQueue;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import java.util.Queue;
import java.util.concurrent.atomic.*;
import rx.*;
import rx.Observable.Operator;
import rx.exceptions.MissingBackpressureException;
import rx.internal.operators.*;
import rx.internal.util.*;
import rx.internal.util.atomic.SpscAtomicArrayQueue;
View dependencies.gradle
allprojects {
repositories {
maven {
url ''
maven {
url = ''
You can’t perform that action at this time.