Skip to content

Instantly share code, notes, and snippets.

View lanwen's full-sized avatar
🎃
Thats my status

Kirill Merkushev lanwen

🎃
Thats my status
View GitHub Profile
@lanwen
lanwen / eventsource.js
Created March 19, 2017 22:11 — forked from mattpodwysocki/eventsource.js
Adding support for server-sent events for RxJS
if (!!root.EventSource) {
/**
* This method wraps an EventSource as an observable sequence.
* @param {String} url The url of the server-side script.
* @param {Observer} [openObserver] An optional observer for the 'open' event for the server side event.
* @returns {Observable} An observable sequence which represents the data from a server-side event.
*/
dom.fromEventSource = function (url, openObserver) {
return new AnonymousObservable(function (observer) {
@lanwen
lanwen / sse.go
Created March 14, 2017 20:48 — forked from schmohlio/sse.go
Example SSE server in Golang
// v2 of the great example of SSE in go by @ismasan.
// includes fixes:
// * infinite loop ending in panic
// * closing a client twice
// * potentially blocked listen() from closing a connection during multiplex step.
package main
import (
"fmt"
"log"
@lanwen
lanwen / nosetests profiling
Created June 16, 2016 22:43 — forked from jassinm/nosetests profiling
nosetest profiling
nosetests --with-profile --profile-stats-file=nose.prof
python -c "import hotshot.stats ; stats = hotshot.stats.load('nose.prof') ; stats.sort_stats('time', 'calls') ; stats.print_stats(20)"