Prawn: Fast, Nimble PDF Generation For Ruby
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!Comments [0]
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".
Comments [0]
I have been a fan of tumblelogs ever since the early days of Projectionist. I think I first visited that site in 2005, and at the time I remember being blown away by the revolutionary format. At that time, the only other site I remember seeing that had the same tumble format was Jake Nickell's. I was inspired, and soon rolled my own, which was hosted at http://www.speric.net. It was quite simple: a number of scripts, run every few hours by cron, that parsed my delicious/Flickr/Amazon Wishlist/Netflix RSS feeds, and dumped the contents in a database. I never had a form with which to manually enter anything, the entire site was automated.
In the intervening years I had a love/hate relationship with blogging, full-fledged or micro. Right now I think I have discovered a purpose in my blogging: to keep a record of the present, for the future. When I became an older teenager, I would often wonder what my parents were like when I was young. I am 27 now; what were they like when they were my age? How mature was my dad? What were his interests? What were his thoughts? Of course I can sit down and talk to him about these things, but I want to leave my children one better: a real journal, something they can browse in the future. In particular, for me, it's a place to keep notes on the things I read. Chapter summaries, moments of clarity and breakthrough, etc.
I abandoned my old tumblelog for Posterous, because it's dead simple, powerful, and a beautiful and elegant solution. Many blogging sites have tried to build a rich feature set, while Posterous is leveraging an old-timer: the email client. It's brilliant in it's simplicity.
The one thing I did miss, which my old tumblelog had and Tumblr currently has, was a way to automatically bring in my RSS feeds. This was the one major strike against Posterous, until I realized something so obvious: email is the Posterous API. I know they have an API, but I think email is their most powerful API. With that in mind, like a good hacker, I simply modified my old scripts to send an email to Posterous, instead of to a database. Instead of running every hour, they will run once a day and at the end of the week, to provide a "digest" of sorts.
But with this method, of Posterous + "email-as-API", I've duplicated everything I had with my custom tumblelog, while leveraging all Posterous has to offer. I am happy with the result.
Comments [0]
Comments [0]