- Configurar chave SSH
- Criar Droplet
- Realizar update e upgrade
- Crua usuário
adduser deploy
eusermod -aG sudo deploy
- Cria pasta
.ssh
prodeploy
cp ~/.ssh/authorized_keys /home/deploy/.ssh/authorized_keys
chown -R deploy:deploy .ssh/
chmod 700 .ssh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const formatValue = (value: number): string => | |
Intl.NumberFormat('pt-BR', { | |
style: 'currency', | |
currency: 'BRL', | |
}).format(value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @example | |
* | |
* Get "00:20" from 20 or "01:16" from 76 | |
* | |
*/ | |
function stringFromSeconds(seconds: number): string { | |
const date = new Date(0) | |
date.setSeconds(seconds) | |
const [sliceFrom, offset] = seconds >= 3600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Search value in object by concatened string of keys of nested objects. | |
* | |
* @example | |
* | |
* Find street name from object: | |
* | |
* const obj = { | |
* address: { | |
* district: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates an object from a flattenObject. | |
* | |
* @example | |
* | |
* Create following object: | |
* | |
* { | |
* address: { | |
* city: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a flatten object from an any level nested object. | |
* | |
* @example | |
* | |
* Create following object: | |
* | |
* { | |
* 'address.city.name': 'São Paulo', | |
* 'address.state.name': 'SP', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isValidCpf = (cpfValue) => { | |
if (!cpfValue) return false | |
const formatToString = val => { | |
if (Array.isArray(val)) return val.join('') | |
if (typeof val === 'string') return val | |
return null | |
} | |
const cpfString = formatToString(cpfValue) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function cnpjValidation(value) { | |
if (!value) return false | |
// Aceita receber o valor como string, número ou array com todos os dígitos | |
const validTypes = | |
typeof value === 'string' || Number.isInteger(value) || Array.isArray(value) | |
// Elimina valor não em formato inválido | |
if (!validTypes) return false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
export ANDROID_HOME=~/Android/Sdk | |
export PATH="$PATH:$ANDROID_HOME/tools" | |
export PATH="$PATH:$ANDROID_HOME/platform-tools" | |
# Path to your oh-my-zsh installation. | |
export ZSH="/Users/diegofernandes/.oh-my-zsh" | |
export PATH="$PATH:/usr/local/bin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { resolve } = require('path'); | |
module.exports = { | |
env: { | |
browser: true, | |
es6: true, | |
jest: true, | |
}, | |
globals: { | |
Atomics: 'readonly', |