Skip to content

Instantly share code, notes, and snippets.

Avatar
🌞

polbins polbins

🌞
View GitHub Profile
@polbins
polbins / README.md
Last active May 17, 2016
Add ADB Screen Capture to the Command Line
View README.md

This alias adds ADB Screen Capture on the command-line

HOW-TO

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
polbins / .gitignore
Last active Sep 14, 2016
My Android Studio Project .gitignore
View .gitignore
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@polbins
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();
okHttpClient.interceptors().add(mRefreshAndRetryInterceptor);
mRestAdapter = new RestAdapter.Builder()
...
.setClient(new OkClient(okHttpClient))
.build();
private final Interceptor mRefreshAndRetryInterceptor = new Interceptor() {
@polbins
polbins / ClearableEditText.java
Created Dec 27, 2016
Clearable EditText Custom View
View ClearableEditText.java
public class ClearableEditText extends EditText {
@BindDrawable(R.drawable.ic_clear_dark_gray)
Drawable mClearDrawable;
public ClearableEditText(Context context) {
super(context);
init();
}
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.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom
@polbins
polbins / pre-push
Last active Oct 3, 2018
Pre-push to run your lint and tests
View pre-push
#!/bin/bash
# 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
polbins / EndlessListActivity.java
Last active Jan 9, 2019
Android Endless Scroll using RecyclerView
View EndlessListActivity.java
public class EndlessListActivity<D> extends Activity {
private EndlessRecyclerOnScrollListener mEndlessScrollListener;
private EndlessListAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RecyclerView listView = (RecyclerView) findViewById(R.id.list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
@polbins
polbins / JsonTestUtil.java
Last active Mar 7, 2019
Android Unit Test Utility Classes
View JsonTestUtil.java
public class JsonTestUtil {
private static ObjectMapper mObjectMapper;
private static ObjectMapper getObjectMapper() {
if (mObjectMapper == null) {
mObjectMapper = new ObjectMapper();
}
return mObjectMapper;
}
View countdown-timer.markdown