Skip to content

Instantly share code, notes, and snippets.

View timveletta's full-sized avatar
🚀

Tim Veletta timveletta

🚀
View GitHub Profile
@timveletta
timveletta / hosting-stack.ts
Last active July 10, 2023 21:36
Static site hosting with AWS CDK
import { Stack, Construct, StackProps, CfnOutput } from "@aws-cdk/core";
import {
HostedZone,
IHostedZone,
ARecord,
RecordTarget,
} from "@aws-cdk/aws-route53";
import { CloudFrontTarget } from "@aws-cdk/aws-route53-targets";
import { BucketProps, BlockPublicAccess, Bucket } from "@aws-cdk/aws-s3";
import {
@timveletta
timveletta / react-state-in-cleanup.js
Created July 13, 2020 09:44
How to access React state when cleaning up your component with hooks.
const [value, setValue] = useState();
const valueRef = useRef();
useEffect(() => {
valueRef.current = value;
}, [value]);
useEffect(() => {
return function cleanup () {
console.log(valueRef.current)
@timveletta
timveletta / Node CI GitHub Action
Last active August 31, 2019 13:19
Building and deploying a static site to AWS S3 and CloudFront
name: CI/CD
on: [push, pull_request]
jobs:
run-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]