Blog Posts

Get the FN Key Working on Windows 10 on Mac Book Pro

This worked for me; it might not work for you. Remember I'm just same random guy on the internet so I take no responsibility for anything that happens to your machine. Okay? The Problem As yet (5th Aug 2015) there’s no official support from Apple for Windows 10 running through Boot Camp. So, when I upgraded from…

Published

Mock out Google Maps Geocoder with Jasmine Spies

The Google Maps Geocoder is a handy utility that lets you do this: var geocoder = new google.maps.Geocoder(); geocoder.geocode( { address: '1600 Amphitheatre Parkway, Mountain View, CA 94043' }, function (results) { // address results of Google HQ }, ); When writing unit tests though, we don't really want…

Use Script Blackboxing to Skip Third Party Libraries When Debugging JavaScript in Chrome

Sometimes you'll be debugging some click handler in your code, happily stepping through, only to find yourself suddenly lost in the middle of JQuery’s minified code. From there, it can be a struggle to step back out and resume debugging at the entry point to the library. Wouldn't it be great if we could just skip past…

Published

Use PowerShell to Add Some Logic to Your Build Numbers in TeamCity

TeamCity has a bunch of parameters that you can use to change-up your build number if you want to. Want to add the build count? 1.0.%build.counter% How about adding the branch name as well? 1.0.%build.counter%-%teamcity.build.branch% How about truncating the branch name at 20 characters to support Semantic…

Deploy a Database Project DacPac using OctopusDeploy and PowerShell

In the past, I've had to write numerous collections of PowerShell scripts to deploy websites to various development servers. Octopus Deploy takes the pain out of that by providing a slick interface that lets you easily set up environments and get your code out to them. One thing that it doesn't handle out of the box…

Use PowerShell to Create a Folder in Octopus Deploy

Octopus Deploy has a small but good selection of tasks that you can run as part of a deployment process. If you find yourself wanting to create a folder as part of a deployment (it could be a target for uploaded files, logs etc.) then you can do that quite easily through PowerShell. In this example, we'll create an…

Published

Getting Your Macro on with DOSKEY

I'm a big fan of the command line (much to the mirth of some of my co-workers). I do a lot of stuff through Git, Grunt and the like so I've usually got a Cmder window open somewhere. When using Git, there are a bunch of commands that I use frequently so it’s handy to have a shortcut to these. DOSKEY is a Windows…

Published

Mocking Angular’s $http Promise return type using only Mocks

Last week, we had a look at Mocking Angular’s $http Promise return type using the $q library. This gives you a great deal of control over when your mock promises are resolved. But, it comes at the cost of requiring both the $q library and manually calling $rootscope.$apply(). If you want to avoid those (and you don't…

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