Chris Heilmann posted a simple commenting trick at ajaxian, these tricks are so simple but usefull i myself never think about ‘em before. As a programmer nor a designer we often comment nor uncomment many lines of our code while testing it, rather than inserting and deleting the same lines (commeting tags) everytime we test it, we simply do these tricks:
Javascript
view plaincopy to clipboardprint?
-
foo();
-
//*
-
bar();
-
baz.foo = 200;
-
return
-
{
-
dolly:clone()
-
}
-
// */
and to comment all lines except foo() we only need to remove a slash at the beginning of the comment tags, and to re-comment it just add the slash at the same place.
view plaincopy to clipboardprint?
-
foo();
-
/*
-
bar();
-
baz.foo = 200;
-
return
-
{
-
dolly:clone()
-
}
-
// */
CSS
Here are the trick for commenting in CSS
view plaincopy to clipboardprint?
-
.test
-
{
-
font:bold 1.2em/1em arial;
-
/**/
-
padding:0 5px;
-
margin:0;
-
color:red;
-
/**/
-
border:solid 1px red;
-
}
and to activate the comment we simply remove an asterix(*) character on the beginning of the comment tags
view plaincopy to clipboardprint?
-
.test
-
{
-
font:bold 1.2em/1em arial;
-
/*/
-
padding:0 5px;
-
margin:0;
-
color:red;
-
/**/
-
border:solid 1px red;
-
}
PHP
These trick is for php programing by collaborate sharp(#), slash(/), and asterix(*)
view plaincopy to clipboardprint?
-
private function foo()
-
{
-
$return = false;
-
/*
-
$this->foobar();
-
if($this->bar)
-
{
-
$return = true;
-
}
-
else
-
{
-
$this->foo();
-
}
-
#*/
-
return $return;
-
}
and to activate the commented lines simply we put sharp(#) character before the slash(/) at the beginning of the comment tags.
view plaincopy to clipboardprint?
-
private function foo()
-
{
-
$return = false;
-
#/*
-
$this->foobar();
-
if($this->bar)
-
{
-
$return = true;
-
}
-
else
-
{
-
$this->foo();
-
}
-
#*/
-
return $return;
-
}
So simple huh but i belive these will save your time alot :).