What is Toluu?
Toluu is a free service for sharing the feeds you read and discovering new ones.
Get Invite

techno.blog("Dion")

blogging about life, the universe, and everything tech


TokenObject: A strange little piece of code that creates objects for meJanuary 7

Do you ever write random bits of code and wonder why you are doing it? Something that seems worth it at the time and then you really wonder?

I just did this with a class that I call TokenObject. The goal of this trivial class is to take a string, and give me a nice way to get pieces out of it. Normally I would use split and grab the right piece, but I was doing so much conversion from “command line string” to an object, that I ended up with something that lets me do this:

var userpass = "dion password"; var up = new TokenObject(userpass, {params: "user pass"}); // up.user; // up.pass; // Can also get via: up.param('user'); up.param(0);

Funny huh? :)

/* * TokenObject: Given a string, make a token object that holds positions and has name access */   var TokenObject = function(input, options) { this._input = input; this._options = options; this._splitterRegex = new RegExp(this._options.splitBy || '\\s+'); this._pieces =
Loving Ubiquity; Extending the Web in 2009January 2

I have a project that deals with JavaScript commands that anyone can author, so I decided it would be smart to take more time looking and integrating with Ubiquity which recently got another beautiful upgrade.

Ubiquity really is the “other” command line of the Web (the URL bar being the first one). It gives me Quicksilver like access, but also has huge improvements: Writing plugins is simple JavaScript, and you can subscribe to commands from other people. This is huge. A social command-line!

There is a built in tinyurl command, but I use tr.im one these days, so I quickly wrote one:

CmdUtils.CreateCommand({ name: "trimurl", homepage: "http://almaer.com/firefox/commands/", author: { name: "Dion Almaer", email: "dion@almaer.com"}, license: "ASL", description: "Sends your URL to tr.im instead of tiny url", help: "Just type in the URL!", takes: {
window.resize firing frequency in browsersDecember 31 2008

I was playing with a Web application that did interesting redrawing of the layout (e.g. needed to do JavaScript magic in the onresize event).

I noticed that in Firefox the event took a fair time to fire. Joel Webber (of GWT fame) has also found this and said:

“Firefox and Opera do this wierd thing where they only fire resize events when you let go of the mouse button, or every second or so while dragging. It’s really irritating because there’s no way to get a “real” resize event, and it makes your ui look crappy when it goes through intermediate wrong-sized states.

I’ve always assumed this was to cover up layout performance issues. WebKit and IE fire resize events immediately.”

I wonder if the layout issue is correct, and if so, it would be nice to be able to somehow say to the browser “yup, I am in control of layout so please fire faster” or maybe by defining onresize you are saying that.

With decorators/annotations you would say:

@FireFrequency(ms=10) window.onresize = function() { // .... }

Turns out that Ben was being a good citizen and in going to file a bug, found a couple

Not just social history, actual information from TwitterDecember 31 2008
<html> <head> <script>   document.write("This page should show you your twitter info if you're logged in. (If you see a login box make sure you're logged into Twitter)<br/><br/>");   // forgive the document.write ugliness function orly(data) { document.write("Your username is "+data[0]['user']['screen_name']+"<br>"); document.write("Your real name is "+data[0]['user']['name']);   } </script> <script src="http://twitter.com/statuses/user_timeline.json?count=1&callback=orly"></script>   </head> <body>   </body> </html>

What is that is all it took to grab your username and even real name out of Twitter? Try it, it works.

Yowser?!

(via Bill Zeller)

F**k That; Love The Tool You’re WithDecember 30 2008

Dave Thomas gave a great keynote talk at RubyConf this year titled F**k Ruby (where the term was for Fork ;).

Dave is a very enjoyable presenter to listen too. He always has some of the British humour that I am of course partial too.

I loved how he managed to use the Scottish term Tath:

The luxuriant grass growing about the droppings of cattle in a pasture.

His talk is embedded at the end of this post. The Ruby stuff was very interesting and great, but what stuck with me was the early talk about loving the tool that you work with every day.

As programmers (Dave always titles himself as “programmer”) Dave talks about how we get a blank sheet daily, and if we don’t love the tool that we get to use to make the creation that day, then we will not do the best that we can, and it will show in our work.

I can totally relate to that. Sometimes we may think “use any tool as long as you create somethin useful.” Stick with Java even if you fancy doing something with Rails/Django/… because it is the safe choice.

If you are having fun and loving your tools then you will create (or adapt, which could simply be with config, plugins, or whatever) something so much better. Of course, as I now run a developer tools lab with Ben I don’t think of “t