View keybase.md
Keybase proof
I hereby claim:
- I am automaticalldramatic on github.
- I am reeseone (https://keybase.io/reeseone) on keybase.
- I have a public key ASDcrqAF-d20V6sFhvrFoQqWZH8QdE7o_lDOm2EDLFt7awo
To claim this, I am signing this object:
View SyncCards.ts
export interface ObservablePaginatedResult { | |
cards: Observable<Array<SomeCards>>; | |
stop: () => void; | |
} | |
// returns an observable to subscribe to for changes and a method to stop listening to the snapshot | |
public SyncCards(pageSize: number = this.DefaultPageSize): <ObservablePaginatedResult> { | |
// an internal subject to handle streaming until the connection is closed. The buffer size of 1 fits my scenario and is up to the readers discretion | |
const cards$: ReplaySubject<Array<SomeCards>> = new ReplaySubject<SomeCards[]>(1); |
View sortByDesc.ts
// this method accepts the property to order by. In our example, this would be priority | |
// sortByDesc('priority') | |
sortByDesc(prop: string) { | |
return this.returnedCardsArr.sort((a, b) => a[prop] < b[prop] ? 1 : a[prop] === b[prop] ? 0 : -1); | |
} | |
// also a slightly verbose way of keeping only unique IDs replacing the ones received from the new call - cause the data also might have changed. | |
for (const card of c) { | |
if (!this.uniqueMap.has(card.id)) { | |
this.uniqueMap.set(card.id, true); |
View snapshotWatchers.ts
private snapshotWatchers: Array<() => void> = []; | |
private syncRequest: Partial<ObservablePaginatedQuery>; | |
private syncCards() { | |
// assume some code here to initialise variables, create a service instance et al | |
// syncRequest is a class variable | |
this.syncRequest = WatchPaginatedCards(); | |
this.syncRequest.cards.pipe().subscribe( |
View WatchPaginatedCards.ts
// I updated the interface | |
export interface ObservablePaginatedResult { | |
cards: Observable<Array<SomeCards>>; | |
nextPage: IterableIterator<() => void>; // the method returned by iterator should be called to stop listening for changes on this page | |
} | |
public WatchPaginatedCards(pageSize: number = this.DefaultPageSize): <ObservablePaginatedQuery> { | |
const cards$: ReplaySubject<Array<SomeCards>> = new ReplaySubject<SomeCards[]>(1); |
View keybase.md
Keybase proof
I hereby claim:
- I am automaticalldramatic on github.
- I am rizwaniqbal (https://keybase.io/rizwaniqbal) on keybase.
- I have a public key ASBIwoVK08YsA2ZKfvShz-SYOLALs9SwVTOdzEDXrSgbtAo
To claim this, I am signing this object:
View postgres-brew.md
Installing Postgres via Brew
Pre-Reqs
In your command-line run the following commands:
brew doctor
brew update
View app.yaml
env: flex | |
runtime: go1.12 | |
main: cmd/some-service-name/main.go |
View golang-nuts.go
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
// Suggestions from golang-nuts | |
// http://play.golang.org/p/Ctg3_AQisl |
NewerOlder