$q.all([ promise1, promise2 ]).then($q.spread(function (promise1Result, promise2Result) {
});
import Flummox from 'flummox'; | |
import { Map } from 'immutable'; | |
// Instead of a constructor, just wrap flux creation inside a function | |
export default function createFlux() { | |
const flux = new Flummox(); | |
// Actions are the same. Just pass an object instead of a class. | |
const thingActions = flux.createActions('things', { | |
incrementSomething(amount) { |
import {Component} from 'react' | |
import shallowEqual from 'react/lib/shallowEqual' | |
export function observe(ComposedComponent) { | |
if (!ComposedComponent.observe) { | |
return ComposedComponent | |
} | |
Object.defineProperty(ComposedComponent.prototype, 'data', { |
{ | |
"parser": "babel-eslint", | |
"env": { | |
"es6": true, | |
"mocha": true, | |
"node": true | |
}, | |
"ecmaFeatures": { | |
"blockBindings": true, | |
"forOf": true, |
import webpackSimpleConfig from "webpack-simple-config" | |
/* | |
ideas: | |
- simpler config | |
- fix loaders order (imo, more logical order): proof is that every new webpack user don't get this part | |
- no tons of way to provide config via string, query etc | |
- some shortcuts: simple extract, aliases | |
*/ |
http { | |
upstream web_backend { | |
server web01:80; | |
server web02:80; | |
} | |
proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=cache-space:100m max_size=1024m inactive=1h; | |
proxy_temp_path /var/cache/nginx/tmp; | |
server { |
// https://github.com/deebloo/rxjs-worker | |
var observable = Observable.of([0, 1, 2, 3, 4]); | |
observable | |
.map(function (data) { | |
return data.concat([5, 6, 7, 8, 9]); | |
}) | |
.workerMap(function (data) { | |
return data.concat([10,11,12,13,14]);; | |
}) |
I would recommend @acdlite's redux-actions over the methods suggested in this Gist.
The methods below can break hot-reloading and don't support Promise-based actions.
Even though 'redux-actions' still uses constants, I've come to terms with the fact that constants can be good, especially in bigger projects. You can reduce boilerplate in different places, as described in the redux docs here: http://gaearon.github.io/redux/docs/recipes/ReducingBoilerplate.html
// @flow | |
declare module 'react-relay' { | |
declare export type RecordState = 'EXISTENT' | 'NONEXISTENT' | 'UNKNOWN'; | |
declare export type onCompleted = (response: ?Object, errors: ?Array<PayloadError>) => void | |
declare export type onError = (error: Error) => void | |
declare export type CommitOptions = { | |
onCompleted: onCompleted, |