Skip to content

Instantly share code, notes, and snippets.

public function action_authcode() {
//随机生成一个4位数的数字验证码
$num="";
for($i=0;$i<4;$i++){
$num .= rand(0,9);
}
//4位验证码也可以用rand(1000,9999)直接生成
//将生成的验证码写入session,备验证页面使用
SESSION::put("authcode", $num);
//创建图片,定义颜色值
@wjch
wjch / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@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
{
@wjch
wjch / setting_user.json
Last active December 14, 2015 05:58
我的Sublime Text2用户配置
// While you can edit this file, it's best to put your changes in
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
// 主题文件的路径
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
@wjch
wjch / playLOL.sh
Last active December 14, 2015 06:59
博客的一些代码
#!/bin/bash
cd "/home/你的用户名/.wine/drive_c/Program Files/League of Legends US/RADS/system"
WINEDEBUG=+ntdll wine "rads_user_kernel.exe" run lol_launcher $(ls ../projects/lol_launcher/releases/) LoLLauncher.exe
@wjch
wjch / LINUX Proxy settings using export http_proxy.sh
Created March 1, 2013 17:01
LINUX Proxy settings using export http_proxy,在本shell及其子进程中进行设置
export http_proxy=http://server-ip:port/
export http_proxy=http://127.0.0.1:8087/ //GAE
export http_proxy=http://proxy-server.mycorp.com:3128/