Get money for your social data with Datacoup

  1. Make an account in Datacoup
  2. Link your social accounts (Facebook, Twitter, Instagram, Meetup…)
  3. Configure your Paypal account
  4. No ????, that's it
  5. Profit! 
I'm getting about $1 per week :-) Here's my page:

Elegant permalinks in Rails

In this post we're adding permalinks to a Rails app using the friendly_id gem.

Let's say you have a `User` and a `Photo` model in your app, and a user has_many :photos.

To add a permalink to a photo post that looks like this:

Add friendly_id to your Gemfile:
gem "friendly_id"
Add the permalink schema to your routes.rb:
get ":user_id/photos/:photo_id", to: "photos#show", as: :photo_permalink
Now, add the friendly_id scheme to your User:

Live on Youtube!

I'm on Youtube now!

Currently I'm playing Dark Souls, on my first NG+ run. Lot's of PVP'ing and jolly cooperation :)

In a couple weeks I'm thinking on getting into The Crew with some friends, I'll keep you updated.

Get insights of your PostgreSQL database with PgHero

PgHero is a ruby gem that gives you insights of your PostgreSQL database.

Out of the box it provides info about stuff like cache hit rate, which queries are too slow, which tables need indexes, and more. Here's how it looks on a production app:

(Yeah, I have to add an index there I know :P)

To add it to your app: add this line to your  Gemfile:
gem 'pghero'
And add this to config/routes.rb to mount the dashboard:
mount PgHero::Engine, at: "pghero"

You'll also want to secure the access to the dashboard if you mount it as part of your public-facing app; we didn't have to as it is in our admin section.

There's also the option to check the insights programmatically, run it via SQL without the web interface, run it as a standalone app, get system stats like CPU usage… check their readme for the good stuff.

Happy optimizing!

Globalize and Rails 4.2

Recently I've been working on preparing our Rails app at Ztory to Rails.4.2. As of today 9/12, here are the changes to our current gemset we needed to support this Rails version:
gem "rails", "~> 4.2.0.rc2"
gem "devise", git: "", branch: "lm-rails-4-2"
gem "globalize", github: "ncri/globalize" # for Rails 4.2
I've facing an issue with the globalize gem, so I'm documenting my progress here. Using the latest stable release of the gem gives me the following error: