Skip to content

Instantly share code, notes, and snippets.

@MikeGrace
Created November 30, 2010 02:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikeGrace/721065 to your computer and use it in GitHub Desktop.
Save MikeGrace/721065 to your computer and use it in GitHub Desktop.
Example Twitter addon using KRL, subscribing to the stream_item_clicked event
ruleset a60x436 {
meta {
name "example-staf-app"
description <<
example-staf-app
>>
author "Mike Grace"
logging on
}
rule parity_of_users_twitter_id {
select when web stream_item_clicked
pre {
userId = event:param("userId");
target = event:param("target");
lastDigit = "#{userId}".replace(re/.*(.$)/,"$1");
evenDigit = "#{lastDigit}".replace(re/[0,2,4,6,8]/,"even");
parity = (evenDigit eq "even") => "even" | "odd";
parityNotice =<<
<p>This users Twitter ID is <b>#{parity}</b></p>
>>;
}
{
append(target, parityNotice);
emit <|
checkin("a60x436", target);
|>;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment