Skip to content

Instantly share code, notes, and snippets.

=begin
This is my current matching algorithm. It's very database-heavy - with this number of records...
>> User.count
=> 25
>> Kink.count
=> 76
>> Rating.count
=> 1900
# Requires mod_deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
ActionController::Base.asset_host = Proc.new do |source|
# This will give you asset1-asset8.example.com
"http://assets#{rand(8) + 1}.example.com"
end
@driver.return_response_as_xml = true
response = @driver.GSDVOrder(:RequestID => 1)
parsed_response = Hpricot::XML(response)
@driver.GSDVOrder(:RequestID => 1)
@driver = SOAP::WSDLDriverFactory.new("http://www.webservice.com/services/order.wsdl").create_rpc_driver
# Changes the default date and time string formatters in Rails. See http://j.mp/2nZ022 and http://j.mp/1BRFSf for more info
#
# >> Time.now.to_s
# => "3rd Nov, 2009 10:54 PM GMT"
# >> Date.today.to_s
# => "3rd Nov, 2009"
Time::DATE_FORMATS[:default] = lambda { |time| time.strftime("#{time.day.ordinalize} %b, %Y %I:%M %p %Z") }
Date::DATE_FORMATS[:default] = lambda { |date| date.strftime("#{date.day.ordinalize} %b, %Y") }
raise ArgumentError, "Registration type is not 'registration'" unless registration?
raise ArgumentError, "TLD does not support automatic registrations" unless supports_automatic_registrations?
raise ArgumentError, "Contact information is invalid" unless contact_information_valid?
if registration_complete?
toggle!(:processed)
else
return false
end
raise ArgumentError, "Registration type is not 'registration'" unless registration?
raise ArgumentError, "TLD does not support automatic registrations" unless supports_automatic_registrations?
raise ArgumentError, "Contact information is invalid" unless contact_information_valid?
if registration_complete?
toggle!(:processed)
else
return false
end