Photo
Knewton’s @jdavies1618 explains math jokes.

Knewton’s @jdavies1618 explains math jokes.

Text

jQuery Shorthand: Write even less (html) code.

jQuery Shorthand is a plugin for the jQuery framework which provides a parser for converting Strings and JSON into HTML elements. This allows you to store HTML definitions using less space, and makes creating HTML from Javascript really easy.

$$(“div#my-div.my-class”)

Will create an HTML element:

<div id=”my-div” class=”my-class”></div>

This is just a simple example. There are more advanced and complex shorthand structures which allow you to:

  • Create elements
  • Style elements
  • Invoke jQuery on Elements
  • Set element attributes
  • Bind event handlers

Check out the Shorthand Overview on Github for more information, or take a quick peek at the shorthand example page to get a feel for the parser.

Text

Wordpress: link to an author’s posts without displaying a text link

By default, the only means for linking to an author’s posts is to use this function: the_author_posts_link.  Problem is, it always displays a text link as well.  Not useful for linking things like author avatars or other buttons.

To add some flexibility, use this link instead:

<a href=”<?php bloginfo(‘url’); ?>/author/<?php the_author_meta(‘user_login’); ?>”>

You can customize the_author_meta using these values to fit whatever author posts permalink format your blog is using.

Tags: wordpress
Text

Gatling Analytics: make any JavaScript tracker asynchronous

Gatling is a jQuery plugin that provides a framework for firing non-asynchronous tracking pixels in an asynchronous manner.

The problem with non-asynchronous trackers is they block the page load until they respond, creating a sequence of delays. By using Gatling to handle third-party analytics trackers, you get the following benefits:

  • Trigger any number of tracking pixels in parallel, without impacting site performance.
  • Centralize your tracking pixels into one file for easier management and auditing.
  • Implement multiple trackers for one provider much more easily (e.g., track a hit on two different Google Analytics accounts).
  • Stop depending on third parties to implement their own asynchronous libraries properly.
  • Fire off trackers as the result of a user action on your site without touching the actual source of your application.

It’s good for site owners, and it’s good for tracker providers. Get into it by reading the Gatling overview.

Read More