Welcome to doginthehat — the website of Ben Lagoutte, senior developer.

Recent Posts

Sass mixin to debug your css layout

If you find yourself with a complex css layout that isn’t quite working the way it should be, and you can’t quite work out what’s happening. The dev tools might be helping but you keep having to refer to it for every little changes. Here’s a handy sass mixin that you can simply drop in any element and get a quick debug view of your page with outlines: @mixin debug-layout { outline:1px solid black; >…

Read More

Install QPKG on QNAP TVS-871T

For reference if anyone comes across the same issue. I’ve been trying to install QPKG on the device (to install a Dropbox client on it) but found a lot of obsolete information. There is a post on a qnap forum here (https://forum.qnap.com/viewtopic.php?t=99196) that hints at an alternative option called Entware-ng. To install it, download it from the previous link. Then in your QNAP management page, go to the App Center, click on the cog wheel…

Read More

Configure ArangoDB in strapi

I’ve just started testing out strapi and decided to run it against an existing ArangoDB database. I ran into a small issue with the automatically generated models. With the default generated code, you’ll notice that records do get added to the database but an E_UNKNOWN error keeps popping up in the admin and the records list has a blank id. ArangoDB uses a particular id key column called _key. To get this to work, you…

Read More

Testing your nginx configuration alteration in Gitlab Omnibus

If you’re familiar with nginx, you probably know to run nginx -t to test your config changes are valid before reloading the service. If you are running nginx through the embedded version of Gitlab Omnibus, it’s slightly more tricky. Say you’ve include some additional hosts to it (via nginx[‘custom_nginx_config’]) If you want to test that it’s correct before reloading everything the syntax is: /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx -t Path to nginx, with custom configuration path to…

Read More

Fixing Google Analytics integration in Lemonstand V1

With Lemonstand V1 now unfortunately unsupported, we’re starting to see a few random errors appearing now and then that won’t be fixed — e.g. braintree payments fix. One such problem is the recent deprecation of Google’s auth login system and switch to oAuth2 which throws an error in the dashboard. Fear not, someone has already created a fix for it and published the code on Github: https://github.com/TuzBot/LS-V1-Google-Analytics-oAuth2 Effortlessly applied to a few sites. Thanks Michael…

Read More

Deprecated error with Lemonstand V1 and Braintree Payments

If you’re running an eCommerce website using Lemonstand V1 (which is now unsupported since their V2 is the new hot stuff) and have recently upgraded your server to PHP 5.5+, you may run into a deprecated error when using Braintree Payments. The error is in /modules/shop/payment_types/shop_braintree_transpredirect_payment/Braintree/Util.php and is pretty easy to fix. There are two functions using the deprecated /e modifier: delimiterToCamelCase & camelCaseToDelimiter. The fixed versions of these methods are: delimiterToCamelCase public static function…

Read More

Considerations with HSTS and storing website assets on Amazon S3

With SSL getting pretty cheap through some providers and many guides offering easy instructions to get going on setting up, be sure to approach with caution. Aral Balkan has a pretty well written set of instructions on this website on how to setup SSL with the best practice configuration. It’s all very good information available there. There is one line that you should be very cautious about understanding properly: # Add HSTS add_header Strict-Transport-Security “max-age=31536000;…

Read More


Interesting results trying to optimise a website for a client. This is the blitz.io results before and after. In both cases the website run the same Lemonstand installation. The before setup had a standard cPanel installation with: Apache 2.2.25 PHP 5.4.21 with XCache MySQL 5.0.96 2GB Ram The after setup has: nginx 1.0.15 PHP 5.5.15 with Zend OPcache (running as php-fpm) MySQL 5.5.39 6GB Ram There is obviously a lot of difference between the two…

Read More

Basic openssl RSA encrypt/decrypt example in Cocoa

Caveat – I’m building an OSX app for Maverick – this may work for iOS but I haven’t tried. In a recent project I’ve had to build a small Cocoa app that decrypt a packaged document. The document packaging is basically provided by a RSA public/private key encryption. The encryption is generated by a website and I had zero issue doing this in PHP.. actually was insanely simple. Then I had to do it in…

Read More

Compiling webpay on a cPanel based server

This is more of note-to-self for future reference but other people might appreciate it. If you have to use the St George webpay API, high five to you first and you’ve probably suffered through trying to install it. Assuming that you have all the requirements to compile it (swig, php), the only things you need to remember are: You need to compile it using the active php installation from cPanel/WHM, which includes the correct extension…

Read More

Recent Projects