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 values = [1, 2, 3, 'a', 'b', 'c']; | |
// [] -> [] | |
// [x] -> [x] | |
// x: xs : y -> [x, y] ++ func(xs) | |
const melder = values => { | |
if (values.length <= 1) { | |
return values; | |
} |
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 Prelude | |
import Data.Complex | |
data CompassPoint = E | N | W | S deriving (Show, Enum) | |
type Position = Complex Double | |
type Point = (Position, CompassPoint, Int) | |
type ComplexPoint = (Point, [Point]) | |
-- Question 1 | |
question1 n = (\((x:+y), _) -> abs x + abs y) . last . take n $ iterate step1 ((0:+0), E) |
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
['A', 'B', 'C'].map(element => { | |
let result; | |
if (element === 'A') { | |
result = 'a'; | |
} | |
if (element === 'B') { | |
result = 'b'; | |
} | |
if (element === 'C') { | |
result = 'c'; |
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 express = require('express') | |
const app = express() | |
const port = 3000 | |
app.get('/', (req, res) => res.send('Hello World!')) | |
app.listen(port, () => console.log(`Example app listening on port ${port}!`)) |
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
# Use an official Node runtime as a parent image | |
FROM node:12.7.0-alpine | |
# Set the working directory to /app | |
WORKDIR '/app' | |
# Copy package.json to the working directory | |
COPY package.json . | |
# Install any needed packages specified in package.json |
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
{ | |
"AWSEBDockerrunVersion": "1", | |
"Image": { | |
"Name": "andrewbest/node-docker-eb" | |
}, | |
"Ports": [ | |
{ | |
"ContainerPort": "3000" | |
} | |
] |
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 addOne = (input) => { | |
return input +=1; | |
)} // Notice the rogue ')' here |
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
version: 2 | |
jobs: | |
test: | |
working_directory: ~/app | |
docker: | |
- image: circleci/node:latest # (1) | |
steps: | |
- checkout | |
- run: | |
name: Update npm |
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
branch-defaults: | |
master: | |
environment: CiComparisonBlog-env | |
environment-defaults: | |
CiComparisonBlog-env: | |
branch: null | |
repository: null | |
global: | |
application_name: CI Comparison Blog | |
default_ec2_keyname: null |
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
image: node:latest # (1) | |
stages: | |
- build | |
- test | |
- docker-deploy-image | |
- aws-deploy | |
cache: | |
paths: |
OlderNewer