Skip to content

Instantly share code, notes, and snippets.

View m3h3d1ha2an's full-sized avatar
💪
A servant of the Almighty, building with intention.

Mehedi Hasan m3h3d1ha2an

💪
A servant of the Almighty, building with intention.
View GitHub Profile
@m3h3d1ha2an
m3h3d1ha2an / how to have zero mege commits with git.md
Last active May 20, 2025 08:00
If you want zero merge commits and a perfectly linear history, here's your git workflow scenario ( example , main is release branch, and dev is developerment)

1. Make Sure Everything Is Up to Date

git switch dev
git pull origin dev
git switch main
git pull origin main

2. Rebase dev onto main

This puts all your dev commits “on top of” main, making the history linear and avoiding merge commits.

A Modern Way to Create a Dialog or Modal Without JavaScript (Pure HTML and CSS Only) in 2025

This example demonstrates how to build a fully functional dialog/modal using only HTML and CSS.

HTML Structure

<!-- HTML Structure for the Dialog -->
<input type="checkbox" id="dialog-toggle" class="hidden">
<label for="dialog-toggle" class="dialog-open">Open</label>
<div class="dialog-backdrop">
@m3h3d1ha2an
m3h3d1ha2an / solution.md
Last active April 10, 2025 07:02
browser-external:events:9 Module "events" has been externalized for browser compatibility. Cannot access "events.EventEmitter" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
@m3h3d1ha2an
m3h3d1ha2an / postgresql_plus_arch-linux.md
Created March 14, 2025 00:02 — forked from NickMcSweeney/postgresql_plus_arch-linux.md
Getting postgresql running on Arch Linux

Setup Postgresql

run postgresql with systemctl

Install postgres

latest

sudo pacman -S postgresql

specific version

find version & build from source

@m3h3d1ha2an
m3h3d1ha2an / property-user-does-not-exist-on-type-requestparamsdictionary-any-any-parsedqs-recordstring-any.md
Last active March 30, 2025 23:44
Problem: Property 'user' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'

Problem: Property 'user' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'

When working with Express and jsonwebtoken, it's better to use res.locals to store user-related data rather than modifying the req object directly. This approach adheres to best practices and avoids potential issues with modifying the req object.

Here’s why:

  1. Separation of Concerns: res.locals is designed for passing data to subsequent middleware or templates. It keeps the request object clean and unmodified.
  2. Middleware-Safe: Using res.locals ensures that the data is available to other middleware without interfering with the original request object.

Instead of:

@m3h3d1ha2an
m3h3d1ha2an / gensecret.md
Created March 4, 2025 15:10
JWT Secret Generator With NodeJS One Line command
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))" | wl-copy
@m3h3d1ha2an
m3h3d1ha2an / .zshrc
Created February 20, 2025 02:17 — forked from unyo/.zshrc
.zshrc with fnm
# fnm
eval "$(fnm env)"
# add fnm autocomplete
fnm completions --shell=zsh > ~/.config/zsh/completions/_fnm # you can run this once and then comment out
fpath+=~/.config/zsh/completions/_fnm
autoload -U compinit
compinit
# autoload .nvmrc
@m3h3d1ha2an
m3h3d1ha2an / visualize-react-renders.md
Last active January 27, 2025 14:00
Add the following link to your index.html of react codebase to see renders on project ui in browser
<script src="https://unpkg.com/react-scan/dist/auto.global.js"></script>