Skip to content

Instantly share code, notes, and snippets.

View qmmr's full-sized avatar

Marcin Kumorek qmmr

View GitHub Profile
@qmmr
qmmr / reduceReducers.js
Created April 6, 2016 15:51
Redux reduceReducers in ES5
var reduceReducers = function () {
var reducers = [].slice.call(arguments);
return function (previous, current) {
return reducers.reduce(function (accu, curr) {
return curr(accu, current);
}, previous);
};
};
@qmmr
qmmr / thunkMiddleware.js
Created April 6, 2016 14:00
Redux thunkMiddleware in ES5
// INFO: ThunkMiddleware
var thunkMiddleware = function (store) {
return function (next) {
return function (action) {
if (typeof action === 'function') {
action(store.dispatch, store.getState);
}
return next(action);
};
@qmmr
qmmr / README.md
Last active March 11, 2016 14:44
Collection of useful urls
@qmmr
qmmr / redux_egghead_notes.md
Created January 17, 2016 22:56 — forked from diegoconcha/redux_egghead_notes.md
Redux Egghead.io Notes

###Redux Egghead Video Notes###

####Introduction:#### Managing state in an application is critical, and is often done haphazardly. Redux provides a state container for JavaScript applications that will help your applications behave consistently.

Redux is an evolution of the ideas presented by Facebook's Flux, avoiding the complexity found in Flux by looking to how applications are built with the Elm language.

####1st principle of Redux:#### Everything that changes in your application including the data and ui options is contained in a single object called the state tree

@qmmr
qmmr / JSXSpreadAttributes.md
Last active September 14, 2015 19:15 — forked from sebmarkbage/JSXSpreadAttributes.md
JSX Spread Attributes

JSX Spread Attributes

If you know all the properties that you want to place on a component a head of time, it is easy to use JSX:

  var component = <Component foo={x} bar={y} />;

Mutating Props is Bad, mkay

@qmmr
qmmr / transferring-props.md
Last active September 5, 2015 10:59 — forked from sebmarkbage/transferring-props.md
Deprecating transferPropsTo

Deprecating transferPropsTo

It's a common pattern in React to wrap a component in an abstraction. The outer component exposes a simple property to do something that might have more complex implementation details.

We used to have a helper function called transferPropsTo. We no longer support this method. Instead you're expected to use a generic object helper to merge props.

render() {
 return Component(Object.assign({}, this.props, { more: 'values' }));
@qmmr
qmmr / ElementFactoriesAndJSX.md
Last active September 5, 2015 10:59 — forked from sebmarkbage/ElementFactoriesAndJSX.md
New React Element Factories and JSX

New React Element Factories and JSX

In React 0.12, we're making a core change to how React.createClass(...) and JSX works.

If you're using JSX in the typical way for all (and only) React components, then this transition will be seamless. Otherwise there are some minor breaking changes described below.

The Problem

@qmmr
qmmr / app.js
Last active August 31, 2015 22:20 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@qmmr
qmmr / es6notes.md
Last active August 29, 2015 14:22
ES6 notes

Strings

String.prototype.includes(txt, start)

It was meant to be String.prototype.contains like the Array.prototype.contains but it would break MooTools

let title = 'JS Futures in London!';
title.includes('JS') // true
title.includes('!') // true
title.includes('JS', 3) // false
@qmmr
qmmr / .zshenv
Last active August 29, 2015 14:15
SublimeLinter.sublime-settings
# load nvm
if [[ -f ~/.nvm/nvm.sh ]]; then
. ~/.nvm/nvm.sh
nvm use v0.10
else
echo "You're missing .nvm.sh!"
fi
export PATH=/usr/local/bin:/usr/local/sbin:$HOME/.rvm/bin:$PATH