Skip to content

Instantly share code, notes, and snippets.

@mrsimonemms
Last active June 4, 2016 16:30
Show Gist options
  • Save mrsimonemms/498129e3300eb61817e34391ad2b75fc to your computer and use it in GitHub Desktop.
Save mrsimonemms/498129e3300eb61817e34391ad2b75fc to your computer and use it in GitHub Desktop.
How clever are developers
// Get the kettle
var kettle = Kettle.getKettle();
// Check we have enough water
while (kettle.cupsOfWater() < 1) {
// No - add water until there's enough
kettle.addWater();
}
// Boil the kettle
kettle.boil()
.on('boiled', function () {
// Kettle boiled - now make the tea
var cuppa = new Tea();
// Is sugar required?
if (numberOfSugars > 0) {
cuppa.addSugar(numberOfSugars);
}
// Is milk required?
if (milkRequired) {
cuppa.addMilk();
}
// Finished making - drink your tea
cuppa.drink();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment