Skip to content

Instantly share code, notes, and snippets.

View anaisbetts's full-sized avatar

Ani Betts anaisbetts

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<Wix
xmlns="http://schemas.microsoft.com/wix/2006/wi"
>
<Bundle
Name="SampleApp"
Version="1.0.0.0"
Manufacturer="Example"
UpgradeCode="c99db653-84c8-4c03-bc0e-716cc966b50c"
@anaisbetts
anaisbetts / gist:3020906
Created June 29, 2012 21:59
A Dumb Static HTTP server for unit testing (will serve up a directory for you)
public sealed class StaticHttpServer : IDisposable
{
public int Port { get; protected set; }
public string RootPath { get; protected set; }
IDisposable inner;
public StaticHttpServer(int port, string rootPath)
{
Port = port; RootPath = rootPath;
using System.Globalization;
using System.Text.RegularExpressions;
using Newtonsoft.Json.Serialization;
namespace GitHub.Api.Extensions
{
public class CustomContractResolver : CamelCasePropertyNamesContractResolver
{
protected override string ResolvePropertyName(string propertyName)
{
internal static Type reallyFindType(string type, bool throwOnFailure)
{
#if WINRT
// WinRT hates your favorite band too.
return Type.GetType(type, false);
#else
return AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(x => x.GetTypes())
.Where(x => x.FullName == type)
.FirstOrDefault();
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Threading;
using GitHub.Extensions;
using NLog;
using ReactiveUI;
psi.EnvironmentVariables["GIT_PAGER"] = "cat";
psi.EnvironmentVariables["LANG"] = "C";
psi.EnvironmentVariables["GIT_ASKPASS"] = "true";
psi.EnvironmentVariables["DISPLAY"] = "localhost:1";
psi.EnvironmentVariables["SSH_ASKPASS"] = "true";
psi.EnvironmentVariables["GIT_SSH"] = "ssh-noprompt";
@anaisbetts
anaisbetts / MainPage.xaml.cs
Created August 21, 2012 09:19
RxUI 4.0 View Bindings
public sealed partial class MainPage : Page, IViewForViewModel<MainPageViewModel>
{
public MainPage()
{
this.InitializeComponent();
// Wired up by convention, looks for a control on MainPage named Test and wires it up
this.Bind(ViewModel, x => x.Test);
// Same deal, looks for a control named FooTest
## The definition of Foo changes at runtime when the symbol is bound
## This means that type verification essentially becomes a variant
## of the Halting problem and is not trivially solvable.
if (a > 4) then
def Foo()
end
else
def Foo()
end
end

ReactiveUI 4.0 Preview is live!

After coding some pretty interesting new features, as well as to update to the latest released version of Rx (2.01), I am now releasing a preview release of ReactiveUI 4.0. You can get the binaries one of two ways:

  • install-package reactiveui -pre or install-package reactiveui-winrt -pre
  • Download the Zip release from GitHub

How does this break backwards compatibility?

public static IDisposable Bind<TViewModel, TView, TProp>(
this TView view,
Expression<Func<TViewModel, TProp>> vmProperty,
Expression<Func<TView, TProp>> viewProperty)
where TViewModel : class
where TView : IViewFor<TViewModel>
{
// C# isn't smart enough to infer the type parameters
// by looking at the TView to determine TViewModel
}