Skip to content

Instantly share code, notes, and snippets.

View namchuai's full-sized avatar

NamH namchuai

View GitHub Profile
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;
@namchuai
namchuai / circle.xml
Created August 16, 2018 02:54 — forked from gohilbhagirath90/circle.xml
list item with left side half circle android
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false" >
<solid android:color="@android:color/white" />
<size
android:height="50dp"
android:width="50dp" />
</shape>
@namchuai
namchuai / install virtualenv ubuntu 16.04.md
Created February 7, 2020 15:56 — forked from frfahim/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@namchuai
namchuai / uuid.jinja
Created January 4, 2023 16:15 — forked from benwalio/uuid.jinja
create a basic uuid using jinja2
{%- set ns = namespace(uuid = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx') %}
{%- set ns.new_uuid = '' %}
{%- for x in ns.uuid %}
{%- set ns.new_uuid = [ns.new_uuid,(x | replace('x', [0,1,2,3,4,5,6,7,8,9,'a','b','c','d','e','f'] | random ))] | join %}
{%- endfor %}
{{ ns.new_uuid }}