Skip to content

Instantly share code, notes, and snippets.

View alvarocamillont's full-sized avatar

Alvaro Camillo Neto alvarocamillont

View GitHub Profile
@alvarocamillont
alvarocamillont / build_local.sh
Created January 16, 2020 19:43
Script para build do portinari local
CYAN='\033[0;36m'
GREEN='\033[0;32m'
# Caminho dos repositórios
caminho=/home/alvaro/totvs/git
# Caminho do repositório do portinari-style
repositorioPortinariStyle=$caminho/portinari-style
# Caminho do repositório do portinari-angular
@alvarocamillont
alvarocamillont / review.md
Last active January 23, 2020 17:58
CheckList para review

CHECKLIST REVIEW

  • PORTINARI-STYLE:

    • Simular problema (se houver)
    • Baixar a branch
    • buildar
    • Rodar o watch e o live-server
    • Verificar samples do CDN
    • Comparar com o Zeplin
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { People, Planet } from '../model/api';
@Component({
selector: 'app-example-sync',
templateUrl: './example-sync.component.html',
styleUrls: ['./example-sync.component.css']
<h1>Personagem</h1>
<section *ngIf="people$ | async as people">
<p>Nome: {{ people.name }}</p>
<p>Nascimento: {{ people.birth_year }}</p>
<p>Cor do Olho: {{ people.eye_color }}</p>
</section>
<br />
<h1>Planeta</h1>
<section *ngIf="planet$ | async as planet">
<p>Nome: {{ planet.name }}</p>
@alvarocamillont
alvarocamillont / subsink.ts
Created June 1, 2019 03:41
Exemplo usando SubSink
import { HttpClient } from '@angular/common/http';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { SubSink } from 'subsink';
import { People, Planet } from '../model/api';
@Component({
selector: 'app-example-subsink',
templateUrl: './example-subsink.component.html',
styleUrls: ['./example-subsink.component.css']
@Component({
selector: 'app-example-normal',
templateUrl: './example-normal.component.html',
styleUrls: ['./example-normal.component.css']
})
export class ExampleNormalComponent implements OnInit, OnDestroy {
people: People;
planet: Planet;
private subPeople: Subscription;
ngOnDestroy() {
if (this.subPeople) {
this.subPeople.unsubscribe();
}
}
ngOnInit() {
this.subPeople = this.http
.get<People>('https://swapi.co/api/people/1/')
.subscribe((data: People) => {
this.people = data;
});
}
this.subPeople = this.http
.get<People>('https://swapi.co/api/people/1/')
.subscribe((data: People) => {
this.people = data;
});
this.subPeople.unsubscribe();
this.http
.get<People>('https://swapi.co/api/people/1/')
.subscribe((data: People) => {
this.people = data;
});