Update.
This commit is contained in:
parent
b252c4cf57
commit
171caaa7cf
19
capybara.md
19
capybara.md
|
@ -93,3 +93,22 @@ Miscellaneous
|
||||||
wait_until
|
wait_until
|
||||||
current_path
|
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
|
||||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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/
|
26
minitest.md
26
minitest.md
|
@ -6,6 +6,11 @@ title: Minitest
|
||||||
require 'minitest/autorun'
|
require 'minitest/autorun'
|
||||||
|
|
||||||
describe "X" do
|
describe "X" do
|
||||||
|
before do .. end
|
||||||
|
after do .. end
|
||||||
|
subject { .. }
|
||||||
|
let(:list) { Array.new }
|
||||||
|
|
||||||
it "should work" do
|
it "should work" do
|
||||||
assert true
|
assert true
|
||||||
end
|
end
|
||||||
|
@ -13,17 +18,22 @@ title: Minitest
|
||||||
|
|
||||||
### Specs
|
### Specs
|
||||||
|
|
||||||
a.must_equal b
|
.must_equal b
|
||||||
3.must_be_close_to 2.99999
|
.must_be_close_to 2.99999
|
||||||
|
.must_be_same_as b
|
||||||
|
|
||||||
collection.must_include needle
|
.must_include needle
|
||||||
collection.must_be_empty
|
.must_be_empty
|
||||||
|
|
||||||
.must_be_kind_of
|
.must_be_kind_of
|
||||||
.must_match
|
.must_be_instance_of
|
||||||
a.must_be :<=, 42
|
.must_be_nil
|
||||||
obj.must_respond_to msg
|
.must_match /regex/
|
||||||
a.must_be_same_as b
|
.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_output out_or_nil [, err]
|
||||||
proc { ... }.must_raise exception
|
proc { ... }.must_raise exception
|
||||||
|
|
|
@ -29,10 +29,10 @@ title: Package JSON
|
||||||
|
|
||||||
### Scripts
|
### Scripts
|
||||||
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./bin/xxx", /* npm start */
|
"start": "node ./bin/xxx", /* npm start */
|
||||||
"test": "vows --spec --isolate", /* npm test */
|
"test": "vows --spec --isolate", /* npm test */
|
||||||
}
|
}
|
||||||
|
|
||||||
### Git
|
### Git
|
||||||
|
|
||||||
|
@ -59,4 +59,4 @@ title: Package JSON
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
|
|
||||||
|
|
||||||
http://package.json.nodejitsu.com/
|
[Reference](http://package.json.nodejitsu.com/) (Nodejitsu.com)
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
Powerline:
|
||||||
|
⮂
|
||||||
|
⮀
|
||||||
|
⮃
|
||||||
|
⮁
|
||||||
|
⭤
|
||||||
|
⭡
|
||||||
|
⭠
|
||||||
|
|
||||||
|
|
||||||
|
┌─┐
|
||||||
|
└─
|
||||||
|
✈
|
||||||
|
⋅
|
|
@ -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
|
4
tig.md
4
tig.md
|
@ -8,6 +8,10 @@ Tig shortcuts
|
||||||
|
|
||||||
### Invocation
|
### Invocation
|
||||||
|
|
||||||
|
tig
|
||||||
|
|
||||||
|
tig status
|
||||||
|
|
||||||
tig blame FILE
|
tig blame FILE
|
||||||
tig master # Show a branch
|
tig master # Show a branch
|
||||||
tig test..master # Show difference between two bracnhes
|
tig test..master # Show difference between two bracnhes
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue