Skip to content

Instantly share code, notes, and snippets.

Zeyi (Rice) Fan fanzeyi

Block or report user

Report or block fanzeyi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fanzeyi
fanzeyi / chinese_district.py
Created Jan 10, 2015
integrate GB2260 with SQLAlchemy
View chinese_district.py
# -*- coding: utf-8 -*-
import gb2260
import sqlalchemy.types as types
class ChineseDistrict(types.TypeDecorator):
impl = types.Integer
def process_bind_param(self, value, dialect):
View DoubanList.txt
[Adblock Plus 2.0]
! Version: 20141221
! Title: DoubanList
! Expires: 1 day (update frequency)
! Homepage: https://gist.github.com/fanzeyi/b69bff4c45f3dc9d44d0
!
douban.com##.lnk-doubanapp
douban.com##.get_douban_app
movie.douban.com###app-discuss
@fanzeyi
fanzeyi / gist:18fc24a495c72a68e4b0
Last active Aug 29, 2015
Integrate SQLAlchemy with Enum34
View gist:18fc24a495c72a68e4b0
class Enum34(types.TypeDecorator):
impl = types.Integer
def __init__(self, enum_class, *args, **kwargs):
super(Enum34, self).__init__(*args, **kwargs)
self._enum_class = enum_class
def process_bind_param(self, value, dialect):
if value not in self._enum_class:
raise ValueError("Not a valid enum value")
View pre-commit.sh
#!/bin/sh
if [ $(git diff --cached | grep "debugger|console\.log" -E | grep -E "^\+" | wc -l) -gt 0 ]; then
echo "[Pre-commit check] Detected debug code in commit. Remove it!"
exit 1
fi
exit 0
@fanzeyi
fanzeyi / 10.9.patch
Last active Jan 1, 2016
SDL 1.2.15 Patch for 10.9
View 10.9.patch
--- ./src/video/quartz/SDL_QuartzVideo.h 2014-01-02 02:36:48.000000000 +0800
+++ ./src/video/quartz/SDL_QuartzVideo.h 2014-01-02 02:36:50.000000000 +0800
@@ -91,7 +91,9 @@
CGDirectDisplayID display; /* 0 == main display (only support single display) */
const void *mode; /* current mode of the display */
const void *save_mode; /* original mode of the display */
+#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
CGDirectPaletteRef palette; /* palette of an 8-bit display */
+#endif
NSOpenGLContext *gl_context; /* OpenGL rendering context */
@fanzeyi
fanzeyi / app.py
Created Nov 15, 2013
Simple stream file proxy with Flask and Requests
View app.py
# -*- coding: utf-8 -*-
from flask import Flask
from flask import Response
from flask import stream_with_context
import requests
app = Flask(__name__)
View v2ex_api.md
View .vimrc
" Zeray Rice's New Vimrc
" Created: Augest 24, 2013
" ===============
" Vundle
" ===============
set nocompatible
filetype off
View remove-doulist.js
$.map($.map($("div[data-target-type='doulist']"), function(d) {return $(d).data("sid");}), function(sid) {$.post("http://www.douban.com/j/status/delete", {"sid" : sid, ck : get_cookie("ck")});});
@fanzeyi
fanzeyi / artboards.sketchpreset
Created Jun 22, 2013
Android Icon Artboards for Sketch
View artboards.sketchpreset
<dict>
<key>name</key>
<string>Android</string>
<key>presets</key>
<array>
<string>Icons</string>
<dict>
<key>height</key>
<integer>144</integer>
<key>name</key>
You can’t perform that action at this time.