Skip to content

Instantly share code, notes, and snippets.

View TheMagoo73's full-sized avatar
🦧
Doing Open Source stuff

John Clarke TheMagoo73

🦧
Doing Open Source stuff
View GitHub Profile
@TheMagoo73
TheMagoo73 / array-map.js
Created May 31, 2018 08:57
A quick demo of the forEach and map higher-order functions in JS
var data = ["fred", "ann", "bob", "nina"];
console.log("Original data: ")
data.forEach(d => console.log(d));
data = data.map(d => "test-" + d);
console.log("Updated data: ")
data.forEach(d => console.log(d));
@TheMagoo73
TheMagoo73 / array-filter.js
Created May 31, 2018 09:06
A quick demo of the filter higher-order function in JavaScript
var data = ["fred", "ann", "bob", "nina"];
console.log("Original data: ")
data.forEach(d => console.log(d));
data = data.filter(d => d.includes("a"));
console.log("Updated data: ")
data.forEach(d => console.log(d));
@TheMagoo73
TheMagoo73 / gist:d6b6bb5917c070549bc865fe56def96c
Created July 17, 2019 15:15
Polymer 3 element CI/CD configuration for Circle CI (maybe...)
version: 2
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:7.10
jobs:
prequisites:
<<: *defaults
@TheMagoo73
TheMagoo73 / gke-private-cluster.tf
Created August 6, 2019 13:28
Terraform definition of a GKE private cluster
terraform {
backend "gcs" {
bucket = "tf-state-laaso-cluster"
prefix = "terraform/state"
credentials = "terraform-deploy.json"
}
}
provider "google" {
version = "~> 2.12.0"
@TheMagoo73
TheMagoo73 / dockerfile
Created August 6, 2019 14:06
Terraform/CircleCI dockerfile
FROM alpine:3.10
RUN apk update
RUN apk add --no-cache wget openssh git bash tar gzip ca-certificates
RUN rm -rf /var/cache/apk/*
RUN wget --quiet https://releases.hashicorp.com/terraform/0.12.6/terraform_0.12.6_linux_amd64.zip \
&& unzip terraform_0.12.6_linux_amd64.zip \
@TheMagoo73
TheMagoo73 / config.yml
Created August 6, 2019 14:17
CircleCI definition for a Terraform deployment
version: 2
defaults: &defaults
working_directory: ~/repo
docker:
- image: gumshoe/cci-terraform:0.0.1-alpha
environment:
TF_IN_AUTOMATION: true
GOOGLE_APPLICATION_CREDENTIALS: ~/repo/terraform-deploy.json
@TheMagoo73
TheMagoo73 / .dockerignore
Last active August 19, 2019 13:35
example .dockerignore file
node_modules
.gitignore
build
@TheMagoo73
TheMagoo73 / dockerfile
Created August 19, 2019 13:39
Example dockerfile for React and NGINX
FROM node:11.1.0-alpine as build
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY ./ /app/
@TheMagoo73
TheMagoo73 / nginx.conf
Created August 19, 2019 14:00
Example nginx conf file for running React apps
# auto detects a good number of processes to run
worker_processes auto;
#Provides the configuration file context in which the directives that affect connection processing are specified.
events {
# Sets the maximum number of simultaneous connections that can be opened by a worker process.
worker_connections 8000;
# Tells the worker to accept multiple connections at a time
multi_accept on;
}
@TheMagoo73
TheMagoo73 / config.yml
Last active August 19, 2019 16:22
React and Docker CircleCI config
version: 2.1
orbs:
docker: circleci/docker@0.5.13
jobs:
run_tests:
working_directory: ~/react-app
docker:
- image: circleci/node:10.16.3