Author Archives: Tony
Deduping join data in ruby based on multiple attributes
In the past I created an app using Rails built in HABTM and no unique index on the join tables. I’m more into the has_many :through choice today.
In order to migrate my data with a unqiue index, I had a bunch of de-duping to do. It was a bit trickier than [...]
Posted in Software Tagged de-duplication, habtm, removing duplicates, ruby, Ruby On Rails, unique index Comments closed
More cool stuff with ruby’s tap method
I had to write up a quick data processor at work today and I wanted a decent output at the end of execution. The ruby tap method came in handy here.
class AssetDeliveryPopulater
def self.populate
results_text = []
asset_secrets_count, asset_delivery_count, asset_not_found_count, asset_delivery_creation_errors = 0,0,0,0
Email.all.tap{|emails| [...]
Tap before you squash
Tap is a pretty awesome ruby method I recently discovered.
Let’s say I have the following request:
post '/api/v1/users/',
params.merge(:sig =>
Authentication.calculate(TestAuthData.secret_access_key,params.to_query)
).to_json
I realize [...]
RSpec 2, Sinatra and Mongoid example
I spent yesterday coding a very abbreviated version of an authentication service that uses Sinatra, Mongoid and RSpec 2. It took more than a couple hours because there are so many outdated code samples on the web that just don’t work. I put my code up on github for people to see. [...]
Gym Shuffle
Gym Shuffle is the world's first workout randomizer for your iPhone.
Better Human Race
Better Human Race is the easiest way to raise money for charity. Search with Yahoo, Shop with Amazon, Connect with Facebook, and use our toolbar. I am co-founder and currently the developer of all Better Human Race technology.
Posted in portfolio Tagged Ajax, apache, Conduit, CSS, Facebook API, javascript, jquery, linux, MySQL, passenger, Ruby On Rails, XHTML Comments closed

Recursive custom to_json in Ruby for arrays of objects or nested objects