This file contains hidden or 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 save_with_lock | |
| r = Record.first | |
| # This will raise PG::LockNotAvailable if already locked | |
| # | |
| r.with_lock("FOR UPDATE NOWAIT") do | |
| # do stuff | |
| end | |
| # This rescue block isn't executed for some reason?? |
This file contains hidden or 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
| App.views.creditCardForm.items.items[0].up('form').insert(1, { | |
| xtype: 'fieldset', | |
| id: 'customerInfoFormFieldset', | |
| title: 'Name and Address Details', | |
| instructions: 'Please enter your name and address.', | |
| defaults: { | |
| xtype: 'textfield', | |
| labelAlign: 'left', | |
| labelWidth: '40%', | |
| required: false, |
This file contains hidden or 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
| require 'spec_helper' | |
| describe "Faking it with Savon" do | |
| before do | |
| Savon.hooks.define "Fake Response", :soap_request do | |
| HTTPI::Response.new(200, {}, "<Envelope><Body><response>Success!</response></Body></Envelope>") | |
| end | |
| after do | |
| Savon.hooks.reject! "Fake Response" |
This file contains hidden or 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
| client = Savon::Client.new do | |
| # This can be a URL also | |
| wsdl.document = "/Path/to/your.wsdl" | |
| # These are optional, only if your WSDL sucks :) | |
| wsdl.endpoint = "https://your_endpoint" | |
| wsdl.namespace = "http://your_namespace" | |
| certs = Akami::WSSE::Certs.new :cert_file => "/path/to/cert.crt", :private_key_file => "/path/to/private/key.pem", :private_key_password => "password" | |
| wsse.sign_with = Akami::WSSE::Signature.new certs |
This file contains hidden or 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
| module Capybara | |
| def Capybara.auto_save_and_open_page=(val) | |
| @auto_save_and_open_page = !!val | |
| end | |
| def Capybara.auto_save_and_open_page? | |
| @auto_save_and_open_page ||= false | |
| end | |
| end |
This file contains hidden or 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
| # These instructions are for Ruby 1.9.3 under rbenv. | |
| # To install ruby-debug19 for ruby-1.9.3 you need to download the following gems from http://rubyforge.org/frs/?group_id=8883 | |
| linecache19-0.5.13.gem | |
| ruby_core_source-0.1.5.gem | |
| ruby-debug19-0.11.6.gem | |
| ruby-debug-base19-0.11.26.gem | |
| #Then in your console |
This file contains hidden or 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
| Sample::Application.routes.draw do | |
| # Route /a/b -> Foo::BarsController. This is useful | |
| # when you need to conform to a certain url structure | |
| # while using a controller that doesn't match that structure, | |
| # eg. a controller supplied by a Rails engine. | |
| scope '/a' do | |
| resources :b, controller: 'bars', module: 'foo' | |
| end | |
| end |
This file contains hidden or 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
| if Rails.env.production? | |
| require 'fileutils' | |
| FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets", "admin")) | |
| template_path_one = "#{Gem.loaded_specs['activeadmin'].full_gem_path}/app/assets/stylesheets" | |
| template_path_two = "#{Gem.loaded_specs['activeadmin'].full_gem_path}/lib/active_admin/sass" | |
| old_compile_path = "#{Rails.root}/public/stylesheets/admin" | |
| new_compile_path = "#{Rails.root}/tmp/stylesheets/admin" | |
| Sass::Plugin::remove_template_location template_path_one |
This file contains hidden or 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
| # Somewhere in the file | |
| Capybara.auto_save_and_open_page = true if 'true' == ENV['CAPYBARA_AUTO_SAVE_AND_OPEN_PAGE'] |
This file contains hidden or 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
| module Travis | |
| class Builder | |
| @@ -29,9 +30,18 @@ module Travis | |
| host = rails_config['url'] || 'http://127.0.0.1' | |
| url = "#{host}/builds/#{build['id']}#{'/log' if data.delete(:append)}" | |
| uri = URI.parse(host) | |
| - data = { :body => { :_method => :put, :build => data }, :head => { :authorization => [uri.user, uri.password] } } | |
| - # stdout.puts "-- post to #{url} : #{data.inspect}" | |
| - register_connection EventMachine::HttpRequest.new(url).post(data) | |
| + data = { |
NewerOlder