Skip to content

Instantly share code, notes, and snippets.

@johnholdun
Created June 20, 2010 04:16
Show Gist options
  • Save johnholdun/445552 to your computer and use it in GitHub Desktop.
Save johnholdun/445552 to your computer and use it in GitHub Desktop.
# That apartment is nice but it's outside your "40 x rent" limit.
# How much more are you gonna have to pay?
# NOTE: I Am Not A Broker, I'm only *pretty* sure this is how it works,
# calculate at your own risk.
def security(rent, salary)
normal_security = rent * 2
base_rent = salary / 40.0
extra_security = (rent - base_rent) * 10
months = [((normal_security + extra_security) / rent.to_f).ceil, 2].max
months * rent
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment