From http://bgrins.github.io/devtools-snippets/#console-save