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
| class ArrayMap | |
| def initialize(array) | |
| @array = array | |
| end | |
| def map(method) | |
| [method.call(head)] + tail.map(method) | |
| end | |
| def head |
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 select(state) { | |
| const id = state.router.params.id; | |
| return { | |
| submission: state.submissions[id] || {} | |
| }; | |
| } | |
| export default connect(select)(SubmissionPage); |
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 from 'react'; | |
| import { connect } from 'react-redux'; | |
| import Rate from './Rate'; | |
| import Submission from './Submission'; | |
| import { performRating, fetchSubmission } from '../actions_creators/SubmissionActionsCreator'; | |
| class SubmissionPage extends React.Component { | |
| performRating(value) { | |
| this.props.dispatch(performRating(this.props.submission, value)); | |
| } |
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
| const _requestSubmission = (id) => { | |
| return { | |
| type: ActionTypes.REQUEST_SUBMISSION, | |
| id: id | |
| }; | |
| } | |
| const _receiveSubmission = (submission) => { | |
| return { | |
| type: ActionTypes.RECEIVE_SUBMISSION, |
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
| // ... | |
| export function configureStore(initialState, createHistory, reduxReactRouter) { | |
| const createStoreWithMiddleware = compose( | |
| applyMiddleware(thunk), | |
| reduxReactRouter({ routes, createHistory }) | |
| )(createStore); | |
| return createStoreWithMiddleware(reducers, initialState); | |
| } |
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
| submissionStore.dispatchToken = AppDispatcher.register((payload) => { | |
| let id; | |
| switch (payload.action.actionType) { | |
| case ActionTypes.REQUEST_SUBMISSION: | |
| id = payload.action.id; | |
| Connection.get(`/submissions/${id}`).then((response) => { | |
| submissionStore.submission = response.data; | |
| submissionStore.emitChange(); | |
| }); | |
| break; |
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 from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import { Provider } from 'react-redux'; | |
| import { reduxReactRouter, ReduxRouter } from 'redux-router'; | |
| import Routes from './routes'; | |
| import { configureStore } from './Store'; | |
| import createHistory from 'history/lib/createBrowserHistory' | |
| var app = document.getElementById('app'); |
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
| <script> | |
| window.__INITIAL_STATE__ = <%- initialState %>; | |
| </script> |
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 from 'react'; | |
| import { RoutingContext } from 'react-router'; | |
| import { configureStore } from './src/Store'; | |
| import { ReduxRouter } from 'redux-router'; | |
| import { reduxReactRouter, match } from 'redux-router/server'; | |
| import { Provider } from 'react-redux'; | |
| import ReactDOMServer from 'react-dom/server'; | |
| import Express from 'express'; | |
| import http from 'http'; | |
| import Webpack from 'webpack'; |
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 { configureStore } from './src/Store'; | |
| import { ReduxRouter } from 'redux-router'; | |
| import { reduxReactRouter, match } from 'redux-router/server'; | |
| import { Provider } from 'react-redux'; | |
| import createHistory from 'history/lib/createMemoryHistory'; | |
| // ... | |
| app.use((request, response) => { | |
| const initialState = {}; |