Category: Code

Like many developers, I get into ruts where I'm not excited about what I'm working on. There are pieces of development that each of us doesn't enjoy for some reason. Maybe you hate QA. Maybe you hate refactoring. Maybe it's writing JavaScript, PHP, CSS, or Go. It doesn't matter what it is for you. These roadblocks of lack of excitement and interest need to be broken through if you are going to succeed, and one of the best ways to do that is to make things new and fun again through learning.

Learning and using new techniques makes things fun again. Coding gets boring when we spend our time doing the same thing over and over again. When we aren't pushing ourselves forward, we are being left behind. It's important to overcome the challenge of doing something new so we continue moving forward.

Here are three things I've read over the last few weeks where I learned something. Maybe one of these will help you learn something new:

Linked Lists by Lara Schenck. This is an overview of a data structure that isn't native to any of the languages I spend the majority of my time in. Lara's series on computer science basics is a great primer for those of us without formal CS educations.

The Documentation for Styled Components. I was introduced to Styled Components when Laura Medalia started mentioning them on her Instagram Stories. I've started playing around with them to see if they are going to be right for some of the react things I've been doing.

to become code that looks like
const firstName = message.body?.user?.firstname || 'default';

Essentially, it allows for eliminating lots of checks to ensure multilevel JavaScript objects are properly defined. This reminds me a bit of the null coalesce operator in PHP as it allows for easier to read code. It needs to be balanced so these languages don’t turn into Perl filled with secret operators.

The proposal is now in stage 1 which means that TC39 “expects to devote time to examining the problem space, solutions and cross-cutting concerns”. It’s still early to get excited about this, but this is one of those pieces of syntactical sugar that make writing code easier.

For the last few years, I’ve been using impromptu for setting my bash prompt. However, it felt in perpetual beta status and I wanted to try out something new, so today I installed bash-git-prompt and am giving it a try.

It was super easy to get started with it following the instructions.

Run brew update

Run brew install bash-git-prompt for the last stable release or brew install --HEAD bash-git-prompt for the latest version directly from the repository

The command line is my IDE. Vim is my editor and all the functions and programs in bash help me be a better developer. As much time as I am writing code though, I also am often spending a lot of time looking through logs to see what is going on. Over the last five to ten years I’ve collected a number of bash functions to help make working with access log files easier. Some are stolen from my old coworker Drew, others from various places online, and others I’ve cobbled together.

I can run cat access.log | fawk 7 to pull out the urls. I can further pipe that to sort | uniq -c | sort -nr | head to pull out the most popular urls. I also have a function for visualizing these results.

When are you using the command line? I use a python script and a change to my HISTTIMEFORMAT to keep track of when I am active on the command line. Since I use vim, this means that every time I launch my text editor along with every time I run a command is recorded. This is my punch card since I got this computer in July, along with a punchcard of just commands that start with git and just commands that start with vim.

All commandsall git related commandsall vim commands

It’s interesting to see that I open Vim on Mondays much more than I commit code on Mondays. I think I need to spend some time figuring out how to make Mondays a day with more commits.

My tweet splitting algorithm first splits the post by sentences. It then tries to build tweets and prioritizes keeping sentences intact. My thinking is that this helps the tweets stand on their own a bit more. If you want to use this, download and activate both publishiza and the gist below as plugins.

Just add that to your .ssh/config and you don’t need to enter your private key passcode every time you ssh. The old behavior will be back. This can be enabled only for specific servers using the cascade inside.ssh/config or for all servers.

HHVM has now released it’s second long term support release and PHP 7 is in the final stages of implementing changes. It’s an exciting time for PHP and to be a PHP developer which means it is also an exciting time to be a WordPress developer since it creates an opportunity for WordPress to once again embrace forwards compatibility.

While I was at PHPUK, one of the most common conversations I had was people being critical of WordPress for supporting PHP 5.2 as a minimum. Many of those same people became less critical once they find out WordPress runs great on PHP 5.6 and that many people run it on HHVM.

For the last several weeks, WordPress has been running it’s unit tests on PHP7 nightly builds. They’ve been running on HHVM for months. Right now, the unit tests are not passing for either one and as far as I know, have never passed for either one. This is a problem.