Page 22 of All Articles

Book Review: Remote: Office Not Required

I’m back on a reading kick as of late having knocked out 3 books in the last few weeks (Web Performance Daybook Volume 2 and Growth Hacker Marketing: A Primer on the Future of PR, Marketing, and Advertising) including the latest from 37signals, Remote: Office Not Required. I’ve been a […]

One Year Quitaversary!

Last week (October 30th, 2013) marks the one year anniversary of quitting my day job at CrowdSavings and pursuing my own startup dreams / running my own company. At the time I had only 3 social networks up and running with around 30k active users (SceneKids making up 99% of […]

How to handle daylight savings time in PHP

If you’ve ever dealt with time in PHP you’ve probably been burnt by daylight savings time before (quite possibly yesterday ;). I’ve been there, waking up on the Sunday of the time change with an email about timestamps being an hour off or some other anomaly that ends up being […]

Temporary `ufw` rules or How I learned to stop scripting and love the shell

This post was originally planned to be a social commentary on the potential for riots this coming Novemeber (a/k/a The 2013 Food Stamp Riots a/k/a The Backlash of the Entitlement Society) but that seemed like such a fucking downer. Then the post was supposed to be about a Python script […]

Split an array into chunks with PHP

Array chunking is a great way to paginate large arrays and as I found out recently, makes it very easy to map a large array from Redis (by way of mget and/or pipelining) back to the original data. Chunking an array is the process of taking an array and splitting […]

Were termites the least of our problems?

I’m definitely starting to think so at this point. If you’re not aware, last week our house was tented for termites and we took a mini vacation to New Orleans. What most don’t know is that this tenting was over a year in the making. Let’s back it up to […]

Shuffle an associative array with PHP

PHP makes it really easy to randomize the order of an array with the shuffle() function. If you’ve ever used this function on an associative array you know that the array will be randomized, but the keys will be dropped. It takes a bit more work, but you can randomize […]

New Orleans is more than just Mardi Gras you know

Blogging from the French Quarter in New Orleans today. A recent bout of termite infestation has left us with a circus tent full noxious gas enclosing our house and no place to call home for a few days. We were originally going to stay down in Ybor City which is […]

Incrementing / Decrementing a String with PHP

In the past, we’ve discussed incrementing and decrementing a variable and incrementing and decrementing a number by another number but did you know that we can also increment and decrement a string? You can use the shorthand operators ++ or -- to accomplish this. Please note that you can’t increment […]

The Pitfalls of Using BuySellAds

BuySellAds (BSA) is a platform for selling advertisements on your website. They take a mere 25% cut of sales and offer you a marketplace listing to help you gain exposure to potential advertisers. I love the idea and have attempted to use them on a few occasions. As of this […]

Simple Probability Distribution with PHP

We’ve all been there, trying to juggle two or more things for either split testing or just because you want some variety. This came up recently for me with juggling advertising networks and I wrote some simply code to handle it. The premise is simple, you assign weights to the […]

LinkedIn Endorsements are Nonsense

Recently a former coworker of mine sent out an email to her LinkedIn network pleading with us to leave her a thoughtful recommendation instead of just endorsing her for skills. Unfortunately, I never worked directly with her at the job (albeit part of the same department) and never really interacted […]

Incrementing / Decrementing a Number by a Number with PHP

We’ve previously discussed how to simply increment and decrement a variable but that only covered incrementing by a value of 1. What about when you want to increment a variable by 5s? There’s a few different ways this can be accomplished. First, the obvious (albeit far from ideal) using ++ […]

The Complexity of Permalinks and Slugs with User Generated Content

I’m not referring to the complexity of the permalink or slug itself, but the complexity to your code that can be introduced with certain formats, specifcally anything that the user can modify. When I was originally building I wanted to ensure that the user’s username was always in the […]

Sorting an associative array by a specific key with PHP

One of PHP’s most powerful data types is the array. It can hold numbers, it can hold letters, it can be sorted, sliced and chunked. Speaking of sorting, when sorting an array the straight forward sorting functions are only for sorting by the keys or by the values. What about […]

How to convert a CSV file into an array with PHP

Loading CSV files into an array is something that comes up more times than I’d like to admit. Scrubbing mailing lists, loading flat files to a database and various other use cases are out there and fortunately, PHP makes it easy to to do. There are a few ways to […]

Company culture is what you make of it

Been hearing from some of my friends that have recently taken new jobs about how shitty the company culture is at the company they work at. We’ve all been there, working in a development shop with the single goal to ship more units to make money. The developers sit back […]

How to Determine if it is Friday the 13th with PHP

It seemed fitting that my post on Friday the 13th would be about Friday the 13th. There are 52 Fridays in 2013, but only 2 of them are the 13th day of the month (September and December). To determine if a Friday is a Friday the 13th, we will need […]

Building a Number Guessing Game in PHP

Believe it or not, but the last 13 or so posts have all been leading up to this one. Generating random numbers, capturing user input, using colors on the command-line, pluralizing words, and then some are all being utilized in this simple number guessing game. The script itself generates a […]

The Wrong Way to Save

If you’ve ever been to a Disney theme park you’ve probably seen them. People with notebooks busting at the seams with pins, wheeling and dealing with other vacationers as well as Disney cast members. These notebooks are often filled with hundreds of pins valued at thousands of dollars, and some […]

How to Terminate a PHP Script

Terminating the execution of a script is usually one of those last ditch ways to handle an error, but it is something we do from time to time, especially if we’re debugging. To terminate the execution of a script, you can call either exit or die, die being an alias […]

How to Pluralize Words with PHP

There’s a good chance you’ve seen it before (and possibly authored it), it looks something like this “You have 1 new messages” or “There are 10 user(s) logged in”. What you end up with is something that’s either incorrect or something like looks a bit amateurish. To fix this, we […]

How to Output Variables within Strings with PHP

Displaying strings isn’t that hard, you just use echo followed by the string in question. But that only gets us so far, what about when we need to use variables inside of the string? Luckily there’s a ton of different ways to accomplish this. echo You can easily use echo […]

Why Limit the Format of a Password?

I’ve been moving towards using longer and longer passwords. When I say longer, I mean upwards of over 20 characters, mixed case, numbers and special characters. These longer passwords make me feel a bit more secure, especially when I can also leverage two-factor authentication on top of it. Know what […]

How to Use Colors in Command-line PHP Output

Nothing spruces up command-line output the way colors do. Just like when you’re customizing your [Bash] prompt, you can use color codes in strings to colorize your output. Keep in mind, these colors will only work on the command-line and not in a browser. First let’s take a look at […]