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
| // connect() is a function that injects Redux-related props into your component. | |
| // You can inject data and callbacks that change that data by dispatching actions. | |
| function connect(mapStateToProps, mapDispatchToProps) { | |
| // It lets us inject component as the last step so people can use it as a decorator. | |
| // Generally you don't need to worry about it. | |
| return function (WrappedComponent) { | |
| // It returns a component | |
| return class extends React.Component { | |
| render() { | |
| return ( |
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
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "sort" | |
| "time" | |
| ) | |
| // a struct to hold the result from each request including an index |
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 React, {PropTypes} from 'react'; | |
| import { debounce } from 'lodash'; | |
| // A simple helper component, wrapping retina logic for canvas and | |
| // auto-resizing the canvas to fill its parent container. | |
| // To determine size/layout, we just use CSS on the div containing | |
| // the Canvas component (we're using this with flexbox, for example). | |
| // Expects a "paint" function that takes a "context" to draw on | |
| // Whenever this component updates it will call this paint function | |
| // to draw on the canvas. For convenience, pixel dimensions are stored |