Ultracompressing JavaScript and CSS

Just read about an incredible way to compress JavaScript and CSS using PNGs on Sitepoint today.

This hit everyone’s radar from the recent 10K Apart contest where a few contestants used this to cleverly circumvent the size budget.

You can read a quick and dirty summary of the technique on the Sitepoint blog, but if you’re interested in the details of the technique and implementation see Jacob Seidelin’s blog as well as the PNGStore library.

Posted in Bookmarks | Leave a comment

Mastering Node

@codepo8 was kind enough to share a link to Mastering Node, an open source eBook on NodeJS.

It’s still a work in progress, but it’s the most complete I’ve seen so far. There’s no formal table of contents, but if you peek at the Makefile, you can get a clear idea on the topics covered so far:

  • Installing Node
  • CommonJS Module System
  • Globals
  • Events
  • Buffers
  • Streams
  • File System
  • TCP
  • HTTP
  • Connect
  • Express
  • Testing
  • Deployment

The easiest thing to to is to clone the repo and build the book (htmldoc req’d) that way you always have the latest and greatest. If you’re lazy, just browse the repo’s .md files or download the PDF that is already built.

via Mastering Node and @codepo8

Posted in Bookmarks | Leave a comment

Story of my life…

via Toothpaste For Dinner – ARCHIVE: Aug 2010.

Posted in Misc | Leave a comment

9 Useful PHP Functions and Features You Need to Know

Nettuts+ a good one today: 9 Useful PHP Functions and Features You Need to Know.

A few good ones are on there which I didn’t know about like glob(), scandir(), gzcompress()/gzuncompress() and I’m surprised that I never knew about register_shutdown_function().

Posted in Bookmarks | Leave a comment

A Quick Intro to mongosniff

Kristina (MongoDB’s author of the PHP and Perl driver) has published a quick and excellent introduction to mongosniff.

Writing an application on top of a framework on top of a driver on top of the database is a bit like playing telephone: you say “insert foo” and the database says “purple monkey dishwasher.” mongosniff lets you see exactly what the database is hearing and saying.

I wasn’t even aware of this little gem of a tool. I’ve been stuck in a few situations where I’ve often wondered what was going on in the background.

via A Quick Intro to mongosniff.

Posted in MongoDB | Leave a comment

Indieconf

indieconf – the independent and web freelancer conference looks like a really awesome conference. If you’re a participant in the conference season (either as a speaker or attendee) this is one to add to your list.

There’s pretty much no reason to not go: It’s one day, on a Saturday, and only $99.

So far the sessions include:

  • Legal Issues in Software Development
  • Pricing Your Services
  • Marketing Through Publishing
  • Top 10 Misconceptions of Software Freelancing
  • Marketing Yourself as a Freelancer on an Online Community
  • Driving Yourself to Success
  • Retooling Your Workflow (Or: Git + Tickets = Happiness)

… and it appears that their CFP is still open (also very tempting).

Posted in Business | Leave a comment

International Freelancers Day

It’s going to be a busy September for me now that International Freelancers Day has been announced. This conference spans two days (Friday the 24th and Saturday the 25th) and is completely free. Sessions seem to gravitate toward the social-business area with a few specific sessions on freelance copywriting, however all offer something valuable that we can walk away with.

Posted in Business | Leave a comment

Mongo Boston: Who’s coming?

via Mongo Boston: MongoDB conference in Boston, MA.

Meghan just announced on the New York Mongo mailing list that they are organizing a MongoDB conference in Boston. NYC to Boston is a nice road trip and the price is right… I’m in.

10gen is organizing a major MongoDB in conference in Boston on September 20. It is a full day event at the Microsoft NERD Center, featuring presentations from several of the developers at 10gen working on the project. In addition, there will be many presentations from companies using MongoDB in production – Totsy, Yottaa, Swipely, Sluggy.com, MyPunchbowl, tiptheweb.org, Harmony. There are even a few members of the NY Mongo User Group presenting, specifically Brendan McAdams (who gave the August talk on Scala + Mongo) and Mitch Pirtle.

I’ve already got my sessions planned out too…

  1. Introducing MongoDB into your organization: MyPunchbowl with Ryan Angilly
  2. Schema Design with Alvin Richards
  3. Indexing and Query Optimizer with Mike Dirolf
  4. MongoHQ: Cloud-based MongoDB Hosting with Ben Wyrosdick & Jason McCay
  5. Map/reduce, geospatial indexing, and other cool features with Mike Dirolf
  6. Replica Sets with Nosh Petigara
  7. Scala + Mongo for Java Developers who don’t know Scala with Brendan McAdams
  8. Python Development with Brendan McAdams
  9. MongoDB E-Commerce Case Study: Totsy with Mitch Pirtle
  10. Real World Data Modeling with MongoDB at Harmony with Steve Smith
  11. MongoDB Roadmap with Alvin Richards

And, of course, the After-Party :)

Posted in MongoDB | Leave a comment

A Better Way to Loop in WordPress 3

A core concept of WordPress development is understanding how The Loop works and how to juggle multiple loops on a single page. To make things easier, WordPress ships with several helper functions to access and render components of individual posts; for example the_title() and the_excerpt(). In order for these functions to work, you need to initialize the global variables which these helpers rely by calling setup_postdata() and pass in the post which you are trying to set up.

One of the problems with this approach is that each of these functions rely on several global variables to keep track of everything. When setup_postdata() is called, most of those variables are clobbered in favor of the new post data. If you wish to refer back to the some data in the original post, chances are you’ll simply be pulling in data from the last post rendered on the screen.

The get_posts() codex page offers some sample code which works around this limitation:

<ul>
    <?php
        global $post;
        $tmp_post = $post;
        $myposts = get_posts('numberposts=5&offset=1&category=1');
        foreach($myposts as $post) :
            setup_postdata($post);
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    <?php $post = $tmp_post; ?>
</ul>

Although it’s an obvious hack, it works. After looping over every other post in $myposts, the original post data is restored so other plugins and core WordPress functions will behave normally.

If you’re a WordPress 3 user (which I seriously hope you are), you don’t need to deal with that mess. Simply call wp_reset_postdata() and call it a day. Just like the code above, wp_reset_postada() simply rewrites the global $post with the original post in $wp_query. You can find the details inside of wp-includes/query.php:

/**
 * After looping through a separate query, this function restores
 * the $post global to the current post in the main query
 *
 * @since 3.0.0
 * @uses $wp_query
 */
function wp_reset_postdata() {
	global $wp_query;
	if ( !empty($wp_query->post) ) {
		$GLOBALS['post'] = $wp_query->post;
		setup_postdata($wp_query->post);
	}
}
Posted in WordPress | 2 Comments

Can the jQuery Ready Event Actually Slow Page Load?

An interesting post from Dave Ward came my way today which outlines a few conditions in which the jQuery Ready event my actually increase perceived load times.

…what if $document.ready is slowing you down? In this post, I’m going show you specific instances where postponing startup code until the document’s ready event slows perceived page load time, could leave your UI needlessly unresponsive, and even causes initialization code to run slower than necessary.

While I always do make a conscious decision to separate library and application code from my initialization methods, I’m starting to wonder if I should be paying more attention to applications similar to his examples.

Dave concludes that this certainly isn’t applicable in all situations. True, in fact, I’d say it’s always the safe bet to include your init routines in a ready event. When you get to the point where performance optimization matters, these are some great points to consider.

via Don’t let jQuery’s $document.ready slow you down | Encosia.

Posted in Bookmarks | Leave a comment