Skip to content

Instantly share code, notes, and snippets.

@panozzaj
Created December 9, 2013 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panozzaj/7868223 to your computer and use it in GitHub Desktop.
Save panozzaj/7868223 to your computer and use it in GitHub Desktop.
Random pulling of post ideas and printing to console
#!/usr/bin/env ruby
ideas = []
current_lines = []
lines = File.read('post_ideas.txt')
lines.split("\n").each do |line|
next if line.strip == ''
if line =~ /^==========/
if current_lines != []
ideas << current_lines.join("\n")
current_lines = []
end
else
current_lines << line
end
end
if current_lines != []
ideas << current_lines.join("\n")
end
puts ideas.sample(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment