Scriptlets – When All You Need is a Little Bit of Hosting Space

Every so often I throw together a quick hack whilst putting together another post. Take the Split Screen Screenshots bookmarklet as an example, that was built back when I needed to grab the top and bottom part of a long web page in a single screenshot.

At the time of the post, I couldn’t get access to my VPN server, so I couldn’t post a fully working bookmarklet with the PHP based hack I’d put together… which is where Scriptlets looks really handy. Scriptlets is a Google App Engine app that lets you write snippets of runnable code (currently Javascript, Python or PHP), access POST and GET variables, and make HTTP requests to other services. (Read more at Easy hook scripts with Scriptlets.)

So for example, creatinga script endpoint for the splitscreen bookmarklet is easy (the code is taked from the original post):

Calling the scriptlet with a URI for the page you want to split works a dream: Split the BBC homepage into two frames

And here’s what the bookmarklet needs changing to:

javascript:window.location=
http://www.scriptlets.org/run/z0exx4?url=”+encodeURIComponent(window.location.href);

As a bit more glue to go withYahoo Pipes, it’s absolutely perfect :-)

PS err, maybe not perfect… in further testing, the scriptlet just returns some debugging noise. A couple of page refreshes and eventually it comes good, but this is far from ideal…

PPS here’s another tool for pasting and running code snippets (I think…?!): Codepad