Skip to content

Instantly share code, notes, and snippets.

View codigoconjuan's full-sized avatar

Juan Pablo De la torre Valdez codigoconjuan

View GitHub Profile
@codigoconjuan
codigoconjuan / app.js
Last active August 12, 2024 22:18
Picture con imágenes AVIF y WEBP
imagen.innerHTML = `
<source srcset="build/img/gallery/thumb/${i}.avif" type="image/avif">
<source srcset="build/img/gallery/thumb/${i}.webp" type="image/webp">
<img loading="lazy" width="200" height="300" src="build/img/gallery/thumb/${i}.jpg" alt="imagen galeria">
`;
@codigoconjuan
codigoconjuan / gulpfile.js
Last active September 26, 2024 23:59
Convertir Imagenes a Webp
export async function imagenes(done) {
const srcDir = './src/img';
const buildDir = './build/img';
const images = await glob('./src/img/**/*{jpg,png}')
images.forEach(file => {
const relativePath = path.relative(srcDir, path.dirname(file));
const outputSubDir = path.join(buildDir, relativePath);
procesarImagenes(file, outputSubDir);
@codigoconjuan
codigoconjuan / gulpfile.js
Created April 21, 2024 18:52
Crop Imagenes
export async function crop(done) {
const inputFolder = 'src/img/gallery/full'
const outputFolder = 'src/img/gallery/thumb';
const width = 250;
const height = 180;
if (!fs.existsSync(outputFolder)) {
fs.mkdirSync(outputFolder, { recursive: true })
}
@codigoconjuan
codigoconjuan / index.html
Created April 18, 2024 19:31
Boletos Festival de Música
<section id="boletos" class="contenedor-boletos">
<h3>Boletos</h3>
<div class="boletos">
<div class="pase">
<p class="pase-nombre">Pase 1 Día</p>
<header class="pase-header">
<p>Incluye</p>
</header>
<div class="pase-body">
@codigoconjuan
codigoconjuan / index.html
Created April 18, 2024 18:56
Lineup Festival Música
<section id="lineup" class="lineup">
<h3>Line Up</h3>
<p class="dia">Viernes 21</p>
<div class="escenarios-contenedor contenedor">
<div class="escenario bg-amarillo">
<p class="nombre-escenario">Techno</p>
<ul class="calendario">
<li>
@codigoconjuan
codigoconjuan / _globales.scss
Last active August 23, 2024 22:10
Estilos Globales para Festival de Música
@use 'variables' as v;
html {
font-size: 62.5%;
box-sizing: border-box;
scroll-padding-top: 0rem;
}
*,
*:before,
*:after {
@codigoconjuan
codigoconjuan / _variables.scss
Created April 16, 2024 23:48
Variables para Festival de Techno y EDM 2024
// Colores
$verde:#4CB8B3;
$rosa: #F53756;
$amarillo: #fdda00;
$morado: #752F97;
$negro: #000000;
$blanco: #FFFFFF;
@codigoconjuan
codigoconjuan / index.ts
Last active July 13, 2024 22:38
Schema de Validación de ZOD para Productos
export const ProductSchema = z.object({
name: z.string()
.trim()
.min(1, { message: 'El Nombre del Producto no puede ir vacio'}),
price: z.string()
.trim()
.transform((value) => parseFloat(value))
.refine((value) => value > 0, { message: 'Precio no válido' })
.or(z.number().min(1, {message: 'La Categoría es Obligatoria' })),
categoryId: z.string()
@codigoconjuan
codigoconjuan / ProductForm.tsx
Last active July 12, 2024 19:17
Formulario para Productos
export default async function ProductForm() {
return (
<>
<div className="space-y-2">
<label
className="text-slate-800"
htmlFor="name"
>Nombre:</label>
@codigoconjuan
codigoconjuan / ProductTable.tsx
Last active July 11, 2024 19:19
Tabla de Productos
export default function ProductTable() {
return (
<div className="px-4 sm:px-6 lg:px-8 mt-20">
<div className="mt-8 flow-root ">
<div className="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div className="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8 bg-white p-5 ">
<table className="min-w-full divide-y divide-gray-300 ">
<thead>
<tr>
<th scope="col" className="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-0">