Skip to content

Instantly share code, notes, and snippets.

Matt Hodan matthodan

Block or report user

Report or block matthodan

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
matthodan / uploader_command
Created Jul 16, 2011
CarrierWave uploader generator
View uploader_command
rails g uploader Photo
matthodan / Gemfile
Created Jul 16, 2011
Add these to your Gemfile
View Gemfile
gem 'mini_magick'
gem 'carrierwave'
View jobs_controller.rb
class JobsController < ApplicationController
before_filter :require_user
ssl_required :index, :new, :create, :update, :destroy, :destroy_all
respond_to :html, :only => [:index, :new, :create, :destroy, :destroy_all]
respond_to :json, :only => [:index, :create, :update, :destroy]
[... omitted ...]
View gist:722758
<%= form_for @user do |f| %>
<%= f.error_message_on :user_not_happy_and_broke %>
<% end %>
View gist:722751
class User < ActiveRecord:Base
validate :user_is_happy_and_broke
def user_is_happy_and_broke
if self.state_of_mind != 'happy' || self.fiscal_status != 'broke'
errors.add :user_not_happy_and_broke, 'User must be happy and broke to continue'
View gist:722744
<%= form_for @user do |f| %>
<%= f.text_field :name %>
<%= f.error_message_on :name %>
<% end %>
View gist:722743
<%= error_messages_for :user %>
View ruby_private_access.rb
#!/usr/bin/env ruby
class Parent
def name
class Child < Parent
View payments_controller.rb
credit_card = {
:type => '[cc type, e.g. 'visa']',
:number => '[cc number, from test account]',
:verification_value => '123',
:month => '[expiration month, from test account]',
:year => '[expiration year, from test account]',
:first_name => '[first name, can be anything]',
:last_name => '[last name, can be anything]',
:street_1 => '[street address, can be anything]',
:city => '[city, can be anything]',
View production.rb
# Setup ActiveMerchant for production mode with Paypal Website Payments Pro
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :production
:login => '[Add PayPal API login here]',
:password => '[Add PayPal API password here]',
:signature => '[Add PayPal API signature here]'
You can’t perform that action at this time.