Skip to content

Instantly share code, notes, and snippets.

@tobiastom
Forked from jeena/gist:1932129
Created March 7, 2012 12:36
Show Gist options
  • Save tobiastom/1992859 to your computer and use it in GitHub Desktop.
Save tobiastom/1992859 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