Terminator has a cool feature that allows you to split your terminal into many panels and type in all of them at the same time. It's called broadcasting and can be enabled by pressing
Alt+a (and disabled by
However, in some circumstances it will also be broadcasted to other running instances of Terminator. This probably is not what you want and could be very dangerous (e.g. if you're logged in to a production server in a terminal that is on another workspace).
To prevent the broadcast from affecting other windows, go to `Prefer...
Phusion Passenger changed the way how it gets restarted several times. Through the project's history, these all were valid:
sudo passenger-config restart-app /path/to/app
passenger-config restart-app /path/to/app
You should not need to know which one to use. Instead, the capistrano-passenger gem will choose the appropriate restart mechanism automatically based on your installed the passenger version.
Add to your
Added a section "manual mode" in case you don't have capistrano 2.
When importing a dump created on a server that has a more recent
pg_dump version you might get an error like
$ geordi dump staging -l # Sourcing dump into the project_development db pg_restore: [archiver] unsupported version (1.14) in file header x An error occured loading staging.dump
On my machine I had
10.14 which was the most recent package from the standard repository. The server, however, had
The issue could be fixed by [installing postgres 12 from the PostgreSQL APT-Repositories]...
Our applications not only need to be functional, they need to be fast.
But, to quote Donald Knuth,
premature optimization is the root of all evil (or at least most of it) in programming
The reasoning is that you should not waste your time optimizing code where it does not even matter. However, I believe there are some kinds of optimizations you should do right away, because
This is an attempt to list some of those things:
The sidekiq-rate-limiter gem allows rate-limiting Sidekiq jobs and works like a charm. However, it needs to be integrated on a per-worker basis.
If you want to limit a whole queue instead, and if your requirements are simple enough, you can do it via a Sidekiq middleware yourself.
Here is an example that limits concurrency of the "mailers" queue to 1. It uses a database mutex via the [with_advisory_lock](https://github.com/ClosureTree/wit...
When logging in Rails, you can use the
log_tags configuration option to add extra information to each line, like
:subdomain. However, those are only valid inside a request context and have no effect when your application is logging from inside a Sidekiq process.
This includes custom as well as any framework logs, like query logging from ActiveRecord.
Since Sidekiq Workers run inside threads of a single process, running multiple jobs in...
Note: Modern Rails has two build pipelines, the asset pipeline (or "Sprockets") and Webpacker. The principles below apply for both, but the examples shown are for Sprockets.
This is an extract from the linked article. It shows an approach on how to implement encrypted passwords with the AWS Key Management Service (KMS).
For most applications it's enough to use a hashed password with a salt (e.g. the gem devise defaults to this).
Generate hash as hash of password + salt.
Encrypt the hash with a public key from KMS (you can store the public key in your server code).
In your database sto...
A flat folder structure can be cool if you have only a few folders but can be painful for huge amounts. We recently had this issue in a project with more than 100.000 attachments, where we used a structure like this
ls command lasted several minutes to show us the content of the attachments folder.
So we decided to use a more hierarchical structure with a limited maximum of folder per layer. As our attachment folder will grow very fast we choosed to use three layers, but that's up to you. Here...
Form fields can be rendered as noneditable by setting the
disabled or the
readonly attribute. Be aware of the differences:
Browser specific behavior:
We often have a separate production branch that lags a bit behind the more cutting edge master branch. Sometimes you want to move some, but not all commits from master to production. This can be done with a
However, this may lead to considerable pain later, since git does not understand the commits are actually "the same". Hazards are unnecessary and hard to resolve conflicts as well as incorrect auto-merges.
In order to avoid this, always merge the production branch back to the master after the cherry-pick. ...
Some cronjobs must only run on a single server. E.g. when you run nightly batch operations on the database, it should probably run on a single server. Running it on multiple servers would likely result in deadlocks or corrupt data.
Some cronjobs must always run on all servers. E.g. starting a sidekiq process on reboot.
If not configured otherwise, cronjobs defined in whenever's `s...
CSP hat zum Ziel einen Browser-seitigen Mechanismus zu schaffen um einige Angriffe auf Webseiten zu verhindern, hauptsächlich XSS-Angriffe.
XSS = Cross Site Scripting. Passiert wenn ein User ungefiltertes HTML in die Webseite einfügen kann.
<div class="comment"> Danke für den interessanten Beitrag! <script>alert('you have been hacked')</script> </div>
Rails löst das Problem weitgehend, aber
This guide shows how to create an AngularJS application that consumes more and more memory until, eventually, the browser process crashes on your users.
Shift + ESCto see a list of Chrome processes...
Find-as-you-type boxes are usually built by observing changes in a text field, and querying the server via AJAX for search results or suggestions when the field has changed.
A common problem with this implementation is that there is no guarantee that AJAX responses are evaluated in the same order as the original requests. The effect for the user is that the search results are flashing back and forth while the user is typing the query, and when the user has stopped typing the last results don't always match the final query.
You won't notice...
This is called "cherry-picking".
git cherry-pick commit-sha1
Note that since branches are nothing but commit pointers, cherry-picking the latest commit of a branch is as simple as
git cherry-pick my-feature-branch
Be aware that cherry-picking will make a copy of the picked commit, with its own hash. If you merge the branch later, the commit will appear in a history a second time (probably without a diff since there was nothing left to do).
Also see our advice for [cherry picking to production branches](https://makandraca...