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 / gist:3403845
Created August 20, 2012 13:01
My Git Alias
git config --global alias.st "status -s -b"
git config --global alias.di "diff"
git config --global alias.co "checkout"
git config --global alias.ci "commit"
git config --global alias.br "branch"
git config --global alias.l "log --online --decorate --graph"
git config --global alias.fixup "commit --amend -C HEAD"
git config --global alias.timeline "log --graph --branches --pretty=online --decorate"
git config --global alias.untracked-files "ls-files -o --exclude-standard"
git config --global alias.ignored-files "ls-files --others -i --exclude-standard"
@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 / sanitize.php
Created May 23, 2012 22:30
Sanitize for PHP
<?php
/**
* Classe que contem os métodos que iram
* filtrar as entradas enviadas via GET e POST
*
* @filesource
* @author Pedro Elsner <pedro.elsner@gmail.com>
* @license http://creativecommons.org/licenses/by/3.0/br/ Creative Commons 3.0
* @abstract
* @version 1.0
@pedroelsner
pedroelsner / gist:3212276
Created July 31, 2012 00:31
Masked Input Celular
// jQuery Masked Input
$('#celular').mask("(99) 9999-9999?9").ready(function(event) {
var target, phone, element;
target = (event.currentTarget) ? event.currentTarget : event.srcElement;
phone = target.value.replace(/\D/g, '');
element = $(target);
element.unmask();
if(phone.length > 10) {
element.mask("(99) 99999-999?9");
} else {
// 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