Skip to content

Instantly share code, notes, and snippets.

@ironbyte
ironbyte / seed_drizzle_zod_faker.ts
Last active March 18, 2024 00:12
TS Seed Script: Drizzle ORM + Zod + Faker (Minimal)
// tsx seed.ts
import { faker } from '@faker-js/faker';
import { pgTable, text, varchar, timestamp } from 'drizzle-orm/pg-core';
import { drizzle, PostgresJsDatabase } from 'drizzle-orm/postgres-js';
import { createInsertSchema } from 'drizzle-zod';
import { customAlphabet } from 'nanoid';
import postgres from 'postgres';
import { z } from 'zod';
@ironbyte
ironbyte / esm-package.md
Created July 26, 2023 11:14 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ironbyte
ironbyte / .gitignore
Created December 11, 2021 05:17
.gitignore (React/Yarn/VSCode)
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
@ironbyte
ironbyte / aws-s3-policy.json
Created February 27, 2021 08:57
Note: Replace <BUCKET_NAME> with your bucket name
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ConsoleAccess",
"Effect": "Allow",
"Action": [
"s3:GetAccountPublicAccessBlock",
"s3:GetBucketAcl",
"s3:GetBucketLocation",
@ironbyte
ironbyte / backup_git_repo.sh
Created February 14, 2021 14:43
Backup a local GIT repository
#!/bin/sh
set -e
REPOSITORY_NAME=$(basename `git rev-parse --show-toplevel`)
BUNDLE_FILENAME=${REPOSITORY_NAME}_`date +%d-%m-%Y""%H%M_%S`.git.bundle
git bundle create $BUNDLE_FILENAME develop master production
@ironbyte
ironbyte / restore.sh
Created January 5, 2021 09:03 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@ironbyte
ironbyte / restore.sh
Created January 5, 2021 09:03 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
#!/bin/sh
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ 'master' = ${current_branch} ]
then
echo "ERROR: Not allowed to push to master."
exit 1;
else
exit 0;
@ironbyte
ironbyte / CONTRIBUTING.md
Created March 4, 2020 16:22
Contributor guide (Moncy Gopalan)

Project Contributor Guide

Style guide

The codebase adheres to the following style guides and is enforced using ESLINT:

@ironbyte
ironbyte / New 52 - Reading Order Part Two
Last active October 31, 2019 06:15
New 52 - Reading Order Part Two (October 2019) - Edited by me
Justice League Dark #9
Justice League Dark #10
Justice League Dark #11
Justice League Dark #12
Justice League Dark #13
Justice League Dark Annual #1 (2012)
Justice League Vol. 2 #8
Justice League Dark #14
Justice League Dark #15
Justice League Dark #16