makandra dev

Ever wondered how you can create a simple table output in bash? You can use the tool column for creating a simple table output. Column gives you the possibility to...

...same level. Pipe output to column -t (maybe configure the delimeter with -s) and see the magic happening. detailed example I needed to separate a list of databases and their...

open-ui.org

tl;dr When browsers start to adapt proposals from Open UI, it might not be necessary to use any 3rd party libraries to have nice components and controls in web...

...applications e.g. selects. It would require only a minimum of CSS and Javascript to get them working and looking good. The purpose of the Open UI, a W3C Community Group...

Sometimes the need arises for SSL in local development. We have guides for different webservers, this one is for puma. make sure mkcert is installed create an SSL certificate for...

...bundle exec rails s Accept the certificate in your browser See also Creating a self-signed certificate for local HTTPS development

Update: This is now documented on Edgeguides Ruby on Rails: If you set the :validate option to true, then associated objects will be validated whenever you save this...

...default, this is false: associated objects will not be validated when this object is saved. Setup # post.rb class Post < ActiveRecord::Base has_one :attachment end # attachment.rb class Attachment < ActiveRecord::Base...

github.com

...really want to get their arguments processable as keyword arguments. Don't change the syntax, or you'll experience pain. Always call super inside of your overridden #initialize method. A...

...things happen in the ActiveRecord world. Just let them happen, otherwise kittens will die somewhere. You don't want that. Example class Item < ActiveType::Object def initialize(attributes) super

For searching in large database tables we usually use PostgreSQL's fulltext search capabilities. While this works reasonably well for content primarily consisting of prose, it is not necessarily a...

...good solution for all use cases. The main issue is that it is only possible to search for prefixes of text tokens, which can potentially be unexpected for users.

...type of network card is used for a given network interface on a linux system, e.g. because the system has multiple network cards, try and match the driver to the...

...interface name: $ ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback...

...main mechanisms for background processing are cronjobs (managed with whenever) job queues, usually with Sidekiq Learn about cronjobs Read HowTo: Add Jobs To cron Under Linux or UNIX? Understand how...

...the load of your application. Decide whether cronjobs should run on one or all servers Note We use the whenever to automatically rewrite the crontab when we deploy. You have...

...git rebase -i main. What it does: Opens an interactive rebase UI to choose squash/edit/fixup for each commit of your branch until the first commit (the base). Keeps your branch...

...s base intact (no rebasing onto main). Lets you squash, reorder, edit, or drop commits. Info This is not the same as git rebase -i main, which would rebase your...

...life as web developers we are constantly faced with technical problems that can be solved with a variety of (sometimes vastly different) technologies. Choosing the right tool for the tasks...

...is crucial for our mid- and long term success. Our technology radar card documents what we're currently investigating either to replace or introduce to our stack of tools. Start...

...Chrome to check if the problem disappears. Keep in mind though that running outdated software, especially web browsers, is in most cases not a good idea. Please verify periodically if...

...you still need to run the old version or if an even more recently updated version fixes the problems introduced in your version. Here's how to get old versions...

...a RubyMine plugin that enables you to review and process merge requests within RubyMine! Setup Open RubyMine settings (Ctrl + Alt + S) > Plugins > Search for "GitLab" > Install (You might need to...

...re-open settings afterwards.) In the RubyMine settings > Version Control > GitLab > Connect your GitLab account with "+" Working with merge requests From the Actions menu (Ctrl + Shift + A), choose "View merge...

makandra dev
badssl.com

...browser's HTTPS handling works as expected (which might be compromised e.g. due to security products or enterprise proxy servers...

Detecting if a Javascript is running under Selenium WebDriver is super-painful. It's much easier to detect the current Rails environment instead. You might be better of checking against...

...the name of the current Rails environment. To do this, store the environment name in a data-environment of your . E.g., in your application layout: <html data-environment=<%= Rails.env %>>

...window manager that provides neat features like automatic layouting of windows, good multi-display support with per display workspaces and more. Since it is only a window manager, you will...

...menus, automatic updates etc. Fortunately, you can run Awesome within MATE, by following these steps (tested on Ubuntu MATE 16.04): Awesome + MATE Create the following file at /usr/share/xsessions/Xsession.desktop: [Desktop Entry...

Canonical does not ship Ubuntu 24.04+ Vagrant images due to HashiCorps switch to the Business Source License (BSL). There is currently no open source fork of Vagrant. Alternatives

...cloud-image/ubuntu-24.04 which can be used. Caveats The images are unmodified but unofficial. Sharing via the /vagrant folder is not possible. Use SSH/SFTP instead...

To set a cookie in your test browser for cucumber tests, you need to know which driver you are using. Use the step below according to your driver.

...to "([^\"]+)"$/ do |key, value| headers = {} Rack::Utils.set_cookie_header!(headers, key, value) cookie_string = headers['Set-Cookie'] Capybara.current_session.driver.browser.set_cookie(cookie_string) end Note that Rack::Utils is only used to...

Select2 is a fantastic library for advanced dropdown boxes, but it depends on jQuery. Alternatives Tom Select There is a selectize.js fork called Tom Select. It is well tested, comes...

...with Bootstrap 3, Bootstrap 4 and Bootstrap 5 styles and is easy to use. You might miss some advanced features. Known issues: Dynamic opt-groups in AJAX requests are not...

When you make a simple TCP connection to a remote server (like telnet), your client won't normally notice when the connection is unexpectly severed on the remote side. E.g...

...if someone would disconnect a network cable from the server you're connected to, no client would notice. It would simply look like nothing is being sent. You can detect...

...function can be a new instance method of all arrays (by patching Array.prototype) or a stand-alone function that takes an array argument. Write a JavaScript function mySelect that works...

...function can be a new instance method of all arrays (by patching Array.prototype) or a stand-alone function that takes an array argument. Did you learn how this works?

regular-expressions.info

...ae]y => grey or gray => but NOT graay or graey [0-9] matches a SINGLE digit in the range from 0 to 9 [0-9a-fA-F] hexadecimal digit...

...with caution. Mostly you'll want to use it for small expressions, e.g. for nested sub-regexes. For more details have a look at the card on quantifier modes.

I recently had to update a few selective npm libraries in a project that uses pnpm to apply a CVE mitigation. My first instinct was to modify the package.json file...

...a much better way. Use pnpm up (aliased to update and upgrade) with a set of exact library names and versions. The resulting changes (both to the package.json and pnpm...

When you want to filter records in a model where a string column roughly matches a given term, you can use PostgreSQL’s trigram similarity search. Writing a fuzzy query...

User.where("similarity(name, ?) > 0.3", "John") This finds all users where the name is similar to "John" with a similarity score above 0.3. You can tune the threshold:

Starting Terminator with split screens is quite simple: Just store a layout and start Terminator with the --layout option. However, if you want to run custom commands in your terminals...

...command exits. You accomplish this by tweaking bash to run a command before actually starting. Pimp your .bashrc Add this to the end of .bashrc: # hack to keep a bash...