Archive for July, 2010

Ajax Will_Paginate with jQuery

Recently for work I had to use ajax to reload a paginated list. I quickly found this post on using will_paginate with ajax, but the official solution uses prototype instead of jQuery, so I spent some time figuring out how to do it with jQuery in a DRY way. Here’s what I came up with (code hosted in a github gist):

When you first load up items/index, the html responder just loads the index view via the _items partial. If you click any of the ajax_will_paginate buttons, the link href will get sent via ajax, the index action will return just the _items partial, and ajax_will_paginate will update the contents of the my_items_list div. If javascript is disabled then clicking on the will_paginate links will work normally.

There are too many things to keep track of

I am easily overwhelmed by the exponentially branching tree of things I must think about in order to get a single thought thunk or a single action performed. Maybe writing some of it down will be helpful, but a lot can happen between a thought and its recording.

I pulled my voice-recorder out of my bag today, because I was thinking about how typing things requires enough of my brain to chase the thoughts out of my head.

I need some system for keeping track of things in my head and sorting things out, for serializing and prioritizing and scheduling. At the moment I’ll think of one important thing and maybe it’ll make it onto my hand, but more likely it’ll be chased out of my head by another thought that seems equally urgent in just a few minutes. Worse, I know this is going to happen, and it taints exciting new ideas with fear and frustration.

Just this morning I thought to ask Tyler if there’s anything in the Bible that you couldn’t possibly figure out unless you knew some elusive culture fact. Remembering that I had thought of that question in the shower and then feared that I would forget it prompted this blog post. As soon as I thought the question, I feared I would lose it, so I repeated it to myself a couple of times, and then suddenly thought of something else which chased it out of my head until now. I’m full of these. What should I do with them? Tyler has been out of the office for hours, and I won’t remember to ask him this tomorrow.

Perhaps if I scheduled a time to read my TODO list, and whenever I thought of a new TODO I’d say it in the voice recorder and have another time to fill in the list… I’ve tried all sorts of things, though, and none of them have ever taken root in my life. Events get scheduled in my Google Calendar, which texts me when things are about to happen. I still miss some of those notifications because I’m so used to them that I ignore them, or because they come an hour before the event and I forget to set a more proximal alarm.

Problems with that: It’s hard to have a set time to do anything as seemingly trivial as a time to read and act upon my TODO list. It also doesn’t contain any method of prioritizing or pruning entries that require more than a couple of minutes to do, like replying to some email or writing a blog post…

How do I know how to prioritize things? I actually have a TODO list (I always do – it’s just not very useful), and it looks like this, copied verbatim:

——————————
TODO:
URGENT TASK: Play level 18 of Portal so Katie can beat it
wordpress theme for crusade and ccfl
on my own time, learn:
everything about rspec, remarkable, pickle and cucumber
vim scripting, specifically how to run quick bash commands with strings from the document from a hotkey (I want a grep -r “<string>” *) http://bit.ly/aWZdq2
how to make gems
how to use  Nokogiri
pray for WALT for guidance during his exit from compacency
pay stu $25 for the shaver
pay ben $35 for the bike
———————————-

There isn’t actually any urgency in my playing Portal, but making the ccfl and crusade websites is extremely important and will take weeks of hard work. There really should be a better place for non-daily prayers, but I don’t have one so it gets dumped here. I owe ben and stu money, and mentioning that to myself here doesn’t really ever help them to get paid, but it does keep track of the amount I still owe them, assuming I remember to update it every time I buy stu a sandwich… Who knows what should be in here?

This causes me a lot of stress, and I hope I figure it out. I’m sortof open to your suggestions, but I have tried a lot of things, and just getting the trivial organizational schemes that work for you just because you’re better endowed for this sortof thing may not feel that welcome. Writing about it has been helpful, though, so I guess writing does impose some order on the chaos.

Anyway, here ends the first of many rambly blog posts. The new philosophy is to prioritize the creation of blog posts over blog post quality.