Skip to content

Instantly share code, notes, and snippets.

View adamnengland's full-sized avatar

Adam England adamnengland

View GitHub Profile
@adamnengland
adamnengland / gist:8d7bc14af58480ba2f3e
Created November 18, 2014 20:26
Check sidekiq queue for retry buildup
class RetryMonitor
include Sidekiq::Worker
def perform
retry_queue = Sidekiq::RetrySet.new
if retry_queue.size > 0
# Send an email or do something else.
end
end
end
Example of a working query
db.postalCode.find( { 'geo' :{ $near :{ $geometry :{ type : "Point" ,coordinates : [ -94.58, 39.09 ] } ,$maxDistance : 10000} } } );
GIS Standard: <Longitude,Latitude>
db.businesses.count( { 'geo' :{ $near :{ $geometry :{ type : "Point" ,coordinates : [ -94.595033, 39.102704 ] } ,$maxDistance : 4000} } } );
out = []
Facility.find_each do |facility|
if facility.send(:belong_to_billable_company?) && facility.facility_map.geometric_objects.count > 10
out << "#{facility.company.name}, #{facility.name} has #{facility.facility_map.geometric_objects.count} objects"
end
end
facilities_receiving_texts = SMSReceivedEvent.pluck(:facility_id).uniq.length
facilities_sending_texts = SMSSentEvent.pluck(:facility_id).uniq.length
sms_received = SMSReceivedEvent.count