Skip to content

Instantly share code, notes, and snippets.

Jakub Chodorowicz chodorowicz

Block or report user

Report or block chodorowicz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@chodorowicz
chodorowicz / reactive2016-lightning-talk-proposal.md
Last active Sep 23, 2016
Reactive Conference 2016 → lightning talk proposal
View reactive2016-lightning-talk-proposal.md

Proposal for a lightning talk at the Reactive 2016 conference → https://reactiveconf.com

Star ⭐ the Gist to vote on this talk.

Move all your side effect to middleware using redux-saga

Redux saga is side effects middleware which allows us to orchestrate even very complex logical flows - think multiple AJAX request which depending on the responses, writing state to localstorage etc. More over it's output are descriptions of actions which can be later processed by middleware, which makes it pure and easily testable. This talk would be a short intro to redux-saga, which would hightlight benefits of concentrating all of side effect in one place and making both actions creators and sagas pure and easily testable.

View .node.eslintrc
// using airbnb-base
// need to change sourceType to script
{
"extends": "airbnb-base",
"env": {
"node": true
},
parserOptions: {
ecmaVersion: 7,
@chodorowicz
chodorowicz / .editorconfig
Last active Mar 25, 2017
web dev dotfiles, config files
View .editorconfig
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
@chodorowicz
chodorowicz / middleware.js
Last active Jul 18, 2016
redux middlewares
View middleware.js
/**
* bare middleare
*/
export default function({ dispatch }) {
return next => action => {
console.log(action);
// send this action to next middleware or reducers if that's the last middleware
next(action);
}
@chodorowicz
chodorowicz / hoc.js
Last active Jul 18, 2018
React HOC example
View hoc.js
/** base form */
import React, { Component } from 'react';
export default function(InnerComponent) {
class WrapperComponent extends Component {
render() {
return <InnerComponent {...this.props} />
}
}
}
View saga.js
/**
* shortcut for fork (no need to define separate watch functions
* https://yelouafi.github.io/redux-saga/docs/basics/UsingSagaHelpers.html
*/
import { takeLatest } from 'redux-saga'
import { fork } from 'redux-saga/effects'
function* fetchUsers(action) { }
function* createUser(action) { }
@chodorowicz
chodorowicz / find.sh
Last active Dec 20, 2016
find shell tool
View find.sh
# find files in several folders
find foo bar baz -name "*.py"
# find
find . -name "__tests__"
# used with Mocha → find spec files in app and test folders
mocha $(find test app -path *.spec.js)
# find recursivelly all symlinks
@chodorowicz
chodorowicz / mastemind.sh
Created Jul 11, 2016
mitmproxy and mastermind
View mastemind.sh
# simple mode with ignore all but specific domains
sudo mastermind --response-body $(pwd)/fake.json --url https://api.github.com/users/octocat/orgs --ignore '^(?!example\.com)(?!mitmproxy\.org)'
@chodorowicz
chodorowicz / setup.sh
Last active Aug 4, 2016
running Selenium test on CI server (SemaphoreCI)
View setup.sh
# run your usual build scripts e.g.
# npm install
# npm run build
# download selenium standalone jar
wget http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.0.jar
# run selenium using xvfb
# set web driver path
# get path to chrome.driver ➡️ which chromedriver
View asci.txt
|\__/| __
/ ö ö \| |
\ -- /
/ 千 /
| | 万 |
| | 両 \_______
\__|___|________|_\
You can’t perform that action at this time.