Skip to content

Instantly share code, notes, and snippets.

@sofadesign
Created July 30, 2011 08:57
Show Gist options
  • Save sofadesign/1115349 to your computer and use it in GitHub Desktop.
Save sofadesign/1115349 to your computer and use it in GitHub Desktop.
Faker use example
#!/usr/bin/env ruby -wKU
puts RUBY_VERSION
require 'faker'
def initiatives
initiatives = []
20.times do
begin_at = Time.now - rand(50*3600*24)
initiatives << {
:title => Faker::Lorem.sentence,
:begin_at => begin_at,
:end_at => begin_at + rand(50*3600*24),
:excerpt => Faker::Lorem.paragraph,
:comments_num => rand(20)
}
end
initiatives.sort{|a,b| b[:begin_at] <=> a[:begin_at] }
end
puts initiatives.to_yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment