Skip to content

Instantly share code, notes, and snippets.

View hoajb's full-sized avatar

Hoa Nguyen hoajb

  • EPAM Systems
  • Ho Chi Minh City, Viet Nam
  • 12:20 (UTC +07:00)
View GitHub Profile
@9re
9re / ExifUtil.java
Created March 7, 2012 00:16
fix flipped / rotated image by getting exif orientation
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.os.Build;
@rfreedman
rfreedman / DebouncedOnClickListener.java
Created May 14, 2013 03:09
A debounced onClickListener for Android
import android.os.SystemClock;
import android.view.View;
import java.util.Map;
import java.util.WeakHashMap;
/**
* A Debounced OnClickListener
* Rejects clicks that are too close together in time.
* This class is safe to use as an OnClickListener for multiple views, and will debounce each one separately.
@irazasyed
irazasyed / homebrew-permissions-issue.md
Last active June 14, 2024 17:01
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*

@kristopherjohnson
kristopherjohnson / ItemPickerDialogFragment.java
Last active May 7, 2018 06:42
Android dialog fragment that allows selection of an item from a list
package net.kristopherjohnson;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@kasperpeulen
kasperpeulen / README.md
Last active July 13, 2024 09:04
How to pretty-print JSON using Dart.
@NikolaDespotoski
NikolaDespotoski / ToolbarAlphaScrollBehavior.java
Last active January 15, 2020 20:44
Toggle Toolbar background alpha and alpha of its title view.
public class ToolbarAlphaScrollBehavior extends CoordinatorLayout.Behavior<android.support.v7.widget.Toolbar> {
private ColorDrawable mStatusBarColorDrawable;
private int mStatusBarColor;
private TextView mTitleView;
private boolean searchedForTitleView = false;
public ToolbarAlphaScrollBehavior(Context context, AttributeSet attrs) {
super(context, attrs);
mStatusBarColor = ContextCompat.getColor(context, R.color.primary_dark);
mStatusBarColor = getColorWithAlpha(0, mStatusBarColor);
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active July 25, 2024 13:16
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@layerlre
layerlre / IntentFacebook.java
Last active January 9, 2023 15:02
Open Facebook Page URL in Facebook app with Intent
....
public void startFacebook(String facebookUrl) {
try {
Uri uri = null;
int versionCode = getPackageManager()
.getPackageInfo("com.facebook.katana", 0)
.versionCode;
@codediodeio
codediodeio / database.rules.json
Last active July 24, 2024 21:05
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}