Skip to content

Instantly share code, notes, and snippets.

@fbrnc
Created August 26, 2015 04:21
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 fbrnc/2d511848e168fb6ecdf4 to your computer and use it in GitHub Desktop.
Save fbrnc/2d511848e168fb6ecdf4 to your computer and use it in GitHub Desktop.
Send a daily email with a screenshot of the current USD/EUR conversion rate attached to it.
var page = require('webpage').create();
page.viewportSize = { "width": 1024, "height": 1500 };
page.clipRect = { "top": 530, "left": 20, "width": 650, "height": 541 };
page.open('http://www.xe.com/currencycharts/?from=USD&to=EUR&view=1M', function() {
setTimeout(function() {
page.evaluate(function() {
document.body.bgColor = 'white';
});
page.render('xe.png');
phantom.exit();
}, 5000);
});
// crontab -e:
// 0 7 * * 1-5 phantomjs xe.js ; cat xe.png | uuencode xe.png | mail -s "XE" mail@example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment