Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
I know how to exit Vim :v

Henrique Barcelos hbarcelos

🤠
I know how to exit Vim :v
View GitHub Profile
@hbarcelos
hbarcelos / README.md
Created Mar 23, 2021
IPFS Cluster Example with IPFS Proxy Enabled
View README.md

This example is adapted from the docker-compose file on IPFS Cluster repo.

It enables the usage of the IPFS Proxy API for clusters.

This API automatically pins content to all nodes in the cluster when /add is called.

@hbarcelos
hbarcelos / RealitioHomeArbitrationProxy.sol
Created Oct 22, 2020
Realitio Home Arbitration Proxy (fixed)
View RealitioHomeArbitrationProxy.sol
// File: src/dependencies/IAMB.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.2;
interface IAMB {
function requireToPassMessage(
address _contract,
bytes memory _data,
uint256 _gas
View keybase.md

Keybase proof

I hereby claim:

  • I am hbarcelos on github.
  • I am hbarcelos (https://keybase.io/hbarcelos) on keybase.
  • I have a public key ASDXXwdVi-W2TfqEWMFIO6V7uEdAvwN1B_bGUG1bk1jj-Qo

To claim this, I am signing this object:

@hbarcelos
hbarcelos / RealitioHomeArbitrationProxy.sol
Created Oct 15, 2020
Cross-chain Realitio Arbitration
View RealitioHomeArbitrationProxy.sol
// SPDX-License-Identifier: MIT
// File: src/dependencies/IAMB.sol
pragma solidity ^0.7.2;
interface IAMB {
function requireToPassMessage(
address _contract,
bytes memory _data,
uint256 _gas
) external returns (bytes32);
@hbarcelos
hbarcelos / README.md
Last active Sep 4, 2020
Reducing boilerplate of watcher sagas in redux-saga
View README.md

How to use

import createWatcherSaga, { TakeType } from './create-watcher-saga.js';

// Act on every counter increment
const watchIncrementSaga = createWatcherSaga({ takeType: TakeType.every }, incrementSaga, 'counter/increment');
// Discard previous user fetches and act only on the latest
const watchFetchUser = createWatcherSaga({ takeType: TakeType.latest }, fetchUserSaga, 'user/fetch');
// Validate sign-up e-mail while the user is typing, but wait the user to have stopped typing for 2 seconds to not flood the server. 
@hbarcelos
hbarcelos / README.md
Last active Jun 11, 2020
RTK vs Nested Immer's Produce
View README.md

This code doesn't quite work. There is an issue with the Immer proxy being revoked.

I didn't have the time to dig into this, so the solution was to not use produce in createStateMachineReducer.

@hbarcelos
hbarcelos / MedianEthUsd.json
Last active May 30, 2020
Getting the USD/ETH price from MakerDAO feed [off-chain only]
View MedianEthUsd.json
[
{
"constant": false,
"inputs": [
{
"internalType": "address",
"name": "usr",
"type": "address"
}
],
@hbarcelos
hbarcelos / FileInput.jsx
Created Dec 10, 2019
Material UI File Input draft
View FileInput.jsx
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 Dec 2, 2019
JS Publications and Podcasts
View Podcasts.md

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 Nov 27, 2019
`react-hook-form` wrapper for Material UI Slider component
View CustomSlider.jsx
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: {