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 / CaretAnimated.tsx
Last active June 6, 2024 13:23
useAnimatedCollapse
import Animated, { SharedValue, interpolate, useAnimatedStyle } from 'react-native-reanimated';
import CaretUp from '~/assets/images/icons/CaretUp';
export const CaretAnimated = ({
isCollapsible,
hidden,
}: {
isCollapsible: SharedValue<number>;
hidden?: boolean;
@kibolho
kibolho / NotificationProvider.tsx
Last active May 29, 2024 22:36
Handle Notification on React Native using expo
import messaging, { FirebaseMessagingTypes } from '@react-native-firebase/messaging';
import * as Notifications from 'expo-notifications';
import { router } from 'expo-router';
import React, { createContext, useContext, useEffect } from 'react';
import { Linking, PermissionsAndroid, Platform } from 'react-native';
import { usePlatforms } from './platformsProvider';
import useLocalStorage from '@/hooks/useLocalStorage';
import { StorageKeys } from '@/infra/storage/storageKeys';
@kibolho
kibolho / getS3PreSignedUrl.ts
Last active May 28, 2024 13:48
Upload to AWS S3 using Django, Boto3 and S3Direct
import { httpClient } from '@/infra/http';
import { HttpStatusCode } from '@/infra/http/http-client';
import { logErrorSentry } from '@/infra/monitoring/sentry';
import { generateRandomUUID } from '@/utils/uuid';
export const getS3PreSignedUrl = async ({
token,
dest = 'client_destination',
name = generateRandomUUID(),
type = 'video/quicktime',
@kibolho
kibolho / rfc-template.md
Last active May 8, 2024 01:19
RFC Template

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
Approval (GENERATED UPON APPROVAL)
@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 November 10, 2024 09:09
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: