Serving SSI content with Grunt and Connect

Having recently tried to search for the answer to this question, and found that one guy had partially answered the question on every post, here’s how to serve SSI / SHTML content through Grunt and Express. The Grunt Task Pretty straight forward, add connect with a server. Change the port and hostname as per your… Read more »

Center a Google Map on a point

I’ve always been surprised that centring on a point/LatLng isn’t a function in the Google Maps API, although the fitBounds method does tend to interfere with the zoom it’s a useful tool to have in the box.

AngularJS Karma testing

Last year I was involved in making a prototype web app using AngularJS, and as it there was the possibility that it may end up as the foundation to production code we wrote unit tests for it’s internal functionality. Whilst there is a ton of examples for testing AngularJS apps we still ran into a… Read more »

Using MarkerClusterer and MarkerWithLabel with Google Maps

Both MarkerClusterer and MarkerWithLabel are great libraries, but they do have their quirks; MarkerClusterer What is a cluster marker? MarkerClusterer doesn’t use Google Markers or pin styles, it takes an image path and creates HTML on a layer. The resultant markup is given a class of ‘cluster’ that you can target in your CSS. Do… Read more »

Using jQuery.ajax rather than jQuery.load

jQuery.load is an incredibly useful method, but if you want to do more with the returned source than put it into a div then you may want to use jQuery.ajax directly with your own callback. The source code for the load method is a great starting point for writing your own callback, in particular how… Read more »

iOS 7 and 412 precondition failed

With every release of iOS there tend to be some gremlins lurking in Safari, iOS 7 was no different. When first testing the site I’ve been building in iOS 7 I was getting a failure when resubmitting an AJAX POST request, the response was 412 (Precondition Failed). Eventually I found this issue explained related to… Read more »

Using Bing Maps with Require.js

Recently I’ve been doing quite a lot of work with Bing Maps. Not every page on the site requires the map API so we’ve been attempting to use require.js, which we already have, to maintain that dependancy. As usual it’s more complicated than we’d hoped. Bing Maps provides a callback hook that we can use… Read more »

An alternative to jQuery.load

Note: Are you looking to use jquery.ajax rather than jquery.load? Click here. The post below talks about using an iFrame as an alternative to AJAX. A very long time ago, 2010 maybe, I was asked to build a site with an “app like feel”, which seemed to mean “we don’t like page refreshes”. At the… Read more »

Interactive Development Standards

I’ve recently been contributing to a set of front-end standards for Sapient, you can see the results at bp.sapient-lab.com. It’s a working document that will hopefully evolve over time. My focus was on the organisation of JavaScript. It was a more complicated task than I’d anticipated as I couldn’t assume that our developers were all… Read more »

Mediaelement.js Flash fallback pain.

Recently I’ve been working a lot with mediaelement.js, much more than I’d hoped to have to have done with a module that promises so much. The biggest issue I faced was changing the video src in the Flash fallback player as when you change the source the new video isn’t loaded until it is played…. Read more »