Skip to content

Instantly share code, notes, and snippets.

View ryanjyost's full-sized avatar

Ryan Yost ryanjyost

View GitHub Profile
@ryanjyost
ryanjyost / Final: AssumptionsContainer.js
Last active January 22, 2017 21:10
rainy-day-fund/src/components/AssumptionsContainer.js
//src/components/AssumptionsContainer
import { connect } from 'react-redux';
import { updateIncomeSources, updateIncome, updateSavings } from '../actions'
import Assumptions from './Assumptions'
const mapStateToProps = (state) => {
return {
assumptions: state.assumptions,
}
@ryanjyost
ryanjyost / Final: reducers_index.js
Created January 22, 2017 21:00
rainy-day-fund/src/reducers/index.js
//src/reducers/index.js
import { combineReducers } from 'redux';
import { assumptionsReducer, expensesReducer, savingsPlanReducer } from './reducers';
const appReducer = combineReducers({
assumptions: assumptionsReducer,
expenses: expensesReducer,
savingsPlan: savingsPlanReducer
@ryanjyost
ryanjyost / Final: reducers.js
Last active January 22, 2017 20:57
rainy-day-fund/src/reducers/reducers.js
//src/reducers/reducers.js
import * as types from '../actions';
//=================================
// Assumptions Reducer
//=================================
const initialAssumptionsState = {
incomeSources: 1,
@ryanjyost
ryanjyost / Final: actions.js
Last active January 22, 2017 19:00
rainy-day-fund/src/actions.js
//src/actions.js
//=============================================
// Assumptions
//action types
export const UPDATE_INCOME_SOURCES = 'UPDATE_INCOME_SOURCES';
export const UPDATE_INCOME = 'UPDATE_INCOME';
export const UPDATE_SAVINGS = 'UPDATE_SAVINGS';
@ryanjyost
ryanjyost / Income-only: Assumptions.js
Last active January 29, 2017 02:47
Income-only: rainy-day-fund/src/components/Assumptions
//src/components/Assumptions.js
import React from 'react';
import { Link } from 'react-router'
import { FormGroup, Row, ControlLabel, FormControl, Button, InputGroup } from 'react-bootstrap';
import {formatDollarValues} from '../helpers'
const Assumptions = ({assumptions, handleUpdateIncome}) => {
return (
@ryanjyost
ryanjyost / Post-Redux: src_index.js
Last active January 25, 2017 03:28
Post-Redux: rainy-day-fund/src/index.js
//src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import router from './router';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import './index.css'
@ryanjyost
ryanjyost / Pre-Redux: index.js
Last active January 15, 2017 21:39
Pre-Redux: rainy-day-fund/src/index.js
//src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import './index.css';
import router from './router';
@ryanjyost
ryanjyost / helpers.js
Last active January 25, 2017 04:33
rainy-day-fund/src/helpers.js
//src/helpers.js
//take raw dollar amount (string or number) and add commas using toLocaleString
export const formatDollarValues = (numString) => {
if(numString == ""){
return '0';
}
if(isNaN(numString)){
return '0';
@ryanjyost
ryanjyost / router.js
Last active January 15, 2017 21:41
rainy-day-fund/src/components/router.js
//src/router.js
import React from 'react'
import { Router, Route, hashHistory, IndexRoute } from 'react-router'
import App from './components/App'
import Landing from './components/Landing'
import WhatIsARainyDayFund from './components/WhatIsARainyDayFund'
import Assumptions from './components/Assumptions'
import Expenses from './components/Expenses'
@ryanjyost
ryanjyost / Pre-Redux: SavingsPlan.js
Last active January 11, 2017 04:39
Pre-Redux: rainy-day-fund/src/components/SavingsPlan.js
//src/components/SavingsPlan.js
import React from 'react';
import { FormControl, InputGroup } from 'react-bootstrap';
import {formatDollarValues} from '../helpers'
const SavingsPlan = () => {
return (