Skip to content

Instantly share code, notes, and snippets.

View avidas's full-sized avatar
🎯
Busy creating tech debt

Avi Das avidas

🎯
Busy creating tech debt
View GitHub Profile
@avidas
avidas / rubyconf.md
Last active November 20, 2018 15:27
RubyConf 2018 Notes

RubyConf 2018 Notes

Keynote by Matz (Ruby Creator)

  • Why do people create programming languages?
  • C was designed to replace assembly to write OS
  • Matz wrote Ruby for fun
  • People write programming languages, why not me
  • Japanese aesthetic/minimalism in Ruby

The games developers play (Andy Croll)

begin
TenantService.switch_to_rest_of_world_tenant
account = Account.find_by_short_code("DYD9GC")
location = Location.find_by_code("LON11")
# Get billing period
start_of_two_months_ago = Date.today.last_month.last_month.beginning_of_month
end_of_two_months_ago = Date.today.last_month.last_month.end_of_month
two_months_ago_range = start_of_two_months_ago..end_of_two_months_ago
billing_period = two_months_ago_range # Invoice for December covers Nov 1 - Nov 30th
begin
TenantService.switch_to_rest_of_world_tenant
location = Location.find_by_code("VAN01")
floor = Floor.find_by(location_id: location.id, floor_number: 16)
hda = HotDeskArea.find_by(floor_id: floor.id)
hda.update_attributes(archived_at: nil)
end
begin
TenantService.switch_to_rest_of_world_tenant
account = Account.find_by_short_code 'HUJW06'
pr = account.primary_reservations.active.find_by(description: '02-15')
pr.update_attributes(price: 4300.0)
end
begin
TenantService.switch_to_rest_of_world_tenant
account = Account.find_by_short_code '1VHUN0'
pr = account.primary_reservations.active.find_by(description: '03-01')
pr.update_attributes(price: 23400.0)
end
begin
TenantService.switch_to_rest_of_world_tenant
account = Account.find_by_short_code '7MY9PT'
primary_reservations = account.primary_reservations.active.where(description: ['2132', '2133', '2134', '2135', '2137'])
# Set commitment terms
start_date = Date.today.next_month.beginning_of_year
months = 6
primary_reservations.map{|res| CommitmentTermService.new(res).create(months, start_date) }
end
begin
TenantService.switch_to_rest_of_world_tenant
account = Account.find_by short_code: 'F469UC'
res = account.primary_reservations.active.find_by(description: 'DD - 15')
# need to find this way since res.commitment_term won't show a future term
term = CommitmentTerm.find_by(termable: res)
term.archive! if term.active?
raise 'Still has active term' if term.reload.active?
end
begin
TenantService.switch_to_rest_of_world_tenant
account = Account.find_by_short_code 'BJGQA0'
pr = account.primary_reservations.active.find_by(description: '9068')
ct_start = Date.today.beginning_of_year.next_year # 01/01/2018
ct_duration = 24
CommitmentTermService.new(pr).update(ct_duration, ct_start)
end
begin
TenantService.switch_to_rest_of_world_tenant
account = Account.find_by_short_code 'B1F4AJ'
pr = account.primary_reservations.active.find_by(description: '411')
ct_start = Date.today.beginning_of_year.next_year # 01/01/2018
ct_duration = 12
CommitmentTermService.new(pr).create(ct_duration, ct_start)
end
begin
TenantService.switch_to_rest_of_world_tenant
nbc = Account.find_by_short_code 'A0XA74'
congress_res = nbc.primary_reservations.active.find_by(description: '16104')
ct_start = Date.today.beginning_of_year.next_year # 01/01/2018
ct_duration = 6
CommitmentTermService.new(congress_res).create(ct_duration, ct_start)
end