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 React, { Component } from 'react'; | |
import { bindActionCreators } from 'redux'; | |
import { connect } from 'react-redux'; | |
import * as Actions from './action'; | |
const mapStateToProps = ({ loaded, loading, error, data }) = ({ loaded, loading, error, data }); | |
const mapDispatchToProps = dispatch => ({ action: bindActionCreators(Actions, dispatch) }); | |
export class MyComponent extends Component { | |
load = _ => this.props.action.load(this.props.id); |
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
trait MonadicOpt<T> { | |
fn fmap<U>(self, f: |T| -> U) -> Option<U>; | |
fn bind<U>(self, f: |T| -> Option<U>) -> Option<U>; | |
} | |
impl<T> MonadicOpt<T> for Option<T> { | |
fn fmap<U>(self, f: |T| -> U) -> Option<U> { | |
match self { | |
Some(x) => Some(f(x)), | |
_ => None, |
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
Bacon = require 'Bacon' | |
_ = require 'underscore' | |
$ = require 'jquery' | |
# Reference: http://unixpapa.com/js/key.html | |
# IE = IE keycodes (webkit, IE) | |
# MZ = Mozilla keycodes (gecko) | |
# Opera = Opera keycodes (opera) | |
# US locale specific. About as well as can be done without browser detection. |
NewerOlder