...it's present inside the first 4k of you page. If you put it somewhere in the bottom of your head section (or in the body) move it to top...
...UA-Compatible is ignored if it's put inside IE conditional comments. Also, you shouldn't have any text before the doctype declaration. If you've got any HTML comments...
...errors.add_to_base('failed') if bad_things? end end ^ # app/models/foo.rb require 'user' class Foo # something happens here end Now, when your environment is booted, Rails will automatically load your models...
...our example, when Foo gets loaded, it will require the User class itself again. Since Ruby 1.8 identifies required files by the string you used (as you alread know), this...
Consider the following: describe '#something' do context 'with lots of required arguments' do it 'should work' do subject.something(:foo => 'foo', :bar => 'bar', :baz => 'baz').should == 'Hello world' end it 'should...
...is actually called. This way you can manipulate objects or other data before using the short-hand reference to your method call. Yes, it is quite similar to using variables...
...programmers dislike meetings so much is that they're on a different type of schedule from other people. Meetings cost them more...
In a recent post, Stephan Schmidt makes several suggestions in order to write "Next Generation Java". Unfortunately, I disagree with most of them
When navigating back to a page that was received from a POST request, undesired side effects may happen. Therefore, modern browsers try to keep users from doing so, i.e. Firefox...
...an error page explaining what's wrong. If the user presses "Try Again", it shows an additional alert asking whether the user is certain. Solution If you need to circumvent...
The httpclient gem comes with a custom SSL cert store.
...customizable, application-level cert store is great when you need to deal with broken or self-signed certificates, you usually want to use the cert store from the underlying Linux...
To find a hash key by it's value, i.e. reverse lookup, one can use Hash#key. It's available...
...have its own context method, or you will always receive errors like "No description supplied for example group declared on ~/project/app/..." The easiest workarounds: do not name any method context...
...use describe instead of context in your specs, and put this into your spec_helper.rb:\ Spec::DSL::Main.class_eval do if method_defined? :context undef :context end
...manage to find the cause of this behaivour yet, but I think it has something to do with the start order of the nova services. (When nova-network isn't...
...present at nova-compute startup, no rules will be applied at all) You can restart the nova-compute service and nova should insert the rules one by one (you can...
...configured timeout. This can become an issue if you rely on the timeout to strike precisely...
The solution in this card is based on a stack overflow post by Leventix. If you need to make request come from a fixed IP address for the duration of...
...a Cucumber scenario, the code below lets you write this: Given my IP address is 188.174.117.205 Rails 3 Given /^my IP address is "(.*?)"$/ do |ip| ActionDispatch::Request.any_instance.stub(:remote_ip).and...
This looks like it is safe to use: 2.2.1 :001 > a = b = "hello world" "hello world" 2.2.1 :002 > a "hello world" 2.2.1 :003 > b "hello world" 2.2.1 :004 > b = " goodbye...
...happening when we do a = b = "hello world"? First, b is assigned to a String object "hello world", then a is assigned to b. a and b are now assigned...
...Thunderbird 3 put there. Though the CompactHeader addon is often claimed to be a solution it does way too much for me -- I like the headers the way they are...
...very well for me (keeps the date and "other actions" menu on the right, see the screenshot below): Open up your profile directory (~/.thunderbird/ /) Create a chrome directory inside it...
Note: This applies to plain Ruby scripts, Rails does not have this issue. When you work with Ruby strings, those strings will get some default encoding, depending on how they...
...are created. Most strings get the encoding Encoding.default_internal or UTF-8, if no encoding is set. This is the default and just fine. However, some strings will instead get...
RSpec supports a one-liner syntax for setting an expectation on the subject: describe Array do describe "when first created" do it { should be_empty } end end The example description...
...it should be empty" will be defined automatically. With RSpec 3's expect-based syntax you use it_is_expected instead: describe Array do describe "when first created" do
...to be defined ahead of your before block and can be different for individual sections. It works just like that: describe User do describe '#locked?' do before :each do subject.should...
...receive(:current_plan).and_return plan end context 'when expiring today' do let(:plan) { stub(:expiry => Date.today) } it 'should be false' do subject.should_not be_locked end end context 'when...
Webmocks hash_including is similar to RSpec::Mocks::ArgumentMatchers#hash_including. Be aware that hash_including (webmock v3.0.1) doesn't parse integer values to String. Without hash including you would...
uri = URI('http://example.com/?foo=1&bar=2') stub_request(:get, 'example.com').with(query: {foo: 1, bar: 2}) Net::HTTP.get(uri) # ===> Success If you only want to check if foo is present...
...alpha channel value, you can use Gimp: Use the color picker tool Hold the Shift key while clicking the pixel A window will appear, containing color information, including the alpha...
...previously announced it would not charge royalties for such video through December 31, 2015 (see http://www.mpegla.com/Lists/MPEG%20LA%20News%20List/Attachments/226/n-10-02-02.pdf), and today’s announcement makes clear that royalties will continue not to...
...be charged for such video beyond that time. Products and services other than Internet Broadcast AVC Video continue to be royalty-bearing...
To force a check on your next reboot (here for your root partition), simply: touch /forcefsck To manually do this, here is how to do it for the first partition...
...on sda, when you are using ext4: fsck.ext4 -fn /dev/sda1 -f forces the check, even if everything seems okay. -n is a "read only" check, where nothing is changed and...
Observed on Rails 2.3 and machinist 1.0.6 Like the title says, when you define the method empty? like in the following example, you may not longer use collection.make.