This commit is contained in:
Rico Sta. Cruz 2016-01-18 00:05:50 +08:00
parent 6e2a22b82b
commit e5bc1cd289
4 changed files with 30 additions and 13 deletions

View File

@ -16,15 +16,13 @@ increment(err) === { type: 'INCREMENT', payload: err, error: true }
```
### [flux-standard-action](https://github.com/acdlite/flux-standard-action)
A standard for flux action objects.
A standard for flux action objects. An action may have an `error`, `payload` and `meta` and nothing else.
```
{ type: 'ADD_TODO', payload: { text: 'Work it' } }
{ type: 'ADD_TODO', payload: new Error(), error: true }
```
An action may have an `error`, `payload` and `meta` and nothing else.
### [redux-promise](https://github.com/acdlite/redux-promise)
Pass promises to actions. Dispatches a flux-standard-action.
@ -33,6 +31,20 @@ increment = createAction('INCREMENT') // redux-actions
increment(Promise.resolve(42))
```
### [redux-promises](https://www.npmjs.com/package/redux-promises)
Sorta like that, too. Works by letting you pass *thunks* (functions) to `dispatch()`. Also has 'idle checking'.
```js
fetchData = (url) => (dispatch) => {
dispatch({ type: 'FETCH_REQUEST' })
fetch(url)
.then((data) => dispatch({ type: 'FETCH_DONE', data })
.catch((error) => dispatch({ type: 'FETCH_ERROR', error })
})
store.dispatch(fetchData('http://google.com'))
```
### [redux-effects](https://www.npmjs.com/package/redux-effects)
Pass side effects declaratively to keep your actions pure.

12
curl.md
View File

@ -29,14 +29,16 @@ Headers:
-b name=val # --cookie
-b FILE # --cookie
-H "X-Foo: y" # --header
--compressed # use deflate/gzip
SSL:
--cacert <file>
--capath <dir>
-E <cert> # --ecrt: Client cert file
--cert-type # der/pem/eng
-E, --ecrt <cert> # --ecrt: Client cert file
--cert-type # der/pem/eng
-k, --insecure # for self-signed certs
## Examples
@ -45,6 +47,6 @@ SSL:
# Auth/data:
curl -u user:pass -d status="Hello" http://twitter.com/statuses/update.xml
# multipart file upload
curl -v -include --form key1=value1 --form upload=@localfilename URL
curl -v -include --form key1=value1 --form upload=@localfilename URL

View File

@ -20,7 +20,7 @@ category: CLI
### Options
--pretty=none # all,colors,format
--pretty=none # all,colors,format
--print=HBhb
# H : request headers
@ -28,7 +28,9 @@ category: CLI
# h : response headers
# b : response body
--output FILE (or -o)
-v, --verbose # same as --print=HhBb
-o, --output FILE
--follow
--timeout SECONDS
@ -43,7 +45,6 @@ category: CLI
--proxy http:http://foo.bar:3128
### References
* https://github.com/jakubroztocil/httpie

View File

@ -21,8 +21,8 @@ category: JavaScript libraries
### Add
.add('days', 1)
.subtract('days', 1)
.add(1, 'day')
.subtract(2, 'days')
.startOf('day')
.endOf('day')
@ -39,6 +39,8 @@ category: JavaScript libraries
.format('LLLL') // Monday, June 9 2014 9:32 PM
.format('llll') // Mon, Jun 9 2014 9:32 PM
See [datetime](datetime.html) for more.
### Reference
* http://momentjs.com/