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 fs = require('fs') | |
const path = require('path') | |
const models = path.join(__dirname, 'models') | |
fs.readdirSync(models) | |
.filter(file => ~file.indexOf('.js')) | |
.forEach(file => require(path.join(models, file))) |
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
/** | |
* This is converted from @palantir/blueprint's editable text. | |
* | |
* @see http://blueprintjs.com/docs/#components.editable | |
*/ | |
import React, {Component} from 'react' | |
import classNames from 'classnames' | |
import { clamp, safeInvoke } from '../utils' | |
import PureRender from "pure-render-decorator"; |
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
'use strict' | |
const uuid = require('node-uuid') | |
class APIError extends Error { | |
constructor (opts) { | |
super(opts) | |
Error.captureStackTrace(this, APIError) | |
this.name = this.constructor.name || 'APIError' | |
this.code = opts.code || 500 |
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
return function apiErrorHandler(err, req, res, next) { | |
var status = err.status || err.statusCode || 500; | |
if (status < 400) status = 500; | |
res.statusCode = status; | |
var body = { | |
status: status | |
}; | |
// show the stacktrace when not in production |
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
{ | |
"version": "0.0.1", | |
"scripts": { | |
"start": "npm-run-all --parallel watch:server watch:build", | |
"watch:build": "NODE_ENV='development' webpack --watch", | |
"watch:server": "nodemon \"./build/server/main.js\" --watch \"./build/server\"" | |
}, | |
"devDependencies": { | |
"babel-core": "^6.20.0", | |
"babel-loader": "^6.2.9", |
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 axios from 'axios'; | |
import Link from 'react-router-dom/Link'; | |
import qs from 'query-string'; | |
import Helmet from 'react-helmet'; | |
import { setToken } from '../utils/auth'; | |
import { | |
Page, | |
Block, | |
Card, |
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
/** | |
* This is converted from @palantir/blueprint's editable text. | |
* | |
* @see http://blueprintjs.com/docs/#components.editable | |
*/ | |
import React, {Component} from 'react' | |
import classNames from 'classnames' | |
import { clamp, safeInvoke } from '../utils' | |
import PureRender from "pure-render-decorator"; |
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
var React = require('react'); | |
var { Component, PropTypes } = React; | |
var throttle = require('lodash/function/throttle'); | |
class InfiniteScroll extends React.Component { | |
static propTypes = { | |
hasMore: PropTypes.bool.isRequired, | |
isLoading: PropTypes.bool.isRequired, | |
onLoadMore: PropTypes.func.isRequired, | |
threshold: PropTypes.number, |
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
module.exports = { | |
'20': '1128.497220', | |
'19': '2256.994440', | |
'18': '4513.988880', | |
'17': '9027.977761', | |
'16': '18055.955520', | |
'15': '36111.911040', | |
'14': '72223.822090', | |
'13': '144447.644200', | |
'12': '288895.288400', |
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 axios from 'axios'; | |
// This is a Higher Order Component that abstracts duplicated data fetching | |
// on the server and client. | |
export default function SSR(Page) { | |
class SSR extends React.Component { | |
static getInitialData(ctx) { | |
// Need to call the wrapped components getInitialData if it exists | |
return Page.getInitialData |