Skip to content

Instantly share code, notes, and snippets.

View lucasconstantino's full-sized avatar
❄️
Working from the cold

Lucas Constantino Silva lucasconstantino

❄️
Working from the cold
View GitHub Profile
const useImageColor = (throwOnError = false) => {
const [element, setElement] = useState<HTMLImageElement | null>(null)
const [color, setColor] = useState<string | null>(null)
const ref = useCallback(
(image: HTMLImageElement | null) => {
if (image) {
image.crossOrigin = 'Anonymous'
setElement(image)
}
@lucasconstantino
lucasconstantino / schema.json
Created April 14, 2019 22:43
GitHub GraphQL API v4 - introspection result (as of 2019-04-14)
This file has been truncated, but you can view the full file.
{
"__schema": {
"queryType": {
"name": "Query"
},
"mutationType": {
"name": "Mutation"
},
"subscriptionType": null,
"types": [
### Title options:
- GraphQL hoje para aplicações client-side que ainda dependem de APIs REST.
- GraphQL today using Apollo for applications that still depend on REST apis
- Wrapping REST apis with GraphQL using Apollo stack
# GraphQL today using Apollo for applications that still depend on REST APIs
Even though people using GraphQL are often extremely excited about the technology, it's popularity is [still growing slowly](https://trends.google.com/trends/explore?date=2014-03-14%202017-03-14&q=GraphQL). Developers working on client-side applications are the ones to benefit the most from GraphQL, but migrating a backend from a working REST API might not be economically justifiable for most teams. What most don't realize, though, is that it is not completely necessary to make the switch on both sides before adopting the technology. The main [JavaScript implementation](https://github.com/graphql/graphql-js) of a GraphQL server runs just fine on the browser, and [Apollo](http://www.apollodata.com/) makes it e
@lucasconstantino
lucasconstantino / graphql-apollo-rest
Last active August 10, 2018 16:48
GraphQL - pt-br
# GraphQL hoje usando Apollo em aplicações que ainda dependem de APIs REST
Apesar do entusiamo das pessoas que já estão usando GraphQL, a popularidade da ferramenta está [crescendo a passos curtos](https://trends.google.com/trends/explore?date=2014-03-14%202017-03-14&q=GraphQL). Desenvolvedores trabalhando no client-side das aplicações são os que mais rapidamente têm a ganhar com o GraphQL, mas poucos ainda conseguem justificar o investimento financeiro na migração de um backend em pleno funcionamento servindo uma API REST. O que poucos percebem, porém, é que não é preciso fazer a migração simultaneamente no servidor antes de começar a usar a tecnologia no client-side. A [implementação de referência](https://github.com/graphql/graphql-js) para servidores GraphQL é escrita em JavaScript, roda muito bem em navegadores, e é ainda mais fácil de usar quando combinada com as ferramentas fornecidas pelo [Apollo](http://www.apollodata.com/).
> Se você prefere Relay, deveria ler [esse post](http://graphql.org/blog/r
### Title options:
- GraphQL hoje para aplicações client-side que ainda dependem de APIs REST.
- GraphQL today using Apollo for applications that still depend on REST apis
- Wrapping REST apis with GraphQL using Apollo stack
# GraphQL today using Apollo for applications that still depend on REST APIs
Even though people using GraphQL are often extremely excited about the technology, it's popularity is [still growing slowly](https://trends.google.com/trends/explore?date=2014-03-14%202017-03-14&q=GraphQL). Developers working on client-side applications are the ones to benefit more from GraphQL, but migrating a backend from a working REST API might not be economically justifiable for most teams. What most don't realize, though, is that it is not completely necessary to make the switch on both sides before adopting the technology. The main [JavaScript implementation](https://github.com/graphql/graphql-js) of a GraphQL server runs just fine on the browser, and [Apollo](http://www.apollodata.com/) makes it easy a
### Title options:
- GraphQL hoje para aplicações client-side que ainda dependem de APIs REST.
- GraphQL today using Apollo for applications that still depend on REST apis
- Wrapping REST apis with GraphQL using Apollo stack
# GraphQL today using Apollo for applications that still depend on REST APIs
Even though people using GraphQL are often extremely excited about the technology, it's popularity is [still growing slowly](https://trends.google.com/trends/explore?date=2014-03-14%202017-03-14&q=GraphQL). Developers working on client-side applications are the ones to benefit more from GraphQL, but migrating a backend from a working REST API might not be economically justifiable for most teams. What most don't realize, though, is that it is not completely necessary to make the switch on both sides before adopting the technology. The main [JavaScript implementation](https://github.com/graphql/graphql-js) of a GraphQL server runs just fine on the browser, and [Apollo](http://www.apollodata.com/) makes it easy a
@lucasconstantino
lucasconstantino / Arquitetura Fractal
Last active January 18, 2017 19:10
Arquitetura Fractal
Títulos
1. Arquitetura Fractal - Um Ensaio Usando Webpack e React
2. Um Ensaio sobre Arquitetura Fractal usando Webpack e React
Aplicações de menor porte são normalmente organizadas de modo a separar os arquivos por *natureza*; componentes, [contêineres](https://css-tricks.com/learning-react-container-components/), rotas, etc. O resultado é uma aplicação com uma estrutura parecida a esta:
```
components/
Header.js
HomePage.js
@lucasconstantino
lucasconstantino / set_permissions.php
Last active March 16, 2016 22:47
Permission managment helper for Drupal
<?php
/**
* Helper to grant/revoke permissions.
*
* @param
* A associative array map of permissions to grant/remove.
* Example:
* array(
* 'all' => array(
@lucasconstantino
lucasconstantino / SassMeister-input.scss
Created February 8, 2016 20:44
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
@import "compass";
div {
@include opacity(0.5);
}
/**
* Jus' encapsulating to avoid pluting global scope.
*/
(function () {
var kolorContainer = document.querySelector('#kolor-kolor')
, buttons = document.querySelectorAll('#kolor-start, #kolor-restart')
, endBlock = document.querySelector('#kolor-end-block')
, interval;