diff --git a/capybara.md b/capybara.md index 30f9cc34..ebf59be5 100644 --- a/capybara.md +++ b/capybara.md @@ -93,3 +93,22 @@ Miscellaneous wait_until current_path +Capybara RSpec matchers +----------------------- + + expect(page).to have_button + expect(page).to have_checked_field + expect(page).to have_content '...' + expect(page).to have_css '...' + expect(page).to have_field + expect(page).to have_link + expect(page).to have_select + expect(page).to have_selector 'h1', text: 'Welcome' + expect(page).to have_table + expect(page).to have_text + expect(page).to have_unchecked_field + expect(page).to have_xpath + + expect(page).to have_selector 'h1', text: 'Welcome' + +http://rubydoc.info/github/jnicklas/capybara/Capybara/RSpecMatchers diff --git a/chef.md b/chef.md new file mode 100644 index 00000000..5de22691 --- /dev/null +++ b/chef.md @@ -0,0 +1,76 @@ + +### Install +In your server: + + $ sudo apt-get install curl + + $ curl -L https://www.opscode.com/chef/install.sh | bash + Thank you for installing Chef! + + $ chef-solo -v + ... + Chef: 11.4.0 + +### Start the cookbook + + wget http://github.com/opscode/chef-repo/tarball/master -O - | tar xzf - --strip-components=1 + +### Knife + + $ knife cookbook site download mysql + +### Invoking chef-solo + + $ chef-solo -c solo.rb -j web.json + +### Simple compile-from-source + + execute "tar --no-same-owner -zxf hi.tar.gz" do + cwd "/usr/local/src" + creates "/usr/local/src/node-v#{version}" + end + + bash "compile" do + cwd "/usr/local/src/node-v#{version}" + code %[ + PATH=/usr/local/bin:$PATH + ./configure + make + ] + creates "/usr/local/src/node-v#{version}/node" + end + +### remote file + + remote_file "/usr/local/src/hi.tar.gz" do + source "http://..." + checksum "ab83be..." + mode 0644 + action :create_if_missing + end + +### ruby_block + + ruby_block "name" do + block { File.read ... } + not_if { File.exists?(...) } + end + +### Execute + + execute "name" do + cwd "..." + environment({ "PATH" => "..." }) + command "make install" + creates "..." + end + +### Conditions + + creates "/usr/local/src/node-v#{version}/node" + not_if { File.exists?('...') } + +### References + + * http://gettingstartedwithchef.com/ + * https://github.com/mdxp/nodejs-cookbook/blob/master/recipes/install_from_source.rb diff --git a/crypto.md b/crypto.md new file mode 100644 index 00000000..30bbaf1e --- /dev/null +++ b/crypto.md @@ -0,0 +1,5 @@ + * [PBKDF2](http://en.wikipedia.org/wiki/PBKDF2) - password-based key derivation + function + + * [HMAC](http://en.wikipedia.org/wiki/HMAC) - Hash-based message authentication + code diff --git a/docker.md b/docker.md new file mode 100644 index 00000000..1eafddb6 --- /dev/null +++ b/docker.md @@ -0,0 +1,93 @@ +Command line interface +---------------------- + +Quick install on a server: + + $ curl get.docker.io | sudo sh -x + +To pull from docker's registry: + + $ docker pull "ubuntu" + +To build from your own `Dockerfile`: + + $ docker build -t "app/container_name" . + +To run: + + $ docker run "app/container_name" [command and args] + -i -t # Interactive mode + pseudo-TTY + -e ENVVAR=value # Environment vars + -p 4444 # Expose a port (??) + -d # Detached mode + + $ docker run -t "ubuntu" -i bash + +OSX Install +----------- + +Prerequisites: + + - Install Virtualbox (`brew install virtualbox`) + - Install Vagrant (http://vagrantup.com) + - Install go (`brew install go`) + +Then make the Docker executable: + + $ git clone https://github.com/dotcloud/docker.git ~/src/docker + $ cd ~/src/docker + $ make + $ mv ./bin/docker /usr/local/bin/docker + +Then run docker: + + $ cd ~/src/docker + $ vagrant up + + +Managing +-------- + +Manage images: + + # List images + $ docker images + REPOSITORY TAG ID + ubuntu 12.10 b750fe78269d + me/myapp latest 7b2431a8d968 + + # Delete an image + $ docker rmi b750fe78269d + +Manage processes: + + $ docker ps + $ docker kill $ID + $ docker rmi $ID + +Manage containers: + +Updating containers +------------------- + + $ docker commit "app/container_name" -m "Change stuff" + +More +---- + +Start a worker + + # Start a very useful long-running process + JOB=$(docker run -d ubuntu /bin/sh -c "while true; do echo Hello world; sleep 1; + done") + + # Collect the output of the job so far + docker logs $JOB + + # Kill the job + docker kill $JOB + +Resources +--------- + + * http://www.docker.io/gettingstarted/ diff --git a/minitest.md b/minitest.md index 8be88e8e..c230d52f 100644 --- a/minitest.md +++ b/minitest.md @@ -6,6 +6,11 @@ title: Minitest require 'minitest/autorun' describe "X" do + before do .. end + after do .. end + subject { .. } + let(:list) { Array.new } + it "should work" do assert true end @@ -13,17 +18,22 @@ title: Minitest ### Specs - a.must_equal b - 3.must_be_close_to 2.99999 + .must_equal b + .must_be_close_to 2.99999 + .must_be_same_as b - collection.must_include needle - collection.must_be_empty + .must_include needle + .must_be_empty .must_be_kind_of - .must_match - a.must_be :<=, 42 - obj.must_respond_to msg - a.must_be_same_as b + .must_be_instance_of + .must_be_nil + .must_match /regex/ + .must_be :<=, 42 + .must_respond_to msg + + .must_be_silent ( proc { "no stdout or stderr" }.must_be_silent) + .must_output "hi" proc { ... }.must_output out_or_nil [, err] proc { ... }.must_raise exception diff --git a/npm-package.md b/npm-package.md index 43ef0801..3c5e5d71 100644 --- a/npm-package.md +++ b/npm-package.md @@ -29,10 +29,10 @@ title: Package JSON ### Scripts - "scripts": { - "start": "node ./bin/xxx", /* npm start */ - "test": "vows --spec --isolate", /* npm test */ - } + "scripts": { + "start": "node ./bin/xxx", /* npm start */ + "test": "vows --spec --isolate", /* npm test */ + } ### Git @@ -59,4 +59,4 @@ title: Package JSON "license": "MIT" -http://package.json.nodejitsu.com/ +[Reference](http://package.json.nodejitsu.com/) (Nodejitsu.com) diff --git a/powerline.txt b/powerline.txt new file mode 100644 index 00000000..62f5dd6f --- /dev/null +++ b/powerline.txt @@ -0,0 +1,14 @@ +Powerline: +⮂ +⮀ +⮃ +⮁ +⭤ +⭡ +⭠ + + +┌─┐ +└─ +✈ +⋅ diff --git a/sinon-chai.md b/sinon-chai.md new file mode 100644 index 00000000..73211748 --- /dev/null +++ b/sinon-chai.md @@ -0,0 +1,47 @@ +### Assert + + expect(spy).called + expect(spy).calledOnce + expect(spy).calledTwice + expect(spy).calledThrice + expect(spy).calledBefore + expect(spy).calledAfter + expect(spy).calledWithNew + expect(spy).alwaysCalledWithNew + expect(spy).calledOn + expect(spy).alwaysCalledOn + expect(spy).calledWith + expect(spy).alwaysCalledWith + expect(spy).calledWithExactly + expect(spy).alwaysCalledWithExactly + expect(spy).calledWithMatch + expect(spy).alwaysCalledWithMatch + expect(spy).returned + expect(spy).alwaysReturned + expect(spy).threw + expect(spy).alwaysThrew + +### Should + + spy.should.have.been.called + spy.should.have.been.calledOnce + spy.should.have.been.calledTwice + spy.should.have.been.calledThrice + spy1.should.have.been.calledBefore(spy2) + spy1.should.have.been.calledAfter(spy2) + spy.should.have.been.calledWithNew + spy.should.always.have.been.calledWithNew + spy.should.have.been.calledOn(context) + spy.should.always.have.been.calledOn(context) + spy.should.have.been.calledWith(...args) + spy.should.always.have.been.calledWith(...args) + spy.should.always.have.been.calledWithExactly(...args) + spy.should.always.have.been.calledWithExactly(...args) + spy.should.have.been.calledWithMatch(...args) + spy.should.always.have.been.calledWithMatch(...args) + spy.should.have.returned(returnVal) + spy.should.have.always.returned(returnVal) + spy.should.have.thrown(errorObjOrErrorTypeStringOrNothing) + spy.should.have.always.thrown(errorObjOrErrorTypeStringOrNothing) + +https://github.com/domenic/sinon-chai diff --git a/tig.md b/tig.md index 3e04d332..8aa742ea 100644 --- a/tig.md +++ b/tig.md @@ -8,6 +8,10 @@ Tig shortcuts ### Invocation + tig + + tig status + tig blame FILE tig master # Show a branch tig test..master # Show difference between two bracnhes diff --git a/vagrant.md b/vagrant.md new file mode 100644 index 00000000..cf6c3486 --- /dev/null +++ b/vagrant.md @@ -0,0 +1,25 @@ +### Get started + +Add some base boxes: + + $ vagrant box add precise32 http://files.vagrantup.com/precise32.box + $ vagrant box add precise64 http://files.vagrantup.com/precise64.box + +Work it: + + $ mkdir test_box + $ cd test_box + $ vagrant init precise64 + +Run it: + + $ vagrant up + $ vagrant ssh + +To stop, use one of the following: + + $ vagrant ssh # then: sudo shutdown -h now + $ vagrant suspend + $ vagrant destroy + + diff --git a/weechat.md b/weechat.md new file mode 100644 index 00000000..38c82196 --- /dev/null +++ b/weechat.md @@ -0,0 +1,27 @@ +### Keys + +(`A-` is alt) + +### Buffers + + ^s ^u - Set unread marker on all windows + + ^p, A-left - Switch buffer left + ^n, A-right - Switch buffer right + A-a - Next buffer with activity + A-0...9 - Switch buffers + + F9/F10 - Scroll buffer title + F11/F12 - Scroll nick list + + A-w A-Left - Switch windows + A-w A-b - Balance windows + + /window splith + /window splitv + /window zoom + +### Search + + ^r - Search + Enter, ^j, ^m - Stop search diff --git a/weinre.md b/weinre.md new file mode 100644 index 00000000..c6838e12 --- /dev/null +++ b/weinre.md @@ -0,0 +1,13 @@ +Install: + + $ npm install -g weinre + +Start the server: + + $ weinre --boundHost 0.0.0.0 + $ open http://localhost:8080 + + + + +See http://people.apache.org/~pmuellr/weinre/