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:
before_save :encrypt_note | |
def encrypt_note | |
salt = SecureRandom.random_bytes(64) | |
key = encrypt_key || ActiveSupport::KeyGenerator.new(ENV["SECRET_KEY"]).generate_key(salt) | |
crypt = ActiveSupport::MessageEncryptor.new(key) | |
%w(client_note food medicines hydration md_appointments activity mood positive_thinking positive_action listener_note).each_with_index do |att| | |
val = if !new_record? and send("#{att}_changed?") | |
read_attribute(att.to_sym) |
** devise ** | |
https://github.com/plataformatec/devise | |
rails generate devise:install | |
rails generate devise MODEL | |
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } | |
before_action :authenticate_user! | |
rails generate devise:views users | |
rails generate devise:controllers [scope] |
# 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| |
scope :trending, -> { |num = nil| where('started_trending > ?', 1.days.ago).
order('mentions desc').
limit(num) }
@tweets = current_user.tweets.unscoped.order(:status).limit(10)
#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?) |