How far down the rabbit hole are you willing to go?
How far down the rabbit hole are you willing to go?
Photo by Compare Fibre on Unsplash

My Broadband provider does not support fixed IP addresses. So for a long time now, I’ve been regularly updating my Digital Ocean firewall to grant SSH access to my local network. A chance conversation with my brother introduced me to dynamic DNS … and a rabbit hole that I thought worthy of a quick write up!

At first I thought that all I need was a dynamic DNS setup, and a means to automatically update what that pointed at when my IP address changed. However, it turns out that Digital Ocean firewalls do not support domain names in the rules…


You can throw Exceptions, but can you catch them nicely for your users?

Photo by Max Chen on Unsplash

Having logic in your controllers to handle unexpected external issues can make your controllers ugly and difficult to manage. Accordingly, Laravel provides the exception handler by default at App\Exceptions\Handler. This does all sorts of handy wrapping, and is great for reporting (bugsnag, honeybadger etc use this). But a handy feature I recently discovered is that if you create custom exceptions with a render method, it will use that to produce a response for your users.

This means that you can keep the end result of your custom…


Photo by Kevin Grieve on Unsplash

A while back, I made a custom faker provider in my Laravel application to provide support for some tweaks I needed to make to some image generation. I pretty much cribbed it from this SO Post, which provides great detail as to how to set it up with a service provider, and your factories can immediately use any of the new functions you define.

However, this evening I needed a new faker function directly inside my tests, and discovered that the WithFaker trait didn’t create the Faker instance in the same way, not picking up on my additional faker methods…


Photo by Simon Boxus on Unsplash

In the ongoing refinement of my CI pipeline for my projects, I’ve been working on triggering automated deployments when my tests pass. A fairly standard thing to do, but not one that is supported out of the box by my current set up of using CodeShip Pro for my test suite, and DeployHQ for deployments.

To resolve this, I would need to create a new step at the end of the Codeship CI process that would be able to trigger the webhook on DeployHQ environment. This would require the following:

  1. A Webhook script to call as part of the CI…

Having a webpack build process of your assets is pretty standard, but what happens when you need to include files from angular-cli as well?

Image found on reddit

The front end requirements for a Django application I’ve been working on have been growing for some time. It started off simple. A bit of inline javascript and a few jQuery widgets were all we needed. It was a classic, get it out, get it working, there’ll be time for better engineering later scenario.

However, requirements just kept on growing, the jQuery got more complex, and finally it got so complex that any small change left…


I Came across a weird problem with a test today. Am working fast through a site I am building in tandem with another dev, and wanted to ensure that the routes that need to be behind the authentication middleware are actually protected by them. I thought my first effort would cover things easily enough:

$response = $this->get(route('foo.bar'));
$response->assertRedirect(route('login'));

But instead I got the following result:

Response status code [200] is not a redirect status code.
Failed asserting that false is true.

It seems that the auth middleware uses metatag based redirecting rather than sending the 302 Status Code with a…


Recently, we’ve needed to update our user model in our django project to support additional properties. Having looked at this great post about extending the user model, it was clear that at this point we needed to simply create a Profile object with a one to one relationship on the User model. I duly followed the approach outlined, creating a signal that would automatically create a Profile object when a User was created:

@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, raw, **kwargs):
if not raw:
if created:
models.Profile.objects.create(user=instance)
else:
instance.profile.save()

(possibly worthy of note is that I didn’t create separate signals…


image source: http://www.quotemaster.org/definition+of+insanity#&gid=1&pid=25

I have an application that I wrote in Laravel 5.1 a couple of years ago. It has a suite of tests at the unit and integrated level, and full Selenium based testing courtesy of the now defunct Laracasts\Integrated package that was an early precursor to much of the testing tools that are now part of Laravel 5.4.

This article is not about the details of the various testing packages and the constantly evolving world of test support in Laravel (as fascinating as that might be to look at). …


Having worked my way through getting Laravel Dusk working on my current project (with a quick sidestep into getting it working on Homestead as well), I figured it was finally time to start working with Dusk to write some actual tests.

My Frontend Testing Background

On earlier projects I have worked on, there was a whole bunch of pain points to getting selenium up and running, and having the tests developed. In all honesty, I steered clear a lot of the time and let other people take care of it. …


Having been playing with Dusk for the last couple of days, I became aware that several people were trying to use it in a slightly different way from my approach. Several people were asking on the testing channel on Slack about how to get it working on Homestead. Having managed to get it running on Codeship, I thought that people would be able to simply apply the changes I had made on Homestead. Turned out there was a little more setup to do.

Caveats

I have only quickly pieced this together in a single project environment, so there may be some…

Mike Smith

just some guy, y'know?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store