This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# AUTHOR: Zeray Rice <fanzeyi1994@gmail.com> | |
# FILE: main.py | |
# CREATED: 01:15:37 06/04/2012 | |
# MODIFIED: 01:57:15 06/04/2012 | |
import requests | |
import datetime | |
from jinja2 import Environment, FileSystemLoader | |
from BeautifulSoup import BeautifulSoup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/PYFallbackEditor.cc | |
+++ b/src/PYFallbackEditor.cc | |
@@ -53,9 +53,9 @@ FallbackEditor::processPunctForSimplifiedChinese (guint keyval, guint keycode, g | |
// case '=': | |
// case '+': | |
case '[': | |
- commit ("【"); return TRUE; | |
+ commit ("「"); return TRUE; | |
case ']': | |
- commit ("】"); return TRUE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var count; | |
var fetching = false; | |
chrome.browserAction.onClicked.addListener(function(a) { | |
chrome.tabs.create({'url' : 'http://www.v2ex.com/notifications'}); | |
}); | |
function fetchNotify() { | |
if(!fetching) { | |
fetching = true; | |
$.get("http://www.v2ex.com/faq", function(r) { | |
count = r.match(/<title>V2EX \((.*)\)<\/title>/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PageHandler(tornado.web.RequestHandler): | |
def get(self): | |
# for method GET | |
pass | |
def post(self): | |
# for method POST | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function decode(loca) { | |
var result = [], url = ""; | |
var line, rows, extra; | |
loca = loca.trim(); | |
if(loca === "") { | |
return ""; | |
} | |
line = Number(loca[0]); | |
rows = Math.floor((loca.length - 1) / line); | |
extra = (loca.length - 1) % line; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/usr/lib/python2.6/site-packages/tornado/web.py", line 988, in _execute | |
getattr(self, self.request.method.lower())(*args, **kwargs) | |
File "/www/v2ex/galaxy/handlers/web/notifications.py", line 49, in get | |
one = self.store.find(Member, Member.notification_token == token).one() | |
File "/usr/lib/python2.6/site-packages/storm-0.19-py2.6-linux-x86_64.egg/storm/store.py", line 1145, in one | |
raise NotOneError("one() used with more than one result available") | |
NotOneError: one() used with more than one result available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local SaySapped = CreateFrame("Frame") | |
SaySapped:SetScript("OnEvent",function(_, _, _, eventType, _, _, _, _, _, _, destName, _, _, spellID) | |
if ((eventType == "SPELL_AURA_APPLIED" or eventType == "SPELL_AURA_REFRESH") and (destName == UnitName("player"))) then | |
if (spellID == 6770) then | |
SendChatMessage("<<有贼>>", "SAY") | |
elseif (spellID == 6771) then | |
SendChatMessage("<<有贼2>>", "SAY") | |
end | |
end | |
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import grequests | |
BASE_PATH = 'http://xxxxx.com/web/_photo/pic/' | |
urls = ["%d0000%s%d" % (year, '0'*(4-len(str(no))), no) for year in range(2005, 2012) for no in range(2001)] | |
rs = (grequests.get(BASE_PATH + u + '.JPG') for u in urls) | |
result = grequests.map(rs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Standard awesome library | |
require("awful") | |
require("awful.autofocus") | |
require("awful.rules") | |
-- Theme handling library | |
require("beautiful") | |
-- Notification library | |
require("naughty") | |
naughty.config.default_preset.width = 400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import calendar | |
START_YEAR = 2012 | |
END_YEAR = 2012 | |
START_MONTH = 7 | |
END_MONTH = 7 | |
cal = calendar.Calendar() | |
result = ["&year=%d&month=%d&day=%d" % (year, month, day) \ | |
for year in range(START_YEAR, END_YEAR + 1) \ |