Skip to content

Instantly share code, notes, and snippets.

Avatar

Alvaro Camillo Neto alvarocamillont

View GitHub Profile
@alvarocamillont
alvarocamillont / build_local.sh
Created Jan 16, 2020
Script para build do portinari local
View build_local.sh
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 Jan 23, 2020
CheckList para review
View review.md

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
View async.ts
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']
View async.html
<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 Jun 1, 2019
Exemplo usando SubSink
View subsink.ts
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']
View multsubs.ts
@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;
View ondestroy.ts
ngOnDestroy() {
if (this.subPeople) {
this.subPeople.unsubscribe();
}
}
View OnInit.ts
ngOnInit() {
this.subPeople = this.http
.get<People>('https://swapi.co/api/people/1/')
.subscribe((data: People) => {
this.people = data;
});
}
View exampleunsub.ts
this.subPeople = this.http
.get<People>('https://swapi.co/api/people/1/')
.subscribe((data: People) => {
this.people = data;
});
this.subPeople.unsubscribe();
View simplesub.ts
this.http
.get<People>('https://swapi.co/api/people/1/')
.subscribe((data: People) => {
this.people = data;
});
You can’t perform that action at this time.