Skip to content

Instantly share code, notes, and snippets.

View Folyd's full-sized avatar
🦀
Rustacean

Folyd Folyd

🦀
Rustacean
View GitHub Profile
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by benny on 15/10/15.
*/
public abstract class HeaderFooterAdapter<T extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public static final int FOOTER = 8769;
@ArthurSav
ArthurSav / WrapGridLayoutManager.java
Created September 11, 2015 14:45
GridLayoutManager with working wrap_content.
package com.inperson.android.utils.leastview;
import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
public class WrappableGridLayoutManager extends GridLayoutManager {
@trawor
trawor / turbo-qiniu.sh
Last active March 8, 2021 03:21
本脚本解决部分地区七牛上传速度慢的问题
#!/bin/bash
#
# 通过对比 ping 响应时间,找到本机最快的上传ip
# Travis@fir.im
#
# 使用方法:
# sh -c "$(curl -sSL https://gist.githubusercontent.com/trawor/5dda140dee86836b8e60/raw/turbo-qiniu.sh)"
echo "# 这个脚本理论上可以帮你获取任意域名的最快速的IP"
echo "# 获取IP列表的服务由 17ce.com 提供, 非常感谢有这么好的免费服务!"
@imran0101
imran0101 / EndlessRecyclerOnScrollListener.java
Last active February 22, 2022 12:50
RecyclerView position helper to get first and last visible positions
/**
* Custom Scroll listener for RecyclerView.
* Based on implementation https://gist.github.com/ssinss/e06f12ef66c51252563e
*/
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = "EndlessScrollListener";
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.
@polbins
polbins / README.md
Last active September 6, 2019 11:08
Android Response Caching using Retrofit 1.9 + OkHttp 2.2

Android REST Controller with Cache-Control

Android REST Controller with Simple Cache Control Headers using Retrofit 1.9.0 + OkHttp 2.2.0

@xrstf
xrstf / setup.md
Last active October 3, 2022 13:30
Nutch 2.3 + ElasticSearch 1.4 + HBase 0.94 Setup

Info

This guide sets up a non-clustered Nutch crawler, which stores its data via HBase. We will not learn how to setup Hadoop et al., but just the bare minimum to crawl and index websites on a single machine.

Terms

  • Nutch - the crawler (fetches and parses websites)
  • HBase - filesystem storage for Nutch (Hadoop component, basically)
@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@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;
@nl5887
nl5887 / transfer.fish
Last active March 22, 2022 09:07
Bash and zsh alias for transfer.sh. Transfers files and directories to transfer.sh.
function transfer
if test (count $argv) -eq 0
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
end
## get temporarily filename, output is written to this file show progress can be showed
set tmpfile ( mktemp -t transferXXX )
## upload stdin or file
@meoyawn
meoyawn / EmptyRecyclerView.java
Created November 1, 2014 11:20
RecyclerView doesn't have an emptyView support, we gotta fix that
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class EmptyRecyclerView extends RecyclerView {
@Nullable View emptyView;