Skip to content

Instantly share code, notes, and snippets.

@rbirkby
rbirkby / InstrumentedAuthorisationService.cs
Created May 17, 2013 08:44
Adding a Logger to an authorization system using a Decorator and abiding by SOLID. Please note that this solution isn't thread safe.
using System;
using System.Diagnostics;
using System.Threading;
using Xunit;
namespace CodingChallenge
{
class Program
{
static void Main()
@rbirkby
rbirkby / SolidQuotes.md
Last active December 17, 2015 02:59
SOLID quotes

I quite agree that a dogmatic or religious application of the SOLID principles is neither realistic nor beneficial. If you had read through any of the articles and/or books I’ve written on these principles over the last 15 years, you’d have found that I don’t recommend the religious or dogmatic approach you blamed me for. In short, you jumped to a erroneous conclusion about me, and about the principles, because you weren’t familiar with the material.

Robert C. Martin
https://sites.google.com/site/unclebobconsultingllc/an-open-letter-to-joel-spolsky-and-jeff-atwood

@rbirkby
rbirkby / ArduinoLedMatrix.c
Last active December 9, 2015 21:48
Hacky code for controlling a Max7219 using an Arduino with the LedControl library.
#include "LedControl.h"
#define DIN 2
#define CLK 3
#define LOAD 4
LedControl lc=LedControl(DIN, CLK, LOAD, 1);
unsigned long delaytime=20;
void setup() {
@rbirkby
rbirkby / OOVatCalculator.cs
Created November 16, 2011 12:34
A UK Vat Calculator written in an OO style
using System;
class Program {
static void Main() {
WriteAmount(new DateTime(2008, 11, 01), 1.00M);
WriteAmount(new DateTime(2009, 01, 01), 1.00M);
WriteAmount(new DateTime(2010, 12, 01), 1.00M);
WriteAmount(new DateTime(2011, 12, 01), 1.00M);
}
@rbirkby
rbirkby / NaiveVatCalculator.cs
Created November 16, 2011 12:23
A UK Vat Calculator written procedurally
using System;
class Program {
static void Main() {
WriteAmount(new DateTime(2008, 11, 01), 1.00M);
WriteAmount(new DateTime(2009, 01, 01), 1.00M);
WriteAmount(new DateTime(2010, 12, 01), 1.00M);
WriteAmount(new DateTime(2011, 12, 01), 1.00M);
}
@rbirkby
rbirkby / NotesWatcher.cs
Created November 11, 2011 16:13
A quick hack notes.ini file watcher (with diff) running in a console app
using System;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;
using System.Threading;
namespace my.utils
{
using System;
@rbirkby
rbirkby / TFSBuild.proj
Created September 12, 2011 13:50
TFS2008 Continuous Deployment
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />
<Target Name="AfterEndToEndIteration">
<Exec Command="..\Sources\lib\remcom \\server d:\Tasks\Deploy.cmd"/>
</Target>
</Project>
@rbirkby
rbirkby / oneliners.cs
Created June 2, 2011 17:12
10 C# One Liners to Impress Your Friends
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
class TenCSharpOneLiners
{
static void Main()
{