Skip to content

Instantly share code, notes, and snippets.

@whiteinge
whiteinge / waitlatestfrom.js
Created March 21, 2017 17:07
waitLatestFrom RxJS operator as a middle-ground between withLatestFrom and combineLatest
/**
waitLatestFrom(...sources, [selector])
Like withLatestFrom but waits for all sources to produce at least one value
before emitting. Emits immediately once it has a value for all sources. After
that it actively collects the latest emission from the other source observables
in the background and emits the latest collected values whenever the primary
source emits -- like withLatestFrom.
If the primary source completes, the other sources will be completed as well.
@AlwxSin
AlwxSin / brief_list.py
Created December 5, 2016 08:25
Django Rest Framework Mixins
class BriefListMixin:
"""
Sometimes front-end needs brief list of models
Need to override brief_fields mapping like
{'frontend_name': 'model_field'}
"""
brief_fields = {}
@decorators.list_route(methods=['GET', ], url_path='brief')