Created
March 1, 2010 10:01
-
Star
(116)
You must be signed in to star a gist -
Fork
(18)
You must be signed in to fork a gist
Revisions
-
defunkt revised this gist
Feb 28, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ # Usage: browser # pipe html to a browser # e.g. # $ echo '<h1>hi mom!</h1>' | browser # $ ron -5 man/rip.5.ron | browser if [ -t 0 ]; then -
defunkt revised this gist
Mar 9, 2010 . 1 changed file with 22 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,25 @@ #!/bin/sh -e # # Usage: browser # pipe html to a browser # e.g. # $ echo "<h1>hi mom!</h1>" | browser # $ ron -5 man/rip.5.ron | browser if [ -t 0 ]; then if [ -n "$1" ]; then open $1 else cat <<usage Usage: browser pipe html to a browser $ echo '<h1>hi mom!</h1>' | browser $ ron -5 man/rip.5.ron | browser usage fi else f="/tmp/browser.$RANDOM.html" cat /dev/stdin > $f open $f fi -
defunkt revised this gist
Mar 2, 2010 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ # pipe html to a browser # e.g. # $ echo "<h1>hi mom!</h1>" | browser # $ ron -5 man/rip.5.ron | browser if [ -t 0 ]; then cat <<usage -
defunkt revised this gist
Mar 1, 2010 . 1 changed file with 19 additions and 23 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,20 @@ #!/bin/sh -e # # Usage: browser # pipe html to a browser # e.g. # $ echo "<h1>hi mom!</h1>" | browser if [ -t 0 ]; then cat <<usage Usage: browser pipe html to a browser $ echo '<h1>hi mom!</h1>' | browser $ ron -5 man/rip.5.ron | browser usage else f="/tmp/browser.$RANDOM.html" cat /dev/stdin > $f open $f fi -
defunkt revised this gist
Mar 1, 2010 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ # pipe html to a browser # e.g. # $ echo "<h1>hi mom!</h1>" | browser # $ ron -5 man/rip.5.ron | browser if $stdin.tty? puts <<-usage -
defunkt revised this gist
Mar 1, 2010 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # # Usage: browser # pipe html to a browser # e.g. # $ echo "<h1>hi mom!</h1>" | browser @@ -20,4 +20,4 @@ else f.puts $stdin.read end exec "open #{tmp.path}" end -
defunkt created this gist
Mar 1, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/usr/bin/env ruby # # Usage: browser # pipe html to a browser # e.g. # $ echo "<h1>hi mom!</h1>" | browser if $stdin.tty? puts <<-usage Usage: browser pipe html to a browser $ echo '<h1>hi mom!</h1>' | browser $ ron -5 man/rip.5.ron | browser usage else require 'tempfile' tmp = Tempfile.new(['', '.html']) File.open(tmp.path, "w+") do |f| f.puts $stdin.read end exec "open #{tmp.path}" end