This file contains 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
solveWithRepa :: (R.Array R.U R.DIM1 Int) -> IO (Int, Int, Int) | |
solveWithRepa stockPrices = do | |
let indices = R.fromListUnboxed (R.Z R.:. (8::Int)) [0..(S.size $ R.extent stockPrices)-1] :: R.Array R.U R.DIM1 Int | |
temp <- (R.computeP $ R.zipWith (\a b -> (a,b)) indices indices) :: IO(R.Array R.U R.DIM1 (Int, Int)) | |
mapped <- (R.computeP $ R.zipWith (\(a,b) c -> (a,b,c)) temp indices) :: IO(R.Array R.U R.DIM1 (Int, Int, Int)) | |
-- let temp = R.foldS foldF (0::Int, 0::Int, 0::Int) mapped | |
temp <- R.foldP foldF (0::Int, 0::Int, 0::Int) mapped | |
let (buyIdx, sellIdx, minIdx) = head $ R.toList temp | |
let buyAmount = stockPrices R.! (R.Z R.:. buyIdx) |
This file contains 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 configureFetch () { | |
const configuredFetch = (endpoint, options) => { | |
const initialOptions = { | |
headers: { | |
Authorization: Cookies.get('token') | |
} | |
} | |
const mergedOptions = _.merge(initialOptions, options); |
This file contains 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 { Router, Link, useRoutes } from 'react-router'; | |
import createHashHistory from 'history/lib/createHashHistory'; | |
var pictures = [ | |
{ id: 0, src: 'http://placekitten.com/601/601' }, | |
{ id: 1, src: 'http://placekitten.com/610/610' }, | |
{ id: 2, src: 'http://placekitten.com/620/620' } | |
]; |
This file contains 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 loginSuccess (router) { | |
return (dispatch, getState) => { | |
const state = getState(); | |
console.log('test'); | |
let nextPath = state.router.query ? state.router.query.next : '/home'; | |
// TODO: Swap these two, when React 0.14 is released. | |
// dispatch(transitionTo(state.router.query.next)); | |
router.transitionTo(nextPath); | |
}; |