Sunday, February 22, 2009

Google Chrome “Feeling Lucky Search”

If you want to do a “Feeling Lucky” search from Google Chrome post haste, I’ve got a great trick for you.  Check this out:

weeb

Fewer clicks, happier browsing.

Here’s how to do it:

1) Create a custom search engine in Chrome:
1

2) Add the search engine with these properties:
2
URL: http://www.google.com/search?q=%s&btnI=Im+Feeling+Lucky

3) Enjoy!!

Friday, February 06, 2009

Move Extracted Interfaces to Their Own File using ReSharper

Update 2/6/09:

Thanks for @orangy for pointing out that there is an even more streamlined approach that I overlooked.

With your cursor on the concrete class use the "Refactor This" keyboard shortcut (CTRL+SHIFT+R), then X.  The extract interface dialog pops. 

Then use the keyboard shortcut ALT+F to change the radio button to "Place in another file".  Then tab through the rest of the controls and make your selections.

Much nicer.

 

One thing I do commonly when developing is create a class, and then extract an interface from it.  ReSharper makes that easy:

1) Put your cursor on the concrete class name.

2) Use ReSharper's "Refactor This" keyboard shortcut (CTRL+SHIFT+R).

3) Hit "x" on the keyboard for "extract interface".

A keyboard friendly dialog will open which will allow you to select which members get extracted out into the interface. 

So now you have an interface sitting in the same file as your concrete class.  That's perfectly acceptable, but I always prefer having each class/interface in it's own file named the same as the class/interface name.  To do that, you just need to put your cursor on the interface name and hit "CTRL+Enter, Enter", to select the option for "Move to another file to match type name". 

Thanks to www.twitter.com/orangy for helping me find this shortcut!!

moveinterface

 

This is part 6 of a series of posts exploring how to become a ReSharper keyboard ninja.

Previously:
Part 5 - Find the Next Error Using ReSharper
Part 4 - What To Pass?
Part 3 - Surround Your Code
Part 2 - Find Inheritors
Part 1 - Quick Documentation View