Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Jul 16, 2015
1 parent ee7f668 commit a57d0ea
Show file tree
Hide file tree
Showing 9 changed files with 277 additions and 50 deletions.
61 changes: 61 additions & 0 deletions awscli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: AWS CLI
---

### EC2

```
aws ec2 describe-instances
aws ec2 start-instances --instance-ids i-12345678c
```

### S3

```
aws s3 ls s3://mybucket
aws s3 cp myfolder s3://mybucket/folder --recursive
aws s3 sync myfolder s3://mybucket/folder --exclude *.tmp
```

### ECS

```
aws ecs create-cluster
--cluster-name=NAME
--generate-cli-skeleton
aws ecs create-service
```

### Homebrew

```
brew install awscli
aws configure
```

## Elastic Beanstalk

### Configuration

* .elasticbeanstalk/config.yml - application config
* .elasticbeanstalk/dev-env.env.yml - environment config

```
eb config
```

See: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html

## ebextensions

* see <http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html>
* see <http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html>

----

See:

* [AWS CLI](https://aws.amazon.com/cli/)
* [Documentation](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)
* [All commands](http://docs.aws.amazon.com/cli/latest/reference/#available-services)
11 changes: 11 additions & 0 deletions capybara.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,16 @@ expect(page).to have_unchecked_field
expect(page).to have_xpath
```

## Page object

```rb
page.status_code == 200
page.response_headers
```

- <http://www.rubydoc.info/github/jnicklas/capybara/master/Capybara/Session>

## See also

- <http://rubydoc.info/github/jnicklas/capybara/Capybara/RSpecMatchers>
- <http://www.rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Matchers>
17 changes: 17 additions & 0 deletions eslint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: eslint
---

```js
// "comma-dangle": "always" ("always-multiline", "never")
var foo = {
bar: "baz",
qux: "quux",
};
var arr = [1,2,];
```

```
// "yoda": "always" ("never")
if ("red" === color)
```
28 changes: 21 additions & 7 deletions expectjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,37 @@ expect(x).toBe(y)
.toBe(val)
.toEqual(val)
.toThrow(err)
.toExist
.toExist /* aka: toBeTruthy */
.toNotExist /* aka: toBeFalsy */
.toBeA(constructor)
.toBeA('string')
.toMatch(/expr/)
.toBeLessThan(n)
.toBeGreaterThan(n)
.toInclude(val)
.toInclude(val) /* aka: toContain */
.toExclude(val)

/* also: toNotBe, toNotEqual, etc */
```

### Spies

```js
spy = expect.spyOn(video, 'play')
expect(spy.calls.length).toEqual(1);
expect(spy.calls[0].context).toBe(video);
expect(spy.calls[0].arguments).toEqual([ 'some', 'args' ]);
expect(spy).toHaveBeenCalled();
expect(spy).toHaveBeenCalledWith('some', 'args');

spy = expect.spyOn(...)
.andCallThrough() /* pass through */
.andCall(fn)
.andThrow(exception)
.andReturn(value)

expect(spy.calls.length).toEqual(1)
expect(spy.calls[0].context).toBe(video)
expect(spy.calls[0].arguments).toEqual([ 'some', 'args' ])
expect(spy.getLastCall().arguments).toEqual(...)

expect(spy).toHaveBeenCalled()
expect(spy).toHaveBeenCalledWith('some', 'args')
```

https://www.npmjs.com/package/expect
21 changes: 21 additions & 0 deletions metalsmith.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Metalsmith
---

### [metalsmith-templates](https://www.npmjs.com/package/metalsmith-templates)

```js
"plugins": {
"metalsmith-templates": {
"engine": "swig",
"directory": "_layouts"
}
}
```

Use `{{ contents }}` to bring it out

Engines:

* swig (like liquid)

21 changes: 13 additions & 8 deletions mocha-html.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@ This is a mocha template that loads js/css from cdn.
<!doctype html>
<html>
<head>
<meta charset='utf-8'>
<title>Mocha</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css" rel="stylesheet" />
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<link href='https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.css' rel='stylesheet' />
</head>
<body>
<div id="mocha"></div>
<script src="https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.js"></script>
<script src="https://cdn.rawgit.com/chaijs/chai/2.3.0/chai.js"></script>
<script>mocha.setup('bdd')</script
<script src="tests.js"></script><!-- replace this -->
<div id='mocha'></div>
<script src='https://cdn.rawgit.com/mochajs/mocha/2.2.5/mocha.js'></script>
<script src='https://cdn.rawgit.com/chaijs/chai/2.3.0/chai.js'></script>
<script>window.onerror=function(msg,url,line){document.getElementById('mocha').innerHTML+='<h1>'+msg+'</'+'h1>'+'<h2>'+url+':'+line+'</'+'h2>';return false}</script>
<script>mocha.setup('bdd')</script>
<!-- what to test: -->
<script src='../index.js'></script>
<!-- tests to run: -->
<script src='first_test.js'></script>
<script src='second_test.js'></script>
<script>mocha.run()</script>
</body>
</html>
Expand Down
45 changes: 10 additions & 35 deletions rspec.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,45 +97,20 @@ expect { thing.approve! }.to change(thing, :status).
expect { thing.destroy }.to change(Thing, :count).by(-1)
```

### Mocking - basic
### Double

book.stub(:title) { "The RSpec Book" }
book.stub(:title => "The RSpec Book")
book.stub(:title).and_return("The RSpec Book")

# First arg is a name, it's optional
book = double("book", :title => "The RSpec Book")

### Mocking - consecutive return values
```rb
book = double('book')
book = instance_double('Book', pages: 250)
```

die.stub(:roll).and_return(1,2,3)
die.roll # => 1
die.roll # => 2
die.roll # => 3
die.roll # => 3
die.roll # => 3
### Method stubs

### Expectations
```rb
allow(die).to receive(:roll) { 3 }
```

expect(double).to receive(:msg)
expect(double).to receive(:msg).with(no_args())
expect(double).to receive(:msg).with(any_args())
expect(double).to receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can any kind of Numeric
expect(double).to receive(:msg).with(1, boolean(), "b") #2nd argument can true or false
expect(double).to receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
expect(double).to receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
expect(double).to receive(:msg).with(1, ducktype(:abs, :div), "b") #2nd argument can be object that responds to #abs and #div

expect(double).to receive(:msg).once
expect(double).to receive(:msg).twice
expect(double).to receive(:msg).exactly(n).times
expect(double).to receive(:msg).at_least(:once)
expect(double).to receive(:msg).at_least(:twice)
expect(double).to receive(:msg).at_least(n).times
expect(double).to receive(:msg).at_most(:once)
expect(double).to receive(:msg).at_most(:twice)
expect(double).to receive(:msg).at_most(n).times
expect(double).to receive(:msg).any_number_of_times
https://relishapp.com/rspec/rspec-mocks/docs

## Subjects

Expand Down
38 changes: 38 additions & 0 deletions saucelabs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Sign up for opensauce

- http://saucelabs.com/opensauce

Install zuul

```
npm i -g zuul
```

Configure zuul

```yml
# ~/.zuulrc
sauce_username: me
sauce_key: abc12348-e3e2-...
```
Add .zuul.yml to your project
```yml
# .zuul.yml
ui: mocha-bdd
browsers:
- name: chrome
version: latest
- name: ie
version: 6..latest
- name: firefox
version: latest
```
Try to run tests
```
zuul test/test.js
zuul --local test/test.js
```
85 changes: 85 additions & 0 deletions slim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: Slim
---

```slim
doctype html
html
head
title Slim Examples
meta[charset='utf-8']
meta(name="keywords" content="template language")
meta name="author" content=author
meta property='og:image' content=asset_url('foo.png')
meta property='og:image' content=(path_to_user user)
meta(
property='description'
content='this is the song that never ends')
```

### Ruby attributes

```slim
a class=[:menu,:highlight]
.card *{'data-url' => place_path(place)}
```

### Inline ruby

```slim
ruby:
def foobar
"hello"
end
div= foobar
```

### Embedded js

```slim
javascript:
alert('Slim supports embedded javascript!')
```

### Comments

```slim
/ Comment
/! HTML comment
```

### Ruby

```slim
== yield
= t('.hello')
- 3.times do |i|
div
```

### Verbatim text

```slim
div
| This is text
it is nice
```

### Inline HTML

```slim
<div class='foo'>
- if articles.empty?
| Nothing here
</div>
```

### Inline tags

```slim
ul
li: a(href='/') Home
```

<http://slim-lang.com/>

0 comments on commit a57d0ea

Please sign in to comment.