Skip to content

Instantly share code, notes, and snippets.

View AndrewBestbier's full-sized avatar

Andrew AndrewBestbier

  • McKinsey & Company
  • London
View GitHub Profile
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;
}
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)
['A', 'B', 'C'].map(element => {
let result;
if (element === 'A') {
result = 'a';
}
if (element === 'B') {
result = 'b';
}
if (element === 'C') {
result = 'c';
@AndrewBestbier
AndrewBestbier / index.js
Created August 22, 2019 21:13
index.js
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}!`))
@AndrewBestbier
AndrewBestbier / Dockerfile
Last active August 22, 2019 22:06
Dockerfile
# 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
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "andrewbest/node-docker-eb"
},
"Ports": [
{
"ContainerPort": "3000"
}
]
const addOne = (input) => {
return input +=1;
)} // Notice the rogue ')' here
version: 2
jobs:
test:
working_directory: ~/app
docker:
- image: circleci/node:latest # (1)
steps:
- checkout
- run:
name: Update npm
branch-defaults:
master:
environment: CiComparisonBlog-env
environment-defaults:
CiComparisonBlog-env:
branch: null
repository: null
global:
application_name: CI Comparison Blog
default_ec2_keyname: null
image: node:latest # (1)
stages:
- build
- test
- docker-deploy-image
- aws-deploy
cache:
paths: