Ruby On Rails acts_as_tree select menu

This time I would like to share a helper I wrote for rails. I was trying to write a form to add categories and I wanted to present a neatly formatted select box of existing categories to select as the parent category. It also needed infinite nested subcategories. I could not find a tutorial or example code anywhere for what I was trying to do. So I wrote this little snippet. Read the rest of this entry »

Ruby Polyline Decoder For Google Maps

As promised I have finished the ruby polyline decoder. This class will take an encoded polyline and decode it returning an array of latitude and longitude values. This one gave me a headache. Hope you can find use of it. Please take time to tell me the projects you are using it for, I'm just nosy. Read the rest of this entry »

Ruby Polyline Encoder for Google Maps

I wrote this translation of the PolylineEncoder.js by Mark McClure because I needed a way to create encoded polylines for Google maps. When I first started my project - http://nomadexplorers.com.

I tried using an existing ruby translation of PolylineEncoder.js. It was giving me some errors when I tried using it and it only took an array of coordinates. For my needs I needed the class to accept an array of objects. This seems a bit more elegant to me. Also, in the notes that where provided in the class comments, it appeared to have a bug that would incorrectly encode the second point. So instead of trying to debug and rewrite their code, I just decided to do my own implementation. Read the rest of this entry »