Skip to content

Instantly share code, notes, and snippets.

View kibolho's full-sized avatar
🚀
Working

Abílio Azevedo kibolho

🚀
Working
View GitHub Profile
@kibolho
kibolho / rfc-template.md
Last active April 23, 2024 17:48
RFC Template

Here is the English translation:

RFC Title

Status (Proposed/Accepted/Implemented/Obsolete)
RFC # (GENERATED UPON APPROVAL)
Author(s) Your name (me@example.org), and other (you@example.org)
Obsoletes RFCs this replaces. Remove if none.
Creation MM/DD/YYYY
@kibolho
kibolho / useIsBreakpoint
Created January 22, 2024 22:20
Hook to check breakpoints of tailwind dynamically
import { useMediaQuery } from 'usehooks-ts';
// Define Tailwind's breakpoints
const breakpoints = {
sm: 640,
md: 768,
lg: 1024,
xl: 1280,
'2xl': 1536,
};
@kibolho
kibolho / AuthContext.tsx
Last active August 28, 2023 20:45
Auth0 B2B Contexts and Hooks
'use client';
import {
AppState,
Auth0Provider,
Auth0ProviderOptions,
User as Auth0User,
AuthorizationParams,
useAuth0,
} from '@auth0/auth0-react';
@kibolho
kibolho / AddressForm.tsx
Last active July 17, 2023 12:05
Address Form with Google Autocomplete and React Hook Form
import { zodResolver } from '@hookform/resolvers/zod';
import { Input } from './Input';
import { Controller, useForm } from 'react-hook-form';
import { z } from 'zod';
const addressSchema = z.object({
id: z.string().optional(),
party_id: z.string().nonempty('Party is required'),
address_type: z.nativeEnum(AddressType),
address_line_1: z.string().nonempty('First Line is required').min(3, 'First Line is too short'),
@kibolho
kibolho / chromeOptions.ts
Created June 22, 2023 17:45
Generate Image from HTML
import chrome from 'chrome-aws-lambda';
const chromeExecPaths = {
win32: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
linux: '/usr/bin/google-chrome',
darwin: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
};
const exePath = chromeExecPaths[process.platform];
@kibolho
kibolho / actionDeployToS3.yml
Created March 16, 2023 16:51
Action to deploy to S3
name: Deploy to S3 (Prod)
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
@kibolho
kibolho / stringfy.ts
Last active March 9, 2023 22:07
Stringfy
/* eslint-disable no-bitwise */
interface StringifyOptions {
encoder?: any;
encode?: boolean;
encodeValuesOnly?: boolean;
addQueryPrefix?: boolean;
allowDots?: boolean;
charset?: string;
charsetSentinel?: boolean;
@kibolho
kibolho / removeDependencyFromYarnLock.js
Created December 6, 2022 00:04
Remove dependency from yarn lock
// add to package.json
// "postinstall": "node scripts/removeDependencyFromYarnLock.js"
const fs = require('fs');
const FILE_SRC = 'yarn.lock';
const REPLACE = '';
const replace = (path, opts = 'utf8') =>
new Promise((resolve, reject) => {
@kibolho
kibolho / index.ts
Last active November 22, 2022 17:43
Stringify Objects and Arrays into Query Params
import stringify from './stringfy';
const params = [{"teste": "1"},{"teste": "2"},{"teste": "3"}];
const stringParams = stringify(params, {
encodeValuesOnly: true,
encode: false,
encoder: encodeURIComponent,
addQueryPrefix: true,
});