This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Resource": "*", | |
"Action": [ | |
"ec2:RunInstances", | |
"ec2:CreateTags" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -xe | |
## Code Deploy Agent Bootstrap Script## | |
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | |
function installdep(){ | |
yum install -y ruby jq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Threading; | |
using static System.Console; | |
namespace ThreadPlayground | |
{ | |
class NonExclusiveLockSemaphore | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Threading; | |
using static System.Console; | |
namespace ThreadPlayground | |
{ | |
class ReaderWriterLockSlimSample | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Senha informada e com suporte para push notification | |
if (!sessionStorage.getItem('notificacao-push-permissao')) { | |
/* Apenas no 1* acesso do usuário a essa funcionalidade, deverá ser exibida e mensagem de Permitir, caso ele tenha permitido | |
/ e posteriormente bloqueado, ele já terá visto essa mensagem, caso ele tenha apagado os dados do localStorage | |
/ (apenas usuários avançados o farão) essa mensagem irá aparecer, mas como ele já terá permitido a notificação, a mensagem nativa | |
/ do browser não será exibida (UX ruim, mas dificilmente irá ocorrer) | |
/ * no iOS o localStorage é apagado periodicamente, porém, como não têm suporte à push notification, sem problemas... */ | |
this.props.messageService.show('Click \'ALLOW\' to be notified of your password, even with your phone in your pocket!') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable() | |
export class ProcessamentoService { | |
private headers: Headers; | |
private baseUrl: string; | |
private historicoProcessamentosSubject = new Subject<Processamento[]>(); | |
historicoProcessamentos$: Observable<Processamento[]> = this.historicoProcessamentosSubject.asObservable(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable() | |
export class CoursesService { | |
constructor() { } | |
findAllCourses(): Observable<Course[]> {// ... //} | |
findLatestLessons(): Observable<Lesson[]> {// ... //} | |
findCourseByUrl(courseUrl:string): Observable<Course> {// ... //} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const subject = new Rx.Subject(); | |
const subscription = subject.subscribe({ | |
next: valor => console.log(`observerB consumindo informação: ${valor}`), | |
error: err => console.log('observerB recebendo uma notificação de erro') | |
}) | |
subject.next(1) | |
/* Cancelando a "inscrição" no Stream de eventos emitidos pela instância de `subject`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'my-app' | |
}) | |
export class MyComponent implements OnInit, OnDestroy { | |
public processamentoSubject = new BehaviorSubject<Processamento[]>(null); | |
public processamentos$: Observable<Processamento[]> = this.processamentoSubject.asObservable(); | |
// 1. Criar objeto subject de bool. | |
destroy$: Subject<boolean> = new Subject<boolean>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Caso comum de uso dos Observables, sendo retornado por uma função que faz | |
chamadas assíncronas (requisições http). | |
Código exemplifica como é a criação "explícita" de um Observable, | |
mas existem outros métodos que fazem isso por você, | |
como Rx.Observable.of(<SeuObjetoRetornado>)*/ | |
const obterRecursoDaApi = Rx.Observable.create(observer => { | |
setTimeout(() => { | |
observer.next([{id: 1, titulo: 'algum título'}, {id: 2, titulo: 'outro título'}]); | |
observer.complete(); |