Skip to content

Instantly share code, notes, and snippets.

@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 / web-service.md
Last active August 29, 2015 14:19
Quick web server

"%ProgramFiles(x86)%\IIS Express\iisexpress.exe" /path:%cd%

Defaults to port 8080

@rbirkby
rbirkby / RxVideo.cs
Last active August 29, 2015 14:09
C# port of Netflix Rx video example
internal class VideoExample {
/**
* Demonstrate how Rx is used to compose Observables together such as
* how a web service would to generate a JSON response.
*
* The simulated methods for the metadata represent different services
* that are often backed by network calls.
*
* This will return a sequence of dictionaries such as this:
@rbirkby
rbirkby / AtomicDiamond.cs
Last active August 29, 2015 14:08
Reactive Equations
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
class X : IObservable<int>
{
public IDisposable Subscribe(IObserver<int> observer)
{
return Observable.Interval(TimeSpan.FromSeconds(1))
@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