Skip to content

Instantly share code, notes, and snippets.

Tower: "Delta 351, you have traffic at 10 o'clock, 6 miles!"
Delta 351: "Give us another hint! We have digital watches!"
Tower: "TWA 2341, for noise abatement turn right 45 Degrees."
Event.observe(window, 'load', function() {
Event.observe('target', 'load', function(event) {
new Ajax.Updater('ad', '/base/ad', {
parameters: { asynchronous:true, evalScripts:true }
});
})
});
def self.recent_activity(page = {}, options = {})
page.reverse_merge! :size => 10, :current => 1
options.reverse_merge! :order => 'users.created_at DESC'
Activity.find(:all, :page => page, *options)
end
def connected_conference?
!client.nil? && !vendor.nil? && !transaction.nil?
end
class Listing < ActiveRecord::Base
belongs_to :user
def get_availability
if user.active_phone_number && user.outgoing_call_session.nil? && user.incoming_call_session.nil? && (self.active == true)
return :online
elsif user.outgoing_call_session || user.incoming_call_session
return :busy
else
return :offline
www.amacite.com:80 66.249.67.208 - - [21/Aug/2009:20:33:35 -0500] "GET /books/programming-language-concepts HTTP/1.1" 200 2158 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
www.amacite.com:80 66.249.67.208 - - [21/Aug/2009:20:33:49 -0500] "GET /books/java-web-services-programming HTTP/1.1" 200 2374 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
www.amacite.com:80 66.249.67.208 - - [21/Aug/2009:20:34:02 -0500] "GET /books/programming-scala-animal-guide HTTP/1.1" 200 2825 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
www.amacite.com:80 66.249.67.208 - - [21/Aug/2009:20:34:15 -0500] "GET /books/expert-oracle-jdbc-programming HTTP/1.1" 200 2718 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
www.amacite.com:80 66.249.67.208 - - [21/Aug/2009:20:34:29 -0500] "GET /books/a-guide-to-programming-in-java HTTP/1.1" 200 2003 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bo
def update_phone_transaction
# Billing Interval [seconds]
billing_interval = AppConfig.billing_interval.to_i
actual_billable_time = ((transaction_object.billable_time + billing_interval) / billing_interval) * billing_interval
if time_left? < 0
# Rounds billable_time down to actual billed_time to avoid inconsitencies when user getting charged for being a few seconds over call time when going to refill menu and vendor disconnects
if transaction_object.billed_time != transaction_object.billable_time
transaction_object.billable_time = transaction_object.billed_time
transaction_object.save
def search
@products = Products.search params[:q]
@products.each_with_index do |e, i|
existing_product = Products.find_by_asin(e.asin)
@products[i] = existing_product if existing_product
end
end
def search
@products = Products.search params[:q]
existing_products = Products.find(:all, :conditions => [:asin => @products.collect(&:asin)])
end
def search
@products = Products.search params[:q]
asins = @products.collect{ |e| e.asin }.to_a
existing_products = Products.find(:all, :conditions => {:asin => asins})
existing_asins = existing_products.collect{|e| e.asin}
@products.delete_if { |e| existing_asins.include?(e.asin)}
@products.insert(0, existing_products).flatten!
end