Version: 1.9.7
Platform: x86_64
First, install or update to the latest system software.
sudo apt-get update
名称 : crontab | |
使用权限 : 所有使用者 | |
使用方式 : | |
crontab file [-u user]-用指定的文件替代目前的crontab。 | |
crontab-[-u user]-用标准输入替代目前的crontab. | |
crontab-1[user]-列出用户目前的crontab. | |
crontab-e[user]-编辑用户目前的crontab. | |
crontab-d[user]-删除用户目前的crontab. | |
crontab-c dir- 指定crontab的目录。 | |
crontab文件的格式:M H D m d cmd. |
# Chinese (China) translations for Devise(3.2.2) | |
# by Kenrick-Zhou (https://github.com/Kenrick-Zhou) | |
# https://gist.github.com/Kenrick-Zhou/7909822 | |
zh-CN: | |
devise: | |
confirmations: | |
confirmed: "您的帐号已经确认,您现在已登录。" | |
send_instructions: "几分钟后,您将收到确认帐号的电子邮件。" | |
send_paranoid_instructions: "如果您的邮箱存在于我们的数据库中,您将收到一封确认账号的邮件。" |
As configured in my dotfiles.
start new:
tmux
start new with session name:
# username = "my_username" | |
# pwd = "my_password" | |
# target_path = "my_target_path" | |
# saving auth cookie | |
system %Q{wget --save-cookies /tmp/cookie.txt --keep-session-cookies --post-data "username=#{username}&password=#{pwd}" -O - \ | |
https://rubytapas.dpdcart.com/subscriber/login?__dpd_cart=d08391e6-5fe2-4400-8b27-2dc17b413027} | |
(25..600).each do |i| |
#Model | |
@user.should have(2).children # check assosiation | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
expect { @user.save }.to change { User.count }.by(1) # or from(1).to(2) | |
expect { @user.save! }.to raise_error(ActivieRecord::RecordInvalid) | |
#More matchers | |
@person.should respond_to(:child?) |
require 'feedzirra' | |
# fetching a single feed | |
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing") | |
# feed and entries accessors | |
feed.title # => "Paul Dix Explains Nothing" | |
feed.url # => "http://www.pauldix.net" | |
feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing" | |
feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0" |
In researching topics for RailsCasts I often read code in Rails and other gems. This is a great exercise to do. Not only will you pick up some coding tips, but it can help you better understand what makes code readable.
A common practice to organize code in gems is to divide it into modules. When this is done extensively I find it becomes very difficult to read. Before I explain further, a quick detour on instance_eval
.
You can find instance_eval
used in many DSLs: from routes to state machines. Here's an example from Thinking Sphinx.
class Article < ActiveRecord::Base