Skip to content

Instantly share code, notes, and snippets.

View douglasdrumond's full-sized avatar
📷
brb

Douglas Drumond Kayama douglasdrumond

📷
brb
View GitHub Profile
@douglasdrumond
douglasdrumond / reduceBitmap
Last active February 11, 2018 13:07
Reduce a Bitmap on Android
// Disclaimer: this wasn't tested, it's just for teaching the way to a friend,
// maybe there are some bugs.
public void reduceBitmap(String sourcePath, String destinationPath) {
// Adjust width and height to your needs
int targetW = 800;
int targetH = 600;
// Get the dimensions of the bitmap
BitmapFactory.Options bmOptions = new BitmapFactory.Options();

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@douglasdrumond
douglasdrumond / dex count
Created October 1, 2014 17:00
Count dex methods
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)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')

Keybase proof

I hereby claim:

  • I am douglasdrumond on github.
  • I am douglasdrumond (https://keybase.io/douglasdrumond) on keybase.
  • I have a public key whose fingerprint is E37E 180E CC71 76C2 D2A5 76A5 A40F 4641 47FC C679

To claim this, I am signing this object:

<color name="sunshine_blue">#ff1ca8f4</color>
<color name="sunshine_blue">#ff1ca8f4</color>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="grey">#cccccc</color>
<color name="sunshine_light_blue">#ff64c2f4</color>
</resources>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:divider="?android:attr/dividerHorizontal"
android:orientation="horizontal"
tools:context="com.example.android.sunshine.app.MainActivity">
<!--
public static String getFormattedWind(Context context, float windSpeed, float degrees) {
int windFormat;
if (Utility.isMetric(context)) {
windFormat = R.string.format_wind_kmh;
} else {
windFormat = R.string.format_wind_mph;
windSpeed = .621371192237334f * windSpeed;
}
// From wind direction in degrees, determine compass direction as a string (e.g NW)
private static final int VIEW_TYPE_TODAY = 0;
private static final int VIEW_TYPE_FUTURE_DAY = 1;
private static final int VIEW_TYPE_COUNT = 2;
@Override
public int getItemViewType(int position) {
return position == 0 ? VIEW_TYPE_TODAY : VIEW_TYPE_FUTURE_DAY;
}