Skip to content

Instantly share code, notes, and snippets.

@paulwongx
paulwongx / announcements.tsx
Created March 28, 2023 00:18
dnd-kit Announcements with chalk
// This file adds coloring to the announcements to make it easier to read and understand what's going on
import {
DragCancelEvent,
DragEndEvent,
DragMoveEvent,
DragOverEvent,
DragStartEvent,
useDndMonitor,
} from "@dnd-kit/core";
@paulwongx
paulwongx / postgres_commands.md
Last active April 23, 2023 22:49
SQL Command Cheatsheet - PostgreSQL
@paulwongx
paulwongx / turborepo.md
Last active June 5, 2023 22:46
Standard Operating Procedures

Turborepo

Creating a new app with tailwindcss

  1. cd apps
  2. npx create-next-app@latest
  3. Add globals.css inside apps
  4. Change .eslintrc.json to .eslintrc.js
module.exports = {
  root: true,
@paulwongx
paulwongx / s3_bucket_policy.json
Last active June 23, 2023 21:08
s3 Bucket Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:GetObjectAcl",
"s3:GetObject",
"s3:DeleteObject",
@paulwongx
paulwongx / dashboard_sidebar.html
Created September 1, 2023 20:48
Tailwind Gists
<div class="flex h-screen w-full flex-col bg-green-50">
<div class="h-[72px] w-full bg-green-100">Header</div>
<div id="body" class="flex flex-row">
<div id="sidebar" class="flex-0 scrollbar h-[calc(100vh-72px)] w-64 bg-green-200 flex flex-col">
<div id="top-sidebar" class="flex flex-col bg-red-50">
<div>Menu 1</div>
<div>Menu 2</div>
<div>Menu 3</div>
</div>
@paulwongx
paulwongx / git-commands.md
Last active December 1, 2023 18:45
Git Commands

Git Commands

# Checking out a new branch
git checkout -b <branch-name>
git checkout -b feature/my-feature

# Commiting a branch
git add .
git commit -m "Your commit message here"
git push origin <branch-name>
@paulwongx
paulwongx / deploy.yaml
Created September 23, 2023 01:58
Github Actions Workflows
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
@paulwongx
paulwongx / object-oriented-programing.md
Created October 18, 2023 18:02
Object Oriented Programming (OOP) Notes

Object Oriented Programming

SOLID Principles

  • Single Responsibility Principle (SRP)
  • Open/Closed Principle (OCP)
  • Liskov Substitution Principle (LSP)
  • Interface Segregation Principle (ISP)
  • Dependency Inversion Principle (DIP)
@paulwongx
paulwongx / cql_example.md
Last active November 18, 2023 18:56
CQL Example
-- CQLSH

-- creating keyspace
CREATE KEYSPACE dev_db WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = 'true';

-- consistency
CONSISTENCY; -- Current consistency level is LOCAL_QUORUM.
CONSISTENCY ONE; -- OK for one node
CONSISTENCY QUORUM; -- Best for multiple nodes at high replication factor of ~3
@paulwongx
paulwongx / index.html
Created November 30, 2023 16:57
Object Detection
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Camera</title>
<!-- Load TensorFlow.js. This is required to use coco-ssd model. -->
<script defer src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"> </script>
<!-- Load the coco-ssd model. -->