Skip to content

Instantly share code, notes, and snippets.

@TelegramSam
Created March 22, 2011 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TelegramSam/882045 to your computer and use it in GitHub Desktop.
Save TelegramSam/882045 to your computer and use it in GitHub Desktop.
ruleset a8x133 {
meta {
name "StackOverflow"
description <<
>>
author "Sam"
logging on
}
dispatch {
}
global {
so_qpm = function(){
apiurl = "http://api.stackoverflow.com/1.1/stats";
apiresponse = http:get(apiurl);
fullstats = apiresponse.pick("content").decode();
fullstats.pick("$..questions_per_minute");
};
double_rainbow = defaction(a){
//pre
b = a + 2;
//actions
{
notify("StackOverflow", "Questions per minute: #{a}") with sticky = true;
notify("Second Notify", "Questions plus two: #{b}") with sticky = true;
}
};
}
rule first_rule {
select when pageview ".*" setting ()
pre {
qpm = so_qpm();
}
{
double_rainbow(qpm);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment