Skip to content

Instantly share code, notes, and snippets.

View savfischer's full-sized avatar

Savannah Fischer savfischer

  • Amsterdam
View GitHub Profile
@savfischer
savfischer / depositor_data.rb
Last active June 5, 2019 21:26
Getting all CMBS data from a single Depositor
# run "redis-server" in one terminal window
# run "bundle exec sidekiq" in one terminal window
# run the following commands in rails console
depositor = Depositor.create(name: 'UBS Commercial Mortgage Securitization Corp.', cik: '0001532799')
CmbsData::IssuingEntitiesFromDepositorsWorker.new.perform(depositor.id)
entities = IssuingEntity.includes(:prospectuses).where(prospectuses: { id: nil })
entities.each do |issuing_entity|
CmbsData::ProspectusHuntWorker.perform_async(issuing_entity.id)
@savfischer
savfischer / industrial_reit_csv_organizing.rb
Last active April 8, 2019 14:35
Deutsche Industrie REIT-AG
require "csv"
arr_of_arrs = CSV.read('reit_properties.csv', encoding: 'iso-8859-1')
def fix_weird_characters(text)
text = text.encode!('utf-8')
text.gsub("ü", "ü")
end
CSV.open("organized_reit_properties.csv", "wb") do |csv|
@savfischer
savfischer / pg_dump_a_table.md
Created March 17, 2019 17:20
Command template for getting postgres table data (pg_dump)

The below command is an example of creating a sql file of the us_states table in my local development postgres database for Rudolph. This is helpful for giving data to other developers, for instance this is how postcodes for the US, Germany, and the Netherlands have been shared with Hardin D&D developers to put into visual manager.

pg_dump -h localhost -p 5432 -U postgres -d cre_cmbs_development -t us_states > us_states.sql

class Bottles
def song
verses(99, 0)
end
def verses(start_verse, end_verse)
lyrics = ''
start_verse.downto(end_verse) do |verse_num|
lyrics += verse(verse_num)
if verse_num != end_verse