Skip to content

Instantly share code, notes, and snippets.

随着model的扩大,肯定需要用namespace来对model进行分类管理,无论是出于对文件夹的优化管理,还是将来对系统的重构、拆解。

例如,对于班级布置和学生布置,就统一放到了assignment这个namespace中,这样,在i18n时,就需要注意,namespace与model之间不是用层级,而是用'/'来分开:

assignment/klass_assignment:
  date_range: 有效期

而不是

@creeek
creeek / using_resque-scheduler.md
Created September 14, 2014 11:21
resque-scheduler

若需要执行定时/定期任务,需要添加 resque-scheduler

  • 路由设置 routes.rb
  require 'resque/server'
  require 'resque_scheduler/server'
  class ActionDispatch::Routing::Mapper
@creeek
creeek / using_jQuery_filter.md
Last active August 29, 2015 14:06
使用JQuery filter方法

样例如下

  1. 筛选出满足条件的 jQuery 对象集合
  2. 使用 filter 进行过滤
@$body.find(':text,:password,textarea,select').filter(':visible:first').focus()
@creeek
creeek / VibrantInk.itermcolors
Created September 4, 2014 03:22
iTerm colors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.52941176470588236</real>
<key>Green Component</key>
<real>0.52941176470588236</real>
@creeek
creeek / my.gitconfig
Created September 4, 2014 03:07
Git config
[user]
name = creeek
email = [email protected]
[color]
status = auto
branch = auto
diff = auto
ui = true
pager = true
[color "branch"]
@creeek
creeek / my.bash_login
Created September 4, 2014 03:02
bash settings
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
##
# Your previous /Users/user/.bash_login file was backed up as /Users/user/.bash_login.macports-saved_2012-04-19_at_19:56:02
##
# MacPorts Installer addition on 2012-04-19_at_19:56:02: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
@creeek
creeek / sjl.vimrc
Created September 2, 2014 05:57
vimrc
" .vimrc
" Author: Steve Losh <[email protected]>
" Source: http://bitbucket.org/sjl/dotfiles/src/tip/vim/
"
" This file changes a lot. I'll try to document pieces of it whenever I have
" a few minutes to kill.
" Preamble ---------------------------------------------------------------- {{{
" Dear /bin/bash: fuck you and your bullshit, arcane command-line behaviour.
@creeek
creeek / atom.config.cson
Last active August 29, 2015 14:05
Atom config file
'exception-reporting':
'userId': 'xxxxxxxx'
'welcome':
'showOnStartup': false
'metrics':
'userId': 'xxxxxxxx'
'editor':
'fontSize': 16
'fontFamily': 'YaHei Consolas Hybrid'
'preferredLineLength': 80
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mi>a</mi><mo>=</mo><msup><mn>5</mn><mrow><msub><mi>log</mi><mn>2</mn></msub><mn>3</mn><mo>.</mo><mn>4</mn></mrow></msup>
</math>
@creeek
creeek / Preferences.sublime-settings
Last active August 29, 2015 14:01
Sublime Text 3 settings
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"draw_minimap_border": false,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
".DS_Store",
".tags*",