...both column name and value are coming from user input and need to be sanitized. Unfortunately this works in SQLite but does not in MySQL: named_scope :filter, lambda { |attribute...

{ :conditions => [ 'articles.? = ?', attribute, value ] } } The solution is to use sanitize_sql_array like this: named_scope :filter, lambda { |attribute, value| { :conditions => sanitize_sql_array([ "`articles`.`%s` = '%s'", attribute, value...

Selenium cannot reliably control a browser when its window is not in focus, or when you accidentally interact with the browser frame. This will result in flickering tests, which are...

...tests to complete. The solution is to run Selenium inside a VNC session so the Selenium-controlled browser doesn't pop up over your main work area. Understanding issues with...

kb.wisc.edu

When receiving a new SSL-Certificate for an existing SSL-key it should be checked that they match cryptographically. Maybe the customer accidentally created a new key and certificate and...

...sent us just the certificate. It's also possible that the certificate chain is in the wrong order. Make sure that the server certificate is the first. This is also...

...it's likely that your cucumber.yml is just fine but not your rerun.txt.\ This sometimes happens when running multiple Cucumber workers with parallel_tests that write into rerun.txt simultaneously -- ending...

...Just remove it and you are good to go again: rm rerun.txt Another possible solution is to have one rerun file per worker for which you'd need to modify...

Back in the old days, we couldn't do something like that: .foo { position: absolute; bottom: 0; /* This was bad: */ left: 10px; right: 10px; } Why? Because IE5 and IE6 (which...

...then) failed horribly trying to render it. I've now checked if this is still an issue with any browser that's not from the stone age. \

...because a printer's resolution is usually much higher than that of a computer screen. If an image absolutely must look awesome when printed, a solution is to embed the...

...image in much higher solution than needed (e.g. four times the horizontal resolution), then scale it down to the desired width using CSS. Note that this will slightly alter the...

amundsen.com

...but REST itself - in a nutshell. so here's a new angle i've started playing with: "REST Upside Down...

web.archive.org

Restricting access to cookies is essential for security in many web apps. For example, the session ID, the secret token used to identify a particular session, is typically stored in...

...a cookie. Cookies have several important settings. Previously, I discussed the secure flag. This time, let’s dive into the cookie domain. The cookie domain is an important security feature...

...variations' was not found; perhaps you misspelled it? I just was hunting down a strange error with this model: class Model placeholder = 'variations' has_many placeholder nested_scope :verbose, :include...

...work (the latter returned [ :some_association, 'variations' ]). Eventually, the quotes led me to the solution: I had to write has_many placeholder.to_sym. When Rails can't find an association...

rubydoc.info

...hard to achieve), because it is no actual "integration testing". If you use this step, know what you are doing. Destroying a record with Capybara is not as easy as...

...user, method: :delete), because RackTest's visit can only perform GET requests. With this step you can destroy a records using either Selenium or RackTest. Example: When I destroy that...

Capybara will match elements outside of a page's tag. For example, the step definitions below match nodes in a page's : Then /^my browser should auto-discover the "([^"]*)" feed...

page.should have_css( 'head link' + '[rel="alternate"]' + "[href='http://www.example.com/#{slug}/feed.rss']" + '[title="RSS feed (all cards)"]' + '[type="application/rss+xml"]', visible: false ) end Then /^my browser should...

When you create e.g. a sidebar box that contains headlines and paragraphs, the final paragraph's margin in that box will create an undesired 'bottom padding' inside that box.

...is a Sass mixin that you can apply to such boxes. It makes the last child's bottom margin disappear: =hide_last_margin >*:last-child margin-bottom: 0

...below if you are affected by the issue: The field's content "" did not match "some-text" (RSpec::Expectations::ExpectationNotMetError) Issue with headless Chrome After removing the line above in...

...it could happen that the tests are no longer running in headless mode. Updating the selenium-webdriver gem to >= 3.13.0 fixed the problem. Issue with old Capybaras

...default Ruby, RubyMine will give you incorrect inspections, for example.\ Here is how to switch which Ruby you use in RubyMine. File → Settings (Or press Ctrl+Alt+S)

...SDK and Gems" from the left pane Switch your "Ruby interpreter". Though it may seem you are changing a global setting here, this is in fact a per-project setting...

find . -cnewer other_file This can be used to check against a specific timestamp, too. This is how you check for all files modified today (since...

...the current bash's PID so you will get some file like /tmp/12345 that stays the same for the current shell. This allows you to check against this file again...

...you want to manually check if e-mail delivery works on a machine by sending an e-mail you can run the following: mail -s Test someone@example.com < /dev/null

...send an empty e-mail with "Test" as its subject to someone@example.com. If you want it to contain a message body, call mail -s Test someone@example.com only; the mail application...

askubuntu.com

Adobe no longer supports their PDF reader on Linux and the official page does not offer it for download. \ However, some files may not display properly on Ubuntu's default...

...PDF reader Evince or PDF forms may not work as expected. Hence, you may still need to use it. Here is how to install the Adobe Reader (acroread) if you...

Note that we used $ and ^ to explicitly look at the end and start of the filenames...

...git pull won't know its remote version. You could use difficult commands to set up a branch's tracking but it's easier to...

...just push it like this: git push -u From the documentation on git push: -u, --set-upstream For every branch that is up to date or successfully pushed, add upstream...

makandra dev
tom.preston-werner.com

A perfect implementation of the wrong specification is worthless. By the same principle a beautifully crafted library with no documentation is also damn near worthless. If your software solves the...

...wrong problem or nobody can figure out how to use it, there's something very bad going on. Fine. So how do we solve this problem? It's easier than...

Here's a pretty useful steps that hasn't made it into Spreewald yet. It is best used with the auto-mapper for BEM classes in features/support/selectors.rb

...above [selector] element When /^I hover above (.*) element$/ do |selector| page.find(selector_for(selector)).hover end Example: When I hover above the album's image element → triggers a hover event...

If your Webpack build is slow, you can use the Speed Measure Plugin for Webpack to figure out where time is being spent. Note that at time of writing, Webpack...

...now have an idea where optimization might be feasible. Look around for suggestions, e.g. the sass-loader readme when you want to optimize Sass build time...

patrickmarabeas.github.io

Webfonts are not always available when your JavaScript runs on first page load. Since fonts may affect element sizes, you may want to know when fonts have been loaded to...

...Promise that will be resolved once the font is available. Example: document.fonts.load('1rem "Open Sans"').then(() => {...

jQuery / fontSpy If your project uses jQuery, you could also use jQuery-FontSpy which...

...on an old version of ImageMagick that you can no longer install in your system, you can choose the run an old ImageMagick in a Docker container. Dockerized ImageMagick commands...

...path arguments. You need to boot a corresponding docker container once before using it. Setting up Docker If you haven't installed Docker yet, use our guide or the official...