Make sure to install the following dependencies for the best experience.
npm install --save tslib
npm install --save-dev typescript
npm install --save-dev ts-node
import low from 'lowdb' | |
import FileSync from 'lowdb/adapters/FileSync' | |
export const database = <T> (defaults: T) => { | |
const adapter = new FileSync<T>('db.json') | |
const db = low(adapter) | |
db.defaults(defaults).write() | |
return db | |
} |
whoami # run some command | |
echo $? # show the exit status code result of the command |
// This lets you emit and listen for events in a type-safe manner | |
// Awesome! | |
import { EventEmitter } from 'events' | |
type Type<Name> = { type: Name } | |
type Value<Type> = { value: Type } | |
export type TypedValue<T, V> = Type<T> & Value<V> |
locals { | |
region = "us-east-1" | |
namespace = "infrastructure" | |
} | |
provider "aws" { | |
region = local.region | |
} | |
module "vpc" { |
#!/usr/bin/env node | |
/* The API routes and middlewares */ | |
const server = () => import('express').then(({ default: express }) => { | |
const app = express() | |
app.get('/hello', (req, res) => { | |
res.json({ message: 'Hey there!' }) | |
}) | |
return app | |
}) |
# https://stackoverflow.com/questions/3349105/how-to-set-current-working-directory-to-the-directory-of-the-script-in-bash | |
cd "${0%/*}" |
// make sure you `npm install twilio` before you run | |
const config = { | |
// get your credentials from the twilio console: www.twilio.com/console | |
// can also be configured as environment variables instead | |
accountSid: '<twilio account sid>', | |
authToken: '<twilio auth token>', | |
// on a twilio trial account, you can only send from and to confirmed or purchased numbers | |
// upgrade your account to send to any number | |
from: '+10000000000', |