Skip to content

Instantly share code, notes, and snippets.

View tforster's full-sized avatar
🏠
In the office

Troy Forster tforster

🏠
In the office
View GitHub Profile
@tforster
tforster / index.js
Last active September 6, 2024 13:16
Naked Redirector CloudFront Function
/**
* @description: Handler entry point.
* - Note AWS CloudFront Functions use a modified ECMAScript 5.1 compatible runtime and NOT NodeJS.
* - Use var, not const or let
* - Use string concatenation and not template literals
* - Beware that the CloudFront Functions Console editor and test environment do NOT mimic CloudFront 100%
* @date 2022-01-26
* @param {object} event: A CloudFront Function event (expecting a Viewer Request event)
* @return {object}: A CloudFront response or request object (depends whether conditions allow pass through or 301 redirect)
*/
@tforster
tforster / Caddyfile
Created February 4, 2022 23:39
Caddyfile configuration for multiple Access-Control-Allow-Origin
(cors) {
@origin{args.0} header Origin {args.0}
header @origin{args.0} Access-Control-Allow-Origin "{args.0}"
}
sub.domain.com {
reverse_proxy 127.0.0.1:3000
header Access-Control-Allow-Methods *
header Access-Control-Allow-Headers content-type
header Access-Control-Allow-Credentials true
@tforster
tforster / graphql.json
Last active February 20, 2022 20:33
Simulated GraphQL response
{
"pages": {
"/products/product-1.xml": {
"title": "Product One",
"summary": "A short summary of this product",
"detail": "Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum",
"price": "$9.99",
"modelName": "product-summary"
},
"/products/product-2.xml": {
@tforster
tforster / zsh-cli-aliases.md
Last active September 26, 2024 18:19
A collection of ZSH aliases for executing various SDK CLIs
@tforster
tforster / .zshrc
Created February 4, 2024 18:27
cw - change working directory
# A simple way of aliasing short project names to deeper working directories.
# - If you work on multiple machines and keep the same directory layout then this becomes very useful
#
# 1. Create a secret gist called joy.json that looks something like the following. Use your own meaningful project names and create as many entries as you need
#
# {
# "bookmarks": {
# "project1": "/full/path/to/the/project1/directory",
# "project2": "/full/path/to/the/project2/directory,
# }
@tforster
tforster / branch.sh
Created February 14, 2024 23:50
Sluggified Git branch creation from GitHub/ADO ticket number and title
#!/usr/bin/env bash
#########################################################################################################################
# branch.sh is used, with arguments, to create a new branch from main that uses a slugified ADO ticket number and title #
#########################################################################################################################
# Exit immediately if a command exits with a non-zero status
set -o errexit
# Treat unset variables as an error when substituting
set -o nounset
# Fails entire pipeline if any command fails
@tforster
tforster / git-command-sequences.md
Last active October 19, 2024 19:38
Useful git command sequences