I Opened a Pinterest Account

Not because I’m interested in Pinterest. A client needed a website linked to Pinterest. I needed to test pin something from the client’s site.

Since I’m new, Pinterest has no idea what I’m interested in, other than that I live in the United States and I’ve visited exactly one Pinterest board (the client I test pinned ). So I have a feed full of nearly random stuff:

  • Recipes for white chicken chili,
  • The five best self tanners,
  • A picture of someone’s dream car (a Chrysler sedan),
  • Fresh pineapple margaritas,
  • Someone’s indoor hammocks in a loft apartment,
  • A woman doing a camel yoga pose,
  • Someone’s wall cubby organizer with all the cubbies filled and more stuff still on the floor,
  • Jennifer Aniston’s latest summer t-shirt, short-shorts and hat ensemble,
  • Step-by-step tree-houses
  • The perfect summer swing dress
  • Angelina Jolie in a new one-shoulder full-length dress, “a great style for bridesmaids”
  • How to make a festive Japanese lantern out of an aluminum beer can

On and on it goes. Another whole universe of random stuff.

Reminds me a little of paging through women’s magazines while waiting to get a haircut. Probably because the demographic of the client’s site is 20- to 30-something women.

It’s a bit surreal scrolling through all this stuff. I try to make some meaning of it, but there isn’t any. Without any context, it’s just stuff.

The ultimate experience in making your own meaning ex nihilo.

Just One for Lunch

Brooke has gone for three days to Syracuse for the Methodist Annual Conference.

Silas is at school.

I’ve cleared the work deck for now.

It’s just me. And the dogs. It’s a beautiful sunny day.

I think I’ll take myself to lunch somewhere where I can sit outdoors.

Use Functions, Not Globals

WordPress is often maligned because of it’s profuse use of global variables.

It’s a legitimate complaint. Globals leave a lot of room for messing things up.

If you’re doing much work with WordPress development, themes and plug-ins, it’s tempting to throw more global variables into the mix.

Don’t. Just don’t.

Specifically, don’t do this:

$EssentialThemeVariable = 'Secret Ingredient';

function do_something_awesome() {
  global $EssentialThemeVariable;

 // do something with $EssentialThemeVariable
}

Depending on where you define $EssentialThemeVariable, you might or might not be able to access it this way. More than likely not.

Instead, define your variable (and make changes to your variable) inside a function that returns the value you need, like this:

function get_essential_variable( $something ) {
  $EssentialThemeVariable = 'Secret Ingredient';
  if ( $something == 10 ) {
    $EssentialThemeVariable = 'Love';
  } elseif ( $something == 12 ) {
    $EssentialThemeVariable = 'Salt';
  }
  return $EssentialThemeVariable;
}

Then, any time you need it, you can get it back in function scope by calling the function that returns it, like such:

function do_something_awesome() { 
  $EssentialThemeVariable = get_essential_variable( 10 ); 
                          // Passing 10 sets Variable to 'Love'
  // do something with $EssentialThemeVariable
}

Now you know why its called functions.php, not global.php.

Happy coding.

Tip of the day:

Never let you kid know your Ebay password.

Silas doesn’t know ours. But today we were offered a “second chance” to buy an item we’d bid on but lost.

The winning bidder was someone’s kid bidding without his parents’ permission.

Technically, anyone who knows your password (without having hacked it) is an authorized bidder. Technically, the kid’s parents were liable to complete the sale. The seller could have filed a claim for the higher price.

As it turned out, the seller offered it to us for the price of our last bid. Filing an Ebay claim and collecting is a royal pain with no guarantee you’ll ever get your money. And we were glad to get it at the lower price.

Which suggests a second tip of the day:

Sometimes it’s better not to be a hardass and look for an easier deal instead.

Zen Garden

Upon further reflection, it happens that the part of the yard that is only half mowed is in the back where it’s clearly in view of where we sit for Porch Zen.

In that context, the unfinished work transforms the back yard into a Zen meditation garden.

It isn’t unfinished. It is perfect just as it is.

Dilemma Resolved

Yesterday I got most of the lawn mowed.

Then, I stopped the mower to toss a tennis ball back into the neighbors’ yard.

When I got back on the mower, the blades wouldn’t engage. The toggle switch was shot.

I found myself on the horns of a dilemma: To go to the parts store, get a replacement switch, repair the mower and finish the job. Or leave the lawn only partly mowed for another day.

I decided I’d go to the parts store.

When I got there the sign on the door said they were taking a long Memorial Day weekend. They had closed on Thursday. They will reopen Tuesday.

Then, on the way home it started pouring rain. Thunder. Lightning. Small hail. The works.

No more dilemma. The yard is partly mowed and will stay that way until Tuesday afternoon.

No sense letting a faulty mower switch ruin a perfectly good Memorial Day weekend.

$3 Helmet

Silas ordered a Power Rangers helmet on Ebay a while ago.

Power Ranger HelmetIt “only” cost $3. But after he’d clicked “Buy Now” we realized that it was $3 plus $39 shipping and handling.

So it’s a $42 power rangers helmet.

It was missing the head straps to hold it on his head. It didn’t matter. He had to have it.

When it came it wouldn’t stay on his head. It slid around and flopped all over the place. If he held still (something he doesn’t do very well) he could keep it on his head for a few minutes at a time.

But you can’t hold still and pretend to be a power ranger. Power rangers, by definition, do not hold still.

He tried using cardboard strips and scotch tape to make new straps. It didn’t work.

“What can I do?” he kept hounding me.

I suggested he email the people who make the helmet to see about getting replacement straps.

He finally agreed. We looked it up on Google.

Power ranger helmets are made by Bandai and distributed in the US by Bandai America.

There was an email for “Product Inquiries,” or some such, on their website. Silas wrote them an email.

I figured that would be the end of it.

The helmet got kicked under a pile of junk under his desk in the hallway and forgotten.

Then three weeks later, Bandai America sent an email back.

Yes, they have a limited number of replacement head straps for those helmets and they’re available on a first-come, first-served basis. They can’t fill requests for replacements by email, but if Silas will send a paper copy of his email to their address in California, they’ll send a set if they’re still available.

I printed the email, and left it to Silas to pencil in his address and a note that, yes, he’d like replacement straps.

A month later, on a day when Silas was moping around the house complaining of being “bored” I sat him down and made him write the note and address the envelope.

This week, the straps finally came, no charge. Silas was ecstatic.

I have to admit, I wasn’t very hopeful about the helmet ever being usable. Sending off the email was an act of desperation. In an age when everything that breaks is disposable, I never thought they’d actually have replacement parts, or that they’d be available for simply the cost of a postage stamp.

It took a while. But Bandai came through. Good for them.

As much as I’m not into their products, it’s good to know that they really do have an interest in doing right by their customers. It made my kid’s day. Which made my day.

5-Day Weekend

The school is “giving us back” our two unused flood days this Memorial Day Weekend.

Today is one of them. Next Tuesday is the other.

Everyone is scrambling to find some way of taking care of kids on the extra days when kids are off but parents aren’t.

Our kid likes school. He’d prefer to be there than at home. Home is “boring.”

This afternoon our kid is going to his friend’s house for the afternoon. Tuesday, his friend will be here most of the day.

That cuts things down to just one day on either end for each family.

The whole idea that you can get emergency days back at the end of the year is foreign to me.

When I was in school, I remember it going the other way. The school built a few snow emergency days into the calendar. I think I remember they planned on five. If snow days went unused, tough. If there was more snow, extra days got tacked on at the end of the year.

Somehow, school used to be out on June 4. Here, the last day isn’t until June 25.

I suppose it all comes out about the same, one way or another.

Which begs the question, why did they bother to change it?

Fixing jQuery – Prototype Script Conflicts

Here’s a quick tip.

I was working on a little jQuery project this week. Everything was fine until I tried to implement it on a CMS page in Magento. When I did that, the Magento menu and cart functions stopped working.

A little searching around made it clear that the problem was a conflict between jQuery and prototype.

Magento uses prototype.js. I guess I knew that. I’d seen that getting loaded from Magento’s app/design/frontend/package/theme/layout/page.xml. And it’s well documented that the jQuery library and prototype library don’t play well together.

jQuery has a fix for this. It comes up if you Google it. It’s as “simple” as adding the following line:

jQuery.noConflict();

Then, whenever you’re going to do something with jQuery, use jQuery instead of the shorthand $ to call it. So, for example:

jQuery(document).ready(function() {
  jQuery('div').hide();
});

What’s not documented so well is exactly where, to put the jQuery.noConflict() line.

After a little tinkering, here’s what worked for me.

  1. Queue your scripts so that jQuery loads first.
  2. Add the jQuery.noConflict() line immediately following the jQuery library.
  3. Load any other jQuery-related libraries (for example, jQuery-migrate or jQuery-UI).
  4. Load prototype last.

You might even add the noConflict line directly to the end of your jquery-x.y.z-min.js file if you’re loading it from a self-hosted location (à-la Magento).

Once you’ve loaded all that you can call jQuery stuff as shown in the example above, and prototype stuff using the $ shortcut.

And, if you want to get really fancy, you can re-shorten the jQuery calls by changing the noConflict line to:

var j$ = jQuery.noConflict();

Then call jQuery stuff using  j$(document).ready(function() { ...

Happy scripting!