Skip to content

Instantly share code, notes, and snippets.

@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}"
}
@gabrielemariotti
gabrielemariotti / build.gradle
Last active November 22, 2024 19:55
Use signing.properties file which controls which keystore to use to sign the APK with gradle.
android {
signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
@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;
@JakeWharton
JakeWharton / HierarchyTreeChangeListener.java
Last active March 16, 2022 02:17
A hierarchy change listener which recursively monitors and entire tree of views. Apache 2.
import android.view.View;
import android.view.ViewGroup;
/**
* A {@link ViewGroup.OnHierarchyChangeListener hierarchy change listener} which recursively
* monitors an entire tree of views.
*/
public final class HierarchyTreeChangeListener implements ViewGroup.OnHierarchyChangeListener {
/**
* Wrap a regular {@link ViewGroup.OnHierarchyChangeListener hierarchy change listener} with one
@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 ) {
@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;
@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".
@swanson
swanson / gist:7dee3f3474e30fe8f15c
Last active January 11, 2024 16:42
Retrofit LocalJsonClient
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Log;
import retrofit.client.Client;
import retrofit.client.Header;
import retrofit.client.Request;
import retrofit.client.Response;
import retrofit.mime.TypedInput;
@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;