When you click a link or a press a button on a Selenium-controlled browser, the call will return control to your test before the next page is loaded. This can lead to concurrency issues when a Cucumber step involves a Selenium action and a Ruby call which both change the same resources.
Take the following step which signs in a user through the browser UI and then sets a flag on the user that was just signed in:
Given /^the user "([^"]*)" signed in (\d) days ago$/ do |name, days| visit new_session_path fill_in 'Username', :w...
When you style multiple adjacent block elements with
float: left, they will be rendered next to each other similar to inline elements. Also like inline elements, they will wrap at the horizontal end of the parent container.
If you want to keep floating elements from wrapping, nest them in a really wide container:
<div class="tabs"> <div class="really_wide_container"> <div class="tab">...</div> <div class="tab">...</div> <div class="tab">...</div> </div> </div>
This is the [Sass](http://sass-la…
In order to cover some edge cases you rarely care about,
Range#include? will become very slow in Ruby 1.9:
Range#include? behaviour has changed in ruby 1.9 for non-numeric ranges. Rather than a greater-than/less-than check against the min and max values, the range is iterated over from min until the test value is found (or max) […] Ruby 1.9 introduces a new method Range#cover? that implements the old include? behaviour, however this method isn’t available in 1.8.7.
The attached …
RubyGems 1.6.0 has undergone some changes which may cause Rails 2.x applications to break with an error like this one (e.g. when running script/server):
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
Fix it by adding the following not only to your environment.rb but also into your script/server file, in both cases before
boot.rb is required.
If you still get the error above you can also add `require 'thre…
If you want to get a deep understanding of how closures, blocks, procs & lambdas in Ruby work, check out the code at the attached link.
Here the summary:
---------------------------- Section 6: Summary ---------------------------- So, what's the final verdict on those 7 closure-like entities? "return" returns from closure True closure? or declaring context...? Arity check? ...
Generate a key pair
- Get the Mac GPGTools
- Open GPG keychain access and generate your keypair ( + N)
- Make your key valid for about 2 (maybe more, up to 5) years; do not choose an infinitely valid key
- Export your key with File > Export
- Do not check "Export secret key"; the resulting file will read
BEGIN PGP PUBLIC KEY BLOCK
- To import other people’s keys just drag&drop a key file or selected text to the application
Mail integration ————-…
Around the time in my life when I stopped ordering drinks made with more than one ingredient, I was woken up for the last time by a hypochondriac Nagios monitoring installation. If you are on-call long enough, you cultivate a violent reaction to the sound of your cell phone's text message alert. If your monitoring is overconfigured, that reaction boils over hastily, as it will interrupt you during meals, sex, sleep — all of the basics — with the excruciating operational details of your web site.
I've since developed, with the help of some n…
When you set both a record's association and that association's foreign key attribute, Rails does not realize you are talking about the same thing. The association change will win in the next
save, even if the foreign key attribute was changed after the association.
As an example, assume you have these two models:
class Group < ActiveRecord::Base has_many :users end class User < ActiveRecord::Base validates_presence_of :group_id belongs_to :group end
We will now load a
User and change both its `g…
After updating your RubyGems, you will probably not be able to run Capistrano any more, but receive an error similar to this:
can't activate net-ssh (= 2.0.22) for , already activated net-ssh-2.1.0 for  (Gem::LoadError)
If you have Bundler installed, you can use
bundle exec to avoid this problem as follows:
Create a gemfile at
~/.capistrano/Gemfile (or at some other sensible place), that only contains these 2 lines:
source 'http://rubygems.org' gem 'capistrano' gem 'capistrano-ext' # You need this for multistag...
"Wallaby" is the codename for an experimental technology that converts the artwork and animation contained in Adobe® Flash® Professional (FLA) files into HTML. This allows you to reuse and extend the reach of your content to devices that do not support the Flash runtimes.
MAX functions are for aggregations only. This will not work and produce an error:
SELECT id, MIN(birthday, '1978-01-01') FROM users;
SELECT id, LEAST(birthday, '1978-01-01') FROM users;
My T410 has a NVIDIA graphics card (NVS 3100M).
My BIOS configuration looks like this:
- NVIDIA Optimus is disabled in
- "Discrete" mode on
- Internal Intel card deactivated
My X crashed when trying to activate both Dell U2410 monitors connected using DVI to the docking station.
The solution was to disable DDC/CI on the monitors:
Menu -> Other settings -> DDC/CI disable
Note that you shouldn't disable DDC/CI if you don't have any issues with your displays.
Adds a slide out panel to your Rails application that directs clients to test stories that have been marked as 'delivered' in Pivotal Tracker.
When calling a Sass mixins, you usually don't need to quote arguments:
However, when a CSS property consists of multiple parts (like
box-shadow), the Sass parser will trip up:
+box_shadow(0 1px 2px #000) // this will blow up
The solution is to quote the argument like this:
+box_shadow('0 1px 2px #000')
As the author of the
box-shadow mixin you now need to unquote this string, so the quotes don't appear in the resulting CSS. E.g. the following version of the
box-shadow mixin will…
? key will display a list of keyboard shortcuts. Available shortcuts are:
|toggle charts (graphs)||
|toggle my work||
|toggle labels & searches||
This is awesome.
Sometimes you might want to know if an attribute is an associated object or a simple string, integer etc. You can use the
reflect_on_association method for that.
if Person.reflect_on_association(:address) Person.address.attributes # do something else Person.address # do something else end
Currently, only up to 500 rows of Analytics table data can be exported at a time into CSV format. If you need to export larger data sets, like exporting all keywords that sent traffic to your site, you can export multiple times as long as each batch contains at maximum 500 rows.
If you have thousands of rows that require multiple exports, you can use the convenient workaround below to export all your rows in one go.
If you use a form (or form fields) multiple times inside one view, Rails will generate the same
id attributes for fields again.
This card presents you with a way to call something like
- form_for @user, :prefix => 'overlay' do |form| = form.text_field :email
and get this as HTML:
<input name="user[email]" id="overlay_user_email" (...) />
You can also put a
:prefix into a field's options. Note how only the
id but not the
name changes as we would not want to pass an
overlay_user[email] param to the controller. Settin…