How to make an accordion with jquery

Assuming that you have a div with id "switcher" and each panel of the accordian has the class of "switch" and that your accordion headers are h2's with a's in them, then:

$("#switcher .switch").hide();
$("#switcher .switch:first").show();

// wire up sidebar switcher
$("#switcher h2 a").click(function() {
  var id = $(this).attr("href");

  $("#sidebar .switch:not("+id+")").slideUp();
  $(id).slideDown();

  return false;
});

This is the matching html:

<div id="switcher">
  <h2><a href="#one">One</a></h2>
  <div class="switch" id="one">
    <p>One</p>
  </div>

  <h2><a href="#two">Two</a></h2>
  <div class="switch" id="two">
    <p>Two</p>
  </div>

  <h2><a href="#three">Three</a></h2>
  <div class="switch" id="three">
    <p>Three</p>
  </div>
</div>

This turned out to be way easier than I first thought.

Learn CSS Positioning in Ten Steps

Sunk Cost

xvfb-run.sh source

Manpage of xvfb\-run

This will come in handy soon.

uninitialized constant MysqlCompat::MysqlRes

So getting an old rails project up and running today was a bit of a problem. And it all ended up being something very simple.

If your on Snow Leopard you probably know that you have to install the mysql gem in a special way:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql
  -- -with-mysql-config=/usr/local/mysql/bin/mysql_config

This is all well and good, until you rake gems:unpack. That's when it all started today.

You see, those gems have to be built. And, just like when you install the gem into your system gems, it has to know the arch settings. That means you need to do:

env ARCHFLAGS="-arch x86_64" rake gems:build

So simple, yet an entire hour lost.

Can ruby gems not do this for me?

Code Conventions for the JavaScript Programming Langugage

"Avoid conventions that demonstrate a lack of competence."

Yojimbo, Instapaper, and Delicious are three applications/services that I really like. However, I want my own version of them.

Things I want to be able to do that I cannot at this time:

  • Add a zip file to Yojimbo
  • Access my Yojimbo stuff on my iPhone (or anywhere other than my laptop)
  • Have Instapaper articles downloaded to my laptop
  • Have an archived copy of every page I add to delicious
  • Have a screenshot of every page I add to delicious
  • Everything should be auto-tagged and indexed
  • Etc...

Then it occurred to me: I don't need three applications, I really just need one good one.

Sometimes I add URLs to Yojimbo because I want an archive of the page. Sometimes I add things to Instapaper, but want to read it when I'm offline. Etc, etc...

So how hard would it be? Is it impossible to get an application/service that I can dump anything into for later and then get to that thing anyway I want?

Anyone got any recommendations?

Microsoft's Creative Destruction

I hope he's wrong, we need more innovation from everyone.

HTML5 Offline Image Editor and Uploader

20 Years of Photoshop

I remember how big a deal it was to me that I could undo multiple times.

There is no way Apple leaves out Flash from the iPhone and iPad because they want to limit people from watching video and playing games.

Why would they push HTML5 video then? Why would they work on Web GL so people can make 3D games in the browser with JS?

Why try to limit someone from doing something while inventing alternative technologies to let them circumvent your control?

Crazy.

Flash vs. HTML5 vs. Anything else

I love flash.

Without flash, I would have never wanted to be a designer. Praystation and other sites where designers uploaded "experiments" drove me to learn and to hack and to code and to draw and to create.

But today: flash sucks.
(It kinda always has really.)

It uses too much cpu on a mac (this is known), AS3 is alienating designers (bread and butter user-base), and there are just some strange bugs (but that doesn't really matter as much).

I still love it. I still use it. And oh boy do I know about some weird bugs with large bitmaps and caching and writing your own bitmap caching and using listeners to make an event loop to register queues to process things so the UI never lags (cause it's going to lag) and on and on.

All just so I can draw things on the screen and maybe even move them every now and then.

That is what I want do. The internet allows anyone to create something beautiful and immediately share it with anyone else.

So will HTML5 kill Flash?

No.

Why would it? Plugins will exist as long as the content we want requires them.

If content creators make content that doesn't require plugins, fine, but what we want is the content.

Flash doesn't matter. Neither does HTML5. Neither does anything else. If people really want content that requires flash to consume, they will find a way to use flash.

People just want to create and share things. They will continue doing that.