Skip to content

Instantly share code, notes, and snippets.

// together:
const asyncEnhancer = // depends on your middleware and how you inject dependencies
const store = createStore(reducer, undefined, asyncEnhancer);
store.dispatch(myAsyncAction()).then(() => {
expect(mySelector(store.getState())).toEqual('foo');
});
// or separate:
describe('async action', () => {
it('dispatches action1 and action2', () => {
@c089
c089 / gist:ed08d81993f42d2f56bf
Last active April 24, 2016 10:25
beating impurity in redux applications using dependency injection
/* First, since our reducers need to be free of side-effects, we move them to an
action creator. Note the double arrow function: The outer function is only there
dependency injection. It's a function that creates an action creator, but I
don't really want to call it an action creator creator ;) */
const impureActionCreator = (idGenerator) => () => ({type: 'FOO_ACTION', id: randomSource.randomId()});
// Our reducer will now stay free of side effects, and we already have `action.id` when it's called
const reducer = (state, action) => // ...
// we can unit test our action creator by injecting a pure stub
200 aber kein payload (das ist das studienführer pdf) http://db.uni-leipzig.de/studieren/downloadfile.php?abschluss_id=10425
404 (das ist der bioinf-master im menü): http://www.informatik.uni-leipzig.de/ifi/studium/studiengnge/ma-bioinf.html
links auf beide urls sind auf: http://www.informatik.uni-leipzig.de/ifi/studium.html

extension interface for the rendr apiProxy / dataAdapter

Currently, when custom behavior for the apiProxy is required, users have to copy the whole apiProxy to make custom changes. While some custom behavior can be placed in the dataAdapter, this does not allow more complex things, which is why we proposed adding cookie handling to the core apiProxy where it does not belong (see #232). This proposal tries to make both the apiProxy and dataAdapter extensible using small, reusable modules. Once rendr supports configuring different data adapters per configured API, this will allow to enable a extension module for all configured APIs by setting it on the ApiProxy or just a specific API by setting it on a DataAdapter.

This would require two extension points: One before the DataAdapter is used to make the request and one when it receives the response. We propose implementing this using two events which will be emitted by both the apiProxy and the dataAdapter(s):

  • one event sent before issuing the
@c089
c089 / gist:6353580
Created August 27, 2013 13:34
npm install buster-server-cli
$ npm install buster-server-cli
npm http GET https://registry.npmjs.org/buster-server-cli
npm http 304 https://registry.npmjs.org/buster-server-cli
npm http GET https://registry.npmjs.org/platform
npm http GET https://registry.npmjs.org/ramp-resources
npm http GET https://registry.npmjs.org/paperboy
npm http GET https://registry.npmjs.org/ejs
npm http GET https://registry.npmjs.org/phantom
npm http GET https://registry.npmjs.org/ramp
npm http GET https://registry.npmjs.org/buster-cli
@c089
c089 / StubSpec.js
Created May 7, 2013 14:36
buster.js failing stubs since sinon 1.7 release
buster.spec.expose();
describe('stubbing', function () {
it('should stub', function () {
var stub = this.stub().returns(1);
expect(stub()).toBe(1);
});
});
@c089
c089 / brew install bitlbee
Last active December 14, 2015 21:19
homebrew issue 18450
==> Installing bitlbee dependency: gnutls
rm /usr/local/bin/srptool
rm /usr/local/bin/psktool
rm /usr/local/bin/p11tool
rm /usr/local/bin/ocsptool
rm /usr/local/bin/gnutls-serv
rm /usr/local/bin/gnutls-cli-debug
rm /usr/local/bin/gnutls-cli
rm /usr/local/bin/gnutls-certtool
rm /usr/local/bin/danetool
function determineRubyCommandToUse(done) {
// check to see if native ruby is available, call back with executable name to use
child_process.exec('ruby -v', function (error) {
if (error) {
done('java -jar lib/jruby.jar');
}
done('ruby');
});
}
npm ERR! fetch failed https://github.com/cujojs/when/tarball/1.3.0
npm ERR! Error: 404 Not Found
npm ERR! at null.<anonymous> (/usr/lib/nodejs/npm/lib/utils/fetch.js:47:16)
npm ERR! at EventEmitter.emit (events.js:126:20)
npm ERR! at WriteStream.flush (fs.js:1529:12)
npm ERR! at fs.close (/usr/lib/nodejs/npm/node_modules/graceful-fs/graceful-fs.js:90:5)
npm ERR! at Object.oncomplete (fs.js:297:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.initConfig({
jshint: {
options: {
onevar: true
},
files: [ 'wtf.js' ]
}
});