Skip to content

Instantly share code, notes, and snippets.

@swankjesse
swankjesse / TwitterSample.java
Created March 11, 2014 00:08
Twitter hello world with OkHttp
package com.squareup.okhttp.sample;
import com.squareup.okhttp.ConnectionPool;
import com.squareup.okhttp.OkHttpClient;
import java.lang.reflect.Field;
import twitter4j.Paging;
import twitter4j.ResponseList;
import twitter4j.Twitter;
import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken;
@thevery
thevery / RoboBaseAdapter.java
Created January 30, 2011 00:19
RoboBaseAdapter for RoboGuice
package roboguice.astroboy;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.google.inject.internal.Nullable;
import roboguice.inject.InjectView;
@JakeWharton
JakeWharton / README.md
Last active October 13, 2015 14:38
Maven pom for Google Play services
@briangriffey
briangriffey / CircularDrawable.java
Last active December 25, 2015 20:29
Use this drawable to to create a circular image like the one found here: https://www.evernote.com/shard/s36/sh/9f22cbd4-9e01-4f7a-9125-2470c4f21e6c/be052171b03a4ad8dc308560971c5944 with any bitmap.
package com.sceneTap.views;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Shader;
@lhackman
lhackman / gist:8422019
Created January 14, 2014 17:15
descriptors for superhero exercise
adjectives = dict(a="red", b="orange", c="green", d="blue", e="yellow", f="orange", g="black", h="super", i="mysterious", j="flying", k="purple", l="sparkling", m="flashing", n="courageous", o="singing", p="tender", q="magnificent", r="radioactive", s="hypnotic", t="screaming", u="ultraviolet", v="royal", w="tap dancing", x= "silent", y="angry", z="amazing")
nouns = dict(a="waffle", b="turtle", c="lantern", d="herb garden", e="trampoline", f="marshmallow", g="ghost", h="tent", i="water bottle", j="rattle", k="cell phone", l="romantic", m="restaurant", n="coin purse", o="quail", p="pineapple", q="mosquito", r="wrestler", s="sun", t="walrus", u="vigilante", v="jester", w="teddy bear", x= "python", y="racoon", z="wombat")
@lhackman
lhackman / microserfs.txt
Created January 14, 2014 22:01
Taken from the wikipedia article on the book Microserfs. Being used as a sample text file for a python problem for a class.
Microserfs, published by HarperCollins in 1995, is an epistolary novel by Douglas Coupland. It first appeared in short story form as the cover article for the January 1994 issue of Wired magazine and was subsequently expanded to full novel length. Set in the early 1990s, it captures the state of the technology industry before Windows 95, and anticipates the dot-com bubble of the late 1990s.
The novel is presented in the form of diary entries maintained on a PowerBook by the narrator, Daniel. Because of this, as well as its formatting and usage of emoticons, this novel is similar to what emerged a decade later as the blog format.
Coupland revisited many of the ideas in Microserfs in his 2006 novel JPod, which has been labeled "Microserfs for the Google generation".
@mpost
mpost / Entry.java
Created December 12, 2013 10:27
Android application demonstrating the usage of Android 4.4 transitions to achieve animations effects.
package com.eclipsesource.overlay;
public class Entry {
private final int imageResId;
private final String title;
private final int id;
public Entry( int imageResId, String title, int id ) {
@orip
orip / build.gradle
Last active April 19, 2016 11:56
ProGuard rules for using Dagger 1.1.0 with gradle.
dependencies {
def dagger_version = "1.1.0"
compile "com.squareup.dagger:dagger:${dagger_version}"
compile "com.squareup.dagger:dagger-compiler:${dagger_version}"
}
@tyvsmith
tyvsmith / dex-count.sh
Created July 22, 2013 18:45
"`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ 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-count.sh; $ 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)
@jgilfelt
jgilfelt / ScalpelDrawer.java
Last active January 28, 2017 13:09
ScalpelDrawer - A simple wrapper for Scalpel (https://github.com/JakeWharton/scalpel) that includes toggle controls accessible from a right-side navigation drawer. Call ScalpelDrawer.wrapInside() in a base Activity onPostCreate() to easily wrap all content in your app.
package com.example.scalpeldrawer;
import android.app.Activity;
import android.content.Context;
import android.support.v4.widget.DrawerLayout;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;