Skip to content

Instantly share code, notes, and snippets.

View kluu1's full-sized avatar

Kevin Luu kluu1

  • Atlanta, GA
View GitHub Profile
...
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 = [
@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]
}
@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"
let myExampleNumber: number = 23;
myExampleNumber = 'some number'; // This line will throw an error
myExampleNumber = 5; // This line will work
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
});
}
class GeneralError extends Error {
constructor(message) {
super();
this.message = message;
}
getCode() {
if (this instanceof BadRequest) {
return 400;
} if (this instanceof NotFound) {
const express = require('express');
const bodyParser = require('body-parser');
const handleErrors = require('./middleware/handleErrors');
const { BadRequest } = require('./utils/errors');
const app = express();
const port = 3000;
app.use(bodyParser.json());
@kluu1
kluu1 / app.js
Created April 2, 2020 12:47
final
const express = require('express');
const bodyParser = require('body-parser');
const handleErrors = require('./middleware/handleErrors');
const { BadRequest } = require('./utils/errors');
const app = express();
const port = 3000;
app.use(bodyParser.json());
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const port = 3000;
app.use(bodyParser.json());
app.post('/post', async (req, res) => {
const { title, author } = req.body;
@kluu1
kluu1 / db.js
Last active April 2, 2020 10:52
const orders = [
{
userId: 1778,
amount: 600,
createdAt: '1563816223063.0',
},
{
userId: 1781,
amount: 250,
createdAt: '1563965186852.0',