This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROMPT='%{$fg_bold[blue]%}$(git_prompt_info) %{$reset_color%}%2~%B%{$fg_bold[red]%} »%b ' | |
RPROMPT='[%*]' | |
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rubygems/package' | |
require 'zlib' | |
require 'fileutils' | |
module Util | |
module Tar | |
# Creates a tar file in memory recursively | |
# from the given path. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Avatar < ActiveRecord::Base | |
attr_accessor :content_type, :original_filename, :image_data | |
before_save :decode_base64_image | |
has_attached_file :image, | |
PAPERCLIP_CONFIG.merge( | |
:styles => { | |
:thumb => '32x32#', | |
:medium => '64x64#', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
custom = ::Mail.new(raw_email) | |
key = Rails.application.config.action_mailer.delivery_method | |
delivery_method = ActionMailer::Base.delivery_methods.fetch(key) | |
delivery_settings = ActionMailer::Base.send("#{key}_settings") | |
custom.delivery_method(delivery_method, delivery_settings) | |
custom.deliver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example::Application.configure do | |
.... | |
ActionMailer::Base.delivery_method = :smtp | |
ActionMailer::Base.smtp_settings = {:address => "localhost", :port => 1025, :domain => 'example.com'} | |
... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Rails.env.production? | |
PAYPAL_ACCOUNT = 'production@gmail.com' | |
else | |
PAYPAL_ACCOUNT = 'development@gmail.com' | |
ActiveMerchant::Billing::Base.mode = :test | |
end |
OlderNewer