Skip to content

Instantly share code, notes, and snippets.

@jeena
Created February 28, 2012 11:58
Show Gist options
  • Save jeena/1932129 to your computer and use it in GitHub Desktop.
Save jeena/1932129 to your computer and use it in GitHub Desktop.
# Ruby
File.open("homepages.csv", "w") {|f| f.write Restaurant.active.delete_if {|r| r.homepage.empty?}.map {|r| [r.id, r.name, r.homepage].join(";") }.join("\n") }
# Haskell (untested)
writeFile "homepages.csv" join "\n" map (\x -> join ";" [x.id, x.name, x.homepage]) filter (\x -> length x.homepage > 0) restaurants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment