Skip to content

Instantly share code, notes, and snippets.

@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()
{
@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 / 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 / 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 / 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 / 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 / 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 / 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 / README.md
Last active December 17, 2015 10:58 — forked from mbostock/.block
van Wijk Smooth Zooming
@rbirkby
rbirkby / GetIISPhysicalDir.cmd
Created February 3, 2014 15:48
Gets the physical directory of an IIS website into a DOS batchfile variable using PowerShell
powershell -command "ipmo WebAdministration; (gi $(gi 'iis:\Sites\Default Web Site\VDIR').physicalpath).parent.fullname | write-host" > destinationtmp.txt
SET /p DESTINATION=<destinationtmp.txt
del destinationtmp.txt