Passing parameters to a shared example group

shared_examples_for "a measurable object" do |measurement, measurement_methods| measurement_methods.each do |measurement_method| it "should return #{measurement} from ##{measurement_method}" do subject.send(measurement_method).should == measurement end end end

wc命令

wc命令用来打印文件的文本行数、单词数、字节数等(print the number of newlines, words, and bytes in files) 格式:wc -l 打印指定文件的文本行数。(l=小写L) 参数:-c, –bytes 打印字节数(print the byte counts) 参数:-m, –chars 打印字符数(print the character counts) 参数:-l, –lines 打印行数(print the newline counts) 参数:-w, –words 打印单词数(print the word counts)

memcached 启动参数

启动参数 -p memcached监听的TCP端口 -l 监听的ip地址 -d 以daemon方式运行,将程序放入后台 -u memcached的运行用户 -P memcached的pid文件路径 -m memcached可以使用的最大内存数量 -c memcached同时可以接受的最大的连接数 如果你希望以socket方式来访问memcached,那么在启动的时候就必须去掉 -l和-p参数,并加上-s参数:

Aliasing “it_should_behave_like” to “it_has_behavior”

RSpec.configure do |c| c.alias_it_should_behave_like_to :it_has_behavior, ‘has behavior:’ end   shared_examples_for ‘sortability’ do it ‘responds to <=>’ do sortable.should respond_to(:<=>) end end   describe String do it_has_behavior ‘sortability’ do let(:sortable) { ‘sample string’ } end end

Mock Receive Counts

my_mock.should_receive(:sym).once my_mock.should_receive(:sym).twice my_mock.should_receive(:sym).exactly(n).times my_mock.should_receive(:sym).at_least(:once) my_mock.should_receive(:sym).at_least(:twice) my_mock.should_receive(:sym).at_least(n).times my_mock.should_receive(:sym).at_most(:once) my_mock.should_receive(:sym).at_most(:twice) my_mock.should_receive(:sym).at_most(n).times my_mock.should_receive(:sym).any_number_of_times

ubuntu 映射远程目录

sshfs 用户名@远程服务器名:远程目录 映射至本地的目录

vim 快捷键

光标控制命令 命令 光标移动 h或^h 向左移一个字符 j或^j或^n 向下移一行 k或^p 向上移一行 l或空格 向右移一个字符 G 移到文件的最后一行 nG 移到文件的第n行 w 移到下一个字的开头 W 移到下一个字的开头,忽略标点符号 b 移到前一个字的开头 B 移到前一个字的开头,忽略标点符号

git fetch origin

可以运行 git fetch origin 来同步远程服务器上的数据到本地。 那么用 git pull 不是也可以吗?区别是啥?

git 与 subversion分支

subversion合并分支消耗太大。然而在 Git 中,一天之内建立、使用、合并再删除多个分支是常见的事。

nginx 405 Not Allowed

nginx 405 Not Allowed 这个错误的原因是:Apache、IIS、Nginx等绝大多数web服务器,都不允许静态文件响应POST请求,否则会返回“HTTP/1.1 405 Method not allowed”错误。

Powered by WordPress | Find Wireless Deals at BestInCellPhones.com. | Thanks to iCellPhoneDeals.com Free Cell Phones, Find Highest CD Rates and Incinerador De Grasa Revisión