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
SELECT s.region_id, s.frequency, s.payment_provider, s.payment_method, s.created_at, s.id, s.email, s.amount_in_local, d.amount_in_local, > | |
FROM subscriptions s | |
JOIN donations d ON s.id = d.subscription_id | |
WHERE d.amount_in_local != s.amount_in_local | |
AND s.created_at > CURRENT_TIMESTAMP - INTERVAL '3 years' | |
GROUP BY 1,2,3,4,5,6,7,8,9 | |
ORDER BY 1,2,3,4,5 | |
; | |
-- Some reasons: |
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
Master: [34m[DEBUG Nuvola][0m master.vala:111: Compositing mode disabled because of WebKitGTK < 2.13.4 | |
Master: [34m[DEBUG Gtk][0m Connecting to session manager | |
Master: [34m[DEBUG DioriteGtk][0m DesktopShell.vala:96: Shell: compiz (null), CSD 0, appmenu 1, menubar 0 | |
Master: [34m[DEBUG Nuvola][0m WebAppRegistry.vala:169: Found web app Test at /usr/share/nuvolaplayer3/web_apps/test, version 1.0 | |
Master: [34m[DEBUG Nuvola][0m WebAppRegistry.vala:169: Found web app 8tracks at /usr/share/nuvolaplayer3/web_apps/8tracks, version 5.1 | |
Master: [34m[DEBUG Nuvola][0m WebAppRegistry.vala:169: Found web app Amazon Cloud Player at /usr/share/nuvolaplayer3/web_apps/amazon_cloud_player, version 5.1 | |
Master: [34m[DEBUG Nuvola][0m WebAppRegistry.vala:169: Found web app Bandcamp at /usr/share/nuvolaplayer3/web_apps/bandcamp, version 2.1 | |
Master: [34m[DEBUG Nuvola][0m WebAppRegistry.vala:169: Found web app Deezer at /usr/share/nuvolaplayer3/web_apps/deezer, version 2.4 | |
Master: [34m[DEBUG |
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
# Using a datatable as per https://github.com/antillas21/ajax-datatables-rails | |
app.get '/things' | |
controller = ThingsController.new | |
controller.request = app.request | |
controller.params = ActionController::Parameters.new({search: 'Thing Name'}) | |
datatable = ThingDatatable.new(controller.view_context) | |
datatable.send(:data) |
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
# This is what my params looks like | |
{:group_id=>86, | |
:payer_id=>1982, | |
:account_type=>"standard", | |
:sms_credit_price_ex_tax=>"0.025", | |
:auto_purchase_sms_credits_amount=>1000, | |
:setup_invoice=>true, | |
:locale=>"en-GB", | |
:timezone=>"London", |
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
source 'https://rubygems.org' | |
gem 'rails' | |
# etc, etc. | |
gem 'rack-cors', require: 'rack/cors' |
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 Account | |
has_many :payment_methods | |
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
describe 'DELETE #destroy' do | |
let(:dummy) { mock('Dummy') } | |
it "should find the object with the given ID and destroy it" do | |
# set the expectations about the interactions | |
Dummy.should_receive(:find).with(99).and_return dummy | |
dummy.should_receive(:destroy) | |
delete :destroy, id: 99 | |
end | |
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
<%= simple_form_for @item do |i| %> | |
<%= i.input :name %> | |
<%= i.input :description %> | |
<%= i.input :price %> | |
<%= i.input :zip %> | |
<%= i.input :weight %> | |
<%= i.input :volume %> | |
<%= i.simple_fields_for :item_images do |image| %> | |
<% image.input :image, as: :file %> | |
<% 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
def self.create_from_parent(parent_type, parent_id, comment_params, current_account) | |
parent = parent_type.safe_constantize | |
raise ActiveRecord::RecordNotFound unless parent && (parent.reflect_on_association(:comments).klass == self) | |
parent.find(parent_id).comments.create(comment_params.merge(account: current_account)) | |
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
class Contact < ActiveResource::Base | |
self.site = 'http://localhost:3000/service/v1/' | |
self.user = (a = Account.find(1)).users.first.email | |
self.password = a.web_service_key | |
end | |
c = Contact.find 1 |
NewerOlder