Skip to content

Instantly share code, notes, and snippets.

@wjch
wjch / README.md
Last active August 29, 2015 14:23 — forked from polbins/README.md

Simple RecyclerView Divider

Simple Horizontal Divider Item Decoration for RecyclerView

    mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
            getApplicationContext()
    	));

NOTE: Add item decoration prior to setting the adapter

/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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
@wjch
wjch / BCDConvert.java
Last active August 29, 2015 14:26 — forked from neuro-sys/BCD.java
BCD Conversion in java
/* Various BCD Conversion util. methods */
public class BCD {
/*
* long number to bcd byte array e.g. 123 --> (0000) 0001 0010 0011
* e.g. 12 ---> 0001 0010
*/
public static byte[] DecToBCDArray(long num) {
int digits = 0;
@wjch
wjch / CHexConver.java
Created November 21, 2015 08:35 — forked from alanland/CHexConver.java
java 中 Hex的转换
package mobi.dzs.util;
/**
* 16进制值与String/Byte之间的转换
* @author JerryLi
* @email lijian@dzs.mobi
* @data 2011-10-16
* */
public class CHexConver
{
/*
* COPYRIGHT NOTICE
* Copyright (C) 2015, Jhuster, All Rights Reserved
* Author: Jhuster(lujun.hust@gmail.com)
*
* https://github.com/Jhuster/TLV
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
/**
* 开启一个子线程来运行服务,来处理异步的任务请求
* An {@link IntentService} subclass for handling asynchronous task requests in
* a service on a separate handler thread.
* <p/>
*/
public class TestIntentService extends IntentService {
// TODO: Rename actions, choose action names that describe tasks that this
// IntentService can perform, e.g. ACTION_FETCH_NEW_ITEMS
private static final String ACTION_DOWNLOAD = "com.mywjch.learnrxjava.action.FOO";
@wjch
wjch / Personal Blocklist
Created January 7, 2016 02:21
Personal Blocklist
001nlp.com
111cn.net
151.com.tw
15meili.com
258369.cn
28im.com
360doc.com
3v4.net
4byte.cn
51edu.com
@wjch
wjch / bilibili.zsh
Created May 24, 2016 11:52 — forked from quxiaowei/bilibili.zsh
从哔哩哔哩下载剧,并将视屏片段合并 需要:youtube-dl, ffmpeg
for i in {1..12}
do
url=http://www.bilibili.com/video/av3794937/index_$i.html
echo $url
youtube-dl -o "SeGmEnT-$i-%(playlist_index)s.%(ext)s" $url
rm -f buffer_list
touch buffer_list
for file in $(ls SeGmEnT-$i-*.flv)
do
echo file "'$file'" >> buffer_list
@wjch
wjch / DividerItemDecoration.java
Created June 20, 2016 09:45 — forked from zokipirlo/DividerItemDecoration.java
DividerItemDecoration. RecyclerView.ItemDecoration simple implementation
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
@wjch
wjch / bezier.js
Created July 25, 2016 16:19 — forked from LiuJi-Jim/bezier.js
De Casteljau Bezier
function DeCasteljauBezier(points, density, step){
//if (points.length < 3) return null;
console.time('bezier');
var ps = points.map(function(p){
return {
x: p.x,
y: p.y
};
}),
results = [],