Skip to content

Instantly share code, notes, and snippets.

@raelsei
raelsei / docker-compose.yml
Created July 8, 2025 10:54
Postal Mail Compose File
version: '3.8'
services:
postal-mariadb:
image: mariadb:latest
container_name: postal-mariadb
restart: unless-stopped
environment:
MARIADB_ROOT_PASSWORD: postal-root-password
MARIADB_DATABASE: postal
Feature Zustand Redux Toolkit
Size ~2KB minified ~10-15KB (with dependencies)
Learning Curve Super easy, hook-based Moderate, Redux concepts required
Boilerplate Barely any Manageable, but more than Zustand
State Model Flexible, object-based Normalized, reducer-based
DevTools Lightweight, built-in Robust, with time-travel debugging
Async Handling Manual or via middleware Streamlined with createAsyncThunk
TypeScript Support Awesome, minimal setup Awesome, with strong type inference
Best For Small to medium apps, quick wins Large apps, complex state
@raelsei
raelsei / button.style.ts
Last active March 3, 2023 10:44
Tailwind Button with theme example
export const inputVariant = {
primary: 'input-primary',
secondary: 'input-secondary',
accent: 'input-accent',
ghost: 'input-ghost',
}
export const inputSize = {
xs: 'input-xs',
sm: 'input-sm',
@raelsei
raelsei / axios-wrapper.ts
Last active August 13, 2024 23:02
Axios Hook
import { AxiosRequestConfig, default as _axios } from 'axios'
const instance = _axios.create({})
export const axios = async ({
method,
url,
data,
...rest
}: AxiosRequestConfig) => {

🚀 Purpose

This MR addresses the issue of [insert issue or goal here] by [insert what the changes do].

🎯 Related Issues/Merge Requests

🔍 Changes

  • [Insert specific changes here, using bullet points]
import { useState, useDeferredValue } from 'react';
function Example() {
const [name, setName] = useState('');
const [age, setAge] = useState('');
const deferredFormData = useDeferredValue({ name, age }, { timeoutMs: 500 });
const handleSubmit = () => {
// Submit the form data using the deferredFormData value
console.log(`Submitting form data: ${JSON.stringify(deferredFormData)}`);
@raelsei
raelsei / default
Created November 30, 2022 20:03
NGINX Default Configuration File
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
import { merge } from 'utils';
//with lodash
import merge from 'lodash/merge';
import { generateRandomFloatInRange, getCurrentTime, generateRandomIntInRange} from './utils';
const getCurrentTimeString = () => {
return `Current Time: ${getCurrentTime()}`
}
@raelsei
raelsei / regex.js
Last active September 18, 2022 15:15
REGEX
export const PHONE_NUMBER_NORMALIZE_REGEX = /^(0)|[^0-9]/g;
. Only use with protune, max iso 1200 30fps 1/60 shutter