Note: You need to have to Heroku PGBackup addon first heroku addons:add pgbackups
..
Creates the backup on heroku first:
heroku pgbackups:capture
# I use this in conjunction with Contentful CMS to render blocks of markdown into my static middleman templates. | |
# In your gemfile, add Redcarpet: | |
gem 'redcarpet' | |
# ...and do a bundle install | |
# In your config.rb, add this line: | |
set :markdown_engine, :redcarpet |
First, Create a folder inside of lib
called seeds
Put your CSV file example.csv
into the lib/seeds
folder. In the example below, the file is called real_estate_transactions.csv
Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.
# Read and write spreadsheets with ruby using the spreadsheet gem | |
# Full Docs: http://spreadsheet.rubyforge.org/GUIDE_txt.html | |
require 'spreadsheet' | |
# Open source spreadsheet | |
workbook = Spreadsheet.open 'source.xls' | |
# READ |
# run using ```rvm jruby-1.6.7 do jruby "-J-Xmx2000m" "--1.9" tej.rb``` | |
require 'rubygems' | |
require 'nokogiri' | |
require 'csv' | |
f = File.open("/tmp/preview.html") | |
doc = Nokogiri::HTML(f) | |
csv = CSV.open("/tmp/output.csv", 'w',{:col_sep => ",", :quote_char => '\'', :force_quotes => true}) |