Skip to content

Instantly share code, notes, and snippets.

View angelorubin's full-sized avatar

Angelo Rogerio Rubin angelorubin

View GitHub Profile
@angelorubin
angelorubin / gist:a7393fc5511e0de326dff0fb6a17ab34
Last active January 30, 2020 14:33
Componente TextField Material UI
<TextField
onChange={handleChange}
value={values.url}
fullWidth
name="url"
error={!isValid}
placeholder=" Shorten a link here..."
variant="outlined"
size="small"
inputProps={{
@angelorubin
angelorubin / spoiler.js
Created April 12, 2019 18:32
controller-spoiler
exports.buscarUm = (request, response, next) => {
const id = request.params.id
Spoiler
.findByPk(id)
.then((spoiler) => {
if (spoiler) {
response.send(spoiler)
} else {
response.status(Status.NOT_FOUND).send()
{
"title": "Recipe Puppy",
"version": 0.1,
"href": "http:\/\/www.recipepuppy.com\/",
"results": [
{
"title": "Ginger Champagne",
"href": "http:\/\/allrecipes.com\/Recipe\/Ginger-Champagne\/Detail.aspx",
"ingredients": "champagne, ginger, ice, vodka",
"thumbnail": "https://www.theseasonedmom.com/wp-content/uploads/2015/12/Ginger-Champagne-Cocktail-11A.jpg"
@angelorubin
angelorubin / async-concat.js
Created October 16, 2018 18:31 — forked from neves/async-concat.js
Concatenação de resultado paginado de API
/*
Tempo esperado para resolver: 30 minutos
Descrição do problema:
Temos uma função chamada listWithPagination que retorna um array de registros paginados.
A única maneira de conseguir um array com todos os registros,
é fazer requisições sequenciais para cada página, concatenando os resultados.
Descrição da solução:
Criar uma função chamada concatenateResults, que receba como parâmetro a função original
'use strict'
const filter = (arr, func) => {
return (function filterInternal (arrayInternal, counter) {
const [head, ...tail] = arrayInternal
return arrayInternal.length === 0
? []
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Javascript - Converting Array to Object">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<h1>Javascript - Converting Array to Object</h1>
Olá pessoal,
Resolvi escrever esta pequena dica inspirado na dúvida de um usuário da comunidade vuejs-brasil.slack.com.
A dúvida era: Como adicionar arquivos scss (não sass, sim, são diferentes, veja [aqui](http://pt.stackoverflow.com/a/54454)) em um componente [Vue](https://vuejs.org/v2/guide/)?
Estou partindo do princípio que você possui um boilerplate do vue, instalado através do [vue-cli](https://github.com/vuejs/vue-cli) com o template webpack.
Pois bem, para incluirmos arquivos .scss em componentes do Vue, primeiramente precisamos instalar dois módulos pelo npm ou [yarn](https://yarnpkg.com):
@angelorubin
angelorubin / SassMeister-input.scss
Created January 26, 2017 16:29
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
@mixin respond-to($color, $width) {
border: {
color: $color;
width: $width;
style: dashed;
const merge2dArrayIntoOne2 = (arrays) => arrays.reduce((p,n) => p.concat(n));
// 77 Caracteres