Skip to content

Instantly share code, notes, and snippets.

View polbins's full-sized avatar
🏔️

polbins polbins

🏔️
View GitHub Profile
@polbins
polbins / pre-push
Last active October 3, 2018 18:40
Pre-push to run your lint and tests
#!/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 / RoundedBottomSheetDialogFragment.kt
Created September 24, 2018 13:55 — forked from ArthurNagy/RoundedBottomSheetDialogFragment.kt
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
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
# 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
@polbins
polbins / ClearableEditText.java
Created December 27, 2016 03:21
Clearable EditText Custom View
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) {
@polbins
polbins / gist:437297ed7587c100e57d
Created March 10, 2015 14:27
Sample use of OkHttp + Retrofit Application Interceptor for Resending Requests w/ Refreshed Tokens
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 / .gitignore
Last active September 14, 2016 02:03
My Android Studio Project .gitignore
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@polbins
polbins / README.md
Last active May 17, 2016 05:13
Add ADB Screen Capture to the Command Line

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