Skip to content

Instantly share code, notes, and snippets.

View fdaciuk's full-sized avatar
🔥

Fernando Daciuk fdaciuk

🔥
View GitHub Profile
@fdaciuk
fdaciuk / Configuração do ReScript.md
Created April 17, 2021 20:03
Configuração do ReScript

Configuração do ReScript

bsconfig.json:

{
  "name": "my-rescript-app",
  "reason": { "react-jsx": 3 },
  "sources": [
 {
@fdaciuk
fdaciuk / How to use async await without try-catch block.md
Last active October 20, 2023 18:34
How to use async/await without try/catch block

How to use async/await without try/catch block

We can use something like this:

async function resolveToNumber () {
  const promise = Promise.resolve(1)
  const [error, result] = await to(promise)
  console.log(error, result) // [null, 1] -> Here we have the result, and error will be null
}
@fdaciuk
fdaciuk / MongoDB provider para AdonisJS (v4).md
Last active October 29, 2022 15:39
MongoDB provider para AdonisJS (v4)

MongoDB provider para AdonisJS (v4)

Os exemplos abaixo utilizam o Yarn para instalação das dependências, mas se você preferir, pode usar o NPM sem problemas :)

  • Instale o driver do mongo no seu projeto:
yarn add --exact mongodb
@fdaciuk
fdaciuk / sorteio-github.js
Last active December 20, 2020 19:30
Sorteio GitHub (Discussions)
/*
Enquanto o GitHub não libera a API da nova feature de Discussions, vamos fazer o sorteio pelo console mesmo!
Para fazer o sorteio é bem simples:
1. abra a Discussão que você quer fazer o sorteio;
2. cole o código abaixo no seu console;
3. Digite no console `sortear()`.
Obs.: Somente comentários únicos serão contabilizados. Respostas à comentários serão ignoradas.
*/
@fdaciuk
fdaciuk / gnome-terminal-profiles.md
Last active December 4, 2023 19:20
Export / Import Gnome Terminal Profiles

Export Gnome Terminal Profile

List profiles

dconf dump /org/gnome/terminal/legacy/profiles:/

Determine the terminal profile string for the profile you will need. This is the terminal profile that I will export:

@fdaciuk
fdaciuk / app.js
Created October 10, 2018 14:33
React: setState onBlur
import React from 'react'
class App extends React.Component {
state = { cep: '' }
handleBlur = (e) => {
this.setState({ cep: e.target.value })
}
render () {
@fdaciuk
fdaciuk / Create Reducer.md
Created September 17, 2017 00:38
Less boilerplate when create a new reducer on Redux

Create Reducer

Less boilerplate when create a new reducer on Redux

Method:

'use strict'

const createReducer = (initialState, actionHandlers) => {
'use strict'
import React, { PureComponent } from 'react'
import t from 'prop-types'
const loadAsync = (promise) => {
class Async extends PureComponent {
constructor () {
super()
this.state = {