Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
coding and learning

Bruno Ramires brunormferreira

:octocat:
coding and learning
View GitHub Profile
View poll.js
const poll = ({ fn, validate, interval, maxAttempts }) => {
console.log('Start poll...');
let attempts = 0;
const executePoll = async (resolve, reject) => {
console.log('- poll');
const result = await fn();
attempts++;
if (validate(result)) {
View gist:d7331d48a1367a1bd5ac970f8266fe76
Hi! This works for me.
Just install the font that you want.
Set "editor.fontLigatures": true and "editor.fontLigatures": true in settings.json on VS Code.
Restart your VS Code.
Be happy!
View HOC.js
import React from 'react';
function Counter(props) {
const { counter, setCounter } = props;
return (
<div>
<h1>Functional Component Example for Counter</h1>
<p>We clicked {counter} times</p>
<button onClick={() => setCounter(counter + 1)}>Increase counter</button>
View fetchWrapper.js
const localStorageKey = '__bookshelf_token__'
function client(endpoint, {body, ...customConfig} = {}) {
const token = window.localStorage.getItem(localStorageKey)
const headers = {'content-type': 'application/json'}
if (token) {
headers.Authorization = `Bearer ${token}`
}
const config = {
method: body ? 'POST' : 'GET',
...customConfig,
@brunormferreira
brunormferreira / reduce.js
Last active Feb 19, 2021
This is a exercise to do with Javascript.
View reduce.js
[
{ id: 1, likes: 13, text: 'Lets code in Reactjs for all day long!' },
{ id: 2, likes: 87, text: 'Software Developer is a good choice to your life!' },
{ id: 3, likes: 51, text: 'Make your code readability.' },
{ id: 4, likes: 32, text: 'Open Source Software is the best thing for the developers learn more and more.' },
]
// -> Remove the likes property ->
[
{ id: 1, text: 'Lets code in Reactjs for all day long!' },
{ id: 2, text: 'Software Developer is a good choice to your life!' },
View useChuckNorris.jsx
import { useState, useEffect } from 'react'
export function useChuckNorris() {
const [loading, setLoading] = useState(false)
const [error, setError] = useState(undefined)
const [data, setData] = useState(undefined)
useEffect(() => {
async function getJoke() {
setLoading(true)
View settings.json
{
// Define o tema do VSCode
"workbench.colorTheme": "Shades of Purple",
// Configura tamanho e família da fonte
"editor.fontSize": 18,
"editor.lineHeight": 24,
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"explorer.compactFolders": false,
View react-router-dom-v5.js
import React from "react";
import {
Link,
BrowserRouter as Router,
Route,
Switch,
Redirect
} from "react-router-dom";
import "./App.css";
@brunormferreira
brunormferreira / gist:57bd7f216ef3eb9fee5423056266d8c8
Created Feb 11, 2020 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:57bd7f216ef3eb9fee5423056266d8c8

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
View .editorconfig
root = true
[*]
indent_style = space
end_of_line = lf
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true