Skip to content

Instantly share code, notes, and snippets.

View brunchybit's full-sized avatar
:octocat:

Micah Adams brunchybit

:octocat:
View GitHub Profile
@fogfish
fogfish / error-behaviour.go
Last active November 4, 2022 13:35
Example of behaviour used for “Assert errors for behavior, not type”
//
// See the post: https://tech.fog.fish/2022/07/05/assert-golang-errors-for-behavior.html
//
// ErrorCodes provides a raw code originared by the failed package
type ErrorCode interface{ ErrorCode() string }
// ErrorType is the primary identifier (IRI) for the problem type, defined by the ontology
type ErrorType interface{ ErrorType() string }
@m-radzikowski
m-radzikowski / script-template.sh
Last active July 13, 2024 13:20
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@sapessi
sapessi / README.md
Last active October 26, 2021 10:48
Continuous deployment of React websites to Amazon S3

Continuous deployment of React websites to Amazon S3

This sample includes a continuous deployment pipiline for websites built with React. We use AWS CodePipeline, CodeBuild, and SAM to deploy the application. To deploy the application to S3 using SAM we use a custom CloudFormation resource.

Files included

  • buildspec.yml: YAML configuration for CodeBuild, this file should be in the root of your code repository
  • configure.js: Script executed in the build step to generate a config.json file for the application, this is used to include values exported by other CloudFormation stacks (separate services of the same application).
  • index.js: Custom CloudFormation resource that publishes the website to an S3 bucket. As you can see from the buildspec and SAM template, this function is located in a s3-deployment-custom-resource sub-folder of the repo
  • app-sam.yaml: Serverless Application model YAML file. This configures the S3 bucket and the cu