Skip to content

Instantly share code, notes, and snippets.

View 4drian-sanchez's full-sized avatar

Adrian Sanchez 4drian-sanchez

View GitHub Profile
@codigoconjuan
codigoconjuan / index.ts
Last active March 6, 2025 18:22
Gist Express Servidor
import colors from 'colors'
import server from './server'
const port = process.env.PORT || 4000
server.listen(port, () => {
console.log( colors.cyan.bold( `REST API en el puerto ${port}`))
})
@Klerith
Klerith / vite-testing-config.md
Last active May 12, 2025 12:30
Vite + Jest + React Testing Library - Configuraciones a seguir

Instalación y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react 
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
  1. Opcional: Si usamos Fetch API en el proyecto:
@codigoconjuan
codigoconjuan / imagenes.js
Created August 4, 2021 21:43
Gist Soporte Imagenes WebP y Avif como Background
(function (document) {
var checkCount = 0,
formatFound = false;
function setHTMLClass(height, className) {
checkCount++;
if (height == 2) {
formatFound = true;
document.documentElement.className += " " + className;
} else {
@codigoconjuan
codigoconjuan / gist:30973f8e5e7d210e0458bc49a55ad2c4
Last active October 21, 2024 02:57
Gist para Imágenes HTML5 con AVIF, webp y JPG
"imagenes": {
"prefix": "pic",
"body": [
"<picture>",
"<source",
"\t sizes=\"1920w, 1280w, 640w\" ",
"\t srcset=\"img/imagen.avif 1920w, \n\t\t\t img/imagen-1280.avif 1280w, \n\t\t\t img/imagen-640.avif 640w\" ",
"\t type=\"image/avif\">",
"<source",
"\t sizes=\"1920w, 1280w, 640w\" ",