Agent forwarding should be enabled with caution. Users with the ability to bypass file permission on the remote host (e.g. the root user) can access the local agent through the forwarded connections. Its not possible to extract your key, but it would be possible to use your agent forwarding to connect to other hosts with your agent/identity.
Never enable SSH Agent forwarding globally in your ssh_config
Using Ruby 1.8.7 you will not be able to use the maximum versions Rubygems 1.8.30 and Bundler 1.17.3 with
https://rubygems.org/ anymore. This is a result of a server certificate on December 5th, 2020. The resulting errors will look like following:
TypeError: can't modify frozen object
Could not verify the SSL certificate for https://rubygems.org/*
Bundler::Fetcher::CertificateFailureError: Could not verify the SSL certificate for https://index.rubygems.org/versions.
Liquid Prompt gives you a nicely displayed prompt with useful information when you need it. It shows you what you need when you need it. You will notice what changes when it changes, saving time and frustration. You can even use it with your favorite shell – Bash or zsh.
When deploying a Rails application that is using Webpacker and Capistrano, there are a few configuration tweaks that optimize the experience.
capistrano-rails is a Gem that adds Rails specifics to Capistrano, i.e. support for Bundler, assets, and migrations. While it is designed for Asset Pipeline (Sprockets) assets, it can easily be configured for Webpacker. This brings these features to the Webpacker world:
git checkout -" you can switch back to the branch you previously worked on.
(master) $ git checkout foobar Switched to branch 'foobar' (foobar) $ git checkout - Switched to branch 'master' (master) $
This also works with other commands like
(master) $ git checkout foobar Switched to branch 'foobar' (foobar) $ git merge - Merged branch 'master'
Validations should be covered by a model's spec.
This card shows how to test an individual validation. This is preferrable to save an entire record and see whether it is invalid.
In general any validation test for an attribute
:attribute_being_tested looks like this:
record.errors[:attribute_being_tested]contains the expected validation error
Cucumber will save a file
tmp/parallel_cucumber_failures.log will the filenames and line number of the failed scenarios after a full test run.
Normally you can say
cucumber -p rerun (rerun is a profile defined by default in
config/cucumber.yml) to rerun all failed scenarios. Unfortunately this does not work with geordi yet.
Here is a list of possible workarounds, that depends on you personal taste:
geordi cucumber @tmp/parallel_cucumber_failures.log
# Run the `c...
The linked blog post contains some background information about the
alt attribute and the
figcaption element. It is interesting, that a figure is not only for images but also for captions, code snippets, quotations and more.
Why improve your code reviews?
Improving code review technique helps your reviewer, your team, and, most importantly: you.
Learn faster: If you prepare your changelist properly, it directs your reviewer’s attention to areas that support your growth rather than boring style violations. When you demonstrate an appreciation for constructive criticism, your reviewer provides better feedback .
Make others better: Your code review techniques set an example for your colleagues. Effective author practices rub off on your teammates, which...
Sometimes you accidentally generate entries in the bash history that you do not want to have there (e.g. commands with credentials).
Here's how to remove single entries.
You can look at the bash history with the
To see e.g. the last 5 entries, use
history | tail -n 5:
>history | tail -n 5 1994 my-secret-command 1995 cd xyz-mnt/ 1996 ls 1997 cd appliance/ 1998 cd ..
Each entry has a number. You can use that to delete it:
history -d 1994. Note that as you delete entries, the numbers of the following...
Cross-Site Request Forgery (CSRF) is an attack pattern for websites. A CSRF attack is usually relevant in a browser context, where state is kept for multiple domains (as opposed to independent requests made e.g. with
curl). The most common example is authentication via cookies. If a script on
https://example.com made requests to
https://docs.google.com, the browser would send all cookies for docs.google.com along, effectively given the script access to anythin...
In the tab where you need it, open Chrome DevTools with F12, open settings with F1, scroll down to the "Global" section and check "Auto-open DevTools for popups".
When you follow a link with target=_blank within that tab, DevTools will be open and you can inspect e.g. request headers.
IRB 1.2 (shipped with Ruby 2.7, but works on 2.5+) brings pretty syntax highlighting and multiline cursor navigation. However, pasting longer contents is incredibly slow.
You can fix that by disabling said features.  Ruby 3.0.0-pre2 / IRB 1.2.6 solved the issue.
Add a command line flag when opening an IRB:
This also works on modern Rails when using
rails console like so:
rails console -- --nomultilin...
This card is mainly an explanation how variable fonts work in CSS, not necessarily a recommendation to actually use them.
Designing and rendering fonts are two highly complex topics. For an arbitrary text to appear properly on your screen, its font must be created multiple times for different "settings" like stroke width (boldness) and style (e.g. italic).
Now as web developers, we usually ship these variants of the same font via multiple
@font-faces of the same font-family:
It is good programming practice to Don't Repeat Yourself (or DRY). In Ruby on Rails we keep our code DRY by sharing behavior by using inheritance, modules, traits or partials.
When you reuse behavior you want to reuse tests as well. You are probably already reusing examples in unit tests. Unfortunately it is much harder to reuse code when writing integration tests with Cucumber, where you need t...
FactoryBot.define do factory :parent do transient do child_name nil child_allowed_to_drive false end child do association(:child, name: child_name, allowed_to_drive: child_allowed_to_drive) end end factory :child do name 'Child' allowed_to_drive false end end # Usage daughter = FactoryBot.create(:parent, child_name: 'Lisa').child daughter.name # => 'Lisa' daughter.allowed_to_drive? # => false son = FactoryBot.create(:parent, child_name: 'Benedikt', child_allowed_to_drive: tr...