Skip to content

Instantly share code, notes, and snippets.

View vmasto's full-sized avatar

Vassilis Mastorostergios vmasto

  • Thessaloniki, Greece
View GitHub Profile
@vmasto
vmasto / twitter-react-redux-email.txt
Last active August 3, 2023 22:34 — forked from fat/email.txt
Twitter's React/Redux application architecture
Hey,
This is the redux video series that helped me learn how to use it: https://egghead.io/courses/getting-started-with-redux. And here's a section on react "stateless functions": https://facebook.github.io/react/docs/reusable-components.html#stateless-functions
Later you might want to play around with React Native
React Native for Web: https://github.com/necolas/react-native-web
Try it out here: http://codepen.io/necolas/pen/PZzwBR/?editors=0010
And I thought you might get some ideas from what we're doing for mobile.twitter.com, which is a bit like this...
@vmasto
vmasto / mock.js
Created February 8, 2017 00:06
Simple JavaScript mocking function
const mock = impl => {
const mockFn = (...args) => {
mockFn.calls.push(args);
return impl ? impl(...args) : undefined;
};
mockFn.calls = [];
mockFn.reset = () => mockFn.calls = [];
return mockFn;
@vmasto
vmasto / extendReducer.js
Created March 13, 2017 00:53
Reducer Extensions
/**
* A higher order function that takes a reducer and an extension
* and returns a reducer amplified with provided extensions on
* existing or new action types.
*
* Extensions are objects containing the action `type` attribute
* and an `actionTypeExtension` function which takes `state` and
* the `action` and must return an object to append to the reducer's
* new state.
*