Skip to content

Instantly share code, notes, and snippets.

View mstum's full-sized avatar

Michael Stum mstum

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mstum on github.
  • I am mstum (https://keybase.io/mstum) on keybase.
  • I have a public key whose fingerprint is 66B1 2E11 BA8E 34C1 605F 1D5C 0DE5 B2FF F611 5471

To claim this, I am signing this object:

@mstum
mstum / Program.cs
Created March 19, 2017 04:03
C# 7 Features
using System;
namespace CSharp7Features
{
class Program
{
static void Main(string[] args)
{
OutVariables();

Keybase proof

I hereby claim:

  • I am mstum on github.
  • I am mstum (https://keybase.io/mstum) on keybase.
  • I have a public key whose fingerprint is 5EB3 3CFF 93DE 63E7 40CF E31A 6A91 BC77 F123 9A88

To claim this, I am signing this object:

@mstum
mstum / Date.cs
Created September 16, 2016 23:52
using System;
namespace mstum.utils
{
/// <summary>
/// A Date type for .net, essentially a <see cref="DateTime" /> without the time portion.
/// </summary>
/// <remarks>
/// If using Dapper, use this to map directly to a Date column in SQL Server:
/// <code>SqlMapper.AddTypeMap(typeof(Date), DbType.Date);</code>
@mstum
mstum / rnn.cs
Created July 20, 2015 23:38
rnn (Requires.NotNull) ReSharper Template
// ReSharper Template to make "rnn" a shortcut to Requires.NotNull
// For use with the Validation NuGet Package by @AArnott
// https://www.nuget.org/packages/Validation
// https://github.com/AArnott/Validation
// C# Pre-6
Validation.Requires.NotNull($param$,"$param$");
// C# 6
Validation.Requires.NotNull($param$, nameof($param$));
@mstum
mstum / Level.cpp
Last active August 29, 2015 14:06
CodeReview #62254 - Static Factory function and Lifetime questions
#include "Level.h"
#include <fstream>
#include <sstream>
std::string Level::GetName(){
// Should this return a Pointer?
return _name;
}
int Level::GetPlayerStartX() {
/*
A C-program for MT19937, with initialization improved 2002/1/26.
Coded by Takuji Nishimura and Makoto Matsumoto.
Before using, initialize the state by using init_genrand(seed)
or init_by_array(init_key, key_length).
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Copyright (C) 2005, Mutsuo Saito,
@mstum
mstum / webapi
Last active December 24, 2015 21:09
Microsoft.AspNet.WebApi.WebHost
Microsoft.AspNet.WebApi.OData
protected void Application_Start(object sender, EventArgs e)
{
WebApiConfig.Register(GlobalConfiguration.Configuration);
}
public static void Register(HttpConfiguration config)
{
@mstum
mstum / gist:5135132
Created March 11, 2013 15:42
Any way to share the OAuth dependency between 4.0 and 4.5 so that I don't DRY? Using an empty group doesn't work in 4.0, it seems that the single net40 match trumps everything. Not putting it into a group gives an error message saying I can't mix "free" dependencies with groups.
<dependencies>
<group targetFramework="net40">
<dependency id="Microsoft.Bcl.Async" version="1.0.14-rc" />
<dependency id="DotNetOpenAuth.OAuth.ServiceProvider" version="4.2.2.13055" />
</group>
<group targetFramework="net45">
<dependency id="DotNetOpenAuth.OAuth.ServiceProvider" version="4.2.2.13055" />
</group>
</dependencies>
@mstum
mstum / gist:4248838
Created December 10, 2012 06:37
Resolving Labels
private static Dictionary<string, int> ResolveLabels(IList<Token> tokens)
{
var result = new Dictionary<string, int>(StringComparer.InvariantCultureIgnoreCase);
var currentPosition = 0;
foreach (var token in tokens)
{
var commandToken = token as CommandToken;
if (commandToken != null)
{