Skip to content

Instantly share code, notes, and snippets.

View SimonCropp's full-sized avatar

Simon Cropp SimonCropp

View GitHub Profile
@SimonCropp
SimonCropp / gist:2419932
Created April 19, 2012 09:25
Bypass Protected Constructor
public class BaseClass
{
protected BaseClass()
{
}
}
public class BypassClass : BaseClass
{
@SimonCropp
SimonCropp / gist:2419965
Created April 19, 2012 09:36
Bypass Protected Constructor 2
public class BaseClass
{
protected BaseClass()
{
}
}
[TestFixture]
public class Foo2
@SimonCropp
SimonCropp / creole-jambalaya.markdown
Created April 21, 2012 03:35 — forked from half-ogre/creole-jambalaya.markdown
How Drew makes jambalaya

Creole Jambalaya

This is how Drew makes jambalaya.

Ingredients

  • 2 tbsp. olive oil
  • 3 lbs. (~1.5kg) chicken pieces (I use bone-in thighs)
  • 1 cup all-purpose flour
  • 1 lb.(~500g) andouille sausage, sliced
//the first context will be skipped in the foreach because the enumeration will be moved forward 1 by the allContexts.First(). Is this intentional
private string GetDestPath(ResolutionContext context)
{
var allContexts = GetContexts(context).Reverse();
var builder = new StringBuilder(allContexts.First().DestinationType.Name);
foreach (var ctxt in allContexts)
@SimonCropp
SimonCropp / after
Created May 20, 2012 01:33
ILWeaving and ReactiveUI
public class Person : ReactiveObject
{
public string FamilyName
{
get { return this.<FamilyName>k__BackingField; }
set
{
if (!string.Equals(this.<FamilyName>k__BackingField, value))
{
base.raisePropertyChanging("FamilyName");
public class Person : MyBaseClass
{
public string Name { get; set; }
}
public class MyBaseClass : GalaSoft.MvvmLight.ViewModelBase
{
protected virtual void Broadcast(object oldValue, object newValue, string propertyName)
{
var message = new PropertyChangedMessage(this, this, oldValue, newValue, propertyName);
Exception Info: Stream was not readable.
at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen)
at System.IO.StreamReader..ctor(Stream stream, Boolean detectEncodingFromByteOrderMarks)
at MetroTwit.Extensions.CommonCommands.<>c__DisplayClass85.<>c__DisplayClass8a.<CheckBoon>b__7c()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
@SimonCropp
SimonCropp / gist:3236814
Created August 2, 2012 12:54
I think I will skip this one
100 Skips
20 bench
20 decline bench
20 incline bench
20 shoulder press
100 Skips
15 bench
15 decline bench
15 incline bench
15 shoulder press
@SimonCropp
SimonCropp / gist:3403640
Created August 20, 2012 12:18
internaltypeof
.method public hidebysig instance class [mscorlib]System.Type GetTypeInfoFromInternal() cil managed
{
.maxstack 8
L_0000: ldtoken [AssemblyToReference]InternalClass
L_0005: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
L_000a: ret
}
public class ApplicationController
{
string myProperty;
public string MyProperty
{
get { return myProperty; }
set {
myProperty = value;
MyPropertyChanged(value);
}