No F*cking Idea

Common answer to everything

How to Use Twitter for Something Else Than Pics of Cats

| Comments

So it was long since last post and i have in pipeline many posts on ODM’s, Genetic Algorithms, Streaming Algorithms Clojure and Haskell i was working on but nothing is finished ;/. Need time!

I’m using twitter

And most of the time it is just updates from friends, sometimes some news from hacker world that potentially could be interesting. I use twitter in a bit odd way first of all i post link to things i read during commute to work :) and i use twitter to post alters from my apps to me.

Why twitter ?

I think twitter is great because he is posting things to my phone also, so instead of building this really complex infrastructure i can use twitter to do everything.

How ?

This is simple i add to every app i make a bit of code to handle twitter. eg. method like this in ruby

1
2
3
4
5
6
7
8
9
10
11
def alert_notify!
  if @config[:notification_list]
    notifier = Twitter::Client.new(
      :oauth_token => @config[:"oauth_token"],
      :oauth_token_secret => @config[:"oauth_token_secret"]
    )
    @config[:notification_list].each do |entry|
      notifier.direct_message_create(entry, "#{Time.now}: I crushed! please go to logs and see what happpened!")
    end
  end
end

This is part of TwitterDriver/Agent class. And i wrap everything into exception handler when i get exception i log it and send notification to me via twitter direct message.

I love this way of using twitter because a year ago i thought it is only for sharing very random not useful messages about cats and sharing instagram pictures.

Try it yourself!

Comments