Skip to content

Instantly share code, notes, and snippets.

View bendly's full-sized avatar

Ben Gao bendly

  • Findly
  • New Zealand
View GitHub Profile
@bendly
bendly / coding_convention.js
Last active September 30, 2016 00:31
JavaScript Coding Convention
/**
* How should we break the following code into multiple lines?
*/
const flowLayout = (cols, cards) => cards.reduce((state, card) => {const w = isDoubleWidth(card.name) ? 2 : 1; state.x += w; if (state.x >= cols) {state.x = 0; state.y++; } return state; }, {x: 0, y: 0, result: Immutable.List(), } ).result;
const mapDispatchToProps = (dispatch, props) => bindActionCreators({onItemClick: searchByOrgId(fetch, props.params.orgId)}, dispatch);
[1, 2, 3].map((x) => Object.assign({}, cc, {a: a b: b }, dd));