short url: caseywatts.com/selfpublish
my book is out! an applied psychology / self-help book targeted at developers: Debugging Your Brain
Markdown --> PDF (as a booklet!)
Markdown --> EPUB and MOBI
short url: caseywatts.com/selfpublish
my book is out! an applied psychology / self-help book targeted at developers: Debugging Your Brain
Markdown --> PDF (as a booklet!)
Markdown --> EPUB and MOBI
#Comprehensive Introduction to @ngrx/store By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
| // using ES6 Proxy to deal with methods of Promise'd objects. works for me in Edge though not Chrome somehow. | |
| let handler = { | |
| get: (target, prop) => function() { | |
| if(target instanceof Promise) { | |
| let args = arguments; | |
| return target.then((o) => o[prop].apply(o, args)); | |
| } else { | |
| let value = target[prop]; | |
| return typeof value == 'function' ? value.bind(target) : value; | |
| } |
| // Typical AMD factory that returns a value, but uses an r-value (sync) require(), | |
| // rather than a long, awkward dependency list. | |
| // You cannot use module.exports or exports to declare the module: | |
| (function (define){ | |
| define(function (require) { | |
| "use strict"; | |
| var mod = require('pkb/modA'); | |
| return { |
| "use strict"; | |
| // `f` is assumed to sporadically fail with `TemporaryNetworkError` instances. | |
| // If one of those happens, we want to retry until it doesn't. | |
| // If `f` fails with something else, then we should re-throw: we don't know how to handle that, and it's a | |
| // sign something went wrong. Since `f` is a good promise-returning function, it only ever fulfills or rejects; | |
| // it has no synchronous behavior (e.g. throwing). | |
| function dontGiveUp(f) { | |
| return f().then( | |
| undefined, // pass through success |
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |