around do |example| superuser_power = Power.new(create(:user, :superuser)) Power.with_power(superuser_power) do # before-block will be run here, DB snapshot will be created example.run # after-block will...
...number of options. Offers some pretty skins for downloading, but is hard to customize beyond that. SoundManager 2 Free. Only does audio. Awkward API. There seems to be no way...
...will be short a window manager. This might be fixable, but it's probably best to simply log out (or shut down) using the Gnome panel...
...diam nonumy eirmod tempor. | | | | | | | | | | | | | | | | | | | +------------+-----------------------------------------+ | Footer | +------------------------------------------------------+ Here are some more details how the layout should behave: Give each element (header, sidebar, etc.) a distinct background color to see where boxes start...
...do not use them. Pay attention to the margins in your styles. Elements that belong together logically (e.g. two navigation sections) should be closer to each other than elements that...
Your development server is usually running on an insecure HTTP connection which is perfectly fine for development.
You can hook into Slack when using Capistrano for deployment. The slackistrano gem does most of the heavy lifting for...
TL;DR Append your locale keys with _html to have them marked as html_safe and translate them with = t...
...would possibly need in a clean way, I prefer to simply always use them. Behind the scenes, Open3 actually just uses Ruby's spawn command, but gives you a much...
Open3.capture3 Basic usage is require 'open3' stdout_str, error_str, status = Open3.capture3('/some/binary', 'with', 'some', 'args') if status.success? # okay else raise "did not work" end Open3 will raise...
...access and manipulate the browser's DOM tree. Using JavaScript we can add interactive behavior to our interfaces that would not be possible through declarative rules in HTML and CSS...
...set :bundle_without, %w[development test cucumber deploy].join(' ') Be aware, that gems that belong to two groups, are only excluded, when both of the groups are excluded, e.g. to...
...when the model has no database or database columns yet. Example: class Post < ApplicationRecord begin # Magically auto-strips all string attributes columns.each do |column| next if [:string, :text].exclude?(column.type...
Any form fields where users enter numbers should be an . Numeric inputs have several benefits over : On mobile or tablet devices, number fields show a special virtual keyboard that shows...
...the inert field. It might might as well be removed from the page. This behavior is OK if the fields might as well be hidden, and you're just looking...
PostgreSQL's Common Table Expressions (CTEs) can be used to extract sub-queries from bulky SQL statements into a temporary...
In rare circumstances, you want to use a websites full domain (say https://mywebsite.com) while testing in dev mode. This...
Ubuntu 24 added some guarding for Python packages which no longer allows installing applications through pip on system level. Instead...
This card tries to summarize by example the different uses of heredoc. In Ruby << vs. <<- vs. <<~ In Rails strip_heredoc...
...gitignore, see https://makandracards.com/makandra/15947 [diff] algorithm = patience # A slower algorithm that sometimes produces better diffs [fetch] prune = true # Remove local remote-tracking branches that have been deleted [rebase]
main-view = date:relative author:abbreviated commit-title:graph=true,refs:true A better diff tool You may switch to delta, a fancy diff tool with syntax highlighting and...
...version you want to use for each bundler command, e.g. bundler _2.1.4_ update New behavior Bundler now honors the version specified under BUNDLED_WITH in the Gemfile.lock. The necessary version...
gem update --system Updating the bundler version for a project With the new behavior bundler should never update its version in a Gemfile.lock automatically anymore. Therefore, unless there are...
Here are some hints on best practices to maintain your tasks in larger projects. Rake Tasks vs. Scripts The Rails default is using rake tasks for your application tasks. These...
run_script(subject, 42, 'some_arg') assert_something end end Further reading Best practices: Writing a Rails script (and how to test it...
In Ruby, the meaning of protected and private is different from other languages like Java. (They don't hide methods...
...make block elements take up much more space than desired, even stretching their container beyond the screen edge on small screens. min-width is defined to win against competing width...
In a nutshell: Use git rebase --onto target-branch source-commit target-branch means "branch you want to be based...
A recent patch level Ruby update caused troubles to some of us as applications started to complain about incompatible gem...