Skip to content

Instantly share code, notes, and snippets.

View lizheming's full-sized avatar
:octocat:

Austin Lee lizheming

:octocat:
View GitHub Profile
@lizheming
lizheming / ipv6.html
Created October 26, 2012 07:05
Srun IPv6 Login By HTML
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Srun Login!</title>
<script type="text/javascript">
function submit() {
document.getElementById('submit').click();
}
</script>
@lizheming
lizheming / LoginController.js
Created September 11, 2015 08:58
Login Github
// 自定义配置
var client = {
id: "",
secret: ""
};
var redirect_uri = "http://lizheming.com:8360/login/callback";
var querystring = require("querystring");
var request = require("request");
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)) {
d=document;
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
lizheming / plugin.php
Created December 27, 2013 11:22
XiaMiPlayer插件部分代码
<?php
/**
* 虾米音乐播放器:虾米音乐搜索+引用
*
* @package XiaMiPlayer
* @author 公子
* @version 3.0.6
* @link http://zh.eming.li/#typecho
*/
class XiaMiPlayer_Plugin implements Typecho_Plugin_Interface
<?php
class WXRDecoder
{
protected $_parser;
protected $_ns;
public $posts=array();
public $tags=array();
public $post_table = 'tbl_posts';
@lizheming
lizheming / blogmi.navi.html
Last active December 11, 2015 22:38
blogmi无限翻页
<div id="page_bar">
<div id="more" page="2">载入更多</div>
<style type="text/css">
#more {font-size:14px;}
#more:hover {cursor:pointer;}
</style>
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.0/jquery.min.js"></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);});});
</script>
@lizheming
lizheming / gist:4554221
Created January 17, 2013 06:52
wechat.php
<?php
include "config.php";
function sql_query($sqlcon){
$con=mysql_connect(DATABASE_HOST, DATABASE_USER,DATABASE_PSSWORD);
mysql_select_db(DATABASE_DB_NAME);
mysql_query("SET NAMES 'utf8'");
$result = mysql_query($sqlcon);
mysql_close($con);
return $result;
}

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?

@lizheming
lizheming / xiami.auto.sign.php
Created November 9, 2012 12:56
虾米自动签到模拟
<?php
$data = '';
$cookie_file = dirname(__FILE__).'/cookie.txt';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://www.xiami.com/task/signin");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($curl, CURLOPT_REFERER, 'http://www.xiami.com/');
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);