Skip to content

Instantly share code, notes, and snippets.

Avatar

Leandro Hermes Neto leandro-hermes

View GitHub Profile
@leandro-hermes
leandro-hermes / setup.sh
Last active Nov 18, 2021
Script de setup para a máquina BASTION
View setup.sh
#!/bin/bash
echo "#######################"
echo "## Environment setup ##"
echo "#######################"
apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update
apt full-upgrade -yy
@leandro-hermes
leandro-hermes / gitflow.sh
Last active Oct 26, 2020
Limpa branches do repositório local e aplica o git flow
View gitflow.sh
echo "
####
# Baixando repo atualizado
####
"
git fetch origin -p
git checkout main
echo "
####
@leandro-hermes
leandro-hermes / vhost
Last active Oct 5, 2020
Configuração simples de vhost nginx
View vhost
server {
listen 80;
server_name sub.domain.com;
root /var/www/path;
location / {
try_files $uri $uri/ /index.html?$query_string;
}
@leandro-hermes
leandro-hermes / handle-error-operator.ts
Last active Sep 29, 2020
RxJS operator that catches the error, feed an variable with error message, then returns an observable with default value
View handle-error-operator.ts
import { of as observableOf, OperatorFunction } from 'rxjs';
import { catchError } from 'rxjs/operators';
// tslint:disable-next-line:max-line-length
export function handleError<T, O = any>(context: any, attrName: string, defaultMessage?: string, returnedValue?: any): OperatorFunction<T, T | O> {
return catchError((err: any) => {
context[attrName] = err.error?.message || defaultMessage;
return observableOf(returnedValue || null);
});
}
@leandro-hermes
leandro-hermes / display-error.component.ts
Last active Sep 28, 2020
Generic component to show app-standardized error messages
View display-error.component.ts
import { Component, Optional } from '@angular/core';
import { ErrorDirective } from './error.directive';
@Component({
selector: 'display-error',
template: `
<img src="/assets/img/bug.svg">
<h2 #content class="mat-h2"><ng-content></ng-content></h2>
<h2 class="mat-h2" [innerHTML]="directive?.errorMessage" *ngIf="!content.innerText"></h2>
@leandro-hermes
leandro-hermes / pull_request_template.md
Last active Sep 9, 2020
Template padrão para pull requests
View pull_request_template.md

O que esta PR propõe?

  • Obrigatório
  • Responda à pergunta desta seção. Para isso, utilize verbos no infinitivo
  • Liste em tópicos as alterações incluídas nesta PR
  • Se for o caso, referencie issues usando a chave ([GWS-<000>])

Screenshots

Se a alteração for na aparência final do produto, screenshots são necessários. No entanto, poderá adicionar outros conforme achar necessário.

Pacotes adicionados/atualizados