Adds head operation in JsonPointer class. Resolves issue #169.

I have implemented a head method to return all the segments of a jsonpointer expression. The head is the current segment until last non-leaf segment.

Algorithm is quite simple to follow and I have found no way to avoid doing two iterations (one for finding first slash for tail operation), and another one for finding the last slash.

Let's do a code review using github and if you think that the algorithm can be improved in any way, please point it out and I will fix it.