Unit testing Observables in .NET

In one of our applications we’ve been using mongodb’s change streams to listen to changes in the database and then broadcast them using signalr for a truly reactive experience. We create an Observable (with Observable.Create) and listen to changes within the lambda passed to it. Every time a change is detected, we emit a new […]

Use DayVenture to find events

I’ve started a website called DayVenture as a side project to allow people to find events that they can easily travel to. The premise is that you enter your location, then you pick a train station that’s within a comfortable distance, and it shows you events that are happening in that location. So far you can type a […]

Stream vs Promise Asynchronicity

I recently hit a stumbling block whilst testing asynchronous javascript. My code needed to make a call to the server from the browser, so I decided to use a Promise as an abstraction in order to stub it out. I chose the bluebird library, as it’s incredibly popular, performant and adheres to the Promises/A+ spec. Unfortunately […]

Fun with parser combinators

Parser combinators are essentially a neat and powerful way of declaratively writing a parser, which could be used for writing your own programming language, or DSL. You make small parsers that act like building blocks and then combine them to create more complex parsers until you have one that encompasses them all. There are quite a few parser libraries, so you can […]

Enabling https in a node js app on windows

Whilst developing my knockout dependency tracking application I realised I had to support access to it over https instead of http. This is because the website we’re currently developing and all of the web services it talks to are secured via federated identity. Ideally we would be able to simply flick a switch to use http during development, but […]

My First F# App™

I’ve been eyeing up F# for some time after reading that it’s the hot new thing. Unfortunately when it comes to learning new ideas or technologies, I find it difficult to actually learn them unless I’m applying them at the same time – so I was in a vicious cycle of needing an application to write, in order […]

Acceptable Dependencies

Today I attended a talk about mocking in order to facilitate unit testing. The example used was a “UsersService” that accepted a repository as a constructor argument. Essentially it was doing CRUD and forwarding the calls almost straight on to the repository: This file contains bidirectional Unicode text that may be interpreted or compiled differently […]

Repeatedly polling server with ajax

I’ve made a small fiddle that illustrates repeatedly polling a server asynchronously once every second with the ability to pause and resume for posterity. For more advanced functionality, including long-polling then SignalR is your man, but for something simple this does the job. The code is also reproduced here: