Skip to content

Instantly share code, notes, and snippets.

@nikhiljha
nikhiljha / AddCookiesInterceptor.java
Created July 29, 2016 04:35
Retrofit2/OkHttp3 Cookies (Drag and Drop, One Size Fits 99%)
// Original written by tsuharesu
// Adapted to create a "drop it in and watch it work" approach by Nikhil Jha.
// Just add your package statement and drop it in the folder with all your other classes.
import android.content.Context;
import android.preference.PreferenceManager;
import android.util.Log;
import java.io.IOException;
import java.util.HashSet;
@lenguyenthanh
lenguyenthanh / Dagger 2.md
Last active May 7, 2020 19:55
Dagger 2 configuration

Small gist shows how to config Dagger 2 to an Android project

@mformetal
mformetal / PreDrawer.java
Last active April 7, 2017 10:04
A simple way to add a predraw listener to a view
public abstract class PreDrawer<T extends View> {
// Private constructor prevent instantiation by the caller. Use addPredrawer() method instead.
private PreDrawer(final T view) {
// Adds the observer to the given view, then calls notifyPredraw() when clean up has been done ready
final ViewTreeObserver viewTreeObserver = view.getViewTreeObserver();
viewTreeObserver.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
@TomFrost
TomFrost / prompt_frost_setup
Last active February 25, 2017 03:29
Frost theme for ZSH via Prezto. Add to ~/.zprezto/modules/prompt/functions
#
# All information at your chilly fingertips.
#
# Authors:
# Tom Frost <tom@frosteddesign.com>
#
# Screenshots:
# http://i.tomfro.st/U1Kov.png
#
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
package net.colaborativa.exampleapp.api;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;