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 random | |
| american_adult_population = int(245e6) | |
| # Warning: This array is HUGE! | |
| # The array is just the numbers from 0 to 245,000,000 | |
| usa_array = range(american_adult_population) | |
| actual_average = float(american_adult_population / 2) | |
| sample_amount = 1500 |
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
| File 1 |
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 class EmployeeList extends React.Component { | |
| state = { | |
| employees: [], | |
| isLoading: true | |
| } | |
| componentDidMount() { | |
| if (localStorage.token) { | |
| this.loadEmployeesData() | |
| } |
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
| // === Action Creators === | |
| export function posItemRequest(itemBody) { | |
| return { | |
| type: 'ITEM_POST_REQUEST', | |
| payload: { | |
| itemBody: itemBody | |
| } | |
| } | |
| } |
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 itemsReducer(state, action) { | |
| switch(action.type) { | |
| case 'UPDATE_ITEM': | |
| return state.items.map(i => itemReducer(i, action)) | |
| default: | |
| return state | |
| } | |
| } | |
| function itemReducer(state, action) { |
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, { Component } from 'react' | |
| import { bindActionCreators } from 'redux' | |
| import { connect } from 'react-redux' | |
| import Settings from '../components/scenes/settings' | |
| import * as settingActions from '../actions/settings' | |
| import * as signUpActions from '../actions/sign-up' | |
| import * as loginActions from '../actions/login' | |
| import * as routerActions from '../actions/router' |
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' | |
| class AppTemplate extends React.Component { | |
| componentWillMount() { | |
| this.props.veritfyUserToken() | |
| } | |
| render() { | |
| if (this.props.state.loading) { | |
| 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
| (defn flatten [nested] | |
| (reduce | |
| (fn [acc el] | |
| (concat acc (if (sequential? el) | |
| (flatten el) | |
| [el]))) | |
| [] | |
| nested)) | |