Skip to content

Instantly share code, notes, and snippets.

View Pablets's full-sized avatar
馃彔
Working from home

Pablo Godoy Pablets

馃彔
Working from home
View GitHub Profile
@Pablets
Pablets / zodValidations.md
Last active September 1, 2023 01:42
zod regexps
import { isValidPhoneNumber } from 'libphonenumber-js';
import { z } from 'zod';

export const passwordValidation = z.string()
  .min(8, 'Must have at least 8 characters')
  .regex(/(?=.*[A-Z])/, 'At least one uppercase character')
  .regex(/(?=.*[a-z])/, 'At least one lowercase character')
  .regex(/^[^ ]+$/, 'No spaces allowed')
  .regex(/(?=.*\d)/, 'At least one number');
@Pablets
Pablets / gradients.md
Last active May 3, 2023 20:24
radial gradient posibilities
    background="
    radial-gradient(
    ellipse 172% 40% at 25% 75%,
    rgba(126,30,153,1) 0%,
    rgba(126,30,153,.4) 40%,
    rgba(229,229,229,0) 60%),

    radial-gradient(ellipse at center,
 rgba(30,153,149,1) 0%,
@Pablets
Pablets / Text.styled.tsx
Last active March 1, 2023 12:45
Text component with styled-components and theme support
import styled from "styled-components";
import { FontWeights, Typography, TextDecorations } from "theme/theme";
type StyledTextProps = {
weigth: FontWeights;
typography: Typography;
textDecoration?: TextDecorations;
color?: string;
};

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

  • redux/
    • store.ts
    • storeTypes.ts
    • reducers/
      • sample/
        • sampleReducer.ts聽// Manejo de estado
        • sampleState.ts聽// Declaraci贸n de la interface del estado y聽 declaraci贸n del estado inicial聽
        • sampleTypes.ts聽// action types (constantes)
        • sampleAction.ts聽// Action dispatchers y creators (primero creators, y dispatchers al final)
  • index.ts聽//combine reducer
/*
* Custom timeout
*
* La complejidad de la soluci贸n viene de la necesidad de poder demostrar que
* funciona con la implementaci贸n de un custom setInterval.
*
* Su utilizaci贸n es similiar a setTimeout():
*
* setTimeout(cb, ms)
*
@Pablets
Pablets / addresses.md
Last active December 8, 2021 16:39
ethereum

0x28a99b6C5cB10572A8484260606f17a2103e00A3

ABI:

[{"constant":true,"inputs":[],"name":"manager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pickWinner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getPlayers","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"enter","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"players","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]

contract deployed at:

0x02D571f36F63A2d7a5296717BAf65765CC93431c

@Pablets
Pablets / README.txt
Last active December 8, 2021 01:19
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@Pablets
Pablets / pm2.md
Last active September 21, 2021 19:11
Descripci贸n de scripts PM2

Use pm2 logs index [--lines 1000] to display logs

Use describe <name | id> describe all parameters of a process

Use pm2 env 0 to display environment variables

Use pm2 monit to monitor CPU and Memory usage index

Use pm2 stop <name> to stop a specific process