Blog

Find the lowest value in an array with PHP

Finding the lowest value of an array is a pretty common task in PHP, especially when you are dealing with things like scores or money. In the old days before PHP 4, finding the lowest value of an array meant…

Continue Reading

How to convert an array to a string with PHP

Converting an array to a string is a pretty frequent task when programming. Whether you want to join some sentences into a paragraph or just smash the values into some sort of hash, you can do so very simply with…

Continue Reading

Depth vs. duration of friendships

This was supposed to be one of those grossly introspective posts that was originally drafted while at that “perfect” level of inebriation (somewhere on the down slope of Ballmer Peak if I had to guess ;) Well, simply put, fuck…

Continue Reading

sudo without password

I've recently run into deployment scenarios where I need to have a unprivileged user account execute something privileged like restarting nginx. Sure, I could just do things with the root account, but most of my deployments are done via SSH…

Continue Reading

Days until Christmas in PHP

The holidays are upon us so it's time for my obligatory holidays themed post! Keep in mind that the title may say Christmas but you could apply this same logic to any holiday or date of your choosing. $christmas =…

Continue Reading

How to reverse a string with PHP

Reversing a string in most languages is a pretty trivial task. In PHP we have a dedicated strrev function to do so: $string = 'This is my awesome string!'; $reverse = strrev($string); But what if this function didn't exist? How…

Continue Reading

Blogging from your phone

Why an I blogging from my phone? Well it’s been a very busy weekend and I wanted to give this a shot. It’s amazing that we have the technology to be able to do what I am doing right now…

Continue Reading

Node.js on the command-line

To start, let me put it out there that I’ve drank the kool-aid and have been doing a ton of hacking with Node.js (and soon enough, IO.js). I’m going to save the details for another post though. So an observation…

Continue Reading

How to generate a date range with PHP

From time to time I need to loop through a date range. One approach is to generate a start date and an end date and then add 1 day to the start date until it reaches the end date (or…

Continue Reading

How to convert a string to an array with PHP

Converting a string to an array is a pretty common task when programming in PHP. If you don't know much about PHP you could easily fall into a situation where you're manually looping through each character in a string checking…

Continue Reading