Skip to content

Instantly share code, notes, and snippets.

View RoryMacDonald's full-sized avatar

Rory MacDonald RoryMacDonald

View GitHub Profile
def calculate_stretchable_sizes()
if @centralized
@left_middle_height_1 = ((@left_middle_height-@center_height)/2).to_i
@left_middle_height_2 = @left_middle_height-(@left_middle_height_1+@center_height)
@right_middle_height_1 = ((@right_middle_height-@center_height)/2).to_i
@right_middle_height_2 = @right_middle_height-(@right_middle_height_1+@center_height)
end
if @centralized
if @left_middle.nil? and @left_width > 0 and @left_middle_height_1 > 0 and @left_middle_height_2 > 0
def generate_product(product = nil, product_type = nil, s3_bucket)
sFramePath = layers_path + "displace/"
b_lampshade = false
if File.directory? sFramePath
b_lampshade = true
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
@RoryMacDonald
RoryMacDonald / gist:184bdd281fc4fdfaa483
Last active August 29, 2015 14:02
Put this at the top of your boot.rb file in a Rails application to see the files being loaded on boot
require 'benchmark'
def require(file)
puts Benchmark.measure("") {
super
}.format("%t require #{file}")
end