How to use Active Job to decouple your background processing from a gem

Posted Over 3 years ago by Judith Roth.

In a web application you sometimes have tasks that can not be processed during a request but need to go...

Testing for XSS in Markdown Fields

Posted Over 3 years ago by Stephan Plöderl.
github.com

If you render markdown from user input, an attacker might be able to use this to inject javascript code into...

Error handling in DOM event listeners

Posted Over 3 years ago by Henning Koch.

When an event listener on a DOM element throws an error, that error will be silenced and not interrupt your...

The JavaScript Object Model: A deep dive into prototypes and properties

Posted Almost 4 years ago by Henning Koch.

Speaker today is Henning Koch, Head of Development at makandra. This talk will be in German with English slides.

Legacy CarrierWave: How to generate versions with different file extensions

Posted Almost 4 years ago by Michael Leimstädtner.

We use CarrierWave in many of our projects to store and serve files of various formats - mostly images. A common...

Ruby: Referencing global variables with the built-in English library

Posted Almost 4 years ago by Emanuel.

tl;dr Don't forget require 'English' if you use a named global such as $LAST_MATCH_INFO. Otherwise this...

Rspec: How to write better specs

Posted Almost 4 years ago by Emanuel.
betterspecs.org

betterspecs.org is a documentation on how to write better RSpec tests. Note that there are also other approaches like The...

How to reset a Mock

Posted Almost 4 years ago by Judith Roth.

With Rspec you can mock objects or functions, for example like this: expect(my_object).to receive(:my_function).and...

whenever: Installing cron jobs only for a given Rails environment or Capistrano stage

Posted Almost 4 years ago by Henning Koch.

We use the whenever gem to automatically update the crontab of the servers we deploy to. By default, whenever will...

The Self-Contained Test

Posted Almost 4 years ago by Henning Koch.
thoughtbot.com

One of the earliest pieces of wisdom we are given as programmers is to not write duplicate code: Don’t...

Rspec: Expecting a Rake task to be called

Posted Almost 4 years ago by Emanuel.

This seems to be obvious, but you can expect Rake tasks to be called in RSpec. it 'deletes all Users...

How to use git fixup

Posted Almost 4 years ago by Emanuel.

Using git fixup helps you to speed up appending changes further back in the git history of your feature branch...

Rubygems: Installing the last version of rubygems that has no rubyforge_project deprecation warning

Posted Almost 4 years ago by Emanuel.

You can install rubygems 3.0.8 (released on February 18, 2020) to keep all the Gem::Specification#rubyforge_project deprecation warnings...

Git: How to add changes matching a regular expression

Posted Almost 4 years ago by Arne Hartherz.

When you have many changes, and you want to spread them across different commits, here is a way to stage...

Five years of "Today I Learned" from Josh Branchaud

Posted Almost 4 years ago by Michael Leimstädtner.
github.com

The linked GitHub repository is a bit like our "dev" cards deck, but groomed from a single person (Josh Branchaud...

ActiveRecord: Named bindings in conditions

Posted Almost 4 years ago by Emanuel.
millarian.com

In Active Record you can use named bindings in where-conditions. This helps you to make your code more readable...

Rails: Concurrent requests in development and tests

Posted Almost 4 years ago by Emanuel.

With puma you can have concurrent requests. There are two concepts on how Puma can handle two incoming requests: Workers...

Test Driven Development with Cucumber and RSpec

Posted Almost 4 years ago by Dominik Schöler.

Test Driven Development is the paradigm to "first write a test, then implement the code". This guide shows how to...

How to use Simplecov to find untested code in a Rails project with RSpec and Cucumber

Posted Almost 4 years ago by Judith Roth.

Simplecov is a code coverage tool. This helps you to find out which parts of your application are not tested...

Bundler in deploy mode shares gems between patch-level Ruby versions

Posted Almost 4 years ago by Michael Leimstädtner.

A recent patch level Ruby update caused troubles to some of us as applications started to complain about incompatible gem...

How to: Throttle CPU in Google Chrome

Posted Almost 4 years ago by Emanuel.

Chrome allows you to throttle the Network and the CPU. Both settings are useful to measure the performance of you...

Video transcoding: Web and native playback overview (April 2020)

Posted Almost 4 years ago by Michael Leimstädtner.

Embedding videos on a website is very easy, add a tag to your source code and it just works...

How to write good code comments

Posted Almost 4 years ago by Dominik Schöler.

Code comments allow for adding human readable text right next to the code: notes for other developers, and for your...

Capybara: How to find a hidden field by its label

Posted About 4 years ago by Emanuel.

To find an input with the type hidden, you need to specify the type hidden: find_field('Some label', type...