Skip to content

Instantly share code, notes, and snippets.

@rsbohn
Created November 25, 2011 20:59
Show Gist options
  • Save rsbohn/1394401 to your computer and use it in GitHub Desktop.
Save rsbohn/1394401 to your computer and use it in GitHub Desktop.
leaky abstraction
ruleset a421x98 {
meta {
name "Leaky Abstraction"
description <<
>>
author "Randall Bohn"
logging off
}
dispatch {
// domain "exampley.com"
}
global {
css << #leak { background: #FFC; }
>>;
leaky = defaction(msg) {
rrr = "<div id='leak'>Leaky: #{msg}</div>";
append("#main", rrr)
};
}
rule first_rule {
select when pageview ".*" setting ()
pre {
intro = << <div>You should see one yellow line below, from the 'leaky' defaction.
If you see two yellow lines it means that the defaction leaked, clobbering the 'content' variable.
</div> >>;
rrr = "<div id='obliterated'>Local: Don't tread on me!</div>";
}
{
append("#main", intro);
leaky("Did I step on something?");
append("#main", rrr)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment