...command on a server which continues to run after the SSH session is closed. Consider systemd-run as alternative. It will turn every command in a systemd service unit:
...openssl speed` as unit run-benchmark.service $ sudo systemd-run --unit=run-benchmark openssl speed # Query the current status $ systemctl status run-benchmark.service ● run-benchmark.service - /usr/bin/openssl speed Loaded: loaded (/run/systemd/transient/run-benchmark.service; transient) Transient: yes
...of a Linux process, like so: $ faketime 'last Friday 4 pm' date Fr 12. Sep 16:00:00 CEST 2025 However, we cannot just modify the time of the docker...
...need to affect the command being run inside the image. So we need to smuggle faketime into the container somehow, and activate it for the process being run.
...to be done separatly for each node version on your system, though. Install yarn 1 system-wide via apt The yarn package depends on the nodejs debian package, but with...
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/yarn.gpg >/dev/null echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update...
...Adding Records via XHR and JS Example For the following examples we use a simple data model where a user has zero or more tasks. class ExampleMigration < ActiveRecord::Migration...
...user.tasks.build } end def update load_user @user.attributes = user_params if @user.save flash[:notice] = 'User saved successfully.' redirect_to(edit_variant_1_user_path(@user)) else flash[:notice] = 'User could not...
Static error pages To add a few basic styles to the default error pages in Rails, just edit the default templates in public, e.g. public/404.html. A limitation to these default...
...templates is that they're just static files. You cannot use Haml, Rails helpers or your application layout here. If you need Rails to render your error pages, you need...
Take a look at the following material: World's shortest UI/UX design course Every UI/UX Concept Explained In Under 10 Minutes Easiest Way to Pick UI Colors
...Rules for Creating Gorgeous UI (Part 2) Visual design rules you can safely follow every time Bootstrapping Design (in our library) Steve Schoger's Refactoring UI book (in our library...
In SQL, NULL represents an "unknown" value. Because of this, it does not behave like a standard piece of data when used in comparison operators. If you don't account...
If you attempt to update or filter these users using a standard toggle, you might run the following queries: SELECT * FROM users WHERE name = 'Alice';
To make CSS rules dependent on the screen size, we use media queries: @media (max-width: 500px) { // rules for screen widths of 500px or smaller } Browsers will automatically enable and...
...disable the conditional rules as the screen width changes. To detect responsive breakpoints from JavaScript, you may use the global matchMedia() function. It is supported in all browsers:
I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method on Enumerable that combines the three: module Enumerable
group_by(&block) .transform_values(&:count) .sort_by(&:last) .to_h end end Just paste that snippet into a Rails console and use #count_by now! Usage examples...
There is an option you can set so that when using the cd command, small typos are automatically corrected. Add the following to your ~/.bashrc: # cd: autocorrect small typos and...
shopt -s cdspell Example: cd Porjects # Projects pwd # /home/judith/Projects Also, I recommend adding aliases for your most common typos of commands you regularly use to your ~/bashrc...
...that matter) will not be affected by this. If you define them in your specs, they will exist globally. This is because of how RSpec works (short story: instance_eval...
# ... end let(:record) { TestRecord.new }
end # TestRecord will exist here, outside of the spec! Do not do this. It will bite you eventually. For example, when you try to...
If you are using our opscomplete.com hosting we can set all environment variables mentioned below for your deployment on request. If you're lucky DO_NOT_TRACK=1 opts...
...are collecting data only after you opt into that. ng analytics --global disable Storybook https://storybook.js.org/docs/configure/telemetry npm run storybook -- --disable-telemetry npm run storybook -- --disable-crash-reports export STORYBOOK...
...T06:22:17.484221 #2698200] INFO -- : [53a240c1-489e-4936-bbeb-d6f77284cf38] more Goal When searching through Rails logs on production, it's often hard to see all lines that belong to...
...the same requests, since output of different requests is often interwoven. Instead, we want to find all requests that match a pattern, and then print all lines that share the...
...for DOM elements, there are some footguns you should know about. Some lists are synchronized with the DOM Some DOM APIs return live lists that automagically update their contents as...
...reflects the change automatically: document.querySelector('#two').remove() console.log(liveList) // [#one] console.log(nonLiveList) // [#one, #two] Snapshotting a live list Lists that silently change their elements can be very surprising to work...
...forget that bad resolution: git rerere forget your_file.rb Afterwards, the badly resolved file will still be in your working directory. To get it back with confict markers, say:
Rails wraps your parameters into an interface called StrongParameters. In most cases, your form submits your data in a nested structure which goes hand in hand with the strong parameters...
...However, there are cases where this does not fit your use case, or has side effects. If you do it differently, be extra careful not to introduce security issues.
...is defined incorrectly. Raise the attributes hash given to your :reject_if lambda to see if it looks like you expect. If you are nesting forms into nested forms, each...
...a new parent record together with a new child record and will need to save the parent before you can save the child. You can opt to only show the...
When you're using feature branches, they will stack up if you don't delete them after the merge to master. Here's how to tidy them up. Delete feature...
...Find already-merged branches by running # On branch master git branch --merged You may safely delete each of the listed branches, because they point to commits that are contained in...
...the new way to do it, and it's great, especially in combination with Sprockets (or Propshaft on Rails 7). You might be missing some convenience features, though.
...cover one specific issue: Once you have started your development Rails server and esbuild with the --watch option (if you used jsbundling-rails to set up, you probably use bin/dev...
Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine...
When a user shares your content, a snippet with title, image, link and description appears in her timeline. By default social networks will use the window title, the first image...
...the current URL and some random text snippet for this purpose. This is often not what you want. Luckily Facebook, Twitter, etc. lets you control how your content appears in...
...is how to view what Capybara is rendering. Rendered text (what the user actually sees) puts page.text Prints just the visible text body, completely stripped of HTML tags and hidden...
...cluttered with excessive blank lines, you can easily avoid printing them: puts page.body.gsub(/^\s*$/, '').squeeze("\n") Advanced DOM parsing with Nokogiri If the raw HTML is too massive to read...
...Plotting graphs in Ruby with Gruff, which comes handy for many uses cases, you sometimes might need configuration for more advanced plots, e.g. for academic concerns. Then using Gnuplot, the...
...first academic open source plotting software, might be a good option. There are several wrappers for Ruby available and I mainly looked at one of the two most frequently used...
...enlightenment in order to learn Ruby. The goal is to learn the Ruby language, syntax, structure, and some common functions and libraries. We also teach you culture. Testing is not...
...just something we pay lip service to, but something we live. It is essential in your quest to learn and do great things in the language...