From e5bc1cd289b2af2c2adca85ade63fb12f2ecb1d7 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Mon, 18 Jan 2016 00:05:50 +0800 Subject: [PATCH] Update --- awesome-redux.md | 18 +++++++++++++++--- curl.md | 12 +++++++----- httpie.md | 7 ++++--- moment.md | 6 ++++-- 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/awesome-redux.md b/awesome-redux.md index 55722d9d8..871a27da1 100644 --- a/awesome-redux.md +++ b/awesome-redux.md @@ -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. diff --git a/curl.md b/curl.md index 021b1e592..b380fb62c 100644 --- a/curl.md +++ b/curl.md @@ -29,14 +29,16 @@ Headers: -b name=val # --cookie -b FILE # --cookie -H "X-Foo: y" # --header - + --compressed # use deflate/gzip + SSL: --cacert --capath - -E # --ecrt: Client cert file - --cert-type # der/pem/eng + -E, --ecrt # --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 diff --git a/httpie.md b/httpie.md index 56afefdaf..4bfc6f3af 100644 --- a/httpie.md +++ b/httpie.md @@ -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 diff --git a/moment.md b/moment.md index 2255ad97b..371fa4210 100644 --- a/moment.md +++ b/moment.md @@ -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/