codeodor.com

Code example for implementing Cross-Origin Resource Sharing (CORS) in Rails.

makandra dev
web.archive.org

When you need to zip up files in Ruby, use zipruby. sudo gem install zipruby You can add existing files...

If you're writing a spec for an application using Resque, you may need to work off queues manually without...

Note: While the solution in this card should still work, we prefer another solution now: Hide your Selenium browser window...

This finally works: User.any_instance.should_receive(…) as does User.any_instance.stub(…) Note: You won't have RSpec 2.6 if you're still working...

tools.ietf.org

In order to use different encodings than ASCII for HTTP headers use the following syntax: Header-Key: Header-Value; Parameter...

Sometimes you need a file of some size (possibly for testing purposes). On Linux, you can use dd to create...

Note: Consider using MATE instead of Gnome 3 on newer system Awesome is a very good tiling window manager that...

With gem dependency it is possible to check the dependencies for your gem before you install it.

When you generate a URL in a mailer view, ActionMailer will raise an error unless you previously configured it which...

makandra dev

I've recently encountered a weird problem with specs making lots of SOLR queries using the acts_as_solr plugin...

If you need to parse a large XML file (> 20 MB or so), you should parse it in chunks, otherwise...

These steps are now part of Spreewald. Since Capybara 0.4.1 a within scope will only look at the first element...

The step definition below allows you to write: Then I should see a link labeled "Foo" But I should not...

When you render a nested form for a Movie which has_many :actors, you want to render the right number...

To test if you can connect to a host using password authentication and explicitly deny public key authentication:

If you stub a method or set expectations with should_receive these stubbed methods may also yield blocks. This is...

apidock.com

This is somewhat similar to the touch command of Linux: FileUtils.touch 'example.txt', :mtime => Time.now - 2.hours If you omit the :mtime...

When some of your Google contacts are no longer synchronized with your e-mail client or mobile phone, those contacts...

Sometimes, when running a rake task, RubyGems 1.8.5 raises an error: rake aborted! undefined method `specifications' for "/usr/lib/ruby/gems/1.8":String

My RubyMine (and it seems like many other Java GUI applications) crashes the Compiz window decorator almost every time on...

If you want to use a helper_method my_helper_method inside a model, you can write ApplicationController.helpers.my_helper...

Consider the following: describe '#something' do context 'with lots of required arguments' do it 'should work' do subject.something(:foo => 'foo...

When rendering a number, you want to pretty up the string coming from #to_s: Render 0.0 as 0