Preface on target audience:
I know they’re out there, but I’ve had a hard time finding them. All I really wanted was a guide on basic encapsulation to make my code cleaner, but so many of the guides focused instead on the Inheritance aspect (which is arguably flashier / sexier).
So I’m working on this Rails app for Melissa. It’s kind of a secret, but it’s pretty neat. She demoed it at a webinar and it was received well.
One problem I’ve encountered is that her main website that manages subscriptions and users is in WordPress. Users will register with that main website and may or may not have access to the Rails application, separately (depending on their subscription level). What I needed was a method to handle User Authentication in Rails that slaves to the subscription / account information held in WordPress. Ideally, this should all keep with the DRY principle to make it nice and Rails-y.
I wanted to avoid using any messy and potentially unsecure session cookie sharing, and I also wanted to avoid doing any database shadowing. I suspected that since all the data is up on databases on the same server, I should be able to just query it out, right?
Right! Continue reading
Update! My twitpic scraper (as well as search API calls) have been integrated into NCSU’s Tweetgator. Check it out on Github!
A couple months ago, IU East re-vamped its twitter wall. We incorporated a codebase originally developed by NCSU, and then I extended it by adding inline hashtag searching and a twitpic scraper.
At the time I wrote it, I could not find any other existing Twitpic scraper – Twitpic doesn’t have a formal API (or at least, it didn’t then; I don’t think it does at the time of this writing, either).
Effectively what this script does (see after the jump) is to browse the Twitpic site, parse out the image IDs, and then re-create the Twitpic images. It is somewhat rudimentary in that it does not cache nor does is it actually download the images — anyone reading this may feel free to extend the code into something like that. Continue reading
I’m an avid user of Google Reader. I follow a couple dozen different websites, check it daily (and sometimes quasi-daily), and have a very elaborate system of tags.
One thing that I did a year or two ago was to take my public broadcast feed of my shared items and integrate it into my main website directly. The goal was to have the homepage of my website always have fresh content by linking it to my shared Reader items (I share anywhere from 3-8 items per day, on average).
Originally, my solution was a bit of a hack: I used Magpie RSS reader to consume the feeds, then did some serious PHP acrobatics to parse out the Google Reader feed — what I failed to understand, at the time, was the fundamental differences between RSS and Atom feeds (subtle, yet significant). All in all, I think it took somewhere from 100-150 lines of code to effectively snatch the feed and parse it out; and it wasn’t perfect, either — frequentle the title and source would get mashed together. But for that particular time, it was fine.
The other night, though, I decided to try and fix it up proper. I discovered that the Zend Framework has some native Atom Feed classes and thought this would be a good place to start. (Details, including my PHP source code, after the jump)