Skip to content

Instantly share code, notes, and snippets.

View fernandocamargo's full-sized avatar
💀
I am the beast I worship

Fernando Camargo Del Buono fernandocamargo

💀
I am the beast I worship
View GitHub Profile
import { object, string } from 'yup';
import { useCallback, useMemo } from 'react';
import { Helmet as Metatags } from 'react-helmet';
import useForm from '../../../../macros/form/macro';
import { Text } from 'components/widgets/fields';
export const validationSchema = object().shape({
email: string().trim().min(3).max(255).email().required(),
password: string().trim().min(10).max(50).required(),
import { useCallback, useEffect, useRef, useState } from 'react'
import { attempt, fail, getInitialState, succeed } from './reducers'
import { Validity } from './helpers'
export default ({ promise }) => {
const { current: controller } = useRef(new AbortController())
const [state, setState] = useState(getInitialState())
const resolve = useCallback(
@fernandocamargo
fernandocamargo / README.md
Last active February 3, 2021 10:56
Trust no one

Usage:

import useAsync from './useAsync';

export const wait5Seconds = new Promise(
  resolve => window.setTimeout(resolve, 5000)
)

export default () => {
 const { resolve, loading } = useAsync({ promise: wait5Seconds })
{
"interview": {
"id": "9771aaf8-eafc-4658-b8ab-1b9eecf2f368",
"candidate": {
"id": "80959d1e-c507-49a2-b965-b3667c7eed48",
"firstName": "Fernando",
"lastName": "Camargo",
"headLine": "Senior Front End",
"photo": {}
},
const LOCAL = { email: "njr@gmail.com", expiredPassword: true };
const DB = {
preferences: { optIn: false },
notifications: { duplicated: true, something: true, fake: false },
bills: [1]
};
const response = (type, res, params) =>
console.log(JSON.stringify({ response: { type, res, params } }, null, 2));
@fernandocamargo
fernandocamargo / urlify.js
Created December 4, 2020 14:31
a e s t h e t i c
const URL = 'domain.com/x/y/z'
const PARAMS = {
firstname: 'firstName',
lastname: 'lastName',
phone: 'phone',
company: 'company',
}
const concat = ({
export const content = [
{ label: 'Item 1' },
{
label: 'Item 2',
children: [
{ label: 'Item 2.1' },
{ label: 'Item 2.2' },
{
label: 'Item 2.3',
children: [
import React from 'react';
import { useForm } from 'hooks';
import settings from './form-settings';
const App = () => {
const {
components: { Form, Submit },
elements: {
const translations = {
x: 'coord_x',
y: 'coord_y',
CodClient: 'id'
};
const vetor = [
{ x: 0, y: 1 },
{ x: 2, y: 1 },
{ x: 4, y: 3 }
const DeviceIMEI = require("react-native-imei");
const formatIMEI = imei =>
String(imei).replace(/(\d{4})?(\d{4})?(\d{4})?(\d{2})/, "$1.$2.$3.$4-");
const getDeviceIMEI = () => {
return DeviceIMEI.getImei().then(imeiList => {
const [IMEI_1, IMEI_2] = imeiList.map(formatIMEI);
this.setState({ IMEI_1, IMEI_2 });