Skip to content

Instantly share code, notes, and snippets.

View yuritoledo's full-sized avatar
🌌

Yuri Toledo yuritoledo

🌌
View GitHub Profile
@ThePredators
ThePredators / readme-mde.md
Last active March 2, 2025 03:55
Setup Mobile Development Environment

⭐ Setup Mobile Development Environment

⚠️ The following configuration has been tested on Intel, M1 & M2 Ships ⚠️

Pre-requisit :

If you have any issues with macOS, or need anything related to it check this documentation

Install Xcode Command Line tools :

@sibelius
sibelius / useMemoArray.tsx
Created February 10, 2020 12:22
useMemo for arrays
const arrayCompare = (a: string[], b: string[]) => {
if (a.length !== b.length) {
return false;
}
for (const item of a) {
if (b.indexOf(item) === -1) {
return false;
}
}
@yuritoledo
yuritoledo / formatReal.js
Created December 16, 2019 12:44
Formatar número para moeda Real
Number(5).toLocaleString('pt-BR', {style: 'currency',currency: 'BRL'})
// {...}
<div>
<form>
<input placeholder="Name" {...formik.getFieldProps("name")} />
<br />
<input placeholder="Email" {...formik.getFieldProps("email")} />
<br />
<input placeholder="Password" {...formik.getFieldProps("password")} />
<br />
<input
import React from "react";
import { useFormik } from "formik";
const initialValues = {
name: "",
email: "",
address: {
street: "",
number: "",
city: ""
@yuritoledo
yuritoledo / gist:f6dadb8deacf898d168c07f239e105cf
Created October 14, 2019 23:52
Remover acentos javascript es6
const removeAcentos = str => str.normalize('NFD').replace(/[\u0300-\u036f]/g, "")
@yuritoledo
yuritoledo / eslint.json
Created October 9, 2019 15:16
eslint react para typescript
{
"env": {
"browser": true,
"es6": true,
"jest": true
},
"settings": {
"react": {
"version": "detect"
}
@yuritoledo
yuritoledo / .rotate-image64.js
Created August 13, 2019 20:12
Rotate image and get new base64
const convert = (src, goToRight) => {
const img = new Image()
const canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')
img.crossOrigin = 'Anonymous'
img.onload = () => {
canvas.width = img.width
canvas.height = img.height
goToRight
? ctx.transform(0, -1, 1, 0, 0, img.height)
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
export function cpfMask (value) {
return value
.replace(/\D/g, '')
.replace(/(\d{3})(\d)/, '$1.$2')
.replace(/(\d{3})(\d)/, '$1.$2')
.replace(/(\d{3})(\d{1,2})/, '$1-$2')
.replace(/(-\d{2})\d+?$/, '$1')
}
export function cnpjMask (value) {