Skip to content

Instantly share code, notes, and snippets.

View kluu1's full-sized avatar

Kevin Luu kluu1

  • Atlanta, GA
View GitHub Profile
class GeneralError extends Error {
constructor(message) {
super();
this.message = message;
}
getCode() {
if (this instanceof BadRequest) {
return 400;
} if (this instanceof NotFound) {
const { GeneralError } = require('../utils/errors');
const handleErrors = (err, req, res, next) => {
if (err instanceof GeneralError) {
return res.status(err.getCode()).json({
status: 'error',
message: err.message
});
}
let myExampleNumber: number = 23;
myExampleNumber = 'some number'; // This line will throw an error
myExampleNumber = 5; // This line will work
@kluu1
kluu1 / main.tf
Last active October 6, 2020 18:14
bare-bones-terraform
provider "aws" {
profile = "default"
region = "us-east-1"
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
@kluu1
kluu1 / main.tf
Last active October 6, 2020 15:43
provider "aws" {
profile = "default"
region = "us-east-1"
}
variable "ingressrules" {
type = list(number)
default = [80, 443, 22]
}
...
resource "aws_instance" "jenkins" {
ami = data.aws_ami.ubuntu.id
instance_type = "t2.micro"
security_groups = [aws_security_group.web_traffic.name]
key_name = "kluu"
provisioner "remote-exec" {
inline = [