Skip to content

Instantly share code, notes, and snippets.

View HenriqueSilverio's full-sized avatar
🎯
Focusing

Henrique Silvério HenriqueSilverio

🎯
Focusing
View GitHub Profile
@HenriqueSilverio
HenriqueSilverio / express-async-handler.js
Last active December 23, 2021 16:14
Utility for Express.js < 5
const asyncHandler = (fn) => (
(req, res, next) => {
Promise.resolve(fn(req, res, next))
.catch(next)
}
)
export default asyncHandler
/**
* Scenario:
* The user requests an account sync
* Given the account
* And the institution of account
* And the user of account
* When the user requests the account sync
* Then a sync is scheduled
* And the sync scheduled event is created
*/

A entrevista é um processo de mão dupla: entrevistador e candidato podem fazer perguntas.

Tecnologia

  • Quais linguagens / frameworks utilizam na stack atual?
  • Qual arquitetura do projeto? Ex: Monolítico, Microsserviços...
  • Qual o processo para enviar código do repositório para produção? Ex: CI/CD, Containers...
  • Qual o processo para adotar / testar novas tecnologias? Ex: Autonomia da equipe, Equilíbrio de objetivos

Processos

const capitalize = (string = '') => {
if (toString.call(string) !== '[object String]') {
return ''
}
const name = string.split(' ')[0]
return name.charAt(0).toUpperCase() + name.slice(1)
}
const cleanup = async () => {
try {
console.log('Cleaning up')
} catch (error) {
console.error(error)
process.exit(1)
}
}
const start = async () => {
// Implementation of Kotlin `String.toByteArray` in JavaScript
// https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-byte-array.html
const UTF8ByteArrayFromString = (string) => {
const encoder = new TextEncoder()
return encoder.encode(string)
}
const stringFromUTF8ByteArray = (array) => {
const decoder = new TextDecoder()
const start = async () => {
try {
throw new Error('Failed to start!')
} catch (err) {
await somethingThrows()
}
}
start()
.catch(err => {
const start = async () => {
throw new Error('Failed to start!')
}
start()
.catch(async err => {
// Precisa de async no catch pra fazer upload de alguma coisa por exemplo...
// Mas por ser async, pode por sua vez dar erro também...
// Então throw novamente...
throw new Error('Failed to catch start error!')
{
"[csv]": {
"files.encoding": "windows1252"
},
"[javascript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.formatOnSave": false
const client = { name: 'RabbitMQ' }
const broker = () => ({
client,
connection: null,
async connect (url) {
if (!this.connection) {
this.connection = `Connected to: ${url}`
}
return this.connection