C# Stopwatch Extension

Nice little extension to the stopwatch to allow for easy testing of the speed of a given method. FoundĀ here

public static class StopwatchExtensions
  public static long Time(this Stopwatch sw, Action action, int iterations)
    for (int i = 0; i < iterations; ++i)
    return sw.ElapsedMilliseconds;

To use it do this: –

var s = new Stopwatch();
Console.WriteLine(s.Time(() => DoStuff(), 1000));



Installing Node.js on Windows

Download the Windows installer fromĀ here

Nothing complex. Just click the ‘Next’ until the installer finishes and then restart the PC.

Once the PC has restarted, open a command line (or Bash Window) and type npm -v. If you get a version number then the install worked fine.

To run js code, simply type node [file.js]