Maximising Medium

I don’t know about you, but I find the reader-unfriendly letterbox design of Medium pretty irritating. [eg]

A platform literally built for people to read things, filling about a quarter of the visible browser height with pointless elements, begging you to sign up or remind you what you’re trying read. Sigh.

So, I’ve knocked up a little ‘bookmarklet’ script to get rid of the annoying bits:

You should be able to click and drag this link >>> MAXMEDIUM <<< to your browser Toolbar to create a simple button to click, when things get on your way on Medium articles.

If that doesn’t work, you can create a new bookmark and paste this code in to the ‘url/link’ entry:

javascript: (function() {
    function R(w) {
        try {
            var d = w.document;
          	console.log(d.getElementsByClassName('metabar'));
            if(d.getElementsByClassName('overlay')[0]){
				d.getElementsByClassName('overlay')[0].parentNode.removeChild(d.getElementsByClassName('overlay')[0]);
            }
            if(d.getElementsByClassName('metabar')[0]){
				d.getElementsByClassName('metabar')[0].parentNode.removeChild(d.getElementsByClassName('metabar')[0]);
            }
            if(d.getElementsByClassName('js-stickyFooter')[0]){
				d.getElementsByClassName('js-stickyFooter')[0].parentNode.removeChild(d.getElementsByClassName('js-stickyFooter')[0]);
            }
        } catch (E) {
          	console.warn(E);
        }
    }
    R(self);
})()

I’ve also created one to kill autoplaying videos from news sites like The Independent, which then follow you down the page as you’re trying to READ the NEWS, even though you stopped it or never wanted to watch it. Double-deep-sigh.

What a waste of bandwidth. And also completely destroying any sense of honesty from analytics on video views. “Hey, video views are up!” “That’s great! Well done video producers! Call the ad men!”
Web developers: “…….”

How I created a TwitterGroup for Gnomedex

twitbot.gifI see Dave has posted a few ideas that he’d like to be able to do with Twitter. His ‘use case #1’ is regarding the ability to subscribe to a kind of ‘reading list’ of people at a conference. Good idea! TwitterGroups are what we need! 🙂

So, while I was at Gnomedex, I wanted a way to track tweets (that’s Twitter posts, for the uninitiated ;p ) from others at the conference who were also on Twitter. A show of hands from the audience showed there were a LOT of us 😉 Naturally, I don’t want to have to follow every user and see everypost/tweet from them – I just want the ones relevant to the conference.

Having got the idea of how to do it in my head in the first morning session, I hacked it together quite quickly during the lunchbreak. It’s based very much like my Urban Dictionary ‘TwitterBot’ which will go and search for the (urban) meaning of a word, at the command of any follower.

So, here’s how I did it:
1. First, I set up an account, called @gnomenet

2. Then I set up a simple database table in MySql with a ‘status_id’ column and a ‘screen_name’ column.

3. I then invited people to ‘follow’ that account and instructed the followers to start a post with  ‘gd’ if they wanted their tweet to appear in the ‘group’ timeline – if they had something to say about the conference.

4. Then, I had a PHP script set on an automated cronjob to poll the followers.xml for the gnomenet account.  The followers.xml file always has the latest tweet from each follower, also providing the status(tweet) id and the follower’s screen name. It polled the followers.xml file once a minute, which is under Twitter’s API limit of 70 per hour.

5. When the script sees ‘gd’ at the start of a follower’s tweet, it then adds the screen_name and status_id to the database table. Then it sends that Tweet to the @gnomenet account after removing ‘gd ‘ from the start. This is easily done using Twitter’s very simple API.

6. The next time the script polls the followers.xml file, if it sees the same user posting the same thing (it compares each status_id with existing records in the database) it says to itself “this user already said that!” and ignores it.

7. If the follower does not have gd at the start of the Tweet, then the script goes and deletes from the database table any post from that user/screen_name  – ie: mostly, there is nothing to delete, as people don’t post to it all the time.

Doing this keeps the database table clean and compact. It worked pretty well for 52 followers! I wonder how many them were not even there at the conference! 🙂

This has a load of potential uses for TwitterBot automation and TwitterGroup creation, though I’m sure there might be a more graceful way of doing this. Happy to hear more ideas

Gnomedex was GREAT fun again – this was my third. But I have to say, I’m looking forward to the possibility of ‘GnomeStock‘ ;p

Twitter Down!

Wow. Looks like Twitter is having the biggest downtime to date. After a day of it crawling at very low speeds, refreshing on the other machine, it’s now firing in circles. Meaning that a hit to my Twitter seems to be constantly redirecting to itself. Odd. And painful (for the server)!

update: Now it’s “Twitter: down for maintenance—be back shortly!”

I think that the users out there with hundreds (some well over a thousand Friends) (Robert Scoble and Jason Calacanis, for example) are probably causing a huge strain on the databases while calling for updates, depending on their architecture.

It could also be that they are in the process of implementing a group feature. Which should enable a further filter to reduce heavy flow. I’m sure they’ll get it all fixed up soon.

It also means that as it’s down people can get back to blogging! Ha!

It’s a shame that this went down, as I did a quick favour for my friend Bre Pettis from Make: magazine and set up a simple PHP script to grab the latest updates from the Make: Craft: and Hacks: zine blogs and post them to their respective Twitter accounts, which Bre set up after I alerted him that those usernames were still available. 😉