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
// using airbnb-base | |
// need to change sourceType to script | |
{ | |
"extends": "airbnb-base", | |
"env": { | |
"node": true | |
}, | |
parserOptions: { | |
ecmaVersion: 7, |
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
root = true | |
[*] | |
end_of_line = lf | |
insert_final_newline = true | |
indent_style = space | |
indent_size = 2 | |
charset = utf-8 | |
trim_trailing_whitespace = true |
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
/** | |
* 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); | |
} |
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
/** base form */ | |
import React, { Component } from 'react'; | |
export default function(InnerComponent) { | |
class WrapperComponent extends Component { | |
render() { | |
return <InnerComponent {...this.props} /> | |
} | |
} | |
} |
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
/** | |
* 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) { } |
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
# 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 |
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
# 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)' |
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
# 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 |
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
|\__/| __ | |
/ ö ö \| | | |
\ -- / | |
/ 千 / | |
| | 万 | | |
| | 両 \_______ | |
\__|___|________|_\ |
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
/** | |
* descructive | |
* https://github.com/lodash/lodash/issues/1677 | |
*/ | |
function toggle(collection, item) { | |
var idx = _.indexOf(collection, item); | |
if(idx !== -1) { | |
collection.splice(idx, 1); | |
} else { | |
collection.push(item); |