Skip to content

Instantly share code, notes, and snippets.

@cvonkleist
Created January 7, 2011 17:04
Show Gist options
  • Save cvonkleist/769741 to your computer and use it in GitHub Desktop.
Save cvonkleist/769741 to your computer and use it in GitHub Desktop.
easy way to preview html in a variable
# put this in ~/.irbrc
def h(html)
File.open('/tmp/irb.html', 'w') { |f| f.write html }
`chromium /tmp/irb.html`
end
Example:
% irb
>> h '<html><body>foo</body></html>'
=> "Created new window in existing browser session.\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment