Moving from tDiary, I’m kind of new to WordPress. I chose it because it was easy enough to run it on my server and had a lot of nifty, nice-looking plugins that would do me with everything that I needed. As you may imagine, while using those plugins is fine and cool, looking into the code is hell. Through my journey of fixing problems I encountered and submitting a couple of patches to the plugin authors, I’ve seen full of code duplicates, unoptimized funtion call repetition, lack of look-up table pre-generation or even a simple memoization, parsing and substituting HTML with messy, awkward, terribly composed regexps, etc. etc. . OK, life is short, let’s just turn a blind eye to them as long as the code works.
Well, so much for digressions. I just wanted to write a code blog like this. In order to do that, there is no doubt you need a good code highlighting engine with download/view buttons. I searched around for the best, but no combination of plugins appealed to my taste. I decided to write a plugin to add what is lacking for me to WP-Syntax and here it is. WP-Syntax Download Extension renders a nice caption on each WP-Syntax highlighted code snippet as below.
Lisp
1
2
3
4
5
6
7
8
(defungoto-next-window(&optional arg)
(interactive"P")
(cond((one-window-p)
(select-window(split-window-horizontally)))
(arg(other-window-1))
(t(other-window1))))
(global-set-key"\C-o"'goto-next-window)
(global-set-key"\M-\C-o"'open-line)
I’ll probably add “print” and “copy to clipboard” buttons in the future. Try it out and feel free to leave a comment.
As you all know, FriendFeed is equipped with some features to cooperate with Twitter. FriendFeed gives you with automatic CC to Twitter for writing and realtime feed updates for reading, and helps you find your Twitter friends on FriendFeed. However, they are just not enough because you cannot expect everyone to join FriendFeed. For Twitter users who don’t or wouldn’t have their accounts on FriendFeed, you have to set up an “imaginary friend” for each one of them by hand to make their tweets come up on your FriendFeed timeline. Even after all these hard work, you are left with some friends who make their tweets private, which FriendFeed cannot import. What about @replies? You don’t even notice on FriendFeed that someone is talking @you when your friends on Twitter are enjoying spontaneous talk with others, including strangers.
Introducing tw2ff
Here’s my answer to all these inconveniences. I wrote a tool called tw2ff that makes your FriendFeed life much easier in terms of integration with Twitter. It consists of the following features:
Friend list synchronization: importing Twitter-only friends to FriendFeed as “imaginary friends”
@replies import: generating a custom RSS feed of @replies for importing to FriendFeed
Protected tweets import: generating a custom RSS feed of protected tweets for importing to FriendFeed
Favorites synchronization: synchronizing FriendFeed likes and Twitter favorites
.. and some more
Installation
tw2ff is bundled in my “friendfeed” ruby gem, so you can install it right away by just one command as follows:
1
gem install friendfeed
The first thing you do after the installation is run tw2ff config and set up credentials for your Twtter and FriendFeed accounts. It invokes a text editor with the following content, so fill in with your login information and save the file.
1
2
3
4
5
6
7
---
friendfeed:
username:"username"
password:"password"
twitter:
username:"username"
password:"password"
The file is located at ~/.tw2ff/config.yml, which directory is created with mode 700. Make sure it is never read by anyone else.
Friend list synchronization
You are now ready to run tw2ff friends to import your Twitter-only friends to FriendFeed as “imaginary friends”. It’s automatic, it compares your friend list on Twitter with subscriptions on FriendFeed and creates one imaginary friend for each Twitter friend missing in FriendFeed, where the screen name is enclosed with parentheses so you can easily see it is an imaginary friend. The tw2ff friends command does not change anything with existing imaginary friends, so you can safely rerun it at any time to keep your FriendFeed timeline in sync with that of Twitter. You will likely want to run it every time you follow a new person on Twitter, but it is also an idea to register this as a daily cron job and just leave the task to it.
One note about replying to imaginary friends. If you post a comment to an imaginary friend’s entry with the “Also send this comment as an @reply twitter from ” box checked, it will be visible in Twitter but not on FriendFeed because imaginary friends are private to you.
After a while, you may happen to visit Twitter or run a Twitter client and notice that some of your friends have changed their icons. That’s when you run tw2ff icons, a command that updates all imaginary friends icons with those of their Twitter accounts. Maybe a candidate for a monthly cron job or so.
Import of @replies and protected tweets
The only way to import private feeds to FriendFeed is put the feed in a secret place no one else would know and feed it to your own imaginary friend. (FriendFeed does not support any kind of authentication in feed crawling)
First off, create an imaginary friend named, say, “@replies”. This is where your secret @replies RSS is fed to. Then set up a cron job that invokes tw2ff replies replies.rss and upload the file replies.rss to a secret location, preferably only fetchable via HTTPS. Now you can add a service to the above said imaginary friend and set the secret location. There are a couple of options to choose what kind of replies should be included to the feed: --include-friends and --include-protected. The default is both off. Specify them as needed. In addition, by the way, I highly recommend adding your favstar feed to the imaginary friend so you can see more as to how others are reacting to you. Currently there is no support in tw2ff for your tweets RT’d, but I’ll implement it some way in near future.
Okay, you’re done with @replies and now, you can pull protected tweets into your FriendFeed timeline the same way by importing a feed produced by tw2ff protected. Please be doubly sure that you won’t leak the feed out to public.
Favorites synchronization
I much prefer FriendFeed likes to Twitter favorites because they are visible to others, naturally including the one whose post is favorited. That makes it easier to share topics not just with your friends but across the much wider friends-of-friends community. Recently Twitter introduced the RT feature to help people share their attentions, but I don’t think it would have been needed if favorites had been implemented and featured properly.
Let’s get back to the subject. I use “likes” a lot in FriendFeed and whenever I “like” a tweet I want to “favorite” it on Twitter at the same time, and vice versa. That’s exactly what tw2ff favorites does. It looks into the recently liked entries for tweets, and the ones not yet favorited are favorited on Twitter. Likewise, it searches the recent entries on your FriendFeed timeline for your favorited tweets, and the ones not yet liked are liked on FriendFeed. All you need to do it make it a cron job. Problem solved!
To-Do’s
Support for RT’s
Switching Twitter client access to OAuth
Utilizing Twitter’s streaming API and eliminate the time lag of @replies/protected tweet feeds
Switching FriendFeed client access to v2 API
(You add one)
Conclusion
With the help of tw2ff as described above, I can live just with FriendFeed without the need for always keeping another window for Twitter. FriendFeed quite shines when it stands as the one-stop portal for sharing what you and your friends are up to. Empower your FriendFeed life with tw2ff!
We the FriendFeeders received a great news the other day, that the near realtime synchronization between FriendFeed and Twitter has finally been back in business!
One of the most selling points of FriendFeed (to me at least) was its being a one-stop source for your friends’ activities and blog/news feeds around the world, but the breakage of Twitter synchronization almost ruined that because nowadays most of what you and your friends are up to is in realtime tweets. I’m happy to see it come back and find that FriendFeed isn’t so far neglected even after Facebook’s acquisition.
Anyway, now that FriendFeed is back I want a nice FriendFeed client that fits a corner of my desktop. If you are a FriendFeeder you know the best client for FriendFeed is a web browser, and as much as you do I really miss the realtime window. I thought it might still serve as a good client, but it lacks some critical features like “CC to Twitter” which you need to reply to your imaginary friends (= non-friendfeeding twitterers you imported), that were added after the site renewal where everything went realtime and the realtime window was gone off from the site.
Drag the link above to your bookmark toolbar to install the bookmarklet, and whenever you want to open a FriendFeed window, fire the bookmarklet on a FriendFeed page. (This is due to security restrictions and jQuery dependency)
Enjoy!
[Update on 2009-12-29: Added some code to set the base target to “_blank”.]