09 2016 档案

摘要:--新建表: -- 阅读全文
posted @ 2016-09-28 20:33 盖瑞 阅读(290) 评论(0) 推荐(0) 编辑
摘要:--遍历数组 --hash数组 阅读全文
posted @ 2016-09-23 15:15 盖瑞 阅读(101) 评论(0) 推荐(0) 编辑
摘要:--将hash作为js方法 阅读全文
posted @ 2016-09-23 14:20 盖瑞 阅读(93) 评论(0) 推荐(0) 编辑
摘要:--判断string是否为空 阅读全文
posted @ 2016-09-23 13:55 盖瑞 阅读(136) 评论(0) 推荐(0) 编辑
摘要:--实例: 阅读全文
posted @ 2016-09-23 12:58 盖瑞 阅读(125) 评论(0) 推荐(0) 编辑
摘要:--用处:SEO,让别人订阅你的文章 阅读全文
posted @ 2016-09-21 17:49 盖瑞 阅读(101) 评论(0) 推荐(0) 编辑
摘要:--使用: (1)layout中使用<%=yield(:js)%> (2)html中使用<% content_for :js do %>[XXX]<% end %> 阅读全文
posted @ 2016-09-21 17:29 盖瑞 阅读(255) 评论(0) 推荐(0) 编辑
摘要:--使用: 阅读全文
posted @ 2016-09-21 17:29 盖瑞 阅读(112) 评论(0) 推荐(0) 编辑
摘要:--后面连接其它数组:[ARRAY].concat([OTHER ARRAY]) --排序:sort,进阶:sort_by{|obj| obj.[VALUE]} --随机获取:[ARRAY].sample([NUM]) 阅读全文
posted @ 2016-09-21 09:57 盖瑞 阅读(86) 评论(0) 推荐(0) 编辑
摘要:select city, statefrom state_county_citywhere city in (select city from state_county_city group by city having count(1) >= 2) 阅读全文
posted @ 2016-09-20 14:17 盖瑞 阅读(210) 评论(0) 推荐(0) 编辑
摘要:1. 解析CSV: (1)读取文件:csv = CSV.read("#{Rails.root}/public/data/statecountycity.csv", :headers => true, :header_converters => lambda{|h| h.strip}) (2)遍历:c 阅读全文
posted @ 2016-09-20 13:07 盖瑞 阅读(159) 评论(0) 推荐(0) 编辑
摘要:--全部转为小写:[STR].downcase --全部转为大写:[STR].upcase --仅仅首字母为大写:[STR].capitalize --每个单词首字母为大写:[STR].titleize 【注】titleize也可以将‘_’和‘-’转为空格 --去除前后空格:[STR].strip 阅读全文
posted @ 2016-09-19 10:17 盖瑞 阅读(96) 评论(0) 推荐(0) 编辑
摘要:-- 从远程分支新建分支并checkout:git checkout origin/[ORIGIN BRAHCH NAME] -b [NEW BRAHCH NAME] -- 跟踪分支: (1) 查看跟踪分支:git branch -vv (2) 设置跟踪分支:git branch --set-ups 阅读全文
posted @ 2016-09-19 09:20 盖瑞 阅读(93) 评论(0) 推荐(0) 编辑