A friend of mine suggested that Tumblr was lacking a decent way to visualize the posts which you’ve ‘liked’. Tumblr provides a great way to view your own posts via the archive page, and so I thought I would try using their existing layout style to visualize liked posts. The Tumblr Likes Grid is my attempt.
Now, I’m not Tumblr, and so I don’t have access to users’ information directly. The information about posts a user likes is available via a call Tumblr’s API. Tumblr is among a growing list of sites using OAuth to authenticate a user and allow querying for data.
Unfortunately, there aren’t many decent javascript OAuth libraries, and I finally settled on using PHP for the three-legged OAuth handling. Even then, it was difficult to get right, and I relied heavily on examples in lieu of better documentation about the process.
The rest of the page is pure javascript. I’m using jQuery for all of my AJAX and DOM manipulation, and mustache for template rendering. I have to say, mustache is really enjoyable! Tumblr has several different types of posts, including text, photos, audio, video, quotes, and more. Each post type corresponds to a matching partial template that mustache can retrieve dynamically when rendering a post object. The templates are cached after the first use for faster rendering.jQuery is used to insert the post objects into columns and month sections dynamically as they are received.
Repeated calls retrieve successively more posts. I tried to emulate the style of the archive page as best as I could, and most of the css and imagery is taken from Tumblr verbatim. I made some alterations, including abandoning the absolute positions of all the photos. I’d like to investigate other interesting ways of visualizing the data in the future, maybe with charts and graphs (yay math!).
Here’s what’s inside the box:
- mustache.js
- jQuery
- PHP
- OAuth, with a little help from Arvin Castro’s example
The following sources were helpful, especially in setting up the OAuth authentication process:
- Authenticating With Tumblr Using OAuth in PHP
- http://pastebin.com/g1ULp4bT
- http://pastebin.com/g1ULp4bT
- Brian Carstensen’s js-util mini project
- and of course…Tumblr! <3
Unfortunately, you’ll need a tumblr (and some liked posts) to view the page. Here’s a screen-shot for the uninitiated:
So that’s the Tumblr Likes Grid. Check it out! Feel free to leave comments and questions here or on my tumblr.
Enjoy!
One of the best parts of being a software developer is that I’m constantly learning. The other day that I encountered a useful application of generics that I think is worth sharing. Normally when creating a fluent interface we want the ability to chain method calls together in a variety of different orders. And often in object oriented programming we put shared functionality in a base class and extend from that. Well unfortunately, in strongly typed languages such as Java these two desires are often at odds with each other. Continue reading…
I am happy to announce that I have finally lifted myself off of my lazy posterior and released the 0.1 (‘Zedoon’) version of my collection of Java tools. UQCLib is intended to be helpful and fun. This initial release contains as its main feature a form of peuso-closures for Java. You can read more about that here.
Documentation, code examples, and downloads are all available from the GitHub project page. The code is provided under the Apache License 2.0, and all are welcome to contribute. Now that everything is set up, I expect version 0.2 to arrive much faster. If you’re on GitHub follow the repository to see the updates as they come. 0.2 (‘Coreidae’) will focus on logging and simple state machines, and should be arriving around August.
Please enjoy, and feedback is appreciated! Email me at uqclib AT unquietcode DOT com.
As I continue to sketch ideas for my dream programming language (if such a thing can even exist), I’ve begun to embrace the idea of “event oriented programming”. Almost everything can be reduced to an event. A simple event can be thought of as a single statement in a linear sequence of statements. In a system without control flow every event is of this type, and each line will be executed in order, performing its intended action.
We know from decades of language development that this is not enough for all but the simplest of programs. The introduction of a ‘jump’ command allowed basic function calls to occur. First you store your location, jump to a different place, then you jump back (which we call ‘return’). Conditional branching, the ‘if/else’ statements, gave even more control over the running of a program. Again, this is really just another flavor of jump, with a test being performed and a jump ignored or taken accordingly.
Without touching the more ‘exotic’ control flows—stately ones such as ‘yield’ and continuations—the next big development (in my view) was the loop. Behind the scenes it’s just another conditional jump, but we begin to see the development of a small lifecycle here. Consider the standard ‘for’ loop: Continue reading…
As part of a look into JSP and the associated XML configuration files that I recently did, I coded up an interesting tag which I call ReflectiveTag. The goal of the experiment was to use reflection to dynamically load a tag handler to use in executing a tag on a page. As the name suggests, this is accomplished with decidedly un-fancy Java reflection. Continue reading…
