This file contains 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
#<ActiveMerchant::Billing::PaypalExpressResponse:0x007fd3a2667178 @params = { | |
"timestamp" = > "2012-02-18T15:00:36Z", "ack" = > "Success", "correlation_id" = > "fd42c44f29d95", "version" = > "62.0", "build" = > "2571254", "token" = > "EC-08B34690L3027751N", "transaction_id" = > "1Y616105WY000492X", "parent_transaction_id" = > nil, "receipt_id" = > nil, "transaction_type" = > "express-checkout", "payment_type" = > "instant", "payment_date" = > "2012-02-18T15:00:34Z", "gross_amount" = > "750.00", "gross_amount_currency_id" = > "USD", "fee_amount" = > "22.05", "fee_amount_currency_id" = > "USD", "tax_amount" = > "0.00", "tax_amount_currency_id" = > "USD", "exchange_rate" = > nil, "payment_status" = > "Completed", "pending_reason" = > "none", "reason_code" = > "none", "protection_eligibility" = > "Eligible", "seller_details" = > nil, "success_page_redirect_requested" = > "false", "Token" = > "EC-08B34690L3027751N", "PaymentInfo" = > { | |
"TransactionID" = > "1Y616105WY000492X", "ParentTransactionID" = > |
This file contains 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
alias slt='open -a "Sublime Text 2"' | |
alias mate='open -a "Textmate"' | |
PS1="┌──[ \e[0;33m\u\e[0m ] ─ [ \e[0;34m\w\e[0m ]\n└─> $ " |
This file contains 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 User < ActiveRecord::Base | |
has_many :projects | |
scope :active, User.joins(:projects).where('projects.id in (?)', Project.active.collect(&:id)).group('user_id') | |
end |
This file contains 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
Parameters: { | |
"utf8" => "✓", "authenticity_token" => "59+EhGAWCZ05Lz/DRso/AiEJI+4s1g/84RRxxsVpF0w=", "order" => { | |
"due_date(1i)" => "2012", "due_date(2i)" => "10", "due_date(3i)" => "23", | |
"order_item_lines_attributes" => { | |
"0" => { | |
"order_item_option_id" => "1" | |
}, | |
"1" => { | |
"order_item_option_id" => "3" | |
}, |
This file contains 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
Show hidden characters
[ | |
{ "keys": ["super+v"], "command": "paste_and_indent" }, | |
{ "keys": ["super+shift+v"], "command": "paste" } | |
] |
This file contains 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
sudo apt-get update | |
sudo apt-get install python-virtualenv | |
sudo apt-get install python-dev | |
sudo apt-get install postgresql | |
sudo apt-get install postgresql-server-dev-9.3 | |
sudo apt-get install redis-server | |
sudo -u postgres createuser -s sentry | |
sudo -u postgres psql -c "alter user sentry with password 'sentry';" |
This file contains 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
week = Time.now.beginning_of_week - 1.week | |
days = [week.strftime('%Y-%m-%d')] | |
1.upto(6) do |i| | |
days << (week + i.days).strftime('%Y-%m-%d') | |
end | |
data = days.map do |day| | |
by_hour = Array.new(24) { 0 } | |
Activity. | |
where('date(created_at) = ?', day). |
This file contains 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
Mysql2::Error: Unknown column 'orders.projects' in 'where clause': SELECT COUNT(*) FROM `invoices` INNER JOIN `orders` ON `orders`.`id` = `invoices`.`order_id` INNER JOIN `projects` ON `projects`.`id` = `orders`.`project_id` WHERE `orders`.`projects` = '---\n:user_id: 283\n' AND `invoices`.`status` = 1 |
This file contains 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 Order < ActiveRecord::Base | |
## Setup accessible (or protected) attributes for your model | |
attr_accessible :project_id, :developer_id, :due_date, :status, :notes, :is_delivered, :deliveted_at, :completed_at | |
## Virtual attributes | |
attr_accessor :pages | |
## Associations | |
belongs_to :project |
This file contains 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
def unread_comments | |
readable_comments.delete_if {|c| c.created_at < c.discussion.assignments.find_by_user_id(id).updated_at } | |
end | |
def create_new_invoice! | |
invoice = invoices.build | |
order_item_options.delete_if{ |o| o.price == 0 }.map{ |o| invoice.invoice_lines.build(:order_item_id => o.order_item.id, :description => o.order_item.name, :unit_price => o.price) } | |
invoice.save! | |
end |