Seeing clean, structured code is always nice. Here are some tips to automate cleaning up messy code.
1. Use HTML Tidy to clean up code
There are some online code cleaners based on Tidy that can do this for you like at http://infohound.net/tidy/
2. Dreamweaver “Apply Source Formatting”
Dreamweaver can format your source code based on a format profile. Find it under Commands -> Apply Source Formatting. This will also trim unnecessary whitespace and the beginning and end of lines.
3. Trim unnecessary whitespace at beginning of line
REGEX: ^\s+
REPLACE: empty string
4. Trim unnecessary whitespace at end of line
REGEX: ^\s$
REPLACE: empty string
5. Convert spaces to tabs
In Dreamweaver, select / highlight all the code, right click, select “Convert spaces to tabs”
6. Delete empty lines
REGEX: [\r\n]{2,}
REPLACE: \n
When writing functions in Javascript that you only need to run as soon as it’s created and not have to reference again, you can create a self-executing anonymous function using the syntax:
In jQuery, you can have your anonymous function called after the document is ready as in
If you’re not using jQuery and want your anonymous function to be called after the page loads (as opposed to immediately before the page finishes loading), you can do
Another benefit is it doesn’t pollute the global namespace by not overriding other functions. To learn more, visit http://briancrescimanno.com/2009/09/24/how-self-executing-anonymous-functions-work/ and http://stackoverflow.com/questions/8248974/executing-jquery-functions-on-dom-ready-from-inside-a-module
If you’re tired of searching through lines and lines of boring, unformatted text to edit you Apache httpd.conf file and wish there were a more user-friendly interface, you’re in luck. Check this out …
If you’re tired of searching through lines and lines of boring, unformatted text to edit you PHP.INI file and wish there were a more user-friendly interface, you’re in luck. Check this out …
http://www.softpedia.com/get/Internet/Servers/Server-Tools/PHPConfig.shtml