Have you played around with any of Esri's open source projects on GitHub? Here are all the JavaScript ones: http://esri.github.io/#JavaScript