In interactive commands, Git allows the user to provide one-letter input with a single key without hitting enter (docs). # Enabled this feature globally git config --global interactive.singlekey true

...enable this feature locally for a single repository git config interactive.singlekey true This allows you to hit "y" instead of "y + ENTER" to move to the next hunk.

Running rails server will start a local server that you can access via http://localhost:3000. When you are working on multiple web apps, they will likely set cookies with...

...generic names on localhost. This is annoying, since you will sign out your current user whenever you switch to another app. A better way is to use our own daho.im...

web.archive.org

When you have a Cucumber step like Then I should see "Did you see those \"quotation marks\" over there?" you'll run into trouble. Cucumber won't take your...

...escaped quotation marks. Workarounds One workaround is to write the step as regex (since there is a step taking a regex): Then I should see /Did you see those "quotation...

...binary file. This method might be telling the truth most of the time. But sometimes it doesn't, and that's what causes pain. The method is defined as follows...

...not guaranteed to be 100% accurate. It performs a "best guess" based # on a simple test of the first +File.blksize+ characters. # # Example: # # File.binary?('somefile.exe') # => true # File.binary?('somefile.txt') # => false #--

When you send automated emails from a noreply@-address, and the recipient has an out of office enabled, the autoreply bounces and they get an additional email with an error...

...To prevent the recipient's auto-response and the following error message you can set the email header Auto-Submitted: auto-generated in your mailer, for example like this:

geordi cucumber path/to/features -r2 Background and how to rerun manually Cucumber will save a file tmp/parallel_cucumber_failures.log containing 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. Here are a few alternative ways...

makandra dev

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

Occasionally you need to do something directly on the server -- like having all records recalculate something that cannot be done in a migration because it takes a long time.

...s say you do something like this: Project.all.each(&:recalculate_statistics!) Even though you may have been successful with this on your development machine or the staging server, keep in mind...

makandra dev
iamvdo.me

Line-height and vertical-align are simple CSS properties. So simple that most of us are convinced to fully understand how they work and how to use them. But it...

...less-known feature of CSS: inline formatting context. For example, line-height can be set as a length or a unitless value 1, but the default is normal. OK, but...

You can execute systemctl --user --failed to check for failed systemd user units. But let's face it: It's inconvenient and you'll probably miss failures. Better use desktop...

...pipewire.socket ConditionUser=!root [Service] LockPersonality=yes MemoryDenyWriteExecute=yes NoNewPrivileges=yes RestrictNamespaces=yes SystemCallArchitectures=native SystemCallFilter=@system-service Type=simple ExecStart=/usr/bin/pipewire Restart=on-failure Slice=session.slice [Install] Also=pipewire.socket

...moving a file, your imports also need to change. To get around this, esbuild support a mechanism first introduced in TypeScript called "path aliases". It works like this:

...if you do use TypeScript): { "compilerOptions": { "baseUrl": "./app/assets", "paths": { "@/*": ["js/*"], "@images/*": ["images/*"], "@css/*": ["css/*"], "@spec/*": ["../../spec/js/*"] } }, "include": [] } (The include: [] only makes sense if you do not use Typescript. If you...

expect(page).to have_field('Username') { |field| field[:class].blank? } Limitations Using execute_script, evaluate_script or evaluate_async_script within a filter block will crash with a timeout...

...Selenium::WebDriver::Error::ScriptTimeoutError Exception: script timeout This is due to Capybara using a zero timeout while calling the filter block. A workaround is to temporarily set a different timeout...

The attached patch lets you find a record by a string or number in any column: User.find_by_anything('carla') User.find_by_anything('email@domain.de') User.find_by_anything(10023)

User.find_by_anything!('carla') Boolean and binary columns are excluded from the search because that would be crazy. I recommend copying the attachment to features/support/find_by_anything.rb, since it is...

}) Example case I had an Unpoly compiler for a tab navigation, which sets an -active class per default to the first tab link and removes it from all...

...other tab links. If another tab link is clicked, the -active class switches to the clicked link. In a Jasmine spec I wanted to test this behaviour. Unpoly's up.hello...

...any of the gems that GEM depends on. For the example above you would say: bundle update cucumber-rails --conservative If Bundler complains of a single dependency that it cannot...

...resolve this way, simply add it to the command: bundle update cucumber-rails capybara --conservative Options for old versions of bundler The options below might be relevant if you're...

With passenger-status --show=requests you can get a huge JSON showing current information about the running passenger processes. This can be useful if you want to find out what...

...a passenger process is doing at the moment (for e.g. if one worker seems to be stuck): * PID: 4273 Sessions: 1 Processed: 47 Uptime: 50m 53s CPU: 43% Memory : 3644M...

developer.mozilla.org

...animate HTML elements using the Web Animation API's method .animate(keyframes, options) (which seems to be Baseline for all browsers since 2022). const fadeIn = [{ opacity: 0 }, { opacity: 1 }] // this...

// the animation object can be used for things like querying timings or state or `pause`, `cancel` the animation animation.pause() animation.play() await animation.finished // do other stuff Even though play...

To return non-HTML responses (like XLS spreadsheets), we usually use the respond_to do |format| format.xls do # send spreadsheet end end This is often, but not always the same...

...one format checks for authorization and the other doesn't. params[:format] is only set when a user explicitly puts a .xls at the end of the URL. The format.xls...

...or ::1 (IPv6) can only be reached from your own PC: Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:3000 0.0.0.0:* LISTEN...

...local address 0.0.0.0 can be reached from other PCs on your network: Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

Looking at the source code of the validates_numericality_of validator, it becomes clear that it converts the attribute in question to either an integer or float: if configuration[:only...

...any of your users as this is only broken in the most extreme case shown above...

apidock.com

...want some output. In Rails > 3.1 you have two methods at hand: announce and say_with_time. In the migration: class AddUserToken < ActiveRecord::Migration class User < ActiveRecod::Base; end

add_column :users, :token, :string announce "now generating tokens" User.find_in_batches do |users| say_with_time "For users ##{users.first.id} to ##{users.last.id}" do users.each do |user| user.update_attribute :token...

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

...can use ETags to allow clients to use cached responses, if your application would send the same contents as before. Besides what "actually" defines your response's contents, your application...

...probably also considers "global" conditions, like which user is signed in: class ApplicationController < ActionController::Base etag { current_user&.id } etag { current_user&.updated_at } end Under the hood, Rails generates...

...want to be in there. In order to reduce the chance to accidentally commit something you didn't intend, review your changes before committing. My preferred way of doing this...

...N . # Add all paths, but not their contents git add -p Git will now show you all your changes in small chunks and ask you in an interactive mode whether...