Skip to content

Instantly share code, notes, and snippets.

@pedroelsner
pedroelsner / _error.js
Created July 22, 2019 21:00
Custom Error page on NextJS
import React from 'react';
import PropTypes from 'prop-types';
import Head from 'next-server/head';
import useElasticApm from '@@/Commons/hooks/useElasticApm';
const statusCodes = {
400: 'Bad Request',
404: 'This page could not be found',
405: 'Method Not Allowed',
@pedroelsner
pedroelsner / effects.js
Last active April 23, 2019 20:43
CSS Effects
import { css, keyframes } from 'styled-components';
import colors from './colors';
const slideUpKeyframe = keyframes`
0% {
opacity: 0;
transform: translateY(30px);
}
100% {
opacity: 1;
@pedroelsner
pedroelsner / gist:efe2b7dfcc0f407c099a7ba0bd474fcf
Created January 9, 2019 20:34
Pipeline Jenkins Simple: Node + Sonar + Consul + Vault + K8S + AWS ECR + SLACK NOTIFY
node {
try {
def PROJECT = "project-name"
def REPO_GIT = "project.git"
def BRANCH_NAME = "ti"
def IMAGE_VERSION = "$BUILD_NUMBER"
def ENV_DOMAIN = "k8s-ti-company"
def ECR_URL = "12345664.dkr.ecr.sa-east-1.amazonaws.com/$PROJECT"
@pedroelsner
pedroelsner / index.js
Created February 5, 2018 20:07
Hapi 17 + JWT
const Hapi = require("hapi");
const JWT = require("jsonwebtoken");
// our "users database"
const people = {
1: {
id: 1,
name: "Jen Jones"
}
};
@pedroelsner
pedroelsner / gist:4d5e466f2fe227250b59
Last active August 29, 2015 14:06
Felipe - Filter Results
<?
//$this->Importacao->recursive = -1
//$this->Filter->setPaginate('contain', array('Importacaodado'));
// ou
$this->Importacao->recursive = 1;
$this->Filter->addFilters(array('filter1' => array( ect.....)));
$this->Filter->setPaginate('order', array('Importacao.id' => 'desc'));
@pedroelsner
pedroelsner / gist:90af693bd42c98001428
Created September 9, 2014 19:39
Script Qlikview para Alexandre Gabriel
Original:
LOAD * INLINE [
Objeto, ID
Ref1, 13
Ref1, 16
Ref1, 19
Ref1, 32
];
@pedroelsner
pedroelsner / gist:5897ff36f1296b90af2f
Last active August 29, 2015 14:05
Edson - Load page ID
<?
/**
* Carrega a API do WordPress
*/
define('WP_USE_THEMES', false); // Não utiliza nenhum tema
require('./wordpress/wp-load.php');
$query = new WP_Query( 'page_id=7' );
if ( $the_query->have_posts() ) {
// Carrega a tabela
Table:
load * inline [
ID, ID2, UF, CABELO, OLHOS
1, 101, 'SP', 'PRETO', 'VERDE'
2, 102, 'RJ', 'CASTANHO', 'CASTANHO'
3, 103, 'SP', 'CASTANHO', 'AZUL'
4, 101, null, 'LOIRO', 'VERDE'
5, 104, 'RO', 'PRETO', 'VERDE'
=Only({$<VALOR_RECEBIDO={'0,00'}> CLIENTE}
@pedroelsner
pedroelsner / gist:5196082
Created March 19, 2013 13:26
Configurando Vim para tabulação com 4 espaços
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab