Skip to content

Instantly share code, notes, and snippets.

View hugoalmeidahh's full-sized avatar
👨‍💻

Hugo Almeida hugoalmeidahh

👨‍💻
View GitHub Profile
@hugoalmeidahh
hugoalmeidahh / Chrome.md
Created June 23, 2021 03:43 — forked from diego3g/Chrome.md
Ambiente DEV

Extensões

  • React Developer Tools
  • Dracula DevTools Theme
import { useField } from '@rocketseat/unform';
import isFunction from 'lodash/isFunction';
import PropTypes from 'prop-types';
import React, { useEffect, useRef, useMemo } from 'react';
import InputMask from 'react-input-mask';
function Input({ name, label, prepend, append, mask, ...rest }) {
const ref = useRef(null);
const { fieldName, registerField, defaultValue, error } = useField(name);
version: '3'
services:
postgres:
image: postgres
environment:
- POSTGRES_USER: ${DB_USERNAME}
- POSTGRES_PASSWORD: ${DB_PASSWORD}
app:
build: .
var listElement = document.querySelector("#app ul");
var inputElement = document.querySelector("#app input");
var btnElement = document.querySelector("#app button");
var toDos = JSON.parse(localStorage.getItem("list_todos")) || [];
function renderTodos() {
listElement.innerHTML = "";
for (todo of toDos) {
import axios from 'axios';
import store from '~/store';
const api = axios.create({
baseURL: 'http://localhost:3333',
});
api.interceptors.request.use((config) => {
const { token } = store.getState().auth; // Aqui poderia ser localStoraget.getItem
import React from 'react';
import PropTypes from 'prop-types';
import { compose } from 'recompose';
import monthNames from '~/util/monthNames';
import 'isomorphic-fetch';
import withLayout from '~/hocs/withLayout';
import withAnalytics from '~/hocs/withAnalytics';
import { Content } from '~/styles/components';
async approved (data, product, response) {
let user =
(await User.findBy('email', data.email)) ||
(await User.findBy('doc', data.doc))
if (!user) {
user = await User.create({
email: data.email,
doc: data.doc,
name: `${data.first_name} ${data.last_name}`.trim()
'use strict'
const Database = use('Database')
const Model = use('Model')
const Env = use('Env')
class Course extends Model {
static get computed () {
return ['thumbnailUrl']
}
import React from 'react';
import { compose, withState, withHandlers } from 'recompose';
const Dropdown = ({ opened, toggleDropdown }) => (
<div>
<button type="button" onClick={toggleDropdown}>
Abrir/fechar
</button>
<ul className={`dropdown ${opened ? 'dropdown-open' : ''}`}>
<li>ReactJS</li>
function asyncFunction(params, callback, err) {
var response = // requisição assíncrona
if (response.status === true) {
callback(response.data);
} else {
err(response.data);
}
}
asyncFunction(