This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<donation> | |
<id type="integer">579779</id> | |
<persona-id type="integer">60341</persona-id> | |
<received-on type="date">2010-07-09</received-on> | |
<amount-in-cents type="integer">57900</amount-in-cents> | |
<authorization-code nil="true"></authorization-code> | |
<bank-name></bank-name> | |
<bank-number></bank-number> |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<persona> | |
<birthday type="date" nil="true"></birthday> | |
<company-name>Innatech</company-name> | |
<department>Development</department> | |
<donations-count type="integer">0</donations-count> | |
<exclude type="boolean">false</exclude> | |
<gender-id type="integer" nil="true"></gender-id> | |
<id type="integer">60341</id> | |
<import-id type="integer" nil="true"></import-id> |
This file contains hidden or 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
# From http://zylstra.wordpress.com/2008/03/12/a-kinder-gentler-phone-number-validation/ | |
validates_format_of :phone, | |
:message => "must be a valid telephone number.", | |
:with => /^[\(\)0-9\- \+\.]{10,20} *[extension\.]{0,9} *[0-9]{0,5}$/i |
This file contains hidden or 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
# Preserve and escape HTML in HAML | |
module Haml | |
module Filters | |
module Preserve | |
include Haml::Filters::Base | |
def render(text) | |
text = Haml::Helpers.html_escape(text) | |
text = Haml::Helpers.preserve(text) | |
text | |
end |
This file contains hidden or 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 Export < ActiveRecord::Base | |
include ActionView::Helpers::DateHelper | |
include ActionView::Helpers::NumberHelper | |
has_attached_file :attachment, :storage => :s3 | |
belongs_to :organization | |
belongs_to :user | |
after_create :process |
This file contains hidden or 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
memory_usage = `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes | |
# Source: http://laurelfan.com/2008/1/15/ruby-memory-usage |
This file contains hidden or 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
# Heroku S3 Database backup task | |
# by Nick Merwin (Lemur Heavy Industries) 10.08.09 | |
# * dumps db to yaml, gzip's and sends to S3 | |
# | |
# Setup: | |
# 1) replace APP_NAME and BACKUP_BUCKET with your info | |
# 2) add config/s3.yml like so (same as Paperclip's): | |
# production: | |
# access_key_id: ... | |
# secret_access_key: ... |
This file contains hidden or 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
SystemNotifier.deliver_notification "My subject", "My optional message" | |
# app/mailers/system_mailer.rb | |
def notification(subject, message=nil) | |
@recipients = "[email protected]" | |
@from = "[email protected]" | |
@sent_on = Time.now | |
@subject = subject | |
@body[:message] = message | |
end |
NewerOlder