Skip to content

Instantly share code, notes, and snippets.

Marco Mastrodonato marcomd

Block or report user

Report or block marcomd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
marcomd / gist:3129118
Created Jul 17, 2012
Authenticate your API with devise, token by header
View gist:3129118
#Session controller provides a token
class Api::SessionsController < Devise::SessionsController
before_filter :authenticate_user!, :except => [:create]
before_filter :ensure_params_exist, :except => [:destroy]
respond_to :json
def create
resource = User.find_for_database_authentication(:email => params[:user_login][:email])
return invalid_login_attempt unless resource
View gist:1987631
class A
def go(*attrs)
p "Before block"
attrs.each do |attr|
p yield(attr)
end if block_given?
p "After block"
marcomd / gist:1788853
Created Feb 10, 2012
ActiveAdmin: Add attributes_table to generic resource
View gist:1788853
#Add this new method
#after def attributes_table
def attributes_table_for_resource(specified_resource, *args, &block)
panel(I18n.t('active_admin.details', :model => "#{} #{}")) do
attributes_table_for specified_resource, *args, &block
marcomd /
Created Aug 4, 2011 — forked from jdeyla/
Suitable for devise 1.4.2
expired: "è scaduto ed è necessario richiederne uno nuovo"
not_found: "non trovato"
already_confirmed: "è già stato confermato, riprova a collegarti"
not_locked: "non era bloccato"
one: "un errore ha impedito il salvataggio di %{resource}:"
other: "%{count} errori hanno impedito il salvataggio di %{resource}:"
You can’t perform that action at this time.