blog.cloudflare.com

What is netfilter's Connection Tracking system? The connection tracking system often referenced as nf_conntrack is part of the Netfilter framework. It allows the Linux kernel to keep track...

...of all logical network connections and sessions. In combination with iptables this feature is used to achieve a stateful firewall. Why to care about nf_conntrack? All connections are stored...

...development PCs so we can operate multiple versions of Node.js in parallel. To make sure that all developers use a compatible version of Node.js, your project should declare the required...

...Node version as you cd into a directory. We have a card about automatically switch version when changing directories which provides a solution that works very well for us.

ruby-doc.org

...they are either called within the current context or because you want to learn something about the API of the current objects. Why is this useful? This is especially useful...

...since Ruby is an interpreted language and the source code and the location might have changed due to the interpretation. Usage Before using this, you can examine any Ruby object

When restoring a barman PITR backup you may encounter this error: Copying required WAL segments. EXCEPTION: {'ret': 2, 'err': '/bin/sh: 1: cannot open /var/lib/barman/foopostgres/wals/00000007.history: No such file\n', 'out': ''}

...present in the wals directory of your backup. The most likely reason is that someone deleted this file in the past. If you do not need this file for restoring...

makandracards.com

...bug) and want to use git bisect to find out when it was introduced? Smart kid. If you have a shell command ready to reveal if your current state is...

...other hand will use the return value of that call to decide if the state is good or bad. First, start bisecting git bisect start Then tell git which revisions...

makandra dev

...HTTP Client that can be useful to test web APIs. Just create a .http scratch file an write your request in it. The request can then be executed with the...

POST http://example.com/api/ Content-Type: application/json { "key" : "value" } It also supports multiple sequential requests, with a JS-API to parse and reuse responses in later requests...

guides.rubyonrails.org

ActiveRecord offers an explain method similar to using EXPLAIN SQL statements on the database. However, this approach will explain all queries for the given scope which may include joins or...

Output will resemble your database's EXPLAIN style. For example, it looks like this on MySQL: User.where(id: 1).includes(:articles).explain EXPLAIN for: SELECT `users`.* FROM `users`  WHERE...

...an event handler, there are multiple methods to cancel event propagation, each with different semantics. event.preventDefault() Only prevents the default browser behavior for the click, i.e. going to a different...

...url or submitting a form. When invoked on a touchstart event, this also prevents mouse events like click to be triggered. event.stopPropagation() Prevents the event from bubbling up the DOM...

Speaker today is Henning Koch, Head of Development at makandra. This talk will be in German with English slides. Introduction As web developers we work with JavaScript every day, even...

...that inherits all properties form User's // child prototype and may then be extended with Student-specific methods. Student.prototype = Object.create(User.prototype) Student.prototype.isEnrolled = function() { return typeof this.studentNumber === 'number' }

makandra dev

...features, this concept might be confusing for developers who have been programming in more static languages, such as Java or C#. This card should help understanding the basic concepts of...

...you might think of a "container" that holds metadata, variables and methods. Metadata describes stuff like the object's class or its object_id which uniquely identifies it. From an...

Matching the "space" character class For matching whitespaces in a regular expression, the most common and best-known shorthand expression is probably \s. It matches the following whitespace characters:

...in some cases these may not be good enough for your purpose. Non-breaking spaces (nbsp) Sometimes a text may contain two words separated by a space, but the author...

rspec.info

rspec >= 3.1 brings a method and_wrap_original. It seems a bit complicated at first, but there are use cases where it helps to write precise tests. For example it...

...use expect_any_instance_of, but with the drawback, that you can't be sure if it really was the correct instance which got the message. Example The example model...

text The browser will think you wrote invalid HTML by accident, and will sometimes reorder elements silently. There is one notable exception: It's OK to wrap block elements...

...in a tag in HTML5 (not 4). The spec says: The a element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as...

docs.ruby-lang.org

Percent Notation We already know that that we can create strings using the percent notation: %(<foo="bar's ton">) is perfectly fine Ruby. Modifier But there is more. The curly...

...brackets ({}) are interchangable with most unicode characters (e.g. square brackets[]). Furthermore, you can add a "modifier" to the percent notation to control the return type of the expression:

robots.thoughtbot.com

...how to make fixes in other people's GitHub repositories. It's basically "Open Source Development 101". Way back in mid-2007, when Rails 1.2 was the new hotness and...

...GitHub was still a year away from crawling out of the primordial internet soup, prolific open source contributor Dr Nic wrote an article titled “8 steps for fixing other people...

mail-tester.com

...s e-mails for issues that might cause e-mails to be classified as spam. They provide a one-time e-mail addresses that you can use to sign up...

...etc. You can then check for scoring results of SpamAssassin and other potential issues. You don't need to hit 10/10. Something around 9/10 is perfectly fine. Note:

...have its own context method, or you will always receive errors like "No description supplied for example group declared on ~/project/app/..." The easiest workarounds: do not name any method context...

...use describe instead of context in your specs, and put this into your spec_helper.rb: Spec::DSL::Main.class_eval do if method_defined? :context undef :context end

...with an english name. This makes you code easier to read and is also suggested by Rubocop's Style/GlobalVars cop. Example before: if 'foo' =~ /foo/ puts $~[1] # => foo end

...following content: require 'English' List of global aliases $ERROR_INFO => $! $ERROR_POSITION => $@ $FS => $; $FIELD_SEPARATOR => $; $OFS => $, $OUTPUT_FIELD_SEPARATOR => $, $RS => $/ $INPUT_RECORD_SEPARATOR => $/ $ORS => $\ $OUTPUT_RECORD_SEPARATOR => $\ $INPUT_LINE_NUMBER...

In a nutshell: Use git rebase --onto target-branch source-commit target-branch means "branch you want to be based on" source-commit means "commit before your first feature commit...

...Let's say my-feature-branch is based on master and we want it to be based on production. Consider this history: %%{init: { 'gitGraph': {'showCommitLabel': true, 'mainBranchName': 'production'}} }%% gitGraph

In development, we store files using ActiveStorage's disk service. This means that stored files are served by your Rails application, and every request to a file results in (at...

...to disable those log entries. Example Here is an example of what loading a single in an example application writes to the Rails log. Started GET "/rails/active_storage/blobs/redirect/..." for ::1 at...

For outputting a given String in HTML, you mostly want to replace line breaks with or tags. You can use simple_format, but it has side effects like keeping some...

...If you only care about line breaks, you might be better off using a small, specialized helper method: def format_linebreaks(text) safe_text = h(text) paragraphs = split_paragraphs(safe...

...Actual error: milliseconds differ Note that while the {} vs instance_of(Hash) oddity shows up in the diff, it is not treated as an error. As soon as the millisecond...

...offset is fixed (see this card for details), the spec will pass. Keep this in mind and don't trust RSpec's diffs too much...

Cucumber up to version 2 had a neat feature called Step Argument Transforms which was dropped in favor of Cucumber 3 ParameterTypes. While I strongly encourage you to drop your...

...keep the exact same functionality of your old Transforms while writing them in the style of new ParameterTypes. Why would I want to keep my Transforms? Transforms allowed you to...

...extend in Ruby, there is a misconception that extend would add methods to the singleton class of a ruby object as stated in many posts on this topic. But in...

...fact, it is added to the ancestors chain of the singleton class! Even though it is technically not the same, practically this can be considered the same in most use...