Category: Code

  • __DIR__ vs dirname( __FILE__ )

    __DIR__ vs dirname( __FILE__ )

    Calling a constant should always be faster than a function call, right? PHP contains two different ways to get the directory that a file is currently in. __DIR__ is a magic constant added to PHP in 5.3. The official PHP documentation specifically states: “This is equivalent to dirname(__FILE__).” Equivalent in return doesn’t necessarily mean equivalent in […]

  • Four Short Things – 2 March 2019

    Inspired by O’reilly’s Four Short Links, here are some of the things I’ve seen, read, or watched recently. Clicks are an “unreliable seismograph” for a news article’s value — here’s new research to back it up This is a summary of a report on user behavior on the web. It found a few things that […]

  • Four Short Things – 23 February 2019

    Inspired by O’reilly’s Four Short Links, here are some of the things I’ve seen, read, or watched recently. Leukemia has won WordPress has allowed me the opportunity to meet hundreds of people first online and then offline, but Alex “Viper007Bond” was the first. When I first started getting involved in WordPress, I spent many late […]

  • Learning Makes Developing Fun

    Learning Makes Developing Fun

    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 […]

  • Null Propagation Operator proposal for JavaScript

    At it’s January meeting, TC39 (essentially the standards body responsible for JavaScript) heard a proposal for some syntactical sugar that really excites me.  It’s called the Null Propagation operator and allows code that looks like const firstName = (message && message.body && message.body.user && message.body.user.firstName) || ‘default’; to become code that looks like const firstName […]

  • “My Code is Self-Documenting” — Eric Holscher 

    Self-documenting code is one of the biggest documentation myths in the software industry. This view generally conflates documentation with code comments. I’d like to make two arguments in this post: Code comments have value Documentation has more value than just explaining how software works Source: “My Code is Self-Documenting” — Eric Holscher – Surfing in […]

  • New BASH Prompt

    New BASH Prompt

    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 Functions I use for access logs

    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 […]

  • Bash punchcard

    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 […]

  • Four rules of thumb for committing code

    The commit message should explain Why, not what Atomic commit. As small as possible Don’t commit commented out code. Just remove it. Before it goes into master/trunk, always have at least two sets of eyes on it. You only have one set even if you have glasses.