Weblog Archive

Understanding and using Ruby's powerful #grep method

Spoiler: it can do much more that what you probably thought.

What is a reduction and why Fibers are the answer for Ruby concurrency

Easy to digest, yet non-trivial explanation of different means of concurrency and parallelism we now have in Ruby, the differences between them and what to keep an eye on.

The Origin of the Shell

Interesting memory of Louis Pouzin who coined the term Shell (and came up with the idea) in the first half of the sixties.

Data pipelines in Ruby on Rails

Nice example of gradually spliting big chunk of work into more and more granular jobs.

My Beef With RuboCop

This.

Raspberry Pi 400

Modern mini computer in keyboard form factor, in the style of my old Speccy is something i've been long waiting for!

How to Introduce Composite Primary Keys in Rails

Use composite primary keys to speed up querying big databases.

Rails Testing Antipatterns: Fixtures and Factories

Changes in ruby 2.7

Long due, at last read. Nice summary of the important changes the 2.7 brings - with code examples.

Writing a Ractor-based web server

Also watch this talk from RubyKaigi about Ractors.

How Sidekiq really works

Short end-to-end walkthrough of what happens behind the curtain when you call perform_async on your Sidekiq job until the moment it is executed.

The State of Ruby 3 Typing

Introducing RBS, Ruby’s new type signature language. What you can write using RBS, the key concepts of the design of RBS, and the benefits and tools that come with RBS.

Some SQL Tricks of an Application DBA

Non-trivial tips for database development.

CLIs are reified UIs

Thoughts about the differences between CLIs and GUIs in relation to materiality of user interaction and it's consequences.

Ruby's Bitwise Toolbox: Operators, Applications and Magic Tricks

Nice quick overview of bitwise operation and how to use them in ruby to do some basic "tricks".

Postgres Distinct On

Use Postgres' DISTINCT ON clause to get rid of N+1 in Rails.

Asynchronous HTTP requests in Rails

How to use Javascript's fetch() method in Rails for async fetch and insert partials.

5 Ways to Splat in Ruby

Quick list of cool ways to use the *splat operator.

Predicting the Future With Linear Regression in Ruby

Simple exlanation and an example of linear regression in ruby.

Why Rubyists Should Consider Learning Go

Practical use of Ruby PStore

How to use ruby's built-in file based key-value store as a cache for your HTTP requests.

Pretty CSV viewing on the Command Line

How to pretty print CSV files on the commandline using only the basic unix tools?

Facade Pattern in Rails for Performance and Maintainability

What's an ACID compliant database?

How to Perform Concurrent HTTP Requests in Ruby and Rails

TL;DR: use Typhoeus::Hydra. Very good article. Read comments for other nice tips.

Exploring Big-O Notation With Ruby

How to pass arguments to methods in ruby and how it affects their arity

How the different types of method arguments work in ruby.

Error handling with Monads in Ruby

Vim-style movement (and more) in Sublime Text 3

Very good and brief guide to vim movement via custom key bindings in ST3.

Fail Fast and Fail Often: Handling API Errors at Scale

Self Improvement

Ruby: when to use extend self vs. module_function in your modules.

How to Use The Ruby Uniq Method To Remove Duplicates

Did you know the uniq method also accepts blocks?

Are you really ready for serverless?

3 Defensive Programming Techniques for Rails

Productive Procrastination for Programmers

Ruby on Rails - Bounded contexts via interface objects

DDD and relational databases – the value object dilemma

Understanding Transducers in Ruby

Ruby 2.7 — Enumerable#tally

First look at the new Enumerable#tally method. Useful for counting occurencies.

Ruby 2.7 — Pattern Matching — Destructuring on Point

Playing with the upcoming Ruby pattern matching/destructuring and a look into some potential usecases for it.

Refactoring Live: Primitive Obsession

[VIDEO] Really excellent hands-on talk on refactoring with live examples. By James Dabbs, from RailsConf 2019.

inject vs each_with_object

When to use inject (reduce) and when each_with_object in ruby?

Refactoring with Hash Defaults

Did you know all the ways you can make a ruby hash have a default value?

AWS Lambda + Ruby = Podcast

Tutorial on how to build a podcast feed with ruby and AWS lambda. You'll write a lambda function that will re-generate your podcast feed everytime you upload a new episode to your S3 bucket.

Reorganizing your (Phoenix) Contexts as Use Cases

How to use the Command/Interactor pattern in Elixir wtih Ecto.Multi and Phoenix contexts.

Serverless Ruby on AWS Lambda with the Jets framework

Practical intro to the Jets framework that allows you to build AWS lambda functions with Ruby in Rails-like way.

Elixir and The Beam: How Concurrency Really Works

Small Functions considered Harmful

Long and deep reflection on the DRY and small-functions design principles. Why it's not always the case that small functions means good code. Judging by the subsequent discussion the article hit a nerve in the community.

A Case For Use Cases

Another aproach to the interactor/command pattern also discussing practical side of using it.

Fibers Are the Right Solution

[VIDEO] Samuel Williams' talk from this year's Ruby Kaigi about troubles wiht concurency & paralelism in ruby and how to solve it with the means we currently have (fibers) - at least in web develompent.

Elixir: Building a Small JSON Endpoint With Plug, Cowboy and Poison

Real-time object detection with deep learning and OpenCV

Fun short tutorial for object detection in python using your laptop's camera.

Nested Forms from Scratch with StimulusJS

[VIDEO] How to make nested forms (Cocoon style) from scratch with Stimulus and Rails.

RailsPanel for Chrome

RailsPanel is a Chrome extension for Rails development that will end your tailing of development.log. Have all information about your Rails app requests in the browser - in the Developer Tools panel. Provides insight to db/rendering/total times, parameter list, rendered views and more. I'm apparently the last person on the planet who did not know about this great extension :)

What does GIL really guarantee you?

[VIDEO] Talk by Daniel Vartanov from RubyConf 2017.

The Lifecycle of a Request

In depth journey through the whole stack from the browser to the Rails controller action, through DNS, webserver, Rack stack to the app itself. Excellent long read for ruby web developers.

Using custom objects in Ruby Ranges

Custom ranges are quite easy to create as you learn from this article.

How to use Bootstrap with Webpack & Rails

[VIDEO] Brace yourselves, Rails 6 is coming! Finally a nice short intro guide on how to use webpacker for JS and CSS instead of the Asset Pipeline.

Disassembling Rails — Template Rendering (2)

Have you ever wondered how does the rendering in Rails work? And did you know that Rails compiles the templates into methods? Nice example of ruby metaprogramming and aood thing to know as a Rails developer.

Article Gatherer

Using he FaastRuby platform I built a little lambda function that runs every night, looks for new articles on my favourite blogs and if it finds any it sends me an email with links.

Ruby's Hidden Gems: Delegator and Forwardable

All the ways you can delegate method calls in ruby. Nice summary.

Ruby is the Best Javascript

[VIDEO] Funny talk about how to turn Ruby into Javascript (i.e. write valid ruby code with JS syntax) which shows the power of metaprogramming in Ruby. By Kevin Kuchta on RubyConf 2018.

Graphiti

Ruby library that pushes REST APIs towords GraphQL. Very interesting, watch at least the video presentation.

Chris McCord Keynote: Phoenix LiveView

[VIDEO] Interactive, Real TIme Apps - No need to write Javascript. Really awesome technology, now out in the public for everyone to try.

The Mess We're In

[VIDEO] Very fun and thought provoking talk by late Joe Armstrong, inventor of Erlang, who passed away just yesterday.

How BioWare's Anthem Went Wrong

Fascinating look into the long & chaotic development of BioWare's latest big game Anthem. Jason Schrier, one of the best game journalists of today interviews almost 20 people involved in the painful process and shines some light on the ordeal they went through. Long- & must- read if you're interested in game development scene.

How we Built a Highly Performant App with Ruby on Rails and Phoenix

How to integrate Rails & Phoenix - the author's team built the admin panel & jobs processing in Rails (fast to build, team more experienced), and the heavy-duty API in Phoenix (can easily handle the traffic & scale). They're enqueueing jobs from the Phoenix part while the Rails app is picking them up for processing. They're also forwarding the requests from Phoneix to Rails. Great approach if you need to gradually move part of your app (API?) to Phoenix.

How to Access Production Data in Rails Migrations

Nice trick for sane data migrations - inside the migration class define migration models that override the real models and thus prevent problems with callbacks, validations, model changes, etc.

ActiveRecord Extended

Very interesting gem that let's you use many of the more advanced PostgreSQL features with your ActiveRecord models.

Enumerating over large datasets in Ruby

On point quick guide on how to (more) efficiently iterate through large datasets with ruby and ActiveRecord, Redis, S3 buckets and even files.

Redis Pub/Sub... How Does it Work?

Old article but I think it still holds up as an intro to using ruby for Redis Pub/Sub messaging. Good to know if your're using something like Rails' ActionCable. Also, the example is much fun to play with.

Introduction to Roda

Excellent intro to the minimalist and innovative web framework Roda.

How I Emacs And So Can You

Great practical intro guide to Emacs.

Ten Ways to Secure your Applications

List of areas you should focus your attention to when securing your web app plus suggestions on what to do/use.

Why I believe Rails is still relevant in 2019

Why don’t we validate controller parameters?

about controller params validation & how to use apipie-rails gem for this purpose.

Value Objects in Ruby

Simple intro to ruby value objects. Also read comments too!