The basic idea is pretty simple: an element's height is accessible via the
offsetHeight property, its drawn height via
scrollHeight – if they are not the same, the browser shows scrollbars.
var hasScrollbars = element.scrollHeight != element.offsetHeight;
So, in order to say something like…
Then the element "#dialog_content" should not have scrollbars
… you can use this step (only for Selenium scenarios):
Then /^the element "([^\"]+)" should( not)? have scrollbars$/ do |selector, no_scrollbars| scroll_heig...
Our old solution for cronjobs, the "craken" plugin, is no longer maintained and does not work on Rails 3.2+.
We will instead use the whenever gem.
"Whenever" works just like "craken", by putting your rake tasks into the server's cron table. Everything seems to work just like we need it.
Add "whenever" to your
group :deploy do gem 'whenever' end
Add it to your
If some AJAX functionality does not work, but you see Firefox making an
OPTIONS request, the reasons is most likely this:
You're accidently trying to talk to a different domain (or switching from
https), and Firefox tries to find out if that is okay, according to the "Cross-Origin Resource Sharing" standard.
For two years we've been using
SearchableTrait which gives models the ability to process Googlesque queries like this:
Contact.search('a mix of words "and phrases" and qualified:fields')
This trait used to be a huge blob of code without tests and documentation, so I made a gem out of it. Check out https://github.com/makandra/dusen for code, tests, and a huge README.
You should use the Dusen gem and delete
SearchableTrait in all future projects.
Note that the syntax to define query proc…
Xfce gives you a million options to configure your panels. Together with Xfce's sometimes arcane configuration UI, this can be a huge time waster and super-annoying if you need to get work done the same day.
This card describes how to setup a classic panel layout as you might be used to from Gnome 2 or Windows (see screenshot below). You can use this to quickly get productive in Xfce, and as a starting point for further customization.
This works in all relevant browsers:
You can use this in your Selenium steps, for example, to assert that a form field is or is not focused.
.htaccess is hell, and
RewriteRules in particular if they are not working as expected. But fear not!
RewriteLog will help you out. \
Add this to your vhost's configuration:
RewriteLog "/tmp/rewrite.log" RewriteLogLevel 9
After that, restart your Apache httpd and
tail the above logfile.
When you are done and all is well: remember to remove those entries again, or set the log level to
0, to switch off rewrite logging.
Harry Roberts, a youngster from the UK, wrote a comprehensive article telling you how to smell CSS rot early.
… and more.
Hopefully you are using Psych for everything, but if you have legacy Syck YAML files lying around you could be in for some pain because they are not necessarily compatible. In my case, I had a bunch of i18n translation files emitted with Syck which uses an incompatible escape code structure instead of plain utf-8, thereby rendering the files unreadable by both Psych and humans alike. My solution was a little script utilizing the fact that the engine can be swapped dynamically.
When you want to copy/move from a shared folder (on Windows guests, for example) and it fails with absurd error messages (lots of text or an error about the target being read-only), you are probably running on Guest Additions that no longer match your VirtualBox version.
Fix: install the latest VirtualBox Guest Additions in your guest machine.
Note that you need to make sure you are using the correct ISO.
Global keyboard shortcuts can be configured in two separate panels in the Xfce Settings manager:
If - for whatever reason - you have to render stylesheets dynamically, the following snippet might be of help. It emulates what "sprockets" would to when precompiling your assets, and give your stylesheets access to all the regular bells and whistles (like
class DynamicStylesheetsController < ApplicationController
def show logical_path = RELATIVE_PATH_TO_YOUR_TEMPLATE path = File.join(Rails.root, logical_path) template = Sass::Rails::SassTemplate.new(path) environment = ...
Over the next year, there are a number of technologies coming down the pipeline that have the potential to radically transform how we use and develop for the Web.
David Walsh from Mozilla shows how to fire 'DOM changed' events from CSS. No need for JS to observe DOM mutation events or check the DOM manually – simply put: no deprecated API, no retarding loops.
With the CSS in place you add a listener for your custom 'DOM changed' event and that's it!
Cards can now be flagged as "Repeating".
Every Wednesday, some of these cards will be moved back to the top of the deck.
This is intended for important cards that you want your team to occasionally repeat, so they aren't lost in the depths of your deck.
For your own deck, you can set the number of cards to repeat in your Deck Admin.
When you are trying to install/update VirtualBox Guest Additions on your guest machine but the setup is for a different/older version (for example 4.0.4 tools for a 4.1.x VirtualBox installation), try this:
sudo apt-get install virtualbox-guest-additions-iso
For some reason, this is no dependency to VirtualBox itself – and if you have an old ISO lying around, VirtualBox will just pick that one, regardless of its version.
When your file manager sorts file case-sensitively after a distribution upgrade, you probably need to reconfigure your locale settings as described here.