Skip to content

Instantly share code, notes, and snippets.

dan dbachelder

  • Zumper, Inc
  • SF
Block or report user

Report or block dbachelder

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
dbachelder /
Created Apr 29, 2015
Android test runner that doesn't finish the activity under test
import android.content.Intent;
import android.util.Log;
* this is a rule that does not finish the activity under test at the end of the test.
* useful for debugging and development. use in the same way as ActivityTestRule.
dbachelder / gist:9587898
Last active Dec 11, 2018
style the actionbar compat searchview. inspired by this article:
View gist:9587898
final SupportMenuItem searchMenuItem = (SupportMenuItem) menu.findItem(;
if (searchMenuItem == null) throw new IllegalArgumentException("menu item is null and that is very suspicious.");
this.searchView = (SearchView) searchMenuItem.getActionView();
if (searchView == null) throw new IllegalArgumentException("search view is null and that is very suspicious.");
// wow. much hack. style search box..
Resources resources = searchView.getContext().getResources();
dbachelder /
Last active May 19, 2017
A version of support DrawerLayout that can open the drawer X pixels... uses reflection to access the private members of DrawerLayout
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.Display;
import android.view.Gravity;
View build.gradle
subprojects {
// This is an annoying hack to get around the fact that the Gradle plugin does not support
// having libraries with different minSdkVersions. Play Services has a min version of 9 (Gingerbread)
// but Android Maps Utils supports 8 (Froyo) still
it.afterEvaluate { subProject ->
// is this a library or an app?
if(subProject.plugins.hasPlugin(AppPlugin.class) || subProject.plugins.hasPlugin(LibraryPlugin.class)) {
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
return new SavedState(superState, numberPicker1.getValue(), numberPicker2.getValue(), numberPicker3.getValue());
protected void onRestoreInstanceState(Parcelable state) {
SavedState savedState = (SavedState) state;
dbachelder /
Created Jan 14, 2014 — forked from jookyboi/
CSS libraries and guides to bring some order to the chaos.


  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.


dbachelder / 0_reuse_code.js
Created Jan 14, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
dbachelder / gist:8322454
Created Jan 8, 2014
problem when building with elasticsearch1.0.0-beta2
View gist:8322454
[info] Compiling 183 Scala sources to /home/dev/projects/core/target/scala-2.10/classes...
[warn] Class org.elasticsearch.common.joda.convert.FromString not found - continuing with a stub.
[warn] Caught: java.lang.NullPointerException while parsing annotations in /home/.ivy2/cache/org.elasticsearch/elasticsearch/jars/elasticsearch-1.0.0.Beta2.jar(org/elasticsearch/common/joda/time/DateTime.class)
[error] error while loading DateTime, class file '/home/.ivy2/cache/org.elasticsearch/elasticsearch/jars/elasticsearch-1.0.0.Beta2.jar(org/elasticsearch/common/joda/time/DateTime.class)' is broken
[error] (class scala.MatchError/p (of class java.lang.Character))
dbachelder /
Last active Dec 20, 2015 — forked from j3tm0t0/
added region and keys to script to make it more obvious what needs to be done
export AWS_REGION='us-west-1'
# creating security groups
ec2-create-group --region $AWS_REGION 'AWS-OpsWorks-Web-Server' -d 'AWS OpsWorks Web server - do not change or delete'
ec2-create-group --region $AWS_REGION 'AWS-OpsWorks-Default-Server' -d 'AWS OpsWorks Default server - do not change or delete'
ec2-create-group --region $AWS_REGION 'AWS-OpsWorks-Blank-Server' -d 'AWS OpsWorks blank server - do not change or delete'
ec2-create-group --region $AWS_REGION 'AWS-OpsWorks-LB-Server' -d 'AWS OpsWorks load balancer - do not change or delete'
You can’t perform that action at this time.