Skip to content

Instantly share code, notes, and snippets.

@alexkolson
Created February 2, 2011 20:43
Show Gist options
  • Save alexkolson/808387 to your computer and use it in GitHub Desktop.
Save alexkolson/808387 to your computer and use it in GitHub Desktop.
ruleset a876x16 {
meta {
name "Flickr Dataset Tutorial"
description <<
Dataset tutorial using the Flickr Public Feed
>>
author "Brad Hintze"
logging on
}
dispatch {
}
global {
dataset FlickrPublicFeed:RSS <-"http://api.flickr.com/services/feeds/photos_public.gne?format=rss2" cachable for 1 minute;
}
rule initialize is active {
select when web pageview ".*"
pre {
InitializedDiv = <<
<div id="FlickrPublicFeed" style="overflow-y:scroll; overflow-x:hidden; height:450px; margin: 3px;">
</div>
>>;
}
notify("Flickr Public Feed", InitializedDiv)
with
sticky=true and
width=325 and
height=450 and
opacity = 1.0;
}
rule populate is active {
select when web pageview ".*"
foreach FlickrPublicFeed.pick("$..item") setting (publicFeed)
pre {
picLink = publicFeed.pick("$..link.$t");
picAuthorURL = publicFeed.pick("$..author@flickr:profile");
picTitle = publicFeed.pick("$..title.$t");
picAuthor = publicFeed.pick("$..media$credit.$t");
picImg = publicFeed.pick("$..media$thumbnail.@url");
InitializedNotifyList = <<
<div style="background-color:#999999;margin: 3px;font-size: 1em;padding: 2px;width: 325px;float: left;">
<div style='float:left;'><img src='#{picImg}'alt='Angry face'/></div>
<div style='float:left; height:75px; width:200px'><a href='#{picLink}'>#{picTitle}</a> by <a href='#{picAuthorURL}'>#{picAuthor}</a></div></div>;
>>;
}
{
append ("#FlickrPublicFeed", InitializedNotifyList);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment