Skip to content

Instantly share code, notes, and snippets.

@soe
soe / ListAdapter
Last active August 29, 2015 14:10 — forked from andraskindler/ListAdapter
package com.andraskindler.playground.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.andraskindler.playground.Item;
import com.andraskindler.playground.R;
package com.andraskindler.sandbox.activity;
import retrofit.RestAdapter;
import retrofit.http.GET;
import retrofit.http.Query;
import rx.Observable;
import rx.Subscriber;
import rx.schedulers.Schedulers;
public class ApiManager {
public class SwipeRefreshLayoutToggleScrollListener extends RecyclerView.OnScrollListener {
private List<RecyclerView.OnScrollListener> mScrollListeners = new ArrayList<RecyclerView.OnScrollListener>();
private int mExpectedVisiblePosition = 0;
private SwipeRefreshLayout mSwipeLayout;
public SwipeRefreshLayoutToggleScrollListener(SwipeRefreshLayout swipeLayout) {
mSwipeLayout = swipeLayout;
}
public void addScrollListener(RecyclerView.OnScrollListener listener){
mScrollListeners.add(listener);
/**
* Created by nikola on 11/28/14.
*/
public class MentionTransformation implements TransformationMethod {
private int mColor;
private Pattern MENTIONS_PATTERN = Pattern.compile("\\B@[a-z0-9_-]+");
private MentionTransformation(int color) {
mColor = color;
1、SwipeRefreshLayout下只能有一个具有scroll功能的子View(ScrollView、ListView、RecyclerView等),子View可以有多个子View
2、实现上拉加载更多,利用RecyclerView的LayoutManger实现
mRecyclerView.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrolled(int dx, int dy) {
if(mLayoutManager.findLastVisibleItemPosition() == dataset.length-1){
Log.d("onScrolled", "end");
dataset[dataset.length-1] = "正在加载...";
adapter.notifyItemChanged(dataset.length-1);
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@soe
soe / WP2Chatter.js
Created August 21, 2012 10:21
WP2Chatter Kynetx
ruleset a1000x9 {
meta {
name 'WP2Chatter'
description <<
WP2Chatter
>>
author "soe soe"
logging on
key wp2chatter {
@soe
soe / gist:4002310
Created November 2, 2012 16:05
baseText
"""
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a tuple in this format:
(view_function, function_args, function_kwargs)
"""
import re
@soe
soe / gist:4003358
Created November 2, 2012 18:25
newText
"""
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a tuple in this format:
(view_function, function_args, function_kwargs)
"""
from __future__ import unicode_literals
@soe
soe / gist:4005234
Created November 3, 2012 00:30
field.api.php old
<?php
// $Id$
/**
* @ingroup field_fieldable_type
* @{
*/
/**
* Exposes "pseudo-field" components on fieldable entities.