Skip to content

Instantly share code, notes, and snippets.

View flyfire's full-sized avatar
🎯
Focusing

flyfire flyfire

🎯
Focusing
View GitHub Profile
package com.segmentfault.app.view;
import android.content.Context;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.NestedScrollingChild;
import android.support.v4.view.NestedScrollingChildHelper;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
int fit = false;
this->testLabel->setText("");
QLabel *myLabel = this->testLabel;
QFont myFont = myLabel->font();
QString str = "this is the new string. this is the new string. this is the new string. super long. don't fit. please please please overflow the box";
while (!fit)
{
@plastiv
plastiv / Article.java
Created April 22, 2015 08:04
Retrofit multipart convertor
@MultipartBody
public class Article {
String author;
File photo;
}
@tdoly
tdoly / v2ex_auto_login.py
Last active May 24, 2019 13:28
v2ex 自动登录,领取金币脚本
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
import logging
import datetime
import requests
import BeautifulSoup
from requests.adapters import HTTPAdapter
@nschwermann
nschwermann / HeaderAdapter
Created December 20, 2014 16:42
RecyclerView HeaderAdapter
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@krishan711
krishan711 / RecyclerViewAdapter
Created December 20, 2014 13:15
RecyclerView with headers and footers
/*
* Created by Krishan Patel.
* Copyright (c) 2014. Rocko Labs Ltd. All Rights Reserved.
*/
package com.rockolabs.kites.adapters;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
@xbin999
xbin999 / qiniu_md
Last active August 29, 2015 14:10
为七牛云存储上传的文件日志显示图像的markdown格式
# only display markdown result
/Users/yangbin/bin/qrsync /Users/yangbin/bin/qiniu-conf.json 2>&1 | grep "Put" | awk -F"[:]" '{printf "![](http://xbin999.qiniudn.com/%s )\n", $6 }'
# replace the original log with markdown format
/Users/yangbin/bin/qrsync /Users/yangbin/bin/qiniu-conf.json 2>&1 |sed -e 's/\(=> xbin999:\)\(.*\)/=> ![](http:\/\/xbin999.qiniudb.com\/\2\)/'
@mheras
mheras / HeaderFooterRecyclerViewAdapter.java
Last active January 12, 2024 17:33
Header & footer support for RecyclerView.Adapter
public abstract class HeaderFooterRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int VIEW_TYPE_MAX_COUNT = 1000;
private static final int HEADER_VIEW_TYPE_OFFSET = 0;
private static final int FOOTER_VIEW_TYPE_OFFSET = HEADER_VIEW_TYPE_OFFSET + VIEW_TYPE_MAX_COUNT;
private static final int CONTENT_VIEW_TYPE_OFFSET = FOOTER_VIEW_TYPE_OFFSET + VIEW_TYPE_MAX_COUNT;
private int headerItemCount;
private int contentItemCount;
private int footerItemCount;
@seanKenkeremath
seanKenkeremath / Android Lollipop Widget Tinting Guide
Last active May 2, 2025 11:54
How base colors in Lollipop apply to different UI elements
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21. To use the support version of these attributes, remove the android namespace. For instance, "android:colorControlNormal" becomes "colorControlNormal". These attributes will be propagated to their corresponding attributes within the android namespace for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
* ripple effect (Lollipop only) -- "colorControlHighlight"
Status Bar:
------------
* background (Lollipop only) - "colorPrimaryDark"
@darnmason
darnmason / HeaderViewRecyclerAdapter.java
Last active March 21, 2020 17:19
RecyclerView adapter designed to wrap an existing adapter allowing the addition of header views and footer views.
/*
* Copyright (C) 2014 darnmason
*
* 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