Skip to content

Instantly share code, notes, and snippets.

View thecodermehedi's full-sized avatar
🧑‍💻
Solo Levelling

Mehedi Hasan thecodermehedi

🧑‍💻
Solo Levelling
View GitHub Profile
@thecodermehedi
thecodermehedi / 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:

@thecodermehedi
thecodermehedi / 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

@thecodermehedi
thecodermehedi / 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.

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">