If you want to know your public key's fingerprint, do this: ssh-keygen -lf ~/.ssh/my.key.pub This may be necessary to authenticate your key on GitHub because of recent events...
...them (to pull etc): ERROR: Hi foobear, it's GitHub. We're doing an SSH key audit. Please visit https://github.com/settings/ssh/audit/... to approve this key so we know it...
Sometimes you want to find the inverse of an ActiveRecord scope. Depending on what you want to achieve, this is quite easy with Rails 7, and a bit more complicated...
...with Rails 6 and below, or when the inverse scope may contain NULL values. There are two different ways of "inverting a scope": As an example, consider the following model...
...project, as a developer you need to follow the following guidelines (e.g. by using something like this issue checklist template). In order to reduce the number of rejects we get...
...from clients, we want to review all code written before it goes to the staging server. Note This process is tailored to our specific needs and tools at makandra. While...
SELECT pg_size_pretty(pg_database_size('some-database')); Example SELECT pg_size_pretty(pg_database_size('cards_p')); ---------------- 13 GB (1 row) SELECT pg_database_size('cards_p');
------------------ 13524832927 (1 row) Related PostgreSQL: Show size of all databases PostgreSQL: How to show table sizes
...result is mutual exclusivity that works in a distributed environment, and it’s dead simple to implement. Ruby implementation An implementation as a Rubygem seems to be with_advisory_lock...
...It has support for MySQL, PostgreSQL and SQLite. Unfortunately, it has a horrible caveat in MySQL: With MySQL (at least <= v5.5), if you ask for a different advisory lock within...
SVG files often contain redundant information, like editor metadata or hidden elements. When esbuild handles your static assets, you can easily optimize SVG files using svgo as a plugin. Here...
...is how to do it. Adding svgo as an esbuild plugin Add the svgo package to your project's package.json Adjust your esbuild.config.js like so: const esbuild = require('esbuild')
...Rubygems page for your Gem (example). Here are some values you can fill: Gem::Specification.new do |s| s.name = 'my-gem' s.homepage = 'https://github.com/makandra/my-gem' s.metadata = { 'source_code_uri' => s.homepage,
...tracker_uri' => s.homepage + '/issues', 'changelog_uri' => s.homepage + '/blob/master/CHANGELOG.md', 'rubygems_mfa_required' => 'true', } ...
Browsers come with a set of built-in elements like or . When we need a new component not covered by that, we often build it from and tags. An alternative...
...custom element. Custom elements will be ignored during HTML validation, but their children will still be validated. Styling new elements Browsers will give unknown elements a default style of display...
Sentry offers a UI to define custom fingerprint and stack trace rules at https://sentry.io/settings/projects/$project-id/issue-grouping. Fingerprint rules have this syntax: 1 or more key:value conditions, followed by...
...as a wildcard for n characters. Overriding the fingerprint from within the application (with the sentry-ruby gem) You can also set a custom fingerprint from within the application:
When you need the DOM node of a tag (e.g. to read extra attributes, or to modify the DOM near it), you can usually reference it via document.currentScript. However, document.currentScript is unsupported in ancient browsers, like Internet Explorer 11 or wkhtmltopdf's Webkit engine. If you are not running async scripts, you can easily polyfill it: document.scripts[document.scripts.length - 1] It works because document.scripts grows with each tag that was evaluated. That is also the reason why this solution will not work reliably for async code. Demo: https://codepen.io/foobear/pen/poRLxQm
If you need to implement newsletter sending, rapidmail is a solid option. Support is very fast, friendly and helpful, and the initial setup is simple. Since rapidmail works via SMTP...
...you can simply ask the Ops team to configure SMTP credentials for your application. You also do not need to use rapidmail’s built-in newsletter feature. Instead, you can...
The shell variable PS1 holds your bash prompt. You might want to change it to serve your needs best. Here is how to: General non-printing escape sequences in your...
=> ✔ mycomputer ~/projects/platforms master > _ # Arne's epic timestamped prompt with return status indicator and status-colored (green if fresh, or red if unstaged, or yellow if staged) git branch:
...you know from "How to tell ActiveRecord how to preload associations (either JOINs or separate queries)", you can tell ActiveRecord explicitly if it should use a LEFT OUTER JOIN or...
...a separate query to preload associations. Here is some special case, where a simple includes is not possible. For the diagram below we want to sort the rides by the...
Pie sometimes does not properly redraw elements upon changes. This often happens when the change comes from somewhere further up the DOM. Consider something like: Active element Inactive element
li .content { -webkit-box-shadow: #666 0px 2px 3px; -moz-box-shadow: #666 0px 2px 3px; box-shadow: #666 0px 2px 3px; behavior: url(/PIE.htc); background: white; } li.active .content...
...absence of error end end end Standard validations can be tested with less code The shoulda-matchers gem gives you some RSpec matchers to test the application of standard Rails...
...validations. Under the hood should-matchers uses the same recipe as outlined above (set invalid state, run validations, check for message, etc.), but your tests will have a lot less...
...all the world to admire. For private gems this is very bad. To make sure this cannot happen, rubygems 2.2+ allows you to restrict eligible push hosts: Gem::Specification.new 'my...
...gem', '1.0' do |s| # ... s.metadata['allowed_push_host'] = 'https://gems.my-company.example' end In case you already messed up, follow these instructions to get your gem removed. Of course, it's not...
...you to find a parental element using CSS or XPath. If you previously did something like this: field.find(:xpath, './ancestor::div[contains(@class, "form-group")]') ..and prefer CSS, you may...
When you create e.g. a sidebar box that contains headlines and paragraphs, the final paragraph's margin in that box will create an undesired 'bottom padding' inside that box.
...is a Sass mixin that you can apply to such boxes. It makes the last child's bottom margin disappear: =hide_last_margin >*:last-child margin-bottom: 0
...babysitting Claude Code (default mode) and giving the LLM a loaded gun (bypassPermissions / --dangerously-skip-permissions). When the agent proposes a tool call that requires confirmation, a secondary Claude instance...
...receives it to decide whether to confirm or deny: Generally speaking, reversible, reading commands like git diff are allowed while irreversible commands like an rm -rf are prevented.
Getting parseable output back from an LLM has two halves: shaping the request, then parsing the response. Even with Ollama's format: parameter set, models leak conversational preamble like Sure...
Message types Ollama's chat endpoint takes a messages array with four roles: system, user, assistant and tool. The following message pattern works well for us: one system message...
...by default, effectively allowing anyone to upload an unlimited amount of files to your storage. The DirectUploadController from @rails/activestorage bypasses your form controller because it uploads the file using an...
...AJAX request that runs directly, before any form roundtrip happens. This is a comfortable solution to allow in-form uploads with progress, errors etc. Otherwise, the file would be uploaded...
...Saving files to a directory that is not shared between deploys or servers If you save your uploads to a made up directory like "RAILS_ROOT/uploads", this directory goes away...
...after every deploy (since every release gets a new). Also this directory is not shared between multiple application servers, so your uploads are randomly saved to one local filesystem or...
...you read this file with the Nokogiri default (DOM) parser, it creates a tree structure with all branches and leaves. It allows you to easily navigate through it via css/xpath...
The only problem is that if you read the whole file into memory, it takes a significant amount of RAM. It is really ineffective to pay for a server...
Hybrid search runs a vector query and a keyword query in parallel against the same documents and merges the two ranked search results. Reach for it once either approach alone...
...performs better with extracted keywords ("parental leave department"), unless you have a very elaborate analyzer (stop-word filter, stemming, language-aware tokenization, etc.). Document and Query Embeddings need different instructions...