I’ve lost count how many times I’ve forgot to ‘sudo’ something:


$ cp ../default.conf new.conf
cp: new.conf: Permission denied

Instead of re-typing this or using the up arrow and prefixing sudo, you can do:


$ sudo !!

This will re-run the previous command as sudo. In my example above:


$ sudo !!
sudo cp ../default.conf new.conf

A handy little time-saver!

I’ve been trying to keep up with the latest Laravel developments. The syntax is just beautiful and it’s use of design patters is just Object-Orientated porn. The main turn-on for me with Laravel is the IoC container and how testable components are. This sits well with my TDD nature and I haven’t even mentioned it’s use of Composer to leverage the PHP community.

So, a few months ago I started a little app. Nothing fancy, but it was in Laravel 3. I’ve decided to rewrite it in Laravel 4 so I can get some experience before it’s officially released. The app has a widget that will be used on remote sites. It will request some javascript from a remote server which may also make an API call.

Read more →

Stripe is one of the best services to integrate when you need to accept payments online. It proudly describes its services as being “developed by developers – for developers”. After working with their API on several projects, it is obvious that this is the case. I have recommended their service to many developers and have seen it integrated with great success. But I don’t use Stripe myself.

Read more →

I’ve been reading a lot recently about the use of guard clauses. Guard clauses can be used early within a method to handle special cases leaving the following code clear. Each method should have a clear execution path however when multiple conditional statements and loops are introduced, this purpose of the method can become lost.

This is something I’ve been doing for a long time. It’s a simple concept and greatly improves readability. Once I handle all my special cases at the beginning of the method, I know the current state of the request is able to continue the execution of the method. Read more →

Mixing it up a little this week and using some bash.


cat ./hill > /dev/null

Hey guys, I’ve got another movie quiz for you!


while ( true )
{
    read( $story );
}

One of the main things that confuses me with Git is Submodules! Coming from an SVN background, it took me a while to get my head around what was going on. In particular, I can’t understand why there isn’t a command to remove a Submodule.

Read more →

Name this movie!


try
{
    if ( $you->can() )
    {
        $you->run()
    }
}
catch( Exception $me )
{
    Log::message( "Caught" );
}

Another nice and simple one – those are the best!

Having used Twitter for some time, I’ve decided that I’m going to interview some of the amazing people that follow me on Twitter! I’ve realised that for a long time I am followed and have been following some really great people, but don’t know much about them. Hopefully I can change this and engage at a more personal level.

Read more →

Can anyone guess this movie?

class Academic
{
    private $rating;
    public function __construct( $rating )
    {
        $this->rating = $rating;
    }
    public function rating()
    {
        return $this->rating < 0.5 ? 'bad' : 'good';
    }
}
$staff = new Academic( 0.1 );
echo $staff->rating();