Created
October 19, 2016 07:23
-
-
Save nickhsu/ec560a99da3f44f55cac07fc9d6f8edd to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
puts <<-HEREDOC | |
<html> | |
<head> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<div class="container"> | |
HEREDOC | |
data = [] | |
ARGF.each do |line| | |
text, keywords = line.match(/(.*?)\|(.*?)$/).captures | |
data << { | |
text: text, | |
keywords: keywords.split(',') | |
} | |
end | |
data.sample(100).each do |d| | |
puts "<div style='border: 1px solid; margin: 15px; padding: 10px;'>" | |
puts "<p>#{d[:text]}</p>" | |
puts "<ol>#{d[:keywords].map{ |k| "<li>#{k}</li>"}.join}</ol>" | |
puts "</div>" | |
end | |
puts <<-HEREDOC | |
</div> | |
</body> | |
</html> | |
HEREDOC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment