Weekend project: A place to post crappy code. HatePaste
21–30 of 33 posts
Re: Weekend project: A place to post crappy code. HatePaste
#22It's interesting that this is one of the most hated ( http://hatepaste.com/paste/f5da3584 ): if (someBoolean == true) { doSomething(); } I got into the habit of doing this since it's immediately obvious that the value you're comparing is expected to be a boolean and not something like an integer, which could cause subtle bugs later on if what you thought was a boolean gets negated. More commonly, it's of the form: if…
It's probably not the best idea to be doing that, but it's not tripped me up yet ;-)
Re: Weekend project: A place to post crappy code. HatePaste
#23Re: Weekend project: A place to post crappy code. HatePaste
#24It's interesting that this is one of the most hated ( http://hatepaste.com/paste/f5da3584 ): if (someBoolean == true) { doSomething(); } I got into the habit of doing this since it's immediately obvious that the value you're comparing is expected to be a boolean and not something like an integer, which could cause subtle bugs later on if what you thought was a boolean gets negated. More commonly, it's of the form: if…
if (someBoolean){
return true;
} else {
return false;
}Re: Weekend project: A place to post crappy code. HatePaste
#25Re: Weekend project: A place to post crappy code. HatePaste
#26Re: Weekend project: A place to post crappy code. HatePaste
#27Re: Weekend project: A place to post crappy code. HatePaste
#28It's interesting that this is one of the most hated ( http://hatepaste.com/paste/f5da3584 ): if (someBoolean == true) { doSomething(); } I got into the habit of doing this since it's immediately obvious that the value you're comparing is expected to be a boolean and not something like an integer, which could cause subtle bugs later on if what you thought was a boolean gets negated. More commonly, it's of the form: if…
Wow. http://www.paulgraham.com/avg.html
Re: Weekend project: A place to post crappy code. HatePaste
#29#ActiveRecord::Base.send(:attr_accessible, nil)#comment this line out to let GitHub get hacked
Re: Weekend project: A place to post crappy code. HatePaste
#30how about adding comments?