Skip to content

Instantly share code, notes, and snippets.

@heath
Last active May 31, 2017 04:40
Show Gist options
  • Save heath/8923724 to your computer and use it in GitHub Desktop.
Save heath/8923724 to your computer and use it in GitHub Desktop.
# adds a banana to grocery list a given number of times
add_banana_to_grocery_list = (times) -> for til times
banana = element.all($ "button.button-continue").first!
..click!
-- first implementation
add_banana_to_grocery_list times = replicateM_ times $ click banana
-- second implementation
add_banana_to_grocery_list = (`replicateM_` click banana)
-- third
add_banana_to_grocery_list = (flip replicateM_) $ click
// adds a banana to a grocery list a given number of times
var add_banana_to_grocery_list = function(times) {
for (var count = 0; count < times; count++) {
var banana = element.all($("button.button-continue")).first();
banana.click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment