I hereby claim:
- I am anthonygharvey on github.
- I am anthonyharvey (https://keybase.io/anthonyharvey) on keybase.
- I have a public key ASBR8Zi7tXaWrn1FmY-l7yHZkXz7n7dG1Yo5IUALBPlEcgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
list_1 = ['a', 'b', 'c'] | |
list_2 = ['c', 'd', 'e'] | |
common_elements = list_1 & list_2 | |
common_elements #=> ["c"] |
list_1 = ['a', 'b', 'c'] | |
list_2 = ['c', 'd', 'e'] | |
list_1_difference = list_2 - list_1 | |
list_1_difference #=> ["d", "e"] |
list_1 = ['a', 'b', 'c'] | |
list_2 = ['c', 'd', 'e'] | |
list_1_difference = list_1 - list_2 | |
list_1_difference #=> ["a", "b"] |
list_1 = ['apple', 'orange', 'grape'] | |
list_2 = ['strawberry', 'apple'] | |
combined_list = list_1 | list_2 | |
combined_list #=> ["apple", "orange", "grape", "strawberry"] |
list_1 = ['apple', 'orange', 'grape'] | |
list_2 = ['strawberry', 'apple'] | |
combined_list = (list_1 + list_2).uniq | |
combined_list #=> ["apple", "orange", "grape", "strawberry"] |
class ApplicationController < ActionController::Base | |
# other controller actions | |
def current_user | |
@current_user ||= User.find(session[:user_id]) if session[:user_id] | |
end | |
helper_method :current_user | |
end |
def print_shipping_label2(order) | |
return nil if order.outstanding_payments? | |
return order.send_address_reminder if order.address_incomplete? | |
return order.print_standard_shipping_label if order.standard_shipping? | |
order.print_priority_shipping_label | |
end |
def print_shipping_label(order) | |
if order.outstanding_payments? | |
nil | |
else | |
if order.address_incomplete? | |
order.send_address_reminder | |
else | |
if order.standard_shipping? | |
order.print_standard_shipping_label | |
else |
def example_method(parameter) | |
return nil unless parameter == true #<-- guard clause | |
# awesome code here | |
end |