Skip to content

Instantly share code, notes, and snippets.


Cameron MacFarland distantcam

View GitHub Profile
View Attachment.cs
abstract class Attachment<T> : IAttachment
protected T viewModel;
protected abstract void OnAttach();
void IAttachment.AttachTo(object obj)
viewModel = (T)obj;
View AfterWeaving.cs
public class SomeViewModel : INotifyPropertyChanged
private string <URL>k__BackingField;
public event PropertyChangedEventHandler PropertyChanged;
public string URL
View xkcd.fx
sampler2D input : register(s0);
/// <summary>The second input texture.</summary>
/// <defaultValue>c:\examplefolder\examplefile.jpg</defaultValue>
sampler2D RandomTexture : register(s1);
/// <summary>The radius of the Poisson disk (in pixels).</summary>
/// <minValue>1</minValue>
/// <maxValue>10</maxValue>
/// <defaultValue>5</defaultValue>
distantcam / ShellNew-sln2012
Created Dec 13, 2012
ShellNew registry key for .sln files.
View ShellNew-sln2012
Windows Registry Editor Version 5.00
View RxCommand.cs
using System;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Windows.Input;
public class RxCommand : ICommand, IObservable<object>, IDisposable
private readonly ISubject<bool> canExecuteSubject;
private readonly ISubject<object> executeSubject;
distantcam / drawarc.c
Created Apr 28, 2013
Pebble helper functions
View drawarc.c
Copyright 2013 Cameron MacFarland
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distantcam / CecilExtensions.cs
Created Aug 21, 2013
Mono.Cecil Extension Methods
View CecilExtensions.cs
public static class CecilExtensions
/// <summary>
/// Finds a type within the references of an assembly.
/// </summary>
/// <param name="module">The module to search the references of.</param>
/// <param name="type">The type to look for.</param>
/// <returns>The found type definition, or null if the type is not found.</returns>
/// <example>To find <see cref="System.Object"/> within a module.
/// <code>module.Find(typeof(System.Object));</code>
View DictionaryExtensions.cs
using System;
using System.Linq;
namespace System.Collections.Generic
public static class DictionaryExtensions
public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TKey, TValue> valueFactory)
TValue v;

Keybase proof

I hereby claim:

  • I am distantcam on github.
  • I am distantcam ( on keybase.
  • I have a public key whose fingerprint is F6C6 9E11 DC61 9DA7 B310 8417 875C C3D7 5421 5F94

To claim this, I am signing this object:

View AkavacheExtensions.cs
public static class AkavacheExtensions
public static IObservable<string> GetOrFetchWithETag(this IBlobCache cache, string url)
var result =
// Get from cache
// Cached values are true
.Select(x => Tuple.Create(x, true))