robinadr

Posted in December, 2013

While googling myself here and there over the past year or so, I’ve noticed that this site has gone farther and farther down the Google search results. I originally attributed this to the lack of frequent updates, which seemed reasonable.

Then I happened to log into Google Webmaster Tools and found out my site had been flagged for having ads that seemed like link selling. They had noticed, of course, my Text Link Ads at the bottom of my site.

After doing some research, it seems Google would prefer for those links to have a rel="nofollow" attribute, if they had to exist, but this is against the Text Link Ads terms of service. Which makes sense, since having search engines follow those links is exactly why they sell them. However, this makes for poor Internet etiquette.

Google’s Matt Cutts (head of search spam at Google) even called TLA out specifically:

Although version 2.6 was just released less than a month ago, I’m proud to announce the release of Smarter Archives 3.0. As the version number would suggest, this is a major update.

I’ve completely rewritten the code while maintaining backwards compatibility, resulting in more streamlined code, and also reducing the total number of database queries used to 1. As in a single query. More on the code differences can be found later in this post.

Go to the plugin page to download it now, or upgrade from within your WordPress dashboard.

Continue reading →

I have been using SyntaxHighlighter Evolved to highlight code on here for a while, but it always had problems playing well with the Markdown plugin I use. I wanted to change to something that falls back gracefully, and doesn’t require any special markup outside of what Markdown can do.

I ended up using Google Code Prettify to highlight my code. It doesn’t use any weird markup (just adding a prettyprint class to the <code> block, and I can do all of it in Markdown. Here’s an example of a code block:

~~~ {.prettyprint .lang-php}
<?php
// Source code here
print( "some string" );
?>

The above Markdown ends up rendering like this:

~~~ {.prettyprint .lang-php}
<?php
// Source code here
print( "some string" );
?>

Because it doesn’t use any strange or custom tags (just a class on a <code> block), it will degrade gracefully into just a regular <pre> block without highlighting if the Prettify code disappears or isn’t working. To me, this is a much better solution than a [shortcode] like the ones that SyntaxHighlighter Evolved uses.

Here are the 2 lines of code that make it all work:

~~~ {.prettyprint .lang-html}


## Conflicts with WordPress

If your theme makes use of it, WordPress adds classes to the `<body>` tag through the [`body_class()`][4] template tag. Unfortunately, on some pages, these classes can sometimes conflict with the global styles used by the Prettify themes. For example, on my tag archive pages, the `<body>` tag had a class of `tag`, which is one of the classes Prettify uses to highlight code. The result was pink text everywhere on the page.

[4]: http://codex.wordpress.org/Function_Reference/body_class

To fix this conflict, I edited my Prettify styles to change the scope of the styles to those classes *within* `<pre>` and `<code>` blocks. For example, this is the original style rule:

~~~ {.prettyprint .lang-css}
  /* a markup tag name */
  .tag {
    color: #f2777a;
  }

I changed it to this:

~~~ {.prettyprint .lang-css} / a markup tag name /

content pre .tag {

color: #f2777a;

}

The disk usage for my website shot up recently, and I couldn’t figure out why. I did some digging, and I found out that my plugins folder was 23 MB in size. How can this be? For reference, my entire website is only about ~48 MB, and that’s including this jump.

$ du -hd 1 | grep plugins
 23M    ./plugins

It turns out that this was all due to my Jetpack install:

$ du -hd 1 | grep jetpack
 21M    ./jetpack

As it turns out, the languages folder was 10 MB on its own:

$ du -hd 1 | grep lang
 10M    ./languages

So I deleted the following files and folders: languages, tests, phpunit.xml, and readme.txt. My Jetpack folder is now down to a more reasonable 6.6 MB. It seems pretty sloppy to include the unit tests with a production release, but if you remember to delete these folders every time you update the plugin, you will save a lot of disk space.

Of course, if you actually need a translation, I would recommend deleting all the PO/MO files except for the ones you need.

While eating a pear this morning, I found myself wondering why they have a characteristically gritty texture within the soft, juicy flesh. I did some quick research, and learned this:

Pears have a characteristically gritty texture caused by cells in the flesh called stone cells. Although more and more of these have been bred out, all varieties still contain them. #

It turns out these “stone cells” are examples of a sclereid, which are sclerenchyma cells that die at maturity once they form their lignin-reinforced cell walls. In fact, the volume of these cells are comprised of mostly the cell wall itself. Lignin is a tough material that plants use to reinforce their cell walls and is what makes the stone cells seem like small grits in your mouth.