Skip to content

Instantly share code, notes, and snippets.

@Wellers0n
Wellers0n / MuiltSelect.tsx
Created January 4, 2023 18:58
MuiltSelect with mui
import { TextField } from '@mui/material';
import Autocomplete from '@mui/material/Autocomplete';
import { useFormikContext } from 'formik';
import React from 'react';
type OptionsValues = {
title: string,
value: string
}
@Wellers0n
Wellers0n / redirect-nextjs-url.ts
Created February 14, 2023 14:30
redirect url nextjs url from http to htttps
if (
PRODUCTION_ENV &&
request.headers.get("x-forwarded-proto") !== "https"
) {
const hostname = request.headers.get("host") || request.nextUrl.hostname;
return NextResponse.redirect(
`https://${hostname}${request.nextUrl.pathname}`
);
}
@Wellers0n
Wellers0n / query-params-nextJS.tsx
Created January 5, 2023 16:23
passing array to query params with nextJS
const { query } = router
const queryParams = {
[field]: [value]?.concat?.(query[field] || [])
}
router.replace({
query: { ...query, ...queryParams },
});
@Wellers0n
Wellers0n / pull-request.yml
Last active December 17, 2022 19:27
pull-request
name: ci
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
env:

Install pyenv

brew update
brew install pyenv

.zsh config

export PYENV_ROOT="$HOME/.pyenv"
@Wellers0n
Wellers0n / docker-compose.yml
Created December 4, 2021 13:09
docker-compose
version: '3.9'
services:
postgres:
image: 'postgres:13'
ports:
- '5432:5432'
volumes:
- postgres:/data/db
environment:
@Wellers0n
Wellers0n / metro.config.js
Created June 30, 2019 23:28
metro config to monorepo
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const path = require('path');
const getWorkspaces = require('get-yarn-workspaces');
const workspaces = getWorkspaces(__dirname);

Github Two-Factor Authentication (2FA) for Brazil via SMS

The Github doesn't provide country code for Brazil (+55). To add this option, just run the code below in your console:


🇧🇷 [pt-BR]

Autenticação em dois fatores (2FA) do GitHub para o Brasil via SMS

@Wellers0n
Wellers0n / setup-jest.js
Last active January 20, 2021 17:46
jest setup
import React, { useState } from 'react'
import Sidebar from './Sidebar'
import Edit from './Edit'
import { render, waitForElement, fireEvent } from '@testing-library/react';
describe('Component sidebar tests', () => {
const setup = () => {