Skip to content

Instantly share code, notes, and snippets.

View TylerSustare's full-sized avatar

Tyler Sustare TylerSustare

View GitHub Profile
# Super simple example
Resources:
Ec2Instance:
Type: 'AWS::EC2::Instance'
Properties:
InstanceType: t2.micro
ImageId: ami-46ca739 # Amazon Linux AMI
# Update with a Tag
Tags:
- Key: Name
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"jsxBracketSameLine": true,
"arrowParens": "avoid",
"printWidth": 160
}
@TylerSustare
TylerSustare / change_the_rest.js
Last active September 17, 2019 16:10
Neat use of rest operator in React
class SomeClass extends Component {
onChange({ ...rest }) {
this.setState(rest);
};
options = {
// ...
onChangePage: currentPage => this.onChange({ currentPage }),
onChangeRowsPerPage: numberOfRows => this.onChange({ numberOfRows })
};
@TylerSustare
TylerSustare / batchedSequentialPromiseAll.js
Created September 26, 2019 22:34
Sequential Promise.all() in batches
const waait = i => new Promise(res => setTimeout(() => { return res(i); }, 2000));
const batchedPromiseAll = async (array) => {
let requests = array.slice(0);
let results = [];
let processBatch = async (chunks, results) => {
let curr;
try {
@TylerSustare
TylerSustare / app.js
Created January 10, 2020 05:21
firebase realtime database data
import React, { Component } from 'react'
import firebase from 'firebase';
export default class List extends Component {
constructor(props) {
super(props);
this.state = {
loaded: false,
data: {},
};
@TylerSustare
TylerSustare / tsconfig.json
Created February 12, 2020 19:17
Default tsconfig
{
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"lib": ["ESNext", "ES2019", "es2018", "es2017", "es7", "es6", "dom"],
"declaration": true,
"outDir": "./dist",
"strict": false,
"esModuleInterop": true,
"resolveJsonModule": true,
@TylerSustare
TylerSustare / iterateOverEnum.ts
Created June 12, 2020 18:48
Itterate through string enum in TypeScript
export enum EnumType {
choice = 'choice',
checkbox = 'checkbox',
boolean = 'boolean',
blank = 'blank',
match = 'match',
order = 'order'
}
export const getEnumTypeValues = (): { key: string; text: string }[] =>
@TylerSustare
TylerSustare / pretty_log.js
Created October 9, 2020 16:36
Fantastic Console Logs
console.log("%cPLS WORK!!!!","color: red; font-family:sans-serif; font-size: 20px");
console.log("%cYAY it worked!","color: cyan; font-family:sans-serif; font-size: 24px");
@TylerSustare
TylerSustare / docker-compose.yaml
Last active February 17, 2023 07:05
Postgres, Mongo, DynamoDB, and Redis Docker compose. Just start 'em all and see what happens.
# inspiration
# https://dev.to/pfreitag/running-postgresql-in-docker-for-local-dev-2ojk
# https://medium.com/faun/managing-mongodb-on-docker-with-docker-compose-26bf8a0bbae3
# https://rharshad.com/dynamodb-local-docker/
# https://docs.fauna.com/fauna/current/integrations/dev.html#requirements
# instructions
# 1. start 'em up
# docker-compose up -d
@TylerSustare
TylerSustare / boot.sh
Last active August 15, 2021 19:59
Ubuntu Boot Script with Caddy
apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
apt update
apt full-upgrade -y
apt install caddy