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" | |
| "math/rand" | |
| ) | |
| const ( | |
| win = 100 //The winning score | |
| gamesPerSeries = 10 //The number of games per series to simulate |
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
| /** | |
| * | |
| * Wordpress like hook system for javascript. | |
| * | |
| * The purpose of this library is to make code extensible by using hooks like in | |
| * the Wordpress CMS. | |
| * | |
| * The functions in this library shall help other developers hook their code | |
| * into a generic code using their callbacks. | |
| * |
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 { connect } from 'react-redux'; | |
| export default function (ComposedComponent) { | |
| class Authentication extends Component { | |
| // static -> class level property | |
| //eg. Authentication.contextType | |
| static contextTypes = { | |
| // if we want access to our router | |
| // we need to say ahead of time that |
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 { | |
| CHANGE_AUTH | |
| } from '../actions/types'; | |
| //for auth reducer the default state is false | |
| //i.e. user is not logged in | |
| export default function (state = false, action){ | |
| switch (action.type){ | |
| case CHANGE_AUTH: | |
| return action.payload; |
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 { | |
| CHANGE_AUTH | |
| } from './types'; | |
| export function authenticate (isLoggedIn) { | |
| return { | |
| type: CHANGE_AUTH, | |
| payload: isLoggedIn | |
| }; | |
| } |
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 { createStore, applyMiddleware } from 'redux'; | |
| import { Router, Route, browserHistory } from 'react-router'; | |
| import App from './components/app'; | |
| import Resources from './components/resources'; | |
| import reducers from './reducers'; | |
| const createStoreWithMiddleware = applyMiddleware()(createStore); |