Skip to content

Instantly share code, notes, and snippets.

ngbrown / ArrayHelpers.cs
Created Jun 18, 2010
C# Extension Methods
View ArrayHelpers.cs
namespace Helpers
using System;
/// <summary>
/// A static class of extension methods for <see cref="Array"/>.
/// </summary>
public static class ArrayHelpers
/// <summary>
ngbrown / RandData.cs
Created Jun 18, 2010
C# UnitTest Helpers
View RandData.cs
namespace UnitTestHelpers
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
/// <summary>
/// Provides random test data
/// </summary>
ngbrown / ScanSum.cs
Created Jun 19, 2010
Examples of using TextScanner
View ScanSum.cs
namespace ScanSum
using System;
using System.Globalization;
using System.IO;
using TextScanner;
internal class ScanSum
ngbrown / JetBrains.ExternalAnnotations.xsd
Created Aug 13, 2011
Started to define a basic XSD schema for JetBrains external annotations.
View JetBrains.ExternalAnnotations.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="JetBrains.ExternalAnnotations" xmlns="" xmlns:xs="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
Usage: You only need to add the following to the assembly element:
<assembly name="Assembly.Name"
ngbrown / WideCharToMultiByteTest.c
Created Apr 23, 2012
Demonstrates Windows reading past the source string when using WideCharToMultiByte.
View WideCharToMultiByteTest.c
// WideCharToMultiByteTest.c : Demonstrates Windows reading past the source string
// when using WideCharToMultiByte.
// The source problem uses UNICODE_STRING, so it may not be null terminated.
#define _WIN32_WINNT 0x400
#include <WinSDKVer.h>
#include <stdio.h>
#include <tchar.h>
ngbrown / strstartswith.h
Created Jul 3, 2012
string starts with
View strstartswith.h
// From
#ifndef __GNUC__
template <typename T, size_t N>
char ( &_ArraySizeHelper( T (&array)[N] ))[N];
#define countof(array) (sizeof(_ArraySizeHelper(array)))
ngbrown / AlphanumComparatorFast.cs
Created Oct 5, 2012
Alphanumeric compariter using Linq and an EnumerableComparer.
View AlphanumComparatorFast.cs
namespace Utilities
using System.Collections;
using System.Collections.Generic;
/// <remarks>
/// From
/// </remarks>
public class AlphanumComparatorFast : IComparer<string>, IComparer
View GridViewSort.cs
namespace Extenders
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Documents;
/// <summary>
ngbrown / WhenGivenAttribute.cs
Created Nov 9, 2012
It would be nice if SpecFlow accepted custom attributes based off of StepDefinitionBaseAttribute
View WhenGivenAttribute.cs
namespace StepDefinitions
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Assist;
ngbrown / TileCanvas.cs
Last active Dec 19, 2015 — forked from robfe/TileCanvas.cs
TileCanvas updated to be more efficient with adding and removing tiled images.
View TileCanvas.cs
public class TileCanvas : Canvas
public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register(
new PropertyMetadata(null, ImageSourceChanged));
private Size lastActualSize;