When you regularly make use of Cucumber's "show me the page" step (or let pages pop up as errors occur), the capybara-20120326132013.html files will clutter up your Rails root...

To tell Capybara where it should save those files instead, put this into features/support/env.rb: Capybara.save_and_open_page_path = 'tmp/capybara...

The will_paginate gem will show a default of 30 records per page. If you want to test pagination in a Cucumber feature, you don't want to create...

...records just for that. Instead, you probably want to modify the number of items shown, by saying something like this: Given we paginate after 2 users Using the following step...

To find a hash key by it's value, i.e. reverse lookup, one can use Hash#key. It's available...

Sometimes you want git to ignore certain files that appear on your machine. You can do this in 3 ways: Per project, in the project's .gitignore file

Downsides of per-project .gitignore entries While it might be tempting to set it per project (other devs might benefit from it), you need to do it each...

...be answered with an empty response if the underlying content hasn't changed. This saves CPU time and reduces the bandwidth cost for a request/response exchange to about 1 KB...

...can be considered secure. Random masking of CSRF tokens was introduced to mitigate BREACH, a side-channel attack against HTTPS that was published in 2013. BREACH is pretty hard to...

Migrating data from a legacy into a new system can be a surprisingly large undertaking. We have done this a few times. While there are significant differences from project to...

...project, we do have a list of general suggestions. Before you start, talk to someone who has done it before, and read the following hints: Understand the old system

makandracards.com

...have a README that gives the reader a quick overview of the project. Its size will vary as projects differ in complexity, but there should always be some introductory prose...

...for a developer to read when starting on it. Purpose That's already the main purpose of a project README: Give a new developer a quick overview of the project...

...response includes caching headers like Expires or Cache-Control, their validity depends on the server's Date header if present. Otherwise, the browser uses its local time. This can lead...

...for authentication. The cookie for this feature might include an Expires attribute, specifying its validity: Set-Cookie: remember_me=abc123; Expires=Fri, 15 Dec 2023 12:00:00 GMT

To open a terminal quickly navigate to System → Preferences → Keyboard Shortcuts. There, click the "Run a terminal" row (It should be in the "Desktop" section) and press the keyboard shortcut...

...for Ubuntu's default terminal is gnome-terminal. Be aware that many programs use shortcuts of their own and you would not want to clash with those (like Ctrl+T...

You can make both mobile Chrome and mobile Safari display a native app install banner. The banner suggests that the user installs an app that is related to the current...

...page. It is shown in the phone's native UI. See attached animation. There is some fineprint you need to read to make this work (see below). References Android: Increasing...

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.

ruby.about.com

The flip-flop operator is a hotly contested feature of Ruby. It's still struggling to find an idiomatic use case, except for a few very rarely needed things. It...

...s not something you'll likely reach for on a daily, weekly or even monthly basis. The only thing you really need to know about it is what it does...

TL;DR: Pannellum is a small (~56 kB, own WebGL renderer, no three.js) equirectangular panorama viewer. The npm package has no ES module export - importing it runs an IIFE that...

...assigns the API to window.pannellum. Bundle it statically, make sure the viewer's container gets a definite size, and allow blob: in your img-src CSP. Considered Photo Sphere Viewer...

...you have files in your .gitignore they won't be considered for changes, but still you might want to get rid of them, e.g. because they clutter your file system...

...While a regular git clean will ignore them as well, passing the -x switch changes that: git clean -x If you want to see what would happen first, make sure...

...toggle an outlining of HTML elements quickly. This helps greatly when you want to see the actual dimensions of elements, e.g. for floating elements inside containers, instead of opening up...

...shortcut (Shift+G for the 9.2-compatible layout or for the default layout with enabled "single-key shortcuts") and select "Outline" from the View → Style menu (needs to be done...

The program 'foo' can be found in the following packages: * foobar * barfoo Try: sudo apt-get install -bash: foo: command not found But you can customize this with the...

...connected with ssh. Because I'm using $@ I can also use options like a custom ssh-port...

stackoverflow.com

This StackOverflow question about nested function definitions in Ruby imparts a good understanding of Ruby's def...

Angular's location provider stalls links to the current URL, i.e. window.location. As soon as the $location service is activated in an Angular app, it will intercept links. The click...

...your interaction with the browser history (i.e. you're just using Angular as JS sugar on your page), Angular will create the above issue as soon as you use anything...

This is an attempt to list some of those things: On the server Always optimize: Don't do stupid things with the database. Avoid "n + 1" queries. Don...

...Use form models. Optimize on demand: Don't optimize without knowing what's actually slow. Measure first, for example by using a performance monitoring tool like NewRelic, Scout, AppSignal, Skylight...

...an error in the User#name method) you will end up with a confusing stacktrace that looks like you have an error in your render call. If this happens to...

...you, temporarily remove the annotation to see the correct error. Niklas opened an issue in rails, a fix is merged and will arrive in Rails >7.2.2.2 and...

makandra dev

...to load fast it's recommended to optimize images. Ideally an image's file size should be as small as possible while still being of decent quality. This card demonstrates...

...tools for image optimization Use identify to fetch information about pictures. convert can change size/quality and strip meta information. Both commands are supplied by ImageMagick. $ identify in.jpg in.jpg JPEG 294x440...

If your shell seems frozen You probably pressed Ctrl-S which stops the buffer. Try Ctrl-Q to resume. If your shell behaves strangely (no input being displayed, strange character...

...Try typing this, followed by pressing the return key: reset That should clear the screen and reset output settings etc...

...this matter, as the image rendering depends on multiple factors. At least the operation system, browser or image viewer software and monitor influence the resulting image colors on your screen...

...possibility to upload images, they will most likely contain tons of EXIF metadata and sometimes exotic color profiles like eciRGB. We want to get rid of the metadata, as it...

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...