Skip to content

Instantly share code, notes, and snippets.

View raphaelanjos1's full-sized avatar
🏠
Working from home

Raphael Anjos raphaelanjos1

🏠
Working from home
  • Rio de Janeiro, Brazil
View GitHub Profile
@raphaelanjos1
raphaelanjos1 / master-javascript-interview.md
Created November 19, 2019 13:37 — forked from Geoff-Ford/master-javascript-interview.md
Eric Elliott's Master the JavaScript Interview Series
@raphaelanjos1
raphaelanjos1 / index.js
Created March 25, 2019 20:40
graphql-tag fragments
import gql from 'graphql-tag'
const PokeInfo = gql`
fragment BasicPokeInfo on pokemon {
name
image
number
}
`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Exercício</title>
<style>
.clicked {
background: darkgray;
@raphaelanjos1
raphaelanjos1 / image.js
Last active November 26, 2018 12:03
CardMedia não renderiza dentro do Card.
import React from 'react'
import CardMedia from '@material-ui/core/CardMedia'
const styles = {
media: {
height: 140
}
};
const Image = ({ image, name }) => (
import React from 'react'
const Films = ({ films }) => (
<div className="card-row">
<span className="card-label">Films: </span>
{films.length > 0 &&
films.map(film => (
<span key={film.episode_id} className="planet-films">
{films.length === 1 ? `${film.title}` : `${film.title}, `}
</span>
@raphaelanjos1
raphaelanjos1 / index.js
Created November 6, 2018 11:41
Warning: Each child in an array or iterator should have a unique "key" prop.
import React, { Fragment } from 'react'
import { Name, Image } from '../../atoms'
const Evolution = ({ evolutions }) => (
<Fragment>
{evolutions.map((evolutions, index) => (
<Fragment>
<Name key={index} name={evolutions.name} />
<Image key={evolutions.id} image={evolutions.image} name={evolutions.name} />
</Fragment>
@raphaelanjos1
raphaelanjos1 / App.js
Last active October 29, 2018 12:36
Hookedex
import React, { useState } from 'react'
import PokeResult from '../../components/organisms'
export default function Pokedex() {
const [searchInput, setSearchInput] = useState('')
const [search, clickSearch] = useState('')
return (
<div style={{ display: 'flex', justifyContent: 'center', flexDirection: 'column', alignItems: 'center' }}>
<h2>Pokedex</h2>
@raphaelanjos1
raphaelanjos1 / challenge-28.js
Created October 18, 2018 22:10
Here's the problem: ao pesquisar um CEP válido, tudo funciona conforme o esperado. Porém, ao digitar um CEP inválido, continuo a visualizar a mensagem "Endereço referente ao CEP [CEP]" ao invés da mensagem de erro.
(function (DOM) {
'use strict'
/*
No HTML:
- Crie um formulário com um input de texto que receberá um CEP e um botão
de submit;
- Crie uma estrutura HTML para receber informações de endereço:
"Logradouro, Bairro, Estado, Cidade e CEP." Essas informações serão
preenchidas com os dados da requisição feita no JS.
- Crie uma área que receberá mensagens com o status da requisição:
<link rel="stylesheet" href="./style.css">
<table style="width:100%" class="q_sel_simp">
<tbody>
<tr>
<td class=" sel_simp linha_impar coluna_impar" style="width:9%;text-align:center;vertical-align:baseline">
<div onclick="clicar_texto('opc674241_1')">0</div>
</td>
<td class=" sel_simp linha_impar coluna_par" style="width:9%;text-align:center;vertical-align:baseline">
<div onclick="clicar_texto('opc674241_2')">1</div>
import React, { Fragment } from 'react'
const renderAbilities = (abilities) => {
const isValidAbility = (ability) => Boolean(ability.ability)
const abilityElement = ({ ability: { name } }, index) => <li key={index}>{name}</li>
return abilities.map((ability, index) =>
isValidAbility(ability) ? abilityElement(ability, index) : null
)
}