Skip to content

Instantly share code, notes, and snippets.

@weirhp
weirhp / gplus.stream.api.js
Created January 11, 2012 02:50 — forked from quietlynn/gplus.stream.api.js
An unofficial API to get Google+ streams.
/*
Google+ Stream API => An unofficial API to get Google+ streams.
Copyright (C) 2012 Jingqin Lynn
Based on the "An Unofficial Google+ Circle and Followers API for Google Chrome" poject
https://github.com/mohamedmansour/google-plus-extension-jsapi
by +Mohamed Mansour <https://github.com/mohamedmansour>
Under the license: https://github.com/mohamedmansour/google-plus-extension-jsapi/blob/master/LICENSE.md
This program is free software: you can redistribute it and/or modify
@weirhp
weirhp / gist:1749500
Created February 6, 2012 04:06 — forked from wendal/gist:1749430
演示简单Proxy代理类
public static void main(String[] args) {
List list = (List) Proxy.newProxyInstance(List.class.getClassLoader(),
new Class[] { List.class },
new InvocationHandler() {
public Object invoke(Object obj, Method method, Object[] args)
throws Throwable {
if ("size".equals(method.getName()))
return (int)(Math.random() * 1000);
return null;
@weirhp
weirhp / MethodParamNamesScaner.java
Created March 10, 2012 15:45 — forked from wendal/MethodParamNamesScaner.java
获得方法形参名称列表(Java)
package com.weirhp;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
@weirhp
weirhp / gist:2365759
Created April 12, 2012 09:10
log info
41172 [qtp15272259-27] WARN org.eclipse.jetty.util.log - /dodopipe.proxy/InvokeMethod
java.lang.RuntimeException: Fail to invoke getter com.prj17.bean.StudentWapper.'getStudents()' because [java.lang.IllegalArgumentException:
ject is not an instance of declaring class]: object is not an instance of declaring class
at org.nutz.lang.Lang.makeThrow(Lang.java:85)
at org.nutz.lang.eject.EjectByGetter.eject(EjectByGetter.java:26)
at org.nutz.json.entity.JsonEntityField.getValue(JsonEntityField.java:124)
at org.nutz.json.JsonRendering.pojo2Json(JsonRendering.java:184)
at org.nutz.json.JsonRendering.render(JsonRendering.java:302)
at org.nutz.json.JsonRendering.appendPair(JsonRendering.java:79)
at org.nutz.json.JsonRendering.map2Json(JsonRendering.java:129)
@weirhp
weirhp / MethodParamNamesScanerByASM.java
Created April 19, 2012 07:21
获得方法形参名称列表By ASM (Java)
package com.weirhp;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@weirhp
weirhp / ExpresstionConvert.java
Created May 7, 2012 15:48
将后缀表达式转为中缀表达式
package com.weirhp.interview;
import java.util.ArrayDeque;
/**
* 将后缀表达式转为中缀表达式,满足:
*
* <pre>
* example 1:'56 34 213.7 + * 678 -'
* 56 * (34 + 213.7) - 678
@weirhp
weirhp / MapConverter.java
Created May 16, 2012 10:51
把简单的键值对转换成复杂的结构对象
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MapConverter{
@weirhp
weirhp / pypod.py
Created May 18, 2012 07:23 — forked from chuangbo/README.md
Python dynamic DNSPod DNS Script
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import httplib, urllib
import socket
import time
params = dict(
login_email="email", # replace with your email
login_password="password", # replace with your password
@weirhp
weirhp / EncodeQQPass.java
Created June 1, 2012 17:32
加密webQQ 传输时的密码2012-06-02
package com.weirhp.qq.core.web;
import java.security.NoSuchAlgorithmException;
/**
* 加密webQQ 传输时的密码
* miniQQ快乐挂下载地址 http://qq.weirhp.com
* @author weirhp@gmail.com
* http://weibo.com/weirhp
*/
@weirhp
weirhp / gist:2971187
Created June 22, 2012 07:57 — forked from wendal/gist:2364746
nutz 为所有实体类建好全部表
Dao dao = ioc.get(Dao.class);
for (Class<?> klass : Scans.me().scanPackage("net.wendal.tb.bean"))
if (klass.getAnnotation(Table.class) != null)
dao.create(klass, false);