Scroll down for code snippets and text.
Smex is IDO style completion for M-x. It is very customizable. I
recommend taking a look at the README for all the available options.
Here's the minimum setup required.
It's available on the ELPA and the source is on github.
Smex source on github
available on marmalade repo