Skip to content

Instantly share code, notes, and snippets.


Austin Lee lizheming

View GitHub Profile
lizheming / stringToPyin.php
Last active Aug 29, 2015
View stringToPyin.php
class dict {
private $_dict;
function __construct() {
/** 设置字典库 */
$this->_dict = array(
'A' => array(59371,41648,50400,33157,41392,18661,47599),
'Ai' => array(19697,32178,35504,36856,20712,25068,28663,26608,29399,19381,17099,47497,30339,43240,54250,56459,45201,25005,57749,17131,36057,28596,49375,29162,55685,31713,27114,64665,19190,56536,37508,22145,59104,42373,18930,17311,30185,29599,54922,60552,35971,19670,27069,47505,56476,52365,63875,43184,17031,45460,45466,43440,32176,44464,57310,36230,41904,42672,42928,42416,42160,18330,22758,52719,58012,27797,45716,44208,44720,23788,45302,25559,49645,30387,51430,56208,24969,51680,44976,16588,46209,43696,43952,18334,57994,29916,51424,34439),
'An' => array(63223,39405,58764,17125,31621,34691,56712,18059,46512,33240,42376,22239,20462,39914,36586,64753,21940,18566,20963,29912,29649,37368,23685,26617,22193,47024,25589,19441,40169,36845,45488,29099,29640,37881,24205,61928,55010,17352,50928,36553,22468,30127,3
View user_agent.php
function user_agent($ua){
$os = null;
if(preg_match('/Windows 95/i',$ua) || preg_match('/Win95/',$ua)) {
$os = "Windows 95";
} elseif (preg_match('/Windows NT 5.0/i',$ua) || preg_match('/Windows 2000/i', $ua)) {
$os = "Windows 2000";
} elseif (preg_match('/Win 9x 4.90/i',$ua) || preg_match('/Windows ME/i', $ua)) {
$os = "Windows ME";
} elseif (preg_match('/Windows.98/i',$ua) || preg_match('/Win98/i', $ua)) {
View martix.js
var m = {
e: d.querySelectorAll('input'),
r: parseInt( d.body.clientWidth / 20 ),
c: parseInt( d.getElementById('container').clientHeight / 19),
o: function() {return {x: 0,y: Math.floor(m.c / 2)};},
g: function(x, y) {return m.e[(m.o().y - y) * m.r + x];}
var e = function(x, y) {
if( y>=0 )
lizheming / plugin.php
Created Dec 27, 2013
View plugin.php
* 虾米音乐播放器:虾米音乐搜索+引用
* @package XiaMiPlayer
* @author 公子
* @version 3.0.6
* @link
class XiaMiPlayer_Plugin implements Typecho_Plugin_Interface
View WXRDecoder.php
class WXRDecoder
protected $_parser;
protected $_ns;
public $posts=array();
public $tags=array();
public $post_table = 'tbl_posts';
curl -d 'username={username}&password={password}&mac={macaddress}&n=99&type=3'
lizheming / blogmi.navi.html
Last active Dec 11, 2015
View blogmi.navi.html
<div id="page_bar">
<div id="more" page="2">载入更多</div>
<style type="text/css">
#more {font-size:14px;}
#more:hover {cursor:pointer;}
<script type="text/javascript" src=""></script>
<script type="text/javascript">
$('#more').click(function() {$.get('?page='+$('#more').attr('page'), function(data) {$('#content_box').append($('#content_box', data).html());$('#more').attr('page',parseInt($('#more').attr('page'))+1);});});
View gist:4554221
include "config.php";
function sql_query($sqlcon){
mysql_query("SET NAMES 'utf8'");
$result = mysql_query($sqlcon);
return $result;
lizheming / xiami.php
Last active Feb 6, 2017
View xiami.php
$name = '';
$password = '';
$curl_post = 'email='.$name.'&password='.$password.'&done=/&submit=登 录';
$cookie_file = dirname(__FILE__).'/cookie.txt';
$curl = curl_init();
View gist:4356905

Snow in canvas land

Other people's code is awful, and your own code from months previous counts as someone else's. With this and the festive spirit in mind, I dug up a canvas snow demo I made two years ago to see how bad my code really was.

Turns out the performance landscape has changed quite a bit, but after applying a couple of workarounds, best practices, and memory management, I got the demo running smoother than it ever did.

Ugh, I can't believe I just wrote "performance landscape". Anyway...

How does the demo work?