Created
January 7, 2011 17:04
-
-
Save cvonkleist/769741 to your computer and use it in GitHub Desktop.
easy way to preview html in a variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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