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
# This docker file will consist of two stages. The first stage will be used to arrange the application | |
# dependencies and compile it. The second stage will be used to set up an nginx server to serve the | |
# static angular content. | |
### Stage 1: Downloading application dependencies and compiling angular AoT | |
# Create image based on the official Node based on the Alpine linus distribution image from dockerhub | |
FROM node:alpine AS builder | |
# Create a directory where our app will be placed. -p is to create parent directories as necessary |
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
const compose = (...fns) => | |
fns.reverse().reduce((prevFn, nextFn) => | |
value => nextFn(prevFn(value)), | |
value => value | |
); |
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 { someReducer } from './someReducer.js' | |
describe('someReducer', () => { | |
it('should return the correct initial state', () => { | |
expect(someReducer(undefined, {}).toEqual({ | |
prop1: 'someValue1', | |
prop2: 'someValue2', | |
..... | |
}); | |
}); |
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 { someReducer, SOME_REDUCER_INITIAL_STATE } from './someReducer.js' | |
describe('someReducer', () => { | |
it('should return the correct initial state', () => { | |
expect(someReducer(undefined, {}).toEqual(SOME_REDUCER_INITIAL_STATE); | |
}); | |
}); |
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
// scoreboard-reducer.js | |
const INITIAL_STATE = { | |
home: 0, | |
away: 0, | |
} | |
export const scoreboardReducer = (state = INITIAL_STATE, action) { | |
switch (action.type) { | |
case 'INCREMENT_HOME_SCORE': | |
return {...state, home: state.home + 1 }; | |
case 'INCREMENT_AWAY_SCORE': |
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
// scoreboard-reducer.js | |
const INITIAL_STATE = { | |
home: 0, | |
away: 0, | |
} | |
export const scoreboardReducer = (state = INITIAL_STATE, action) { | |
switch (action.type) { | |
case 'GOAL_SCORED': | |
const scoringSide = action.payload.team; | |
return {...state, [scoringSide]: state.[scoringSide] + 1 }; |
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
// scoreboard-reducer.js | |
const INITIAL_STATE = { | |
home: 0, | |
away: 0, | |
} | |
export const scoreboardReducer = (state = INITIAL_STATE, action) { | |
switch (action.type) { | |
case 'INCREMENT_SCORE': | |
const scoringSide = action.payload.team; |
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
// scoreboard-reducer.js | |
const INITIAL_STATE = { | |
home: 0, | |
away: 0, | |
} | |
export const scoreboardReducer = (state = INITIAL_STATE, action) { | |
switch (action.type) { | |
case 'INCREMENT_SCORE': | |
const scoringSide = action.payload.team | |
return {...state, [scoringSide]: state[scoringSide] + 1 }; |
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 styled from "styled-components"; | |
const Checkbox = styled.input.attrs(() => ({ | |
type: 'checkbox' | |
}))` | |
appearance: none; | |
background-color: #ffffff; | |
border: 1px solid #000000; | |
box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px -15px 10px -12px rgba(0,0,0,0.05); | |
padding: 8px; |
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
// You and your teammate have been working on a project for two and a half | |
// weeks. Everything is going well except you notice that one of the functions | |
// your teammate wrote is failing a test case, which you know to be correct. | |
// Unfortunately, your teammate is sick today and to make matters worse, you | |
// realize that you need to demo your project in ten minutes. So you decide | |
// to try and fix the function. Can you fix it in time for your demo? | |
//////////////////////////////////////////////////////////////////////////////// | |
const SYMBOLS = [ 'AAPL', 'AMZN', 'MONY', 'PETS', 'PZZA', 'SHOP', 'TSLA', 'WIFI' ]; |
OlderNewer