Skip to content

Instantly share code, notes, and snippets.


Andrew Stanton-Nurse anurse

View GitHub Profile
anurse / HashCodeCombiner.cs
Created Feb 19, 2014
HashCodeCombiner - Useful for GetHashCode implementations!
View HashCodeCombiner.cs
// Copied from
// Licensed under the Apache 2 License Terms as defined in
// The only change made is to move the class to the System namespace to make it easily available in any project this file is included in.
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.Collections;
namespace System

Keybase proof

I hereby claim:

  • I am anurse on github.
  • I am anurse ( on keybase.
  • I have a public key whose fingerprint is 54D5 8341 7CFE 423E 5A54 D52B 4388 456B 1C13 750E

To claim this, I am signing this object:

anurse / atom-shell.d.ts
Created Dec 22, 2014
Atom TypeScript definitions.
View atom-shell.d.ts
/// <references src="node.d.ts" />
declare module "app" {
var app: AtomShell.App;
export = app;
declare module "browser-window" {
class _BrowserWindow extends AtomShell.BrowserWindow { }
anurse / GetActiveDNX.ps1
Last active Aug 29, 2015
Get the active DNX and put it on your prompt
View GetActiveDNX.ps1
# If 'dnvm' is present, this code writes " ([activednx])" to the host, where [activednx] is the
# active DNX name. If 'dnvm' is not present, this writes nothing.
# If we have dnvm, use it to determine the active DNX
if(Get-Command dnvm -ErrorAction SilentlyContinue) {
$activeDnx = dnvm list -passthru | where { $_.Active }
if($activeDnx) {
Write-Host " (" -nonewline -ForegroundColor ([ConsoleColor]::Yellow)
Write-Host "dnx-$($activeDnx.Runtime)-win-$($activeDnx.Architecture).$($activeDnx.Version)" -nonewline -ForegroundColor ([ConsoleColor]::Cyan)
Write-Host ")" -nonewline -ForegroundColor ([ConsoleColor]::Yellow)

MSBuild Targets and Props in NuGet 3

NuGet 2.x supports the inclusion of .targets and .props files in NuGet packages. These files will be added as Imports in the csproj MSBuild file when the package is installed. For example, consider a package with the following files:

View vimrc
" Update MYVIMRC
let $MYVIMRC="~/.dotfiles/vim.symlink/vimrc"
let $MYCOLORS="~/.dotfiles/vim.symlink/colorscheme.vim"
set ff=unix
" Make windows accept unixy stuff
if has('win32') || has('win64')
set runtimepath=~/.vim,$VIM/vimfiles,$VIM,$VIM/vimfiles/after,~/.vim/after
set dir=$TEMP
anurse / Sleepsort.cs
Created Jun 16, 2011
Sleepsort for C#!
View Sleepsort.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace ConsoleApplication2 {
class Program {
static void Main(string[] args) {
View gist:1340667
int Count(Folder f) {
int count = 0;
foreach(Item i in f) {
if(i is File) {
} else {
count += Count((Folder)i);
return count;
anurse / Product.cs
Created Dec 19, 2011
Mocking internal interfaces
View Product.cs
// Product Code
internal interface IFoo
void Bar();
void Baz();
anurse /
Created Mar 18, 2012
Recommendations for Razor Room
  1. People from the team try to hang out here, but there's no guarantee they'll see your question. For more persistent discussion, ask on ASP.Net forums or StackOverflow and add a link to the chat room
  2. Room owners are team members! They know what's up!
  3. The more code you can give us, the better chance we'll have of figuring out your problem.
  4. Other questions? Having trouble getting someone to see a question you're asking? Tweet @anurse