Skip to content

Instantly share code, notes, and snippets.

@jimeh
Created September 15, 2009 10:20
Show Gist options
  • Save jimeh/187214 to your computer and use it in GitHub Desktop.
Save jimeh/187214 to your computer and use it in GitHub Desktop.
#
# The dumbest piece of code I've EVER written.
#
# I REALLY don't know WTF I was thinking, or not thinking.
# I must have been drunk and asleep while I wrote this method.
#
# It's not only stupid, but IT DOESN'T EVEN WORK! *stabs self in face*
#
def stupid_method
data = fetch.some(:data)
if !(data.prop_1 == "something" && data.prop_2 == "something else")
@result = false
else
@result = true
end
@result = true
end
#
# Looking at it today, I fixed it in 30 seconds after screaming
# "WHAT THE FUCK?!?" for 25 seconds.
#
def stupid_method
data = fetch.some(:data)
@result = false
if data.prop_1 == "something" && data.prop_2 == "something else"
@result = true
end
end
@timblair
Copy link

Further simplification:

def stupid_method
  data = fetch.some(:data)
  @result = (data.prop_1 == "something" && data.prop_2 == "something else")
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment