Blog Posts

Mocking Angular’s $http Promise return type

The Angular $http service provides an easy way to interact with an API endpoint. If you want to query some data, you can simply do this: var request = $http.get('/api/items'); request.success(function (data) { console.log('I have data', data); }); The request object above is an Angular HTTP promise (ng.IHttpPromise…

Using Jasmine Spies to Create Mocks and Simplify the Scope of Your Tests

Jasmine spies are a great and easy way to create mock objects for testing. By using a Spy object, you remove the need to create your own function and class stubs just to satisfy test dependencies. Some TypeScript Code Let’s say you have this service for saving a person: iperson-service.ts /// <reference…

Published

Fixing 'Sublime Text Has Stopped Working' on Windows when you have a corrupted session

This might not work for your issue, but it’s fixed it for me a fair few times. Every now and again, I'll fire up Sublime Text to be met with this: Usually (as far as I can work out) it’s due to a folder that I was previously working on being deleted/missing and this is causing some issues when it tries to reload the…

Published

Your Developers are Miserable and Are Going to Quit

Dear Software Development Managers, I've been lucky enough to work with a fair few development teams over the years, both here and in Canada (you'd have to ask them if that feeling is reciprocated). As well as getting involved with some good projects and taking part in a multitude of technical discussions, I've also…

Published

Create a Grunt meta-runner in TeamCity

As much as all the cool kids are now using Gulp, I'm still using Grunt for a few few automated tasks. In our current project, we're using it to compress all of our JS in the project, run the Jasmine tests through Karma, and generate test code coverage reports. As well as doing this locally, we need to be able to…

Published

Use Windows Credential Store for Git to remember your login for TFS, Bitbucket and such

Git is great. And it’s easy to use from the command line. One niggle though can be having to type in your username and password when pushing to and pulling from remote servers like TFS and BitBucket. In the past, I've used Pageant for this sort of thing but it’s not exactly straight-forward. There’s an easier way. An…

Published

Create a Scratch Branch in Git

Sometimes it gets to 4:59 on a Friday and you've got a bunch of files you've been mucking around with but don't really want to commit. This could be because you're just using throwaway code or because you've made changes to existing files that you don't want to break. In these circumstances, you have a few…

Published

Provisioning a Windows Server Vagrant box with IIS, .NET 4.5 and Octopus Deploy

As part of testing for our new Continuous Integration set-up, I needed to pull together a bunch of machines for testing deployments. I had planned on using Octopus Deploy to do this so Vagrant seemed like the best choice for getting new machines set up. Provisioning The entry point for creating a Vagrant box is…

Add Visual Studio 2013 Command Line Tools to Cmder

Cmder is an excellent console emulator and my go-to tool for Git on Windows. Every now and again I need to dip into the Visual Studio Command Tools to do something like manually run MSBuild, so it’s handy (and easy) to have this set up as a task in Cmder. 1. Manage Tasks Click the plus icon towards the bottom right of…

Published

Writing Cleaner AngularJS with TypeScript and ControllerAs

Our team made the move to TypeScript and Angular at the tail end of last year. I'd had a look at Angular a year or so ago but struggled to get my head around the excessive usage of $scope and the nesting of $parent items that needed to be traversed. Since then (with version 1.2.0), Angular now supports Controller As…