A frequently reintroduced bug

If you have a TimeSpan object, and you need to find the difference between them in milliseconds, you need to use the TotalMilliseconds property. The Milliseconds property will only return the milliseconds portion.

DateTime a = new DateTime(2017, 01, 01, 01, 01, 01, 50);
DateTime b = new DateTime(2017, 01, 01, 01, 01, 03, 80);
TimeSpan c = b - a;
Console.WriteLine(c.Milliseconds); // 30
Console.WriteLine(c.TotalMilliseconds); // 2030

Angular scope from Chrome Dev Tools console

With the dev tools open:

  1. Inspect an element inside the scope (right click > Inspect)
  2. Swap to the console tab, and type in angular.element($0).scope()
  3. If your controller is being initialized like <div ng-controller=”myController as vm”>, you can access all the properties of ‘myController’ (bound to vm) with angular.element($0).scope().vm