Skip to content

Instantly share code, notes, and snippets.

View alvarocamillont's full-sized avatar

Alvaro Camillo Neto alvarocamillont

View GitHub Profile
@alvarocamillont
alvarocamillont / git-update-fork.sh
Created August 29, 2018 19:15 — forked from rdeavila/git-update-fork.sh
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream
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();
ngOnInit() {
this.subPeople = this.http
.get<People>('https://swapi.co/api/people/1/')
.subscribe((data: People) => {
this.people = data;
});
}
ngOnDestroy() {
if (this.subPeople) {
this.subPeople.unsubscribe();
}
}
@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;
@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']
<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>
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']
@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