It was 10pm one night as I was sitting at my desk about ready to go to bed, when the phone rang. It was my old boss P.
"Dave! My man. I need your help, and I need it right now."
My past experience with P assured me that something very interesting was about to be said.
"You see, we're trying to push out a Wordpress website to a client. It's due tomorrow. It's finished, but we can't get it to deploy!"
This launch had the usual PHP suspects:
- Works on my dev machine but not on the server
- The white screen of death where something's crashing but no error messages and a blank page
- Oh, and also,
"Our team hasn't slept in 3 days! They've been working overtime trying to get this site up and they just can't figure it out."
I see we were also making the classic blunder of "I don't have time to sleep!" and I don't guess that's specific to PHP, but the sleep soapbox is for another discussion. The task at hand was a broken website! And his next words are burned into my ears to this day:
"David, I'll pay you $1000 if you can get this website to work."
"No no, I'll pay you $2000 if you can get this website to work."
P always was a convincing salesperson.
I somewhat mourned the loss of the sleep I would not be receiving that night, but I was intrigued by an interesting search and rescue challenge with a high reward for success. I agreed to the project, made some coffee, and set off to burn the midnight oil.
I logged into the server.
I found the site files.
I enabled error logs that had been neglected to be enabled.
And went to the home page again.
What should the error message be?
Syntax error in functions.php line 342.
And just what was on functions.php line 342?
$some_array_variable = [
After some rapid fire Google-fu I knew what had happened. I laughed. Can you spot the syntax error?
Seems the server was running PHP 5.3, but the developers had been using PHP 5.4 on their laptops.
And in PHP 5.4's release notes, there was a small line that stated, "Short array syntax has been added".
PHP didn't always have the familiar "
$arr = [" syntax for array literals - you used to have to write it as "
$arr = array(". And this server didn't comprehend
So! I changed that line to:
$some_array_variable = array(
And the site sprang to life.
And that was the only problem with an otherwise working website. I changed one line - arguably one single character - of the code.
By this point it was 3am. After some back and forth with various stakeholders I managed to explain what had happened and collected my shiny $2000 windfall at the highest effective hourly rate I've gotten before or since. And then went to bed around 10am the next morning.
Freelancers can take advantage of opportunities in a way employees often can't
Suppose I had to be up for a 9-to-5 job in the morning the next day. I'm not exactly old, but going a full 48 hours without sleep would have probably wrecked my week. That would have made the calculus for taking this sudden gig a lot less appealing. But because I work on my own schedule, I could just sleep in (very) late the next day without a lot of fuss.
This is the power of remote part time freelance development - sometimes, with a large enough luck surface area, fun/interesting/unusual/unusually lucrative opportunities come knocking at your door.
Because of the flexibility of not working full time, you can adjust your schedule to not suffer much or any from taking these opportunities.
What I did in December when opportunity came knocking again
You may have noticed this mailing list slowed a bit in the last month. This was partially because an opportunity not unlike the all night PHP syntax hunt showed up in my email inbox a few weeks ago. Some wonderful persons had been reading my mailing list and asked if I wanted some Django work. Because the funding for said work came from a grant, the "accounting fiction" was that all the money in that fund had to be spent by December 31, and if I could work 40 hours this month the project was mine.
And because this project was with interesting people for an interesting cause with an interesting codebase and an interesting application at an interesting rate, I temporarily rearranged my December priorities, cut my activities down to only my essential client projects, and crammed a lot of hours into not a lot of weeks.
And now there may be more work to come from them on a more relaxed pace, I made some good money in December, and everyone seems to be happy. Another example of the power of the flexible schedule that freelancing gives.
Back to our regularly scheduled programming
Now that the accounting fiction has passed, I'm back in the saddle and we can resume our quest to build a freelance business from scratch. If you missed episode 1, I talked about Building Your Own Little Utopia over here. Next we'll discuss how being a Purple Cow will help you stand out from the sea of other freelance developers. This is one of the most important parts of setting up your freelance business, and I'm pretty excited about talking about it with you.
I hope your Decemberween holiday season was grand and swell, and happy 2019!
 I suppose this is probably arguable at this point :P
 My new favorite phrase.