Skip to content

Instantly share code, notes, and snippets.

View Edlavio's full-sized avatar
🎯
Focusing

Pedro Alberto Edlavio

🎯
Focusing
View GitHub Profile
@Edlavio
Edlavio / Postman.desktop
Last active February 9, 2024 10:45
Postman config for Linux
[Desktop Entry]
Name=Postman
GenericName=Postman Client
Exec=/opt/Postman/app/Postman %u
Icon=/opt/Postman/app/icons/icon_128x128.png
@Edlavio
Edlavio / .htaccess
Created February 9, 2024 10:42
Solves the problem of multi routes or dynamic routes that more robust servers have when deploying projects with React
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
@Edlavio
Edlavio / _redirects
Created February 9, 2024 10:44
Solves the redirection problem that some servers have when they cannot find the index.html, *it has to be in the public folder for it to work.
/* /index.html 200
@Edlavio
Edlavio / imageSchema.ts
Last active September 7, 2024 16:34
Image validation using Zod
import { z } from 'zod';
const MAX_FILE_SIZE = 1024 * 1024 * 1;
const ACCEPTED_IMAGE_MIME_TYPES = [
'image/jpeg',
'image/jpg',
'image/png',
];
export const imageSchema = z.object({
@Edlavio
Edlavio / custom-post.ts
Created April 7, 2025 02:47
Custom route in Strapi - To get a blog post by slug
// src/api/post/routes/custom-post.ts
module.exports = {
routes: [
{
method: 'GET',
path: '/posts/slug/:slug',
handler: 'post.findOneBySlug',
config: {
policies: [],