Skip to content

Instantly share code, notes, and snippets.

View mgroves's full-sized avatar

Matthew D. Groves mgroves

View GitHub Profile
public class BasePage : Page
{
public BasePage()
{
ObjectFactory.BuildUp(this);
}
}
public partial class _Default : BasePage // new base class
{
public static class IocBootstrap
{
public static void Configure()
{
ObjectFactory.Initialize(x =>
{
x.Scan(scan =>
{
scan.TheCallingAssembly();
scan.WithDefaultConventions();
public class Friend
{
public string name { get; set; }
public string occupation { get; set; }
}
public class Enemy
{
public string name { get; set; }
public string characteristics { get; set; }
public class Rootobject
{
public string name { get; set; }
public string occupation { get; set; }
public Friend[] friends { get; set; }
public Enemy[] enemies { get; set; }
}
public class Friend
{
<configuration>
<!-- ... snip ... -->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
public static class StatesProvinces
{
public static OrderedDictionary Dictionary
{
get
{
return new OrderedDictionary
{
{"AL", "Alabama"},
{"AK", "Alaska"},
public static bool IsValidState(string state)
{
if(string.IsNullOrEmpty(state))
return false;
return Dictionary.Contains(state);
}
// which is the better design, given StateArgs? A or B?
public class StateArgs
{
public bool IsValid { get; set; }
public string Value { get; set; }
}
// A
public static void ValidateState(StateArgs args)
{
@mgroves
mgroves / gist:9195983
Created February 24, 2014 20:08
Git repo with two files changed
me@MYCOMPUTER /d/zproj/NuGetGallery (master)
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: src/NuGetGallery/NuGetGallery.csproj
# modified: src/NuGetGallery/Web.config
@mgroves
mgroves / gist:9196096
Created February 24, 2014 20:14
Git repo after applying the stash
me@MYCOMPUTER /d/zproj/NuGetGallery (master)
$ git stash apply stash@{0}
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: src/NuGetGallery/NuGetGallery.csproj
# modified: src/NuGetGallery/Web.config