Showing posts with label tweeplies. Show all posts
Showing posts with label tweeplies. Show all posts

Monday, May 11, 2009

Twitter is finally public!

No, I didn't mean IPO for Twitter. :) What I meant is that public can finally benefit from Twitter content. But let me give you an example. I'm following Ben Parr and few minutes ago I saw his tweet about the food:
I so desperately want Thai or Chinese food right now. I'm getting some tonight no matter what. What should I order?

Well, while I am not a big fan of Chinese food, I just found myself also wanting something like this. So what are my options? I can ping Ben in a few hours again, however, why should I wait? I can keep an eye on what is sent to Ben almost in real time. How's that?

Just an easy click at Tweeplies gives you a feed of all his replies, which you can keep an eye on. Yes, it's easy. Yes, it's nice. :) Bon appetite!

Saturday, May 9, 2009

Ruby trick

For those who are trapped into the same problem as I am.

obj.atr

Block below is valid for the block above:

def x(obj, atr)
    return obj.send(:atr)
end

Have fun! Please, let me know how will you use this code, if you find it useful at all. In example, I can see that it can be used for something like this:

p User.find(:first, :condition => {:userid => 1}).name

This will drop an exception, if there is no such user with id 1. However, you can call it through the wrapper:

def wrp(obj, atr)
  if obj.nil?
  then
    return "N/A"
  else
    return obj.send(:atr)
  end
end
 
...
 
p wrp(User.find(:first, :condition => {:userid => 1}), name)

This might be awkward, but works well enough.

P.S. Here is the original question posted in Twitter and replies to it. (Thanks to Tweeplies.)