Skip to content

Instantly share code, notes, and snippets.

Avatar

David Fairbanks david-fairbanks42

View GitHub Profile
View delete-empty-keyring-entries.py
# Linux keyring file (login.keyring) contained a lot of dead entries with black passwords
# Update the application siganture (chrome-6391234) from an entry
# Additional/Alternative search items could be added
import keyring
keys = keyring.get_keyring()
for k in keys.backends:
if isinstance(k, keyring.backends.SecretService.Keyring):
collection = k.get_preferred_collection()
@david-fairbanks42
david-fairbanks42 / observable-expand.ts
Created Apr 10, 2018
This is an example of Rx Observable expand method usage. The idea here is to divide large requests into paged results, then combine the results on the front end. This example will continue to request chunks of data from the backend until it receives a response that says there is no more results to get.
View observable-expand.ts
export class ProductService {
constructor(private authHttp: AuthHttp) {}
get(): Observable<any> {
this.products = [];
return this.authHttp.get('/api/products', {search: {limit: 100}})
// Take information from first response and make subsequent responses
// Response body contains: {hasMore: (boolean), nextOffset: (int), data: (array)}
.expand((response) => {
let obj = response.json();