Monthly Archives: March 2013

How to edit hosts file in OSX

Step 1 – Open the Terminal.app

Step 2 – Open the hosts file
$ sudo nano /private/etc/hosts
Type your user password when prompted.

Step 3 – Edit the hosts file
The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 – localhost). Simply append your new mappings underneath the default ones. Or edit one of the default values if you know what you are doing! You can navigate the file using the arrow keys.

Step 4 – Save the hosts file
When done editing the hosts file, press control-o to save the file. Press enter on the filename prompt, and control-x to exit the editor.

Step 5 – Flush the DNS cache
On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:
$ dscacheutil -flushcache

Thanks to decoding the web

Shortcuts for Chrome Dev Tools

Chrome Developer Tools: Search or navigate to files, methods or line numbers. Shortcuts for text search and beyond.

To search scripts, stylesheets and snippets by filename you can use:
Ctrl + O (Windows)
Cmd + O (Mac OSX)

To perform a text search within the current file you can use:
Ctrl + F (Windows)
Cmd + F (Mac OSX)

To do a text search across all files you can use:
Ctrl + Shift + F (Windows)
Cmd + Opt + F (Max OSX)

If you need to dig down deeper, it’s possible to filter for or navigate to a particular JavaScript function/method or CSS rule when viewing a file using:
Ctrl + Shift + O (Windows)
Cmd + Shift + O (Mac OSX)

The tools also support going to a specific line-number within the Sources editor. To launch the line number dialog when viewing a file you can use:
Ctrl + L (Windows)
CMD + L (Mac OSX)

Cmd/Ctrl + F works across tabs other than Sources such as Resources or Network. If you check the ‘filter’ option when searching, this will filter down the list of results to only those containing the terms you were looking for.

You can also switch between tabs using Cmd + [ and Cmd + ]

If you are editing a script and select some code, you can evaluate it in the console right away using Ctrl + Shift + e

Thanks to @addyosmani