Logan Bailey

Adventures In Web Development

Blog, About, GitHub, and LinkedIn

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.

Rails 3 Blog Tutorial

February 20th, 2011
Every wonder how to easily roll your own blog? This series will take you through the ins and outs of writing your own blog using Ruby On Rails 3.

Custom Date Formatting in Ruby on Rails

October 22nd, 2010
Ruby on Rails offers a couple different standardized date formats which can be really helpful. I'm personally a huge fan of :db, I hate looking it up all the time. But you may be wondering how to create a custom date format.

Setup Double Foreign Keys

October 21st, 2010
This is how to create a model relationship in Ruby on Rails where one model, Message, has two foreign keys to another model, User. The sql tables are defined below, and is given the solution in Ruby and how to retrieve the values.

How to Build Forums in Rails 3

October 20th, 2010
A short tutorial for rails 3, which covers the development of a forum. This tutorial requires little to no rails experience.

How to Setup AuthLogic In Rails 3

October 6th, 2010
I was trying to figure out to setup AuthLogic in Rails 3 and ran into several issues. This is a step by step guide in setting it up.

The Short Comings of Sphinx GEO Search

September 24th, 2010
Drinking the Sphinx Search koolaid runs to issues with geo search. Here I explain the short comings of Sphinx Search Geo Location functionality.

Opening VIM From Inside PHP

September 1st, 2010
Want to prompt the user for a large amount of text for your CLI application? Using some flag and a large string on the command line is not always ideal. Fear not, it's easy to open a text editor from inside your application.

Sphinx Installation and Setup

August 18th, 2010
Sphinx is a simple and easy to use full text search engine. This article will cover installation and setup of your first search index.