During the past year, I've delved deep into a theoretical book in Machine Learning and wrote many programs to demonstrate / visualize concepts and algorithms. I hope, when I apply to a PhD program, the advisor can know about this, because it displays me dedication and passion about this field. However, I don't know how.
This is exactly the point of a CV and cover letter!
The first thing you can do is make a section of your CV on "Projects", with a brief (one-sentence) description of the programs you have written and a link to github.
Don't include trivial stuff: "implemented linear regression in MatLab" is going to hurt your application instead of help it. Less is more in this case; focus on the more interesting projects.
Do make it sound as impressive as possible; if your program was used for a research project, say that. If your project required extensive development, e.g. in terms of lines of code, feel free to include the lines of code.
I would not include reading / self-study as an item here -- delving in the theoretical book on ML is not that important on its own, as you will already say that you are interested in theoretical ML as a research topic.
With a cover letter, you want to be even more selective than on the CV about what you mention. You would state your history of working on projects in theoretical machine learning and then back that up by only mentioning the most impressive thing, as an example. Of course if you acquire more research experience later, that would come first.
A note on timeline and priorities
However, it is a little early to worry about the specifics of what is on your CV and cover letter. You still have a long time before your graduate application, so what is more important right now is actually to acquire more research experience and to develop strong relationships with research mentors so you can get good rec letters. For example, summer research would be very helpful at this stage. So you could use the above advice about your CV and cover letter to put together a strong application to a summer research program.