Skip to content

Instantly share code, notes, and snippets.

Dir["#{Rails.root}/app/jobs/*.rb"].each { |file| require file }
ENV["REDIS_URL"] ||= "redis://dev.vipwithme.com:6379"
uri = URI.parse(ENV["REDIS_URL"])
Resque.redis = Redis.new(:host => uri.host, :port => uri.port)
@top_tipper_ids = Tip.find_by_sql("SELECT SUM(tips.amount_cents) total_tip, tips.client_id FROM tips WHERE tips.vendor_id = #{@user.id} GROUP BY tips.client_id ORDER BY total_tip").collect {|e| e.client_id}
@top_tippers = User.find_all_by_id(@top_tipper_ids)
def popular_tags(limit = nil, order = ' tags.name ASC', gender = 'F', type = nil)
sql = "SELECT tags.id, tags.name, count(*) AS count FROM taggings, tags WHERE tags.id = taggings.tag_id "
sql += " AND taggings.taggable_type = '#{type}'" unless type.nil?
sql += " AND taggings.taggable_type != 'Listing'"
sql += " AND taggings.tagging_user_type = 'Vendor'"
sql += " AND taggings.tagging_user_gender = '#{gender}'"
sql += " GROUP BY tag_id"
sql += " ORDER BY #{order}"
sql += " LIMIT #{limit}" if limit
Tag.find_by_sql(sql).sort{ |a,b| a.name.downcase <=> b.name.downcase}
WORKS IN MRI
deploy@domU-12-31-39-06-60-53 /data/vipwithme/current $ ruby script/console production
Loading production environment (Rails 2.3.5)
>> require 'action_controller/test_process.rb'
=> true
>> attachment = Attachment.new(:uploaded_data => ActionController::TestUploadedFile.new('/var/lib/asterisk/sounds/vipwithme/recordings/9.wav', 'audio/x-wav'))
=> #<Attachment id: nil, size: nil, height: nil, width: nil, parent_id: nil, attachable_id: nil, position: nil, content_type: "audio/x-wav", filename: "9.wav", thumbnail: nil, attachable_type: nil, created_at: nil, updated_at: nil, duration: nil>
>>
$ git clone [email protected]:sprite2005/settling.git
Initialized empty Git repository in c:/Users/sprite/documents/settling/.git/
remote: error: Could not read 364262402f0358d9551bd5478747ed5ba2f00bb9←[K
error: git upload-pack: git-pack-objects died with error.remote: fatal: bad tree
object 364262402f0358d9551bd5478747ed5ba2f00bb9←[K
remote: aborting due to possible repository corruption on the remote side.
fatal: git upload-pack: aborting due to possible repository corruption on the re
mote side.
.container
.top.left
%h1 Login
- form_for @user_session, :url => user_session_path, :html => { :class => 'mainform' } do |f|
= f.error_messages
= f.label :login
= f.text_field :login
%br
= f.label :password
= f.password_field :password
_form.html.haml
%b= form.label :login, "Login <em>(used in your Cashlink.it links)</em>"
= form.text_field :login
%br
%b= form.label :email
= form.text_field :email
%br
%b= form.label :password, form.object.new_record? ? "Password <em>(minimum 6 characters)</em>" : "Change password"
= form.password_field :password
749 Query COMMIT
749 Query SELECT * FROM `call_logs` WHERE (`call_logs`.`id` = 111)
749 Query SELECT * FROM `user_transactions` WHERE (`user_transactions`.transaction_id = 158 AND (`user_transactions`.`role` = 'sender')) LIMIT 1
749 Query SELECT * FROM `users` WHERE (`users`.`id` = 5)
749 Query SELECT * FROM `user_transactions` WHERE (`user_transactions`.transaction_id = 158 AND (`user_transactions`.`role` = 'sender')) LIMIT 1
749 Query SELECT * FROM `users` WHERE (`users`.`id` = 5)
749 Query SELECT * FROM `user_transactions` WHERE (`user_transactions`.transaction_id = 158 AND (`user_transactions`.`role` = 'sender')) LIMIT 1
749 Query SELECT * FROM `users` WHERE (`users`.`id` = 5)
749 Query SELECT * FROM `user_transactions` WHERE (`user_transactions`.transaction_id = 158 AND (
aasm_column :state
aasm_initial_state :initial
aasm_state :account_topped_up
aasm_state :back_in_conference
aasm_state :call_warned
aasm_state :contacting_client
aasm_state :contacting_vendor
aasm_state :client_left_chat
aasm_state :client_hungup_early
aasm_state :client_reject
mysql> DESCRIBE call_sessions;
+----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| vendor_id | int(11) | YES | MUL | NULL | |
| client_id | int(11) | YES | MUL | NULL | |
| listing_id | int(11) | YES | | NULL | |
| phonenumber_id | int(11) | YES | | NULL | |
| transaction_id | int(11) | YES | | NULL | |