There is a well known proof for finding the dimension of modular forms for the full modular group using the residue formula. It is on page 71 of these online notes:
http://www.math.ou.edu/~kmartin/mfs/ch5.pdf
I've read that this can be done for a general congruence group by finding a fundamental domain then performing the contour over the boundary in a similar way. I've been trying for days to do this for the congruence group $\Gamma_0(4)$ but am having no luck. The fundamental domain is given by this nice little Java app:
https://www.math.lsu.edu/~verrill/fundomain/index2.html
Any help would be much appreciated.