Update lots.
This commit is contained in:
parent
7d9f263daa
commit
90dbcff3eb
|
@ -0,0 +1,77 @@
|
|||
title: Chai
|
||||
---
|
||||
|
||||
|
||||
### Assert
|
||||
|
||||
assert(val)
|
||||
assert.fail(actual, expected)
|
||||
assert.ok(val) // is truthy
|
||||
assert.equal(actual, expected) // 'compare with =='
|
||||
assert.strictEqual
|
||||
assert.deepEqual
|
||||
|
||||
assert.isTrue
|
||||
assert.isFalse
|
||||
|
||||
assert.isNull
|
||||
assert.isNotNull
|
||||
assert.isUndefined
|
||||
assert.isDefined
|
||||
assert.isFunction
|
||||
assert.isObject
|
||||
assert.isArray
|
||||
assert.isString
|
||||
assert.isNumber
|
||||
assert.isBoolean
|
||||
|
||||
assert.typeOf(/tea/, 'regexp') // Object.prototype.toString()
|
||||
assert.instanceOf(chai, Tea)
|
||||
assert.include([ a,b,c ], a)
|
||||
assert.match(val, /regexp/)
|
||||
assert.property(obj, 'tea') // 'tea' in object
|
||||
assert.deepProperty(obj, 'tea.green')
|
||||
assert.propertyVal(person, 'name', 'John')
|
||||
assert.deepPropertyVal(post, 'author.name', 'John')
|
||||
|
||||
assert.lengthOf(object, 3)
|
||||
assert.throws(function() { ... })
|
||||
assert.throws(function() { ... }, /reference error/)
|
||||
assert.doesNotThrow
|
||||
|
||||
assert.operator(1, '<', 2)
|
||||
assert.closeTo(actual, expected)
|
||||
|
||||
### Should: chains
|
||||
|
||||
.to .be .been .is .that .and .have .with .at .of .same
|
||||
|
||||
### Should not
|
||||
|
||||
expect(object).not.equal('x')
|
||||
|
||||
### Expectations
|
||||
|
||||
.equal(expected)
|
||||
.eql // deepequal
|
||||
.deep.equal(expected)
|
||||
.be.a('string')
|
||||
.include(val)
|
||||
.be.ok(val)
|
||||
.be.true
|
||||
.be.false
|
||||
.be.null
|
||||
.be.undefined
|
||||
.exist
|
||||
.be.empty
|
||||
.be.arguments
|
||||
expect(10).above(5)
|
||||
|
||||
|
||||
### References
|
||||
|
||||
* http://chaijs.com/api/assert/
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
Badges for open source projects
|
||||
|
||||
* Version badge (gems, npm): http://badge.fury.io/
|
||||
|
||||
* Dependencies (ruby): http://gemnasium.com/
|
||||
|
||||
* CI: http://travis-ci.org/
|
||||
|
||||
* Code quality (ruby): http://codeclimate.com/
|
||||
|
||||
* Test coverage: https://coveralls.io/
|
||||
|
||||
[](https://travis-ci.org/USER/REPO)
|
||||
|
||||
[](http://badge.fury.io/js/PACKAGE)
|
||||
|
||||
[](http://badge.fury.io/rb/GEM)
|
7
curl.md
7
curl.md
|
@ -16,9 +16,10 @@ Data options:
|
|||
|
||||
Headers:
|
||||
|
||||
-A <str> # --user-agent
|
||||
-b name=val # --cookie
|
||||
-b FILE # --cookie
|
||||
-A <str> # --user-agent
|
||||
-b name=val # --cookie
|
||||
-b FILE # --cookie
|
||||
-H "X-Foo: y" # --header
|
||||
|
||||
SSL:
|
||||
|
||||
|
|
12
nodejs.md
12
nodejs.md
|
@ -105,6 +105,17 @@ title: NodeJS api
|
|||
}
|
||||
});
|
||||
|
||||
## [assert]
|
||||
|
||||
assert(val)
|
||||
assert.equal(actual, expected)
|
||||
assert.notEqual(a, e)
|
||||
|
||||
assert.deepEqual(a, e)
|
||||
assert.notDeepEqual(a, e)
|
||||
|
||||
assert.throws(fn)
|
||||
|
||||
[all]: http://nodejs.org/api/all.html
|
||||
[process]: http://nodejs.org/api/process.html
|
||||
[fs]: http://nodejs.org/api/fs.html
|
||||
|
@ -114,5 +125,4 @@ title: NodeJS api
|
|||
info = require('../package.json')
|
||||
info.version
|
||||
|
||||
|
||||
process.stdout.write(util.inspect(objekt, false, Infinity, true) + '\n');
|
||||
|
|
|
@ -10,6 +10,10 @@ title: Package JSON
|
|||
"author": "Rico Sta. Cruz <hi@ricostacruz.com>",
|
||||
"version": "0.1.0",
|
||||
"engines": {"node": ">=0.8.0"},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rstacruz/___.git"
|
||||
},
|
||||
}
|
||||
|
||||
### Dependencies
|
|
@ -0,0 +1,52 @@
|
|||
title: Q.js
|
||||
----
|
||||
|
||||
### Creating promises (Q.promise)
|
||||
|
||||
Q.promise (resolve, reject) ->
|
||||
asyncFunction ->
|
||||
if error
|
||||
reject new Error("Failure")
|
||||
else
|
||||
resolve deferred
|
||||
|
||||
### Creating promises from Node
|
||||
|
||||
# Works like .call() or .apply()
|
||||
|
||||
Q.nfcall(FS.readFile, 'foo.txt', 'utf-8')
|
||||
.then -> ...
|
||||
|
||||
Q.nfapply(FS.readFile, ['foo.txt', 'utf-8'])
|
||||
.then -> ...
|
||||
|
||||
Q.npost(FS, 'readFile', ['foo.txt, 'utf-8'])
|
||||
.then -> ...
|
||||
|
||||
Q.npost(FS, 'readFile', 'foo.txt, 'utf-8')
|
||||
.then -> ...
|
||||
|
||||
readFile = Q.denodeify(FS.readFile)
|
||||
readFile('foo.txt').then -> ...
|
||||
|
||||
### Promises to Node async
|
||||
|
||||
createUser = (next) ->
|
||||
promiseMaker()
|
||||
.nodeify(next)
|
||||
|
||||
### Promise sugars
|
||||
|
||||
# Shortcut for .then(ok, fail, progress)
|
||||
promise
|
||||
.then (data) ->
|
||||
.catch (err) ->
|
||||
.progress (percent) ->
|
||||
|
||||
### Try
|
||||
|
||||
Q.try ->
|
||||
promise()
|
||||
|
||||
.catch (e) ->
|
||||
console.error "Oh well", e
|
2
sinon.md
2
sinon.md
|
@ -6,7 +6,7 @@ title: Sinon
|
|||
var fn = sinon.spy();
|
||||
fn();
|
||||
fn.calledOnce == true
|
||||
fn.calledCount == 1
|
||||
fn.callCount == 1
|
||||
|
||||
### Spy something
|
||||
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
title: Time formats
|
||||
---
|
||||
|
||||
### Ruby
|
||||
|
||||
Weekday
|
||||
%a - Sun
|
||||
%A - Sunday
|
||||
%w - 0..6 (Sunday is 0)
|
||||
Year
|
||||
%y - 13
|
||||
%Y - 2013
|
||||
Month
|
||||
%b - Jan
|
||||
%B - January
|
||||
%m - 01..12
|
||||
Day
|
||||
%d - 01..31
|
||||
%e - 1..31
|
||||
Time
|
||||
%H - Hour of the day, 24-hour clock (00..23)
|
||||
%I - Hour of the day, 12-hour clock (01..12)
|
||||
%l - Hour of the day ()
|
||||
%M - Minute of the hour (00..59)
|
||||
%p - Meridian indicator (AM or PM)
|
||||
%S - Second of the minute (00..60)
|
||||
%Z - Time zone name
|
||||
Misc
|
||||
%j - Day of the year (001..366)
|
||||
%% - Literal % character
|
||||
|
||||
### Moment.js
|
||||
|
||||
Weekday
|
||||
d - 4
|
||||
dd - Su
|
||||
ddd - Sun
|
||||
dddd - Sunday
|
||||
Year
|
||||
YY - 13
|
||||
YYYY - 2013
|
||||
Month
|
||||
M - 1..12 (Jan is 1)
|
||||
MM - 01..12 (Jan is 1)
|
||||
MMM - Jan
|
||||
MMMM - January
|
||||
Day
|
||||
D - 6..31
|
||||
DD - 06..31
|
||||
Time
|
||||
H, HH - 24 hour time
|
||||
h, hh - 12 hour time (use in conjunction with a or A)
|
||||
m, mm - Minutes
|
||||
s, ss - Seconds
|
||||
S - Deciseconds (1/10th of a second)
|
||||
SS - Centiseconds (1/100th of a second)
|
||||
SSS - Milliseconds (1/1000th of a second)
|
||||
Z, ZZ - Timezone offset as `+0700` or `+07:30`
|
||||
X - Unix timestamp
|
||||
a, A - AM/PM
|
||||
Misc
|
||||
DDD, DDDD - Day of year
|
33
travis.md
33
travis.md
|
@ -15,6 +15,7 @@ title: Travis (.travis.yml)
|
|||
|
||||
language: ruby
|
||||
rvm:
|
||||
- 2.0.0
|
||||
- 1.9.3
|
||||
- 1.8.7
|
||||
- rbx-19mode
|
||||
|
@ -36,7 +37,7 @@ title: Travis (.travis.yml)
|
|||
- "rack=master"
|
||||
- "rack=1.3.4"
|
||||
|
||||
### Custom config
|
||||
### Custom test command
|
||||
|
||||
script: make test
|
||||
before_script: make pretest
|
||||
|
@ -46,6 +47,36 @@ title: Travis (.travis.yml)
|
|||
- make pretest1
|
||||
- make pretest2
|
||||
|
||||
### Branches
|
||||
|
||||
branches:
|
||||
except:
|
||||
- legacy
|
||||
|
||||
only:
|
||||
- gh-pages
|
||||
- /^deploy/
|
||||
|
||||
### Etc
|
||||
|
||||
gemfile:
|
||||
- gemfiles/Gemfile.rails-2.3.x
|
||||
- gemfiles/Gemfile.rails-3.0.x
|
||||
|
||||
### Notifications
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- dropbox+travis@ricostacruz.com
|
||||
|
||||
email:
|
||||
recipients:
|
||||
- dropbox+travis@ricostacruz.com
|
||||
on_success: <always|never|change> # default: change
|
||||
on_failure: <always|never|change> # default: always
|
||||
|
||||
irc: "chat.freenode.net#travis"
|
||||
|
||||
### References
|
||||
|
||||
* http://about.travis-ci.org/docs/user/build-configuration/
|
||||
|
|
Loading…
Reference in New Issue