Verbum Humanum

"...elephantine adventures in pursuit of the obvious." 
Filed under

SD News

 

Twitter and SD News

On the suggestion of my friend Nathan Bingham, I recently added some cool Twitter functionality to SD News

I added a page to the administrative backend that shows all the items that have been submitted in the last 48 hours, along with how many votes they have received.  The admin (me) can then add whichever items he chooses to a queue.  There is a cron script that runs once an hour, that takes one item from that queue and sends it to Twitter.  Simple.  I have already sent three links to Twitter and got 13 visitors; not bad considering sdpub only has 24 followers as of today.

The two gems I used, which I recommend for their simplicity, are Ruby Twitter and bitly, which I used to shorten the urls.

Submitting the items to Twitter was easy:

I made sure to save the bit.ly url so that I could look up the stats later:

This leaves me with a Hash, @stats, the key being the item id. I then made a simple view to see how many clicks each item received (referencing @stats[item_id]["clicks"]).

All in all a simple addition to SD News that I hope will pay off.  Thanks again Nathan!

Loading mentions Retweet
Filed under  //   programming   Rails   SD News   Twitter  

Comments [0]

SD News rake stats

I just rake'd some stats for SD News.  The entire project is 560 lines of code.  It could definitely be less; there are some areas that need to be DRY'd up.  But still, 560 lines of code isn't bad.

I have slowly been building a very handy administrative back-end for the site, as the needs have arisen.  It's mostly Rails, but there are two PHP scripts that do some of the maintenance tasks as well.

Perhaps I will write about it in the future, maybe include some screenshots.

One lesson that has been confirmed for me while working on SD News is that even a "small" site has a lot of moving parts under the hood that the user never sees, and that account for a lot of time that you may not have planned on.  Because of my experience I knew it would happen, and it's been fun to work on the "guts".  Beware of the ignorant web programmer's favorite line: "I could bang that out in a weekend".

Loading mentions Retweet
Filed under  //   programming   SD News  

Comments [0]