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 collections | |
import errno | |
import re | |
from hashlib import md5, sha1 | |
import base64 | |
from base64 import b64encode, b64decode | |
import socket | |
import struct | |
import logging |
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
#!/usr/bin/env python | |
#-*- coding:utf-8 -*- | |
from Queue import Queue | |
# --------------------- | |
# Corotine Task Manager | |
# --------------------- |
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
CFLAGS=-fextended-identifiers -std=c99 | |
objects=chinese.ucn.o | |
target=chinese | |
.PHONY: all clean | |
all: $(target) | |
$(target): $(objects) | |
$(CC) $< -o $@ |
# This example does an AJAX lookup and is in CoffeeScript
$('.typeahead').typeahead(
# source can be a function
source: (typeahead, query) ->
# this function receives the typeahead object and the query string
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
" VIM配置文件 | |
" 设置语言及编码 | |
source $VIMRUNTIME/delmenu.vim | |
source $VIMRUNTIME/menu.vim | |
set enc=utf-8 | |
" set fencs=utf-8,ucs-bom,gbk,gb18030,shift-jis,gb2312,cp936 | |
" 常规设置 | |
set nocompatible " 关闭vi兼容模式 |
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
#!/usr/bin/env python | |
import os | |
import random | |
import time | |
import platform | |
snowflakes = {} | |
try: | |
# Windows Support |
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 <[email protected]> | |
import urllib | |
import logging | |
import tornado.auth | |
from tornado import escape | |
from tornado import httpclient |
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
@start: #9bce4c; @end: #6f9f27; | |
.button-gradient (@start, @end); | |
&:hover { | |
.button-gradient (darken(@start, 2%), darken(@end, 2%)); | |
} | |
&:active { | |
.button-gradient (darken(@end, 2%), darken(@start, 2%)); | |
} |
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 simple trick against CSRF for web.py (webpy.org) | |
* At the GET() template, you add a hidden field called csrf_token with value "$csrf_token()" | |
* The POST() should have the @csrf_protected decorator | |
That's it. | |
Request for comments: | |
* Is this secure? Can you see any holes? | |
* Is there anything in [or for] web.py that does this? Am I reinvevting the wheel here? |