Logan Bailey

Adventures In Web Development

Blog, About, GitHub, and LinkedIn

The Dangers of Owning Multiple TLDs

November 8th, 2016
With the advent of custom TLDs, phishing attack vectors are growing. Users no longer have to know what the domain is, they must now also be aware of all the domains and tlds a company owns.

Converting Strings to Streams

September 29th, 2016
With PSR-7 almost execlusively using streams, it's almost essential to have an easy way to convert a `string` into a `stream` resource. Combing across the internet, I've found Evert's blog post last updated June 23rd 2016. I've adapted his 3 liner sample code into a simple function:

Does Your Geography Choose Your Framework?

June 30th, 2016
Working on a remote team, I believed the library, framework, and language choices I made weren't influenced by where I lived. After getting out into the wider world, I realized how many of mine and others' decisions were actually influenced by what developers who lived near us.

When Convention Gets It Wrong

June 10th, 2016
Convention is a powerful tool, it allows programmers to make assumptions about how code will work. However, when choosing between self documenting code and convention, self documenting wins. Conventions make assumptions of the users prior experience, where as self documenting makes no assumptions.

Activating MAMP's General Query Log

May 22nd, 2016
Sometimes it handy to see all of the queries sent that are actually sent to MySQL, unfortunately doing anything in MAMP is less than ideal. See how you can easily turn on the General Query Log in MAMP.

Language Idioms, Yearnings For A Simpler Time

April 12th, 2016
As the php language grows and evolves, I wonder if it's losing itself in an attempt to be "good". The language over the years has grown wide spread criticism for bad programming and enabling bad programmers. Some of these bad programmers have drastically changed their lives, enabling them to have opportunities they would have never imagined. In an effort to seek acceptance, the php community and language have gone through many changes. But at what cost are all of these changes?

Extending Laravel's Blade

January 19th, 2016
Creating simple 1 parameter extensions in laravel is plainly laid out in the documentation. Taking it a step further can be a little more tricky. But this doesn't need to be true.

From Spaghetti To MVC

June 5th, 2015
A step by step example based explanation of transitioning a web page into an MVC based application.

Protecting Actionable Links from CSRF Attacks

February 9th, 2015
For a long time, I didn't protect my actionable links from CSRF attacks. By actionable links, I mean links that will modify data on the server, e.g. "delete product", "publish post", "like". I'd always written these as regular "a href" links, but this can be a very easy to manipulate attack.

So Long WordPress

February 6th, 2015
This blog has been powered by WordPress for somewhere close to 5 years. However, as of this morning, it is powered by my own blogging platform, OpenPub. This was something that I had been meaning to do for awhile, but never had the time. WordPress is a monster of a legacy codebase. I found that as I wanted to add new features, I was forced to rely on third party plugins or digging into the inner workings of WordPress.

Object Composition

November 7th, 2014
A quote from David West, author of Object Thinking, on object composition, which I would've disagreed with a few years ago now really resonates with me. SRP is an important principal, that while we may not apply it religiously helps to make code more maintainable.

Auto Dependency Resolution for IOC

September 11th, 2014
Ever wondered how Laravel determines which objects to pass into your classes. This guide explains how automatic dependency resolution works by showing you how to make a basic IoC container. This relies heavily on php reflection api.

Horizontal Code Reuse Through Traits

February 22nd, 2014
Traits were added to php in version 5.4 as a way to introduce horizontal code reuse. They end up being a way to programmatically copy and paste methods into objects. Traits act as php's version of multiple inheritance.

Cleaning up your templates with array_chunk

January 23rd, 2014
array_chunk is a native php method you've probably never used before, but it probably could have saved you time on lots of occasions. Here we'll dive into a use case for array_chunk, other than batch requests to services, that will help you write cleaner code.

An alternative to confirmation email links

September 12th, 2012
I hate confirmation links. Those emails you get, that say click here to make sure somebody actually reads this email. I propose an easier way for us as developers to verify that somebody is checking a given email address.

Date Formatting and Customizing Devise

March 8th, 2011
When developing your rails app, you've probably run into an issue where the default string value of a date makes no sense for your application. More often than that, there are probably 2 to 3 different date formats that you routinely use. In this article, we'll cover setting up default date formats and short cuts to access thsoe formats.

Adding Authorization Using Devise

February 28th, 2011
This will cover how to use Devise as your user authentication system. In previous posts I've used AuthLogic which is a good solution, I just find Devise simpler to use and implement. This will extend from my article Rails 3 Blog Tutorial. I'd highly suggest going through that tutorial, or you can run these commands.