Skip to content

Instantly share code, notes, and snippets.

@nickhsu
Created October 19, 2016 07:23
Show Gist options
  • Save nickhsu/ec560a99da3f44f55cac07fc9d6f8edd to your computer and use it in GitHub Desktop.
Save nickhsu/ec560a99da3f44f55cac07fc9d6f8edd to your computer and use it in GitHub Desktop.
#!/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