Imaginary Numbers

Using the Rules to Bend the Rules

Quick Block Uncommenting

| Comments

A quick and easy way of commenting or uncommenting large blocks of code in languages with multiline comments, such as the /* wing comments */ found in C-like languages:

1
2
3
4
5
6
7
/* DEBUG: display complicated logging data
$.log("Baking.Cookies.recipe.build:",
  "recipe_id => ", recipe_id,
  "; recipe_contents => ", $.extend(true, {}, recipe), // deep clone
  "; options => ", options
);
// */

Right now the whole block is commented out; but when you cap the top wing comment, you get this:

1
2
3
4
5
6
7
/* DEBUG: display complicated logging data */
$.log("Baking.Cookies.recipe.build:",
  "recipe_id => ", recipe_id,
  "; recipe_contents => ", $.extend(true, {}, recipe), // deep clone
  "; options => ", options
);
// */

Your code editor certainly provides a way of toggling comments, but over large code blocks this may involve making a large selection first. With this technique, adding or removing just two bytes can toggle comments on a block of any length.

Comments