Skip to content

Instantly share code, notes, and snippets.

@chrisbchoi
chrisbchoi / postgres.md
Created October 1, 2022 01:00 — forked from phortuin/postgres.md
Set up postgres + database on MacOS (M1)

Based on this blogpost.

Install with Homebrew:

$ brew install postgresql

Run server:

@chrisbchoi
chrisbchoi / maskDate.js
Created January 6, 2021 09:48 — forked from chrisjpatty/maskDate.js
Javascript date Input mask MM/DD/YYYY
const maskDate = value => {
let v = value.replace(/\D/g,'').slice(0, 10);
if (v.length >= 5) {
return `${v.slice(0,2)}/${v.slice(2,4)}/${v.slice(4)}`;
}
else if (v.length >= 3) {
return `${v.slice(0,2)}/${v.slice(2)}`;
}
return v
}
@chrisbchoi
chrisbchoi / aws-sns-example.js
Created September 26, 2020 08:19 — forked from tmarshall/aws-sns-example.js
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@chrisbchoi
chrisbchoi / gist:2bec7eea80a25810cb98ada7a7992e39
Created April 25, 2019 07:41
How to wire up react project using typescript with CRA
To start a new Create React App project with TypeScript, you can run:
npx create-react-app my-app --typescript
# or
yarn create react-app my-app --typescript
To add TypeScript to a Create React App project, first install it:
npm install --save typescript @types/node @types/react @types/react-dom @types/jest