Monthly Archives: August 2012

Quick and usefull git commands

#Log of all the reference HEAD
$ git reflog

#Go to a previous head
$ git reset –hard HEAD@{0}.

# Check what lines were added?
git log –oneline -p

# Check how many insertions were made
git log –oneline –stat

# Display a visual representation of your git map
git log –oneline –graph


Rake Task Omniauth Identity + carrierwave

I often use rake db:populate in development mode to populate my database with random data. It’s a useful too to test your website and see how it would look like when you have a lot of users. It’s also extremely useful for testing paginations. On I build a script that auto generate random user using the Omniauth Identity gem and then generate random user’s theme that each have an image using the carrierwave gem.

namespace :db do
require ‘Faker’
require ‘omniauth’
desc “Fill database with sample data”
task :populate => :environment do

def make_users

20.times do |n|
name =
email = “test-#{n+1}”
password = “password”

# CREATE USERS: Populate the database with random users
Identity.create! do |user| = name = email
user.password_digest = BCrypt::Password.create(password)
Continue reading

How I set up Paypal Adaptive Payment for

Before you start, you need to create a developer account on and have set u tow user in your paypal sandbox account. One for the merchant, and one for the seller. These account will be use to test this payment here. here will be the sample email I will use to represent the merchant and is the sample email I will use to represent the seller. This payment model is a chained payment which mean that there will be more than one recipient for the amount of the sale.

 In the controller:

class OrdersController < ApplicationController
before_filter :assigns_gateway
include OrderHelper

include ActiveMerchant::Billing::Integrations

Continue reading