Skip to content

Instantly share code, notes, and snippets.

View issam-seghir's full-sized avatar
🏆
Always Learning - Always Improving ✨

Issam Seghir issam-seghir

🏆
Always Learning - Always Improving ✨
View GitHub Profile
@issam-seghir
issam-seghir / vscode-settings.md
Created July 6, 2024 10:53 — forked from mohokh67/vscode-settings.md
Install italic and customizable font for vscode

Link to Youtube video: https://youtu.be/QxcRmsGHcWY

Manual steps:

  • Download and install Victor Mono font
  • Update VSCode setting as bellow:
    • font size, line height and font weight are optional and you can update them as you prefer
{
  "editor.fontSize": 13,
  "editor.lineHeight": 24,
@issam-seghir
issam-seghir / RHF-server-actions-zod.md
Created May 22, 2024 00:22
this is my implementation with RHF + Zod for both Client + Server side validation with server actions :

this is my implementation with RHF + Zod for both Client + Server side validation with server actions :

"use client";
....
const formSchema = z.object({
        .....
});
    const [loading, setLoading] = useState(false);
@issam-seghir
issam-seghir / fileZodValidation.js
Last active May 2, 2024 14:50
validate a file input with zod
const MAX_FILE_SIZE = 500000;
const ACCEPTED_IMAGE_TYPES = ["image/jpeg", "image/jpg", "image/png", "image/webp"];
const RegistrationSchema = z.object({
profileImage: z
.any()
.refine((files) => files?.length == 1, "Image is required.")
.refine((files) => files?.[0]?.size <= MAX_FILE_SIZE, `Max file size is 5MB.`)
.refine(
(files) => ACCEPTED_IMAGE_TYPES.includes(files?.[0]?.type),

Image source

https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png

Try resize it!

  • ![](https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png | width=100)