I solved the CNN exercise from: https://github.com/amaas/stanford_dl_ex/tree/master/cnn and I added a convolutional layer to that exercise to mixed the repo with https://github.com/pmgysel/alexnet-forwardpath (the forward implementation was taken from that repo).
See http://ufldl.stanford.edu/tutorial/supervised/ExerciseConvolutionalNeuralNetwork/