Skip to content

Instantly share code, notes, and snippets.

View TomasCuevas's full-sized avatar
馃幆
Focusing

Tom谩s Cuevas TomasCuevas

馃幆
Focusing
View GitHub Profile
@TomasCuevas
TomasCuevas / git-alias.md
Created May 18, 2023 02:14 — forked from Klerith/git-alias.md
Useful Git Alias

Log

git config --global alias.lg "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"

Status

git config --global alias.s status --short

Alternativa 煤til de status

git config --global alias.s status -sb

@TomasCuevas
TomasCuevas / Dockerfile
Created January 19, 2023 16:02 — forked from Klerith/Dockerfile
Preparar imagen de Docker - Node App
# Install dependencies only when needed
FROM node:18-alpine3.15 AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Build the app with cache dependencies
FROM node:18-alpine3.15 AS builder
@TomasCuevas
TomasCuevas / time-since.ts
Created November 11, 2022 16:17 — forked from Klerith/time-since.ts
Fecha de creaci贸n humana
export const timeSince = ( date: string ) => {
const baseDate = new Date(date)
const seconds = Math.floor(( new Date().getTime() - baseDate.getTime() ) / 1000);
let interval = seconds / 31536000;
@TomasCuevas
TomasCuevas / contextAndProvider.tsx
Last active November 18, 2022 14:21
Context and provider para react/typescript
import { createContext, useState } from "react";
//* CONTEXT *//
interface ContextContextProps {
propertie: boolean
method: () => void
}
export const ContextContext = createContext({} as ContextContextProps);
@TomasCuevas
TomasCuevas / html-meta-tag.md
Last active September 8, 2022 21:02
html-meta-tag

Author: nalabdou

Basic HTML Meta Tag

<meta name="keywords" content="your tags" />
<meta name="description" content="150 words" />
<meta name="subject" content="your website's subject">
<meta name="language" content="ES">
<meta name="robots" content="indexfollow" />
const { validationResult } = require("express-validator");
const { request, response } = require("express");
const fieldsValidation = (req = request, res = response, next) => {
const errors = validationResult(req);
if (!errors.isEmpty()) {
return res.status(400).json({
message: errors.errors,
});
@TomasCuevas
TomasCuevas / templateSlice.js
Last active June 27, 2022 15:29 — forked from Klerith/templateSlice.js
Cascaron para crear Redux Slices r谩pidamente
import { createSlice } from '@reduxjs/toolkit';
export const templateSlice = createSlice({
name: 'name',
initialState: {
counter: 10
},
reducers: {
increment: (state, /* action */ ) => {
state.counter += 1;

Instalaci贸n, inicializacion y configuracion de ESLint + Prettier

En proyectos de React+Vite o NodeJs

1. Inicializacion de ESLint en el proyecto:

npx eslint --init 

2. Eleguir las opciones dadas en la configuracion:

@TomasCuevas
TomasCuevas / vite-testing-config.md
Created June 17, 2022 16:02 — forked from Klerith/vite-testing-config.md
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: