Skip to content

Instantly share code, notes, and snippets.

View garzuze's full-sized avatar
:octocat:

Lucas Garzuze Cordeiro garzuze

:octocat:
View GitHub Profile
@garzuze
garzuze / is-not-blank.validator.ts
Created September 29, 2025 14:47
Not Blank custom validator for class-validator -> does not allow empty strings nor strings with empty characters
import {
registerDecorator,
ValidationArguments,
ValidationOptions,
ValidatorConstraint,
ValidatorConstraintInterface,
} from 'class-validator';
@ValidatorConstraint({ name: 'isNotBlank', async: false })
export class IsNotBlankConstraint implements ValidatorConstraintInterface {
@garzuze
garzuze / solution.md
Created September 5, 2025 12:58
How to solve pnpm not being installed with npm

If you get an error like this:

C:\Program Files\nodejs\node_modules\corepack\dist\lib\corepack.cjs:21535
  if (key == null || signature == null) throw new Error(`Cannot find matching keyid: ${JSON.stringify({ signatures, keys })}`);
                                              ^

Or

bash: pnpm: command not found
@garzuze
garzuze / serializers.py
Created February 26, 2025 10:07
How to create an email verification system without having to add any extra field in your user model - Django
# Create a User registration serializer
# When the user sends the request with his data — in this case, email and password —,
# we create a new user with is_verified=False (builtin field in default user model)
# Then we send an email containing a verification link
# You can customize it so you link points to a route in your fronted, if you use Django only for the backend
# After that you can create a view that uses this serializer
from django.urls import reverse
from rest_framework import serializers
from django.core.mail import send_mail
from django.conf import settings