Learning methods for spiking neural networks are not as well developed as the traditional rate based networks, which widely use the back-propagation learning algorithm. We propose and implement an efficient Hebbian learning method with homeostasis for a network of spiking neurons. Similar to STDP, timing between spikes is used for synaptic modification. Homeostasis ensures that the synaptic weights are bounded and the learning is stable. The winner take all mechanism is also implemented to promote competitive learning among output neurons. We have implemented this method in a C++ object oriented code (called CSpike). We have tested the code on four images of Gabor filters and found bell-shaped tuning curves using 36 test set images of Gabor filters in different orientations. These bell-shapes curves are similar to those experimentally observed in the VI and MT/V5 area of the mammalian brain.