New site -

This post is more than 2 years old.

Back almost two years ago I posted some sample ColdFusion code that retrieved the followers for a Twitter user and then listed them by the number of followers they had. In other words, it told you who your most important followers were. (Well, "important" being measured by the number of followers a person has. One could argue that isn't the most important metric!)

I decided I'd rebuild it in HTML and JavaScript. This would let me run the script in a browser and check different accounts. Twitter's API (while it lasts) is pretty simple but doesn't support CORS. That means any time you use it via JavaScript you need to use JSON/P. That's not difficult either. I whipped up some code, wrote a custom sort on it, and hooked it up to a Handlebars.js template. All in all it was less then 40 lines of code:

Of course - while the code was easy - making it look hot was more work. Luckily, I was contacted by Amin Eftegarie. Amin graciously offered to do the design, and pushed me to actually put this code up on a domain and share it with the world.

You can run this code yourself at All the design is credit him. Trust me - my initial version was slightly uglier. ;)

Unfortunately, this solution is probably not as "tight" as I would like. I was never able to properly handle the error case for when a username didn't exist. I can handle errors in general, but I couldn't specifically notice/handle that case. Also - it's pretty easy to hit your personal API limit. I'll consider adding an OAuth type setup... but frankly... it works "good enough" for a toy and I'm satisfied with it as is. It also takes a little while to run. I've got 4.4K or so followers and it takes close to a minute to get them all and sort them out.

Oh - and I discovered that Melody Thomas Scott follows me. Awesome.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Amin Eftegarie posted on 8/21/2012 at 1:09 PM

Raymond! It "was" awesome to work with you (notice the quotes, I somehow have the feeling we might work together again in the future). I want to add that we basically created this whole tool, from coding, designing, deciding on a name, registering a domain etc, within >>>> 24 HOURS <<<<. It took a bit longer before it was launched, but the first 80% of the work was completed within hours after my initial email to you :). It was a pleasure to work with you, and it was perhaps my most productive collab ever.

Kind regards from the Netherlands,


Comment 2 by Mikel posted on 8/21/2012 at 3:38 PM

Another great example! Thanks for sharing!

Comment 3 by OJ posted on 8/21/2012 at 11:20 PM

hitting enter won't work in IE 9, only in FF and Chrome.

Comment 4 by Raymond Camden posted on 8/22/2012 at 12:34 AM

Reload and try now.

Comment 5 by Michael Chaize posted on 8/27/2012 at 4:45 PM

Wow that's so cool. Do you think you could then use the UI of Narcissus with circles ? How go you bypass twitter limitations ?

Comment 6 by Raymond Camden posted on 8/27/2012 at 5:54 PM

The second question is easier to answer. Since I'm using JS, the Twitter API is using *your* access, or rather your IP, to rate limit. So you still get blocked after a 100 or so hits. Not much I can do about that. At minimum it allows you to check your own followers and maybe a few others. I've got 4.4k or so and I can view mine like 3 times before I get limited. In theory I could add OAuth to it, but, meh, it seems good enough for testing for yourself. ;)

As for the Narcissus UI, don't you have this stat already? I think for this app, since it does one thing, the table makes the most sense. But I'm no UI expert. ;)