LoriB.me

Rambling On…

PSA: Do Not Use camelCase for WordPress Shortcode Attribute Names — 11/05/2018

PSA: Do Not Use camelCase for WordPress Shortcode Attribute Names

I just wasted nearly an hour troubleshooting a shortcode for a project because I did not know that WordPress shortcode attributes are passed through PHP’s strtolower() function (view source).

I rarely use camelCase in PHP, and am also not a huge fan of shortcodes, so have easily managed to get through 15 years of developing WordPress sites without this issue ever popping up.

The use case of the shortcode I was building is to allow the user to display a HubSpot form inside of a WordPress post or page by providing a couple of required attributes, and optionally some additional attributes. The shortcode attributes directly correlate to the HubSpot form parameters. HubSpot forms use camel case for the parameter names, and I matched the shortcode attribute names to the HubSpot form parameter names without thinking much about it. I spent the next 45 minutes trying to figure out why the forms would only display using the default parameters and were ignoring the user provided parameters.

Of course, it turns out that the user parameters were being ignored because they no longer matched the expected attribute names after being converted to lowercase by the aforementioned strtolower() function.

Don’t be like me. Use lowercase/snake_case attribute names in the shortcode_atts() array.

Placeholder Text Generators — 04/19/2015

Placeholder Text Generators

I generate a lot of Lorem Ipsum text when I am laying out websites. Usually I use a keyboard shortcut or the old standby, lipsum.com. I also like Fillerati. Those are nice because they include the option to add different HTML tags, such as  <p> ,  <li> , and headings.

Today while I was being very distracted from work, I did a little googling to find some new placeholder text generators. Below are the ones I bookmarked for future use.

  • Whedon Ipsum – Quotes from Joss Whedon movies and TV shows. This one has a “hidden” link back to the website of the company that (I assume) runs it. The link is not hidden at all in the code but is inside a div styled with  display: none;. There are options to choose the number of paragraphs to generate and to add  <p> tags.
  • TV Ipsum – Generates text from TV theme songs mostly from shows that aired in the 70’s. Option to choose the number of paragraphs.
  • Picksum – Generates lines from the movies of these actors: Christopher Walken, Morgan Freeman, Johnny Depp, Michael Caine, Jim Carrey, and Clint Eastwood. Options for number of paragraphs and  <p> tags.
  • HodorIpsum – Generates Hodor text. I would probably only use this one for personal projects, but it is my favorite by far. Options for number of paragraphs and  <p> tags.
Favorite One-Trick Utility of the Year — 12/30/2014

Favorite One-Trick Utility of the Year

Before I found this tool, I would open images in Photoshop to get proportional values for widths and heights. There are definitely easier ways to go about that, but Photoshop was always the first to come to mind. My new favorite tool for generating proportional image sizes is the Aspect Ratio Calculator.

For the Math inclined, it uses this formula:

original height / original width x new width = new height

Interview on Laravel News — 09/13/2014

Interview on Laravel News

I got interviewed by Eric Barnes on Laravel News about the Baltimore Laravel group and other web development related things 🙂

Laravel Learning Resources — 03/04/2013

Laravel Learning Resources

Over the past year or so, I have become enamored with the Laravel PHP framework and have a huge code crush on the soon to be released version 4.

After attending Laracon in Washington D.C. a couple of weekends ago, I was inspired to start the Baltimore Laravel meetup group. I am compiling this resource list for our first meeting. If you have any favorite Laravel learning resources that are not on this list, please leave a comment!

Laravel on the web

Official Docs

Tutorials and screencasts

Other Resources

Books

Laracon 2013 Presentations

Chalkboard Color Scheme for Komodo — 03/03/2009

Chalkboard Color Scheme for Komodo

This color scheme is updated regularly. (View Updates)

Komodo PHP Sample
Komodo PHP Sample

Komodo Edit 5 has been my default code editor for the past week or so. It is much faster and nicer to look at than previous versions that I have tried. I switch default code editors almost as often as I switch default browsers. There are so many good ones out there, but none feels exactly right. Considering I spend most of my days switching between browsers and editor, I like to keep up with the latest that is available for mac.

One of the things I am most picky about in an editor is the color scheme. It is very hard for me to find schemes that I can stand to stare at for long periods of time. Schemes with white/light backgrounds and colored text are usually too bright for me and dark schemes are usually either too high or too low contrast. For this reason, I usually end up making my own.

If anyone else is using Komodo Edit (or Komodo IDE) and is similarly picky about color schemes, I have made it available for download.

Click here to download the LB Chalkboard scheme

Komodo CSS sample
Komodo CSS Sample

I should mention that the only language specific colors I made changes to are PHP, CSS, HTML, XML, and JavaScript. Also, I am still changing things as I come across them.

Update (3/4/09): Changed CSS comment color from green to default grey.

Update (3/21/09): Downloaded the trial version of Komodo IDE 5 yesterday and noticed that schemes switched over automatically. [update: bought Komodo IDE 5 after trial expired. Still loving it (1/17/10)]

Update (3/24/09): Fixed issue with some defaults changing from white to black text after update to Komodo 5.1. Added language specific colors for Smarty.

Update (8/23/09): Changed Common Syntax bracehighlight background color from dark grey to yellow for increased visibility.

Update (9/17/09): Changed Find highlighting indicator background color from yellow to green for increased readability.

Update (1/17/10): Changed Tag matching indicator background color from orange to light blue for increased readability.

Update (4/20/10): Identifiers color added for JavaScript.

Update (5/30/10): Changed colors of identifiers and strings for JavaScript because the orange identifiers were burning out my retinas. Identifiers are now off-white and strings are light orange.

Update (10/14/10): A few settings were changed slightly after installing Komodo 6.0. Still assessing whether I will change them back or keep them as is.

Update (6/1/11): CSS identifier color changed to increase readability, reduce eye-strain, and match other scheme colors better.

Update (7/9/11): All is well in Komodo 7.0-alpha3 except for the new HTML5 scheme not matching at all. Will get to that if I can ever find some time.

Update (12/28/11): This scheme has been included as a default scheme in Komodo 7 and is now called Dark_Chalkboard. Thanks to ActiveState for including it.