Skip to content

Instantly share code, notes, and snippets.

View andrewk's full-sized avatar

Andrew Krespanis andrewk

View GitHub Profile
@storkme
storkme / sliding-window.js
Created January 24, 2015 11:47
Generate a 'sliding window' of values produced by a time-series source.
var Rx = require('rx');
/**
* Generate a 'sliding window' of the input time series. Please note that this function assumes that the observable
* input series is a linear time series, that is: `selector(n) < selector(n+1)`. Otherwise things will get weird.
*
* @param windowSizeMs - size of the sliding window in ms
* @param {function} [selector] - selector function that obtains the unix timestamp value for a given item
* @param {Rx.Scheduler} [scheduler] - optional scheduler
* @returns {Rx.Observable<T>}
@staltz
staltz / introrx.md
Last active May 10, 2024 12:08
The introduction to Reactive Programming you've been missing