This file contains hidden or 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
| app.run( ($state) => { | |
| const indexed_state = {} | |
| const states = $state.get() | |
| states.forEach( state => { | |
| indexed_state[ state.name ] = state | |
| }) | |
| const URLs = states.map( state => getUrlOf(state) ) |
This file contains hidden or 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
| wage() { | |
| curl -s -XPOST 'http://www.thesalarycalculator.co.uk/salary.php' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Connection: keep-alive' --data "salary=$1&age=low&taxcode=&bonus=&payperiod=12&otime1=&orate1=1.5&otime2=&orate2=2&pensiontype=employer&pension=&childcare=&sacrifice=&sacrificeperiod=12&taxablebenefits=&benefitperiod=12&pretax=&posttax=&chosenTaxYear=2016&submit=Go%21&timeperiods%5B%5D=1&timeperiods%5B%5D=12&timeperiods%5B%5D=52&timeperiods%5B%5D=260&submit=" | pup '.takehome td:nth-child(3) text{}' | |
| } | |
| # `source .aliases` |
This file contains hidden or 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
| // example from http://redux.js.org/docs/basics/UsageWithReact.html | |
| // annotated and simplified for this Medium story | |
| import { connect } from 'react-redux' | |
| import TodoList from "./todo-list" | |
| const mapStateToProps = (state) => { | |
| return { | |
| todos: state.todos // bound to `this.props.todos` | |
| } |
This file contains hidden or 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
| function connect(mapStateToProps, mapDispatchToProps) { | |
| // Target is a component, TodoList in our example | |
| return Target => { | |
| // do something with it | |
| } | |
| } |
This file contains hidden or 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
| function connect(mapStateToProps, mapDispatchToProps) { | |
| return (Target) => { | |
| // we need to return a class | |
| class Connected extends Component { | |
| render() { | |
| return <Target /> | |
| } | |
| } |
This file contains hidden or 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 TodoList from "./todo-list" | |
| function connect(mapStateToProps, mapDispatchToProps) { | |
| return (Target) => { | |
| class Connected extends Component { | |
| render() { | |
| // we pass the props down | |
| return (<Target {...this.props} />) | |
| } |
This file contains hidden or 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
| function compose(composeFn, param) { | |
| if(typeof composeFn != "function") | |
| return {} | |
| return composeFn(param) | |
| } | |
| function connectProps(store, mapStateToProps, mapDispatchToProps) { | |
| return { | |
| ...compose(mapStateToProps, store.getState()), |
This file contains hidden or 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
| require("colors") | |
| exports.createLogger = (type) => ({ | |
| log: (...args) => console.log(`[${type}]`.gray, ...args), | |
| warn: (...args) => console.log(`[${type}]`.cyan, ...args), | |
| error: (...args) => console.log(`[${type}]`.red, ...args), | |
| success: (...args) => console.log(`[${type}]`.green, ...args) | |
| }) |
This file contains hidden or 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 Inferno from 'inferno'; | |
| import Component from 'inferno-component'; | |
| import './App.css'; | |
| import Repeater from "./Repeater" | |
| import DisplayProps from "./DisplayProps" | |
| class App extends Component { | |
| constructor(props) { | |
| super(props) |
OlderNewer