Skip to content

Instantly share code, notes, and snippets.

View RxDave's full-sized avatar

Dave Sexton RxDave

View GitHub Profile
@RxDave
RxDave / Program.cs
Last active April 19, 2017 22:14
Conflating IObserver with IDisposable
using System;
using System.Linq;
namespace Lab
{
// THIS PROGRAM DOES NOT REQUIRE A REFERENCE TO RX
class Program
{
static void Main()
{
@RxDave
RxDave / CurrentThreadScheduler
Last active August 29, 2015 14:11
CurrentThreadScheduler allows cancellation of recursive or iterative observables without concurrency.
using System;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main()
{
@RxDave
RxDave / Output
Created December 5, 2014 03:12
Ix Publish Bug?
Ix
{ left = 0, right = 2 }
{ left = 1, right = 3 }
{ left = 2, right = 4 }
Rx
{ left = 0, right = 1 }
{ left = 1, right = 2 }
{ left = 2, right = 3 }
{ left = 3, right = 4 }
@RxDave
RxDave / gist:9adc25455917ff12b9b8
Last active May 2, 2016 04:04
Async Iterator State Machine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Rxx.Labs
{
// An async state machine example based on a simple FSM example found in the following Wikipedia article:
@RxDave
RxDave / gist:39b7eeff79b57761b14a
Created November 10, 2014 12:01
Scoping Rx queries to the lifetime of an object.
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
public class Foo : IDisposable
{
private readonly CompositeDisposable subscriptions = new CompositeDisposable();
// Called when the object is first created; e.g., a web service response is starting or a UI Control raises its loaded event.
public void Initialize()