This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
properties = [] | |
class Property | |
def initialize(number, postcode) | |
@number, @postcode = number, postcode | |
@vacant = false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'action_view' | |
class Manager | |
def self.pick_team(squad) | |
team = Team.new(Team::FOUR_FOUR_TWO) | |
team.formation.each do |position, count| | |
team.recruit squad.top(position, count) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'debugger' | |
class Hello | |
def hi_there | |
debugger | |
puts "wohoo" | |
end | |
end | |
testing = Hello.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base | |
def public_method | |
puts 'public method called' | |
end | |
# This works as we are calling the private method | |
# from within the object | |
def call_private_method | |
private_method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HTML | |
def initialize(str) | |
@str = str | |
end | |
# instance method (note it makes use of an instance variable) | |
def render | |
puts "<div>#{@str}</div>" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set autoeval | |
set autolist | |
set autoreload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
// This means every time you move away from your current tab it saves, no more cmd + s! | |
"save_on_focus_lost": true, | |
// Let's get rid of all those trailing white spaces! | |
"trim_trailing_white_space_on_save": true, | |
// A good idea to view all white space to make sure you're not using tabs | |
"draw_white_space": "all", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bicycles, docking stations, vans, central system to control the vans, people | |
# people would ride bikes | |
# vans would move them around | |
# a central station would control the vans | |
# repair facility would take the broken bikes and fix them | |
# repaired bikes would be delivered to stations | |
# report on the most/least used stations | |
# bikes would be taken out of service after 1000 rides |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rvm get head | |
rvm install 2.0.0 --autolibs=4 --with-gcc=gcc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def each(array) | |
array.length.times do |i| | |
yield array[i] | |
end | |
end | |
def select(array) | |
result = [] |
OlderNewer