Practice
STOP IT!!
<DIV>
<P>Here's an interesting fact about githeri. </P>
</DIV>
<!-- VERY BADDD -->
<div>
<p>Here's an interesting fact about githeri. </p>
</div>
<!-- VERY GOOOOODDDDDD -->
/****** main content *********/
styles goes here...
/****** footer *********/
styles go here...
# ruby (2 spaces)
def cook_githeri
some_var = true
if some_var
do_something
else
do_something_else
end
end
<!-- html (4 spaces) -->
<html>
<head>
<title>Githeri website</title>
</head>
</html>
//Java (4 spaces)
Use === instead of ==
speed vs size/footprint
for(var i = 0; i < someArray.length; i++) {
var container = document.getElementById('container');
container.innerHtml += 'my number: ' + i;
console.log(i);
}
(function cookGitheri() {
return {
name: 'Githeri',
lastName: 'Man'
};
})();
@posts = current_user.posts.per_page(20).page(params[:page])
@posts = Post.all
Bad
Better