Archived Posts
Displaying posts 101 - 110 of 587
Apparently Google Code limits you to having 10 hosted projects unless you beg for a higher allowance.
I sent an email to the support address (as directed in the error message) asking for help two days ago and have received nothing but an automated response telling me to go whine in the forum.
Lame.
Update: One email, three forum posts, and nearly a week later, they've finally upped my limit. Sweet.
With all the fancy JavaScript libraries to choose from these days, it can be hard to keep your website’s page weight down. Even if you’re using a small, sleek library like YUI or MooTools, there are often times when it would be nice to be able to load certain scripts only when they’re needed.
For example, if you load a bunch of fancy animation libraries to do something spiffy when the user clicks a button, but then the user does something else instead of clicking the button, then you’ve wasted precious time loading scripts you didn’t even need.
Lazy loading is when you wait to load something until you actually need it. It’s not a new concept, and the techniques for implementing lazy loading in JavaScript have been around for a while, but it can be a real pain in the ass to roll your own lazy loading solution, especially if you want it to be compatible with all the major browsers.
Luckily, I’ve done the hard work for you. All you need to do is include LazyLoad in any web page like so:
<script src="http://cdn.wonko.com/lazyload/1.0.4/lazyload-min.js"></script>
Then, when you need to load a script, call LazyLoad.load() or LazyLoad.loadOnce() and pass in the URL of the script you want to load (or an array of URLs if you need to load multiple scripts). You can also specify a callback function that will be executed when the scripts are finished loading.
The only difference between LazyLoad.load() and LazyLoad.loadOnce() is that loadOnce() checks to see if the scripts have already been loaded and makes sure nothing gets loaded twice.
// Called when all scripts have finished loading.
function loadComplete() {
alert('Hooray for LazyLoad!');
}
// Load the YUI Dom, Event, and Animation libraries if they haven't already
// been loaded.
LazyLoad.loadOnce([
'http://yui.yahooapis.com/2.5.2/build/yahoo-dom-event/yahoo-dom-event.js',
'http://yui.yahooapis.com/2.5.2/build/animation/animation-min.js'
], loadComplete);
If necessary, you can also have LazyLoad pass an argument to the callback function or execute the callback in a specific scope:
// Pass an argument to the callback function.
LazyLoad.load('http://example.com/foo.js', loadComplete, 'custom argument');
// Execute the callback function in the specified scope.
LazyLoad.load('http://example.com/bar.js', loadComplete, this, true);
For more usage details, see the source documentation or the unminified source code.
If you’d like to use LazyLoad, you can either include it directly from my server as demonstrated above, or you can download it and host it yourself:
- lazyload-1.0.4.tgz (2008-07-24)
- lazyload-1.0.4.zip (2008-07-24)
LazyLoad works in Firefox 2.x, Firefox 3.x, IE6, IE7, Safari 3.x (including iPhone) and Opera 9.x. If you run into any problems, please let me know.
So when some nutbag finds grill marks on a toasted cheese sandwich that look like the Virgin Mary, it's hailed as a sign from God, but when lightning fries the ever-living shit out of a statue of Jesus, it's just a random coincidence? I'm so confused.
Yesterday we got our first electricity bill since moving to California. After reattaching my lower jaw and popping my eyeballs back into their sockets, I turned off the air conditioner and ran around the house unplugging gadgets and scaring the cats, who aren't used to the silence or the lack of glowing LEDs.
If anyone needs me, I'll be in my back yard trying to build a fusion reactor.
It's been a while since I mentioned I had accepted a job at Yahoo!, and more than a few people have asked me when I was going to stop being lazy and write about what it's like working for Big Purple. Now that I've been there almost two months, I feel like I'm finally ready to give an accurate report.
So. What's it like? In a word: awesome. And by awesome I mean totally sweet.
Maybe it's just that right off the bat I've gotten to work on projects that are really interesting and that present lots of fun challenges, but so far I've been having a blast. I honestly can't remember the last time I've enjoyed a job this much. I can't wait to be able to show people what I've been doing.
I also love the environment. The people are friendly and smart, the campuses are beautiful, the coffee is free, and the food is delicious. Especially the cornbread. I'm absolutely in love with the cornbread served in the Yahoo! cafeterias, to the point where I've had to fight the urge to eat meals consisting entirely of cornbread and honey.
So far I've also managed to resist the urge to partake of the dessert bar, which is kept well-stocked with various kinds of delicious-looking pies and cakes and whatnot, but I imagine I'll eventually lose that battle. And what a delicious loss it will be.
As with any job, there will no doubt be good days and bad days, and I'll eventually develop complaints. I could probably already think of a few minor ones. But as long as the work is at least half as fun as it is now, and as long as they don't take away my cornbread, I think Yahoo! and I will have a long and happy relationship.
Minify 1.0.1 has been released. This release fixes a few bugs and adds a faster JSMin implementation. Download it here.
I wasn't happy with the performance of the existing PHP port of JSMin, so I wrote my own implementation, which is significantly smaller and faster. This new library will be included in the next release of Minify, and you're welcome to download it and use it in your own projects:
require 'jsmin.php';
// Output a minified version of example.js.
echo JSMin::minify(file_get_contents('example.js'));
The people who answer the phones at Oregon's Salem DMV office rock
Ryan Grove Friday May 04, 2007 @ 10:07 AM (PDT)Thanks to my recent misfortunes, I've had to call the Oregon DMV's Salem office several times to make various requests, like asking them to mail me a temporary non-photo driver license to replace the one I lost and having them send me proof of my license status so I could get a California license.
Every time I've called, they've picked up the phone on the first ring, answered with a friendly greeting, and listened carefully as I explained my problem. And each time they've gone out of their way to either fax or mail me the documents I needed as soon as humanly possible, without me even having to ask them to.
Rock on, Oregon DMV. It's not often that I experience such great customer service that I wish I had more excuses to call.
