Skip to content

Instantly share code, notes, and snippets.

@kentcb
kentcb / InteractionAPIExperiment.cs
Created January 20, 2016 08:17
Playing with Interaction APIs
public class InteractionSource
{
public static readonly InteractionSource Global = new InteractionSource();
private readonly IList<Func<NewInteraction, IObservable<Unit>>> handlers;
public InteractionSource()
{
this.handlers = new List<Func<NewInteraction, IObservable<Unit>>>();
}
@kentcb
kentcb / RetryWhile.cs
Created November 12, 2015 00:54
RetryWhile
public static class ObservableExtensions
{
public static IObservable<TSource> RetryWhile<TSource>(
this IObservable<TSource> @this,
Func<TSource, bool> predicate)
{
@this.AssertNotNull(nameof(@this));
predicate.AssertNotNull(nameof(predicate));
return Observable
@kentcb
kentcb / RxUIExample.cs
Created October 19, 2015 02:01
ReactiveUI Example
public class MyViewModel : ReactiveObject
{
private readonly ReactiveCommand<object> saveCommand;
private readonly ObservableAsPropertyHelper<string> fullName;
private readonly ObservableAsPropertyHelper<string> initials;
private string firstName;
private string lastName;
private bool showLastNameFirst;
public MyViewModel()
@kentcb
kentcb / gist:aafc739ec1958af75289
Created March 13, 2015 03:19
iOS bug wrt UITableViewSource that overrides EstimatedHeight
public class Source : UITableViewSource
{
public Source(UITableView tableView)
{
// because of a call to ReloadData here...
tableView.ReloadData();
}
// ...this won't be called...
public override nint NumberOfSections(UITableView tableView)