Skip to content

Instantly share code, notes, and snippets.

View GeirGrusom's full-sized avatar

Henning Moe GeirGrusom

  • Ix Software AS
  • Norway
View GitHub Profile
@GeirGrusom
GeirGrusom / AutoMapperExpress.cs
Last active August 29, 2015 14:17
Fast naive automapper
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace AutoMapperExpress
{
@GeirGrusom
GeirGrusom / NotNull.cs
Created February 27, 2015 07:10
Not null reference type
public struct NotNull<T>
where T : class
{
private readonly T _value;
private NotNull(T value)
{
_value = value;
}
@GeirGrusom
GeirGrusom / PrinterWriter.cs
Created February 20, 2015 07:35
Printer Text Writer
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace Printing
{
public class PrinterWriter : TextWriter
{
@GeirGrusom
GeirGrusom / increment.cs
Created December 17, 2014 10:14
Performance difference between to different expressions for the same thing
using System;
using System.Diagnostics;
namespace Bleh
{
class Program
{
static void Main()
{
for (int i = 0; i < 5; i++)
@GeirGrusom
GeirGrusom / sparsematrix.cs
Created November 27, 2014 08:03
Sparse Matrix
public struct Position : IEquatable<Position>
{
private readonly int _x;
private readonly int _y;
public int X { get { return _x; } }
public int Y { get { return _y; } }
public Position(int x, int y)
{
@GeirGrusom
GeirGrusom / csvdeserializer.cs
Created November 11, 2014 06:50
CsvDeserializer
public class CsvDeserializer<T>
where T : new()
{
private readonly string separator;
public CsvDeserializer()
: this(";")
{
}
@GeirGrusom
GeirGrusom / opentkexample.cs
Created November 4, 2014 05:44
OpenTK colored triangle example
using System;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace OpenTKExample
@GeirGrusom
GeirGrusom / GDIBitManiupulation.cs
Created September 18, 2014 12:23
Example code for manipulating bits in a Bitmap using C# and unsafe
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace BitBlastBitmap
{
static class Program
{