Code Snippet: Generate A Plaintext Data Table

Inspired by some awesome-as-always code written by my co-worker Mike Adams, here’s a helper function to help create plaintext data tables in PHP. This is particularly useful for PHP-based CLI scripts (we use quite a few at Automattic) or for plaintext e-mails.

But first, here’s an example output with the optional dividers enabled:

   ID | First Name     | Last Name   
-------------------------------------
    1 | Alex           | Mills       
    2 | John           | Smith       
    3 | Barack         | Obama       
    4 | Fred           | Flinstone   
12345 | ReallyLongName | IsReallyLong

Click here to keep reading and see the code »

Code Snippet: Helper Class To Add Custom Taxonomy To Post Permalinks

Say you have a custom taxonomy called “sport” and you wanted to inject “football” into the permalink of posts that have the “football” term assigned to it. How would you go about doing that? Well below is a helper class that will make it easy to accomplish exactly that.

Click here to read the rest of the post and see the code »

Restoring “http://” To Your Firefox Address Bar

Lifehacker has a great article on how to stop Firefox from greying out everything but the domain name in your address bar. While I personally don’t mind it and infact think it’s a great anti-phishing feature for the average user, one thing I don’t like is the removal of the protocol, i.e. http://, from the beginning of the address bar. I know they’re trying to conserve space, but screen real estate is not something that I am lacking.

So here’s how to once again show the protocol in your Firefox address bar:

  1. Type about:config into your address bar to access a list of Firefox configuration options that are not exposed through a normal settings panel.
  2. Paste browser.urlbar.trimURLs into the search box to find the parameter we’re going to change.
  3. Right-click the row and select “Toggle” to change the value from true to false.
  4. Close the tab and go back to a normal tab, such as this blog post. You should now see the protocol in your address bar once again.