Newest versions of Chromedriver breaks the user agent for device emulation via device name. In previous versions the user agent of the emulated device was set. In the newest versions the user agent differs from the emulated device.
In Capybara an affected config looks like following:
Capybara.register_driver :mobi...
In CI test runs I noticed that string sorting order changed after switching from a debian-based PostgreSQL docker image to one that is based on Alpine Linux.
Debian image sorting: bar Bar foo Foo
Alpine image sorting: Bar Foo bar foo
Alpine Linux is a very slim linux distribution that results in small docker image sizes (roughly 100MB instead of 150MB), so it's a popular choice. However, it does not have all comman locales installed and does not use all locales that a user installs by default.
Postgres orders string co...
I recently noticed that better_errors
allows you to to open files from within your favorite editor. However it was not so easy to get rubymine://
links to work on Gnome/Linux. Here is how it finally worked for me:
Add this file to ~/.local/share/applications/rubymine.desktop
:
[Desktop Entry]
Version=1.0
T...
tl;dr
asdf
allows you to manage multiple runtime versions with a single CLI tool and is backwards compatible by supporting existing config files, like e.g..nvmrc
or.ruby-version
.
source /home/$user/.rbenvrc
in ~/.profile
eval "$(rbenv init -)" in
~/.bashrcor
~/.zshrc`If you need to convert an SVG source to PS or EPS, the most common suggestion on the interwebs is to use Inkscape from the commandline.
Inkscape is a fairly resource-heavy tool with lots of dependencies. A great alternative for converting is CairoSVG.
CairoSVG is available on most Linux distros through their package management systems, e.g. apt install cairosvg
on Ubuntu.
It has few dependencies (most importantly Python 3 and some related packages, but really not much)...
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 localhost with mkcert:
$ mkcert-v1.4.4-linux-amd64 localhost
Created a new local CA 💥
...
config/puma.rb
:localhost_key = "#{File.join('localhos...
This should be fixed in the latest LTS-branches of our mysql2 fork, 0.2.x-lts and 0.3.x-lts.
Use
gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.2.x-lts' # for Rails 2.x
gem 'mysql2', git: 'https://github.com/makandra/mysql2', branch: '0.3.x-lts' # for Rails 3.x
in your Gemfile, and do a
bundle update mysql2
mysql2 used to check that the client library used at runtime actually matches the one it was compiled against. However, at least on Ubunt...
Bookmarks for directories will be most helpful if you are forced to work in deeply nested projects. Then it's really helpful!
This makes use of the CDPATH
variable. Similar to the PATH
variable, which holds the list of directories which are searched for executables, CDPATH
contains the list of directories that are available for cd
. Besides the current directory (.
), you can add others to that.
The trick is to add a directory for bookmarks to CDPATH
.
First, create the directory with: mkdir ~/.bookmarks
.
Then add the followin...
With cd ..
you can navigate one directory up from the one you are at now. If you use that a lot, consider some handy aliases.
Add the following lines to your ~/.bashrc
:
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
you can add even more aliases, but I usually loose track after too many levels and just jump to the directly directly, e.g. using its absolute path or its bookmark (see [this card](https://makandracards.com/makandra/504947-working-on-the-li...
The tree
command will show you the contents of a directory and all it's sub directories as a tree:
>tree
.
├── a
│ ├── file_1.txt
│ └── file_2.txt
└── b
├── c
│ └── even_more.txt
└── more.txt
3 directories, 4 files
If you have deeply nested directories, the output will be quite long though. To avoid that, you can limit the depth, e.g. tree -L 2
will only go 2 directories deep.
If you use that regularly, consider adding aliases for that to your ~/.bashrc
:
alias tree2='tree -L 2'
alias tree3='tree -L 3'...
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 use best guess
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
. Which ones that are is highly personal, for me it's e.g. tig:
alias tog='tig'
alias tug='tig'
We had a card that described how to install multiple mysql versions using mysql-sandbox
. Nowadays with the wide adoption of docker it might be easier to use a MySQL docker image for this purpose.
docker run --name projectname_db -e MYSQL_ROOT_PASSWORD=secret -p "33008:3306" -d --restart unless-stopped mysql:5.7
The port 33008 is a freely chosen free port on the host machine that will be used to establish a con...
geordi commit
will continue even if one of the given projects is inaccessible. It will only fail if no stories could be found at all.ZSH is an alternative command line shell that includes some features like spelling correction, cd automation, better theme, and plugin support. You can replace Bash with ZSH like following:
sudo apt-get install zsh
Setting ZSH as default login shell
sudo usermod -s /usr/bin/zsh $(whoami)
Opening a new terminal window will show you a dialog where you can configure your initial ZSH config (Option 2 recommended).
Afterwards you can install the plugin manager Oh-My-ZSH and select a prop...
By default parallel_tests will spawn as many test processes as you have CPUs. If you have issues with flaky tests, reducing the number of parallel processes may help.
Important
Flaky test suites can and should be fixed. This card is only relevant if you need to run a flaky test suite that you cannot fix for some reason. If you have no issues...
By default, your terminal emulator (Gnome Terminal, Terminator, etc.) sets some kind of window title to reflect the shell type you are running (e.g. /bin/bash
).
This is most often not too helpful, but you can change that from your shell.
To set a specific title, print an escape sequence like this:
echo -en "\033]0;Hello\a"
You can easily include the current path:
echo -en "\033]0;$(pwd)\a"
Or, to replace your home directory's part with a tilde:
echo -en "\033]0;$(pwd | sed -e "s;^$HOME;~;")\a"
Or,...
Ubuntu 18.04 uses systemd
to manage services.
There are basically two commands for listing all services and manipulating the state of a certain service: service
and systemctl
:
service
manages System V init scriptssystemctl
controls the state of the systemd system and service manager. It is backwards compatible to System V and includes the System V servicesTherefore I prefer to use systemctl
.
>systemctl list-units -a --type=service
UNIT LOAD ...
After a recent Ubuntu update I didn't see the main menu bar of the RubyMine IDE (File | Edit | View | ...
) anymore.
This could be solved by changing a RubyMine registry entry:
ctrl + alt + n
> click on Actions
> type registry
> click on Registry...
linux.native.menu
and disable the checkboxAfter rebooting RubyMine, you'll have gotten the menu bar back.
Because colors improve readability so much.
On Ubuntu 18.04 you can install it with sudo apt install grc
From github:
For the impatient - try following commands:
grc netstat
grc ping hostname
grc tail /var/log/syslog
grc ps aux
I recommend simplescreenrecorder, it produces an adequate output with only a few clicks. The audio recording contained some static noises, but that might be caused by my microphone.
Recording only a single screen or fixed rectangle is supported. The video quality seems quite grained when using the default settings - I found that using the MKV container, H.264 codec, "0" constant rate factor and "veryslow" preset results in the best video quality.
###...
When text renders differently in Firefox and Chrome, it may be caused by a font alias that both browsers handle differently.
A machine running Linux, and a website with the Bootstrap 3 default font-family: "Helvetica Neue", Helvetica, Arial, sans-serif
.
Anti-aliasing and kerning of text looks bad in Firefox. Worse, it is rendered 1px lower than in Chrome (shifted down).
Firefox resolves "Helvetica" to an installed ["TeX Gyre Heros", which is its Ghostscript clone](https://www.fontsquirrel.com/fonts/...
When using Chrome for Selenium tests, the chromedriver
binary will be used to control Chrome. To debug problems that stem from Selenium's Chrome and/or Chromedriver, you might want to enable logging for the chromedriver itself. Here is how.
In your test setup, you may already have something like Capybara::Selenium::Driver.new(@app, browser: :chrome, options: ...)
, especially when passing options like device emulation.
Similar to options
, simply add an extra key service
and pass an inst...
There are several ways to merge two (or more) PDF files to a single file using the Linux command line.
If you're looking for graphical tools to edit or annotate a PDF, we have a separate card for that.
PDFtk is a great toolkit for manipulating PDF documents. You may need to install it first (sudo apt install pdftk
).
Merging multiple files works like this:
pdftk one.pdf two.pdf cat output out.pdf
Unlike pdfjam, PDFtk should not mess with page sizes but simply joins pages as they are.
...
The issue in this card can occur if the node_modules
directory is checked into your Git repository. We usually recommend to exclude node_modules
from version control.
In any case you should document which version of node to use in your project in a .nvmrc
file.
I saw a strange behaviour after we introduced webpack in one of our projects and finally found out the reason: The person who committed the files used a node version that is older than mine.
Every time I wanted to run my rai...