Skip to content

Instantly share code, notes, and snippets.

View RichardSilveira's full-sized avatar
🚀

Richard Silveira RichardSilveira

🚀
View GitHub Profile
@RichardSilveira
RichardSilveira / rxjs-padraoobserver.js
Last active January 25, 2018 17:28
RxJS e o Padrão Observer
const subject = new Rx.Subject();
/* Observers são consumidores dos valores entregues pelos Subjects (ou Observables).
São simplemente objetos com três callbacks, um para cada tipo de notificação
que pode ser entregue pelo Subject/Observable: next, error e complete.*/
const observerA = {
next: valor => console.log(`observerA consumindo informação: ${valor}`),
error: err => console.log('observerA recebendo uma notificação de erro'),
complete: () => console.log('observerA sendo informando que o subject foi finalizado')
}
promise.then (
successFn
);
observable.subscribe (
nextFn
);
import org.apache.log4j.Logger
import org.junit.Test
import java.time.*
import java.time.format.DateTimeFormatter
open class ZonedDateTimeWithEpochTest {
@Test
fun dateTimesExchanges_Between_Brazil_USA_West_Epoch_should_be_the_same() {
@RichardSilveira
RichardSilveira / listView-height-runtime.txt
Created February 19, 2017 13:20
retrieving total height for listView
public static void getTotalHeightofListView(ListView listView) {
ListAdapter mAdapter = listView.getAdapter();
int totalHeight = 0;
int listWidth = listView.getMeasuredWidth();
for (int i = 0; i < mAdapter.getCount(); i++) {
View mView = mAdapter.getView(i, null, listView);