Skip to content

Instantly share code, notes, and snippets.

View falonofthetower's full-sized avatar

Peter Karth falonofthetower

  • CompanyCam
  • Sanford, NC
View GitHub Profile
class Series
def initialize(string)
@string = string
end
def string_to_array
@string.split('').map(&:to_i)
end
def fetch_slices(size, string_array)
<!doctype html>
<html lang="en-US">
<head>
<title></title>
<meta charset="UTF-8" />
</head>
<body>
</body>
</html>
Style/MethodCallParentheses:
Enabled: false
Description: 'Do not use parentheses for method calls with no arguments.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
Style/BracesAroundHashParameters:
Enabled: false
EnforcedStyle: no_braces
SupportedStyles:
# The `braces` style enforces braces around all method parameters that are
def spacer
puts "------------------------------------------------------------------------------------"
end
def blank
puts ""
end
puts "the string method"
blank
set nocompatible
filetype off
if has("autocmd")
filetype indent plugin on
endif
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#rc()
set tags+=gems.tags
# The following formula is used to calculate the fixed monthly payment
# (payment) required to fully amortize a loan of "loan" dollars over a term of
# "duration" months at a monthly interest rate of "interest".
# [If the quoted rate is 6%, for example, "interest" is .06/12 or .005]
def fixed_monthly_payment(loan, interest, duration)
payment = loan * (interest * (1 + interest)**duration) / ((1 + interest)**duration - 1)
payment.round(2)
end
def number?(number)
First off this game is huge. I'm impressed. Most of your code looks to be pretty solid, and your tests are clearly advanced for this stage (we cover testing more extensively later on in the course).
I'm going to concentrate on the area that I see the biggest opportunity for improvement. That is going to be in your modules. First thing I noticed was that you are using `@@global` variables. These are generally frowned on because they can have unexpected side effects. More than that though your structure ends up repeating itself a lot. Many of the methods end up with just one line of difference:
```ruby
break if new_location[0] < Neighborhood.top_left_limit[0]
break if new_location[0] > Neighborhood.bottom_right_limit[0]
```
class Industry < ActiveRecord::Base
belongs_to :Industrious, polymorphic: true
end
class Donut < ActiveRecord::Base
has_one :industry, as: :industrious
end
class Batman < ActiveRecord::Base
has_one :industry, as: :industrious
module GoogleDriveAccess
def new_client
Signet::OAuth2::Client.new(
client_id: ENV["CLIENT_ID"],
:temporary_credential_uri =>
'https://www.google.com/accounts/OAuthGetRequestToken',
:authorization_uri =>
'https://www.google.com/accounts/OAuthAuthorizeToken',
:token_credential_uri =>
'https://www.google.com/accounts/OAuthGetAccessToken',
set nocompatible
filetype off
if has("autocmd")
filetype indent plugin on
endif
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#rc()
set tags+=gems.tags