Skip to content

Instantly share code, notes, and snippets.

@fordguo
fordguo / html5.haml
Created May 30, 2011 14:59 — forked from fnhipster/html5.haml
HTML5 HAML Template
!!! 5
%html{ :lang => "en"}
%head
%title= "Your Website"
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
%meta{ :content => "", :name => "description" }
%meta{ :content => "", :name => "author" }
%meta{ :content => "3 days", :name => "revisit-after" }
%link{ :href => "http://creativecommons.org/licenses/by/3.0/", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" }
%link{ :href => "/feed", :rel => "alternate", :title => "Atom", :type => "application/atom+xml" }
@fordguo
fordguo / devise.zh-CN.yml
Created June 5, 2011 04:24
devise i18n for zh-CN
zh-CN:
errors:
messages:
expired: "您已过期,请重新申请"
not_found: "没有找到"
already_confirmed: "已经确认"
not_locked: "未锁定"
not_saved:
one: "因为1个错误导致此%{resource}保存失败:"
other: "因为%{count}个错误导致此%{resource}保存失败:"
@fordguo
fordguo / pool.py
Created August 26, 2011 02:31
A simple python object pool with thread safe
#-*- coding:utf-8 -*-
import Queue
from contextlib import contextmanager
class ObjectPool(object):
"""A simple object pool with thread safe"""
def __init__(self,objectFn,*args,**kwargs):
super(ObjectPool, self).__init__()
self.objectFn = objectFn
self.objectCls = None
@fordguo
fordguo / gspRender
Created May 28, 2012 15:37
gsp template render
def out = new org.codehaus.groovy.grails.web.pages.FastStringWriter()
def test1Instance = new Test1(prop2: "This is gsp test")
long startTime = System.currentTimeMillis()
def t=groovyPagesTemplateEngine.createTemplate(gspTemplateCode, 'gspTemplate')
for (int i = 0; i < TIMES; i++) {
t.make([test1Instance: test1Instance]).writeTo(out)
out.flush()
println "Executing... $i"
}
response.setContentType("text/json;charset=UTF-8")
@fordguo
fordguo / app.js
Created May 5, 2014 02:59 — forked from jgwhite/app.js
var App = Em.Application.create();
App.ApplicationController = Em.Controller.extend();
App.ApplicationView = Em.View.extend({ templateName: 'application' });
App.HomeController = Em.Controller.extend();
App.HomeView = Em.View.extend({ templateName: 'home' });
App.AuthController = Em.Controller.extend({
import ttk
import Tkinter as tk
def insert_message(columns, (user,message,time), messageid):
for col, var in zip(columns, (user,message,time) ):
col.insert("", "end", "", values=(var,), tags=(messageid))
@fordguo
fordguo / flask skeleton folder tree
Created July 11, 2018 09:40 — forked from efazati/Py Flask Skeleton
flask folders and files structure
.
├── deploy.py
├── project
│   ├── application.py
│   ├── apps
│   │   ├── articles
│   │   │   ├── forms.py
│   │   │   ├── __init__.py
│   │   │   ├── models.py
│   │   │   └── views.py