Localizing a non-trivial application can be a huge undertaking. This card will give you an overview over the many components that are affected.
When you are asked to give an estimate for the effort involved, go through the list below and check which points are covered by your requirements. Work with a developer who has done a full-app localization before and assign an hour estimate to each of these points.
appmust be translated: Screens, mailer templates, PDF templates, helpe…
console.time('myTime'); // Start timer console.timeEnd('myTime'); // End timer and print the time
$nreference the nth-last inspected Element.
Pour color on your Rails console with awesome_print. Turn confusing long strings into formatted output. Have objects and classes laid out clearly whenever you need it.
gem 'awesome_print', :group => :development into your Gemfile. Now on the Rails console you have the command
ap that will give you a colored, formatted output of whatever you pass it. See the example output of the
User class below.
For customization visit the repository on Github.
Cucumber has an output format that prints step definitions only. You can use this to find unused ones:
require_relative 'env'to the top of the first file in features/support.
--dry-runmakes Cucumber skip loading
bundle exec cucumber --dry-run --format stepdefs | grep -B1 'NOT MATCHED' --no-group-separator | grep features/step_definitions
This will print all unused step definitions from your project – however, the result will include false positives. Step…
We figured out, that ActiveJob Inline might lead to autoloading problems in development. The result was an exception when running an import script, which delivers async mails.
A copy of XXX has been removed from the module tree but is still active! (ArgumentError)
Our fix was to use
.deliver_now and not
.deliver_later (this is not a general fix, but it was okey for us). Below there are some debug hints which helped us to locate the problem:
When building a web application, one is tempted to claim it "done" too early. Make sure you check this list.
Desktops, tablets and mobile devices have all different screen resolutions. Does your design work on each of them?
Ubuntu has decided to disable PDF processing because ImageMagick and the underlying Ghostscript had several security issues.
When your Ghostscript is up to date (and receiving updates regularly), you can safely reactivate PDF processing on your computer like this:
<!-- disable ghostscript format types -->
If you need it enabled for an…
draw.io is a web application that lets you draw flow charts and other diagrams. It works much nicer than office suite tools like LibreOffice Draw.
Its UI is easy to use: Simply drag and drop shapes or arrows from the left-hand side onto your sheet. Drag start/end of arrows to shapes to automatically connect them. You can add text to shapes by selecting them and typing. To add colors, select a shape and use the right-hand panel.
While you can, you don't need to store your charts online. "Offline" storage can be files…
In this example we assume that not only the storage gem changes but also the file structure on disc.
Part A: Create a commit which includes a script that allows you to copy the existing file to the new file structure.
Part B: Create a commit which removes all paperclip logic and replace it with the same code you used in the first commit
Here are some implementation details you might want to reuse:
Then pause from Spreewald 1.7+) and open VNC for Firefox.
In Ruby, classes and modules are called constants. This card explains how Ruby resolves the meaning of a constant.
E. g. in the following example,
Array could mean either
Foo::Array or simply
class Foo def list Array.new end end
What Ruby does here is to see if the name
Array makes sense inside of
Foo::, and if that fails, resolves it to
::Array (without a namespace).
You might be surprised that these are all valid ways to reference Ruby's
Browsers' printing methods usually don't print background colors. In most cases this is the desired behavior, because you don't want to spent tons of ink printing the background of a web page. But in some cases you want to print the background color of elements, e.g. bars of a chart. For those elements you need to set the following css styles:
Sometimes, the IRB prints a warning during boot:
irb: warn: can't alias source from irb_source.
During boot, the IRB creates many aliases to give the user quick access to irb functions like
source-ing a file.
However, if IRB's context already responds to the alias it wants to create, it will no…
You need to update a lof gems. Make sure you don't have any version constraints in your
Gemfile or your
bundle update won't do anything!
bundle update cucumber_priority
bundle update spreewald
bundle update cucumber_factory
bundle update parallel_tests
Even on the latest version,
parallel_tests will print some deprecation warnings due to using an older formatter A…
If you want to make a screenshot of a website that works well in print or on a high-DPI screen (like Apple Retina displays), here is how you can capture a high-resolution screenshot.
You can do this without an addon:
CTRL -so it covers most of the window area. Leave generous padding on the left and right so…
This is painful. Consider using Microsoft Office or switching careers. If you need to write < 20 letters consider doing it manually.
So you didn't listen and here it comes:
.ods). Use any columns that work for you, but be consistent. I like to use one column for the address, one column for the salutation line.
When you print (or print preview) and elements are cut off (e.g. after 1st page, or "randomly") you should check your CSS rules for these:
Is there an element with "
display: inline-block" that surrounds your content? Make sure it has "
display: block" for printing.
This primarily affects Firefox and Internet Explorer. Chrome seems to be able to handle
inline-block elements in most cases.
Does the element itself, or a container, define "
overflow: hidden"? Use "
overflow: auto" (or maybe "
overflow: visible") instead.
In most projects I know, Cucumber test suite speed is not an issue. Of course, running 350 features takes its time, but still each test for itself is reasonably fast. There is nothing you can do to fundamentally speed up such a test (of course, you should be using parallel_tests).
However, in projects that go beyond clicking around in a web GUI and checking results, there might be various measures to speed things up. Katapult tests for example could be sped up more than 4 times by re…