Skip to content

Instantly share code, notes, and snippets.

View liwh's full-sized avatar
🎯
Focusing

robie lee liwh

🎯
Focusing
View GitHub Profile
jQuery
1.特点:
小巧
功能强
跨浏览器
插件
2.使用
实际是js文件
a) 复制js到WebRoot
@liwh
liwh / gist:764574
Created January 4, 2011 09:18
valid? 方法会清空errors
>> c.errors.add_on_blank('instructor','not be blank')
=> ["instructor"]
>> c.errors
=> #<ActiveRecord::Errors:0xb01f150c @errors={"instructor"=>["not be blank"]}, @base=#<Conversation id: "3e7f4481-e96b-012d-7fdc-042b2b5ce4fb", state: 10, tag: "20101214-2-00022", title: "死亡索赔", aim: 1, emergency: 1, security: 1, kind_id: 1, content: "当事人利爱琼称有29人来我厂索赔,事�...", record_id: nil, district: "440310008000", ownerdistrict: "440310008000", sub_kind_id: 199, place: "坑梓", source: 3, reportor_id: "3e7f4480-e96b-012d-7fdc-042b2b5ce4fb", reported_at: "2010-12-14 12:46:00", levels: 2, finishdate: "2011-01-27 00:00:00", advice: "请司法所处理,并将处理结果于15个工作...", remark: nil, flag: 1, creator_id: "57ec3557-c4dc-4ac8-87a6-a13ad4104686", modifier_id: "57ec3557-c4dc-4ac8-87a6-a13ad4104686", dispatched_at: "2010-12-16 18:29:35", finished_at: nil, created_at: "2010-12-14 12:47:57", updated_at: "2010-12-31 17:59:31", count: nil, grid_id: nil, building_id: nil, warndate: "2011-01-25 00:00:00", dealdistrict: "440310008000", instruct: "同意拟办意见."
@liwh
liwh / gist:764571
Created January 4, 2011 09:18
valid? 方法会清空errors
>> c.errors.add_on_blank('instructor','not be blank')
=> ["instructor"]
>> c.errors
=> #<ActiveRecord::Errors:0xb01f150c @errors={"instructor"=>["not be blank"]}, @base=#<Conversation id: "3e7f4481-e96b-012d-7fdc-042b2b5ce4fb", state: 10, tag: "20101214-2-00022", title: "死亡索赔", aim: 1, emergency: 1, security: 1, kind_id: 1, content: "当事人利爱琼称有29人来我厂索赔,事�...", record_id: nil, district: "440310008000", ownerdistrict: "440310008000", sub_kind_id: 199, place: "坑梓", source: 3, reportor_id: "3e7f4480-e96b-012d-7fdc-042b2b5ce4fb", reported_at: "2010-12-14 12:46:00", levels: 2, finishdate: "2011-01-27 00:00:00", advice: "请司法所处理,并将处理结果于15个工作...", remark: nil, flag: 1, creator_id: "57ec3557-c4dc-4ac8-87a6-a13ad4104686", modifier_id: "57ec3557-c4dc-4ac8-87a6-a13ad4104686", dispatched_at: "2010-12-16 18:29:35", finished_at: nil, created_at: "2010-12-14 12:47:57", updated_at: "2010-12-31 17:59:31", count: nil, grid_id: nil, building_id: nil, warndate: "2011-01-25 00:00:00", dealdistrict: "440310008000", instruct: "同意拟办意见."
// remove crappy contents from news.google.de
$("div.source, span.source").filter(function() { return /(BILD|WELT ONLINE)/.test( $(this).text() ) }).parent().fadeOut();
$("h2.title > a").filter(function() { return /.*(welt.de|bild.de).*/.test( $(this).attr('href') ) } ).parents("div.story").fadeOut();
可用request.query_string获取页面中传过来的所有params参数,例如:
"#{export_excel_path(:from=>'aaa')&#{request.query_string}"
@liwh
liwh / gist:743606
Created December 16, 2010 16:30
github rollback
git reset --hard <old-commit-id>
git push -f
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
[2010-12-16 20:23:45] ERROR ArgumentError: invalid byte sequence in US-ASCII
#!/bin/sh
d=`date +%Y-%m-%d`
echo $d
vim ./_posts/${d}-$1.textile
http://www.ibm.com/developerworks/cn/java/j-cb08016/
@liwh
liwh / gist:734522
Created December 9, 2010 09:20
linux vim replace command
:6,35 s/s/S/g 替换6到35行