Skip to content

Instantly share code, notes, and snippets.


polbins polbins

View GitHub Profile
polbins /
Last active May 17, 2016
Add ADB Screen Capture to the Command Line

This alias adds ADB Screen Capture on the command-line


Add the alias to your ~/.bash_profile

alias screencap="adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > "

NOTE: to add adb to the command-line

polbins / .gitignore
Last active Sep 14, 2016
My Android Studio Project .gitignore
View .gitignore
# Built application files
# Files for the Dalvik VM
# Java class files
polbins / gist:437297ed7587c100e57d
Created Mar 10, 2015
Sample use of OkHttp + Retrofit Application Interceptor for Resending Requests w/ Refreshed Tokens
View gist:437297ed7587c100e57d
OkHttpClient okHttpClient = new OkHttpClient();
mRestAdapter = new RestAdapter.Builder()
.setClient(new OkClient(okHttpClient))
private final Interceptor mRefreshAndRetryInterceptor = new Interceptor() {
polbins /
Created Dec 27, 2016
Clearable EditText Custom View
public class ClearableEditText extends EditText {
Drawable mClearDrawable;
public ClearableEditText(Context context) {
public ClearableEditText(Context context, AttributeSet attrs) {
View .tmux.conf
# Tmux settings
# Set XTerm key bindings
setw -g xterm-keys on
# Set colors
set-option -g default-terminal "screen-256color"
# Set reload key to r
bind r source-file ~/.tmux.conf
View RoundedBottomSheetDialogFragment.kt
package com.your.package
import android.os.Bundle
import com.your.package.R
* BottomSheetDialog fragment that uses a custom
polbins / pre-push
Last active Oct 3, 2018
Pre-push to run your lint and tests
View pre-push
# Installation
# ============
# 1. Add this snippet to: `<REPO>/.git/hooks/pre-push`
# 2. Make sure to `chmod a+x <REPO>/.git/hooks/pre-push` to make the code executable
# Check if we actually have commits to push
commits=`git log @{u}..`
if [ -z "$commits" ]; then
polbins /
Last active Jan 9, 2019
Android Endless Scroll using RecyclerView
public class EndlessListActivity<D> extends Activity {
private EndlessRecyclerOnScrollListener mEndlessScrollListener;
private EndlessListAdapter mAdapter;
protected void onCreate(Bundle savedInstanceState) {
RecyclerView listView = (RecyclerView) findViewById(;
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
polbins /
Last active Mar 7, 2019
Android Unit Test Utility Classes
public class JsonTestUtil {
private static ObjectMapper mObjectMapper;
private static ObjectMapper getObjectMapper() {
if (mObjectMapper == null) {
mObjectMapper = new ObjectMapper();
return mObjectMapper;
View countdown-timer.markdown