Skip to main content

Mike Kreuzer

Twitter followers

January 22, 2017

I stumbled across some blog posts with Ruby and Python code to find the people you'd followed on Twitter, who weren't following you back. Inspired by those I decided to re-write them in Elixir.

Using the Extwitter library, in Elixir the meat of the code is:

username = "mikekreuzer"
following = ExTwitter.friend_ids(username)
followers = ExTwitter.follower_ids(username)
guilty = following.items -- followers.items
Enum.each(guilty, fn(id) ->
                    user = ExTwitter.user(id, include_entities: false)
                    IO.puts "#{user.screen_name}, #{user.followers_count} followers"
                  end)

You get a lot for free with mix, iex and the scaffolding that sits around your Elixir code. You also have to remember that what would ordinarily be the decrement operator in any other language is used here to subtract one list from another one, rather than a simple minus operator being overloaded (for some reason).

Toy examples of code like this aside, the main pain point of the language remains its lack of 3rd party libraries. There are occasional weird rough edges to the language itself, like the - - operator here, but for everything from dates & times to payment gateways, its the lack of libraries that's the killer.

On a more positive note, I've finally moved the hosting of this blog to a new server where I can finally (finally!) auto-renew my Let's Encrypt certificates & go https only, as well as play with things like Elixir in the real world.

Tags: