Tag Archive for 'javascript'

Revisiting my tumblog

I’ve made several improvements to my tumblog.

Previously, I merely plugged in the RSS output from Yahoo! Pipes to Feedburner, and served up the content using Buzzboost. Using techniques from Cristiano Betta’s lifestream and elsewhere, I simplified and modularized the Yahoo! Pipes mashup.

I then used the pipe’s JSON output and styled it with some simple CSS. I didn’t want too much dependence on other JavaScript libraries so I used native code as much as possible, except for dynamically loading the JSON object from Pipes (for which I used the JSONscriptRequest class). I’m still having trouble getting the logic of reloading the content asynchronously: for now, I simply destroy the child element containing the tumblog items and rewrite everything — expensive, I know.

I’ve also been thinking of creating a Google Gadget out of this, but the iGoogle API’s FetchFeedAsJSON method is somewhat limited. I may have to use my current approach of dynamically creating a JSON script request into the gadget.

Well, without too much fanfare, the code is over here, and the tumblog is right here.

2007 in pictures

Cover-flow style, courtesy of MooFlow tools. The photos were compiled from Flickr.

2007 in pictures

I was attempting to automate the process ala-fd’s Flickr toys, what with the Flickr API’s fantastic use of JSON responses (no need for server-side nor cross-site xHTTP requests). Alas, my days were packed. But I’m getting the hang of it. I’m relearning JavaScript along the way (I could actually rebuild a DOM tree from the JSON response, cool). One thing that would have made my coding easier: an API wrapper for JavaScript.

Anyway, enjoy.

Kudos to Naraoya and ATIS547 for the borrowed pics.

Google translation bookmarklet

I’ve been visiting a few foreign-language sites lately, and Google Translate is a great tool, if a bit awkward.

Google Translate bookmarklet

I created a bookmarklet that will point the site to Google Translate. I then added a keyword (”gt”) so that when I’m in the site, I can just press F6, and enter the keyword.

Snag movie audio tracks

Okay, watching movies in the workplace is a definite no-no, but they didn’t say anything about listening to movies. But I’d rather do it offline, so I whipped up a little bookmarklet that will snag the .MP3 URL off the movies I chose.

  1. First off, select a movie from the list.
  2. Then list all the URLs in that page by using Javascript’s document.links object.
  3. I noticed that the URI for the MP3 link is always the ninth, so just get the ninth URL: document.links[8].href.
  4. Using a regular expression, winnow the URL:
    document.links[8].href.replace(new RegExp('[?&=]','g'),' ').split(' ')[2]
  5. Drop in the javascript resource header, and voila! here’s the bookmarklet that will grab audio track’s URL for download. Right-click and bookmark the link. Or, drag and drop the link to the bookmarks toolbar.

Clever Javascript hack

  1. Go to Flickr.com, view any photostream.
  2. Clear the address bar, and type the following:
    javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){ for(i=0; i-DIL; i++) { DIS=DI[ i ].style; DIS.position=’absolute’; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5 } R++ } setInterval(’A()’,5); void(0);
  3. Sit back, and marvel.

Via Google Blogoscoped.