Skip to content

Instantly share code, notes, and snippets.

View hbarcelos's full-sized avatar
🕶️
I know how to exit Vim :v

Henrique Barcelos hbarcelos

🕶️
I know how to exit Vim :v
View GitHub Profile
@hbarcelos
hbarcelos / MedianEthUsd.json
Last active May 30, 2020 04:37
Getting the USD/ETH price from MakerDAO feed [off-chain only]
[
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "usr",
"type": "address"
}
],
@hbarcelos
hbarcelos / FileInput.jsx
Created December 10, 2019 18:31
Material UI File Input draft
import React, { useState, useCallback } from 'react';
import t from 'prop-types';
import clsx from 'clsx';
import { makeStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import Input from '@material-ui/core/Input';
import FormHelperText from '@material-ui/core/FormHelperText';
import AttachmentIcon from '@material-ui/icons/Attachment';
import { toMegaBytes } from '../../format';
@hbarcelos
hbarcelos / Podcasts.md
Created December 2, 2019 14:25
JS Publications and Podcasts

Podcasts

  • Shop Talk Show
  • The Changelog
  • Syntax
  • JS Party
  • JavaScript Jabber
  • Full Stack Radio
  • Front End Happy Hour
  • JAMstack Radio
@hbarcelos
hbarcelos / CustomSlider.jsx
Created November 27, 2019 22:19
`react-hook-form` wrapper for Material UI Slider component
import React, { useEffect, useCallback, useState, useMemo } from 'react';
import t from 'prop-types';
import clsx from 'clsx';
import { makeStyles } from '@material-ui/core/styles';
import Box from '@material-ui/core/Box';
import Slider from '@material-ui/core/Slider';
const useStyles = makeStyles(theme => ({
sliderWrapper: {},
sliderLabel: {
@hbarcelos
hbarcelos / buidler.config.ts
Last active October 29, 2019 20:42
Buidler + Waffle + Ethers on Node >= 12
import { ethers } from "@nomiclabs/buidler";
import { task, usePlugin, BuidlerConfig } from "@nomiclabs/buidler/config";
import { getWallets, defaultAccounts } from "ethereum-waffle";
usePlugin("@nomiclabs/buidler-ethers");
task("accounts", "Prints the list of accounts", async (taskArgs, env) => {
const accounts = await getWallets(ethers.provider);
for (const account of accounts) {
@hbarcelos
hbarcelos / #1
Last active July 1, 2019 01:03
Kleros Questions
1) How and where do you like to work?
I currently live in São Paulo, Brazil. I am open to moving to Lisbon, but it could take a while, so for now I'd choose to work remotely.
[
{
"constant": false,
"inputs": [
{
"name": "_pinakion",
"type": "address"
}
],
"name": "changePinakion",
@hbarcelos
hbarcelos / app.js
Created August 25, 2018 22:37
Contextual Logger - Example Integration
const express = require('express');
const cuid = require('cuid');
const createLogger = require('./logger.js');
const PORT = Number(process.env.PORT) || 8080;
function clsRequestId(namespace, generateId) {
return (req, res, next) => {
const requestId = req.get('X-Request-Id') || generateId();
@hbarcelos
hbarcelos / logger.js.diff
Last active August 25, 2018 22:27
Contextual Logger - Performance Refactor
diff --git a/logger.js b/logger.js
index d19e435..decb76b 100644
--- a/logger.js
+++ b/logger.js
@@ -1,8 +1,6 @@
const pino = require('pino');
const { createNamespace } = require('cls-hooked');
-const logMethods = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'];
-
@hbarcelos
hbarcelos / logger.js.diff
Created August 25, 2018 21:58
Contextual Logger - Propagating changes to children
diff --git a/logger.js b/logger.js
index d19e435..d2740cd 100644
--- a/logger.js
+++ b/logger.js
@@ -1,8 +1,6 @@
const pino = require('pino');
const { createNamespace } = require('cls-hooked');
-const logMethods = ['trace', 'debug', 'info', 'warn', 'error', 'fatal'];
-