- Clear feature ownership
- Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I used anaconda as my python vendor. | |
So first install anaconda. | |
Then set path in .profile in home directory. | |
--> PATH="$HOME/bin:$HOME/.local/bin:$HOME/anaconda3/bin:$PATH" | |
then create a virtual environment using conda as | |
: conda create --name your_name_for_env python=3.4 | |
this will create named env directory inside anaconda3/envs | |
do source activate your_name_for_env | |
now go to your project directory and install dependencies using pip as: | |
--> pip install -r requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I used anaconda as my python vendor. | |
So first install anaconda. | |
Then set path in .profile in home directory. | |
--> PATH="$HOME/bin:$HOME/.local/bin:$HOME/anaconda3/bin:$PATH" | |
then create a virtual environment using conda as | |
: conda create --name your_name_for_env | |
this will create named env directory inside anaconda3/envs | |
do source activate your_name_for_env | |
then pip install scrapy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create valid redux reducer with action types as object keys and values as | |
* functions, instead of using Switch Statement | |
* | |
* Use it like this: | |
* | |
* `createReducer({ | |
* // optional if you set a initial state as the second argument | |
* initialState: {}, | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import snakeCase from 'lodash/snakeCase' | |
/** | |
* Convert a object with action creators created with | |
* redux-actions createAction to a object with these | |
* functions names as action types | |
* | |
* "someAction" becomes "SOME_ACTION" | |
* | |
* @param {Object} actions Object with action creators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { takeLatest } from 'redux-saga' | |
import { call, put } from 'redux-saga/effects' | |
import fetch from 'isomorphic-fetch' | |
import * as actions from './modules/grid' | |
import * as api from '../lib/api' | |
export function* fetchGrids(action) { | |
try { | |
const grids = yield call(api.GET, 'grids') | |
yield put(actions.fetchGridsSuccess(grids)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createStore} from 'redux'; | |
const counter = (state = 0, action) => { | |
const index = { | |
'INCREMENT': () => { | |
return state+1; | |
}, | |
'DECREMENT': () => { | |
return state-1; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filters an array of objects with multiple criteria. | |
* | |
* @param {Array} array: the array to filter | |
* @param {Object} filters: an object with the filter criteria as the property names | |
* @return {Array} | |
*/ | |
function multiFilter(array, filters) { | |
const filterKeys = Object.keys(filters); | |
// filters all elements passing the criteria |
OlderNewer