Skip to content

Instantly share code, notes, and snippets.

@blainelang
Created October 19, 2013 14:36
Show Gist options
  • Save blainelang/7056730 to your computer and use it in GitHub Desktop.
Save blainelang/7056730 to your computer and use it in GitHub Desktop.
This trick below can be used to toggle between two sets of code, with one symbol in the code with no additional short-keys to learn, and no tool dependencies!
//*
Often, in development or debugging, we need to toggle on/off a section of code or want to swap a few lines.
We often comment out those lines but here is a neat trick where we have the comment annotation around two
sections of code - in my case I want to test some code with a value of 100 or 200 but this could be a tw
large sections of code that I want to toggle or swap.
Add this to you editor and just delete the first / and watch as your editor disables the first assignment
and now enables the 2nd assignment. It's the little things at times that amaze you as I sit here
toggling on/off that first / to see my editor's reaction :)
Reference: https://coderwall.com/p/zbc2zw
*/
//*
$x = 100;
/*/
$x = 200;
//*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment