ruby
ruby
postgres
PostgreSQL and lock timeout issues – how to deal with them also in Ruby on Rails?
PostgreSQL lock timeouts strike during long migrations and complex transactions. How lock_timeout and statement_timeout actually work, quick fixes at the database role level, managing timeouts in Rails migrations, and global protection with StrongMigrations.
ruby
Creating predictable randomness in Ruby: The magic of seeds
Reproducible randomness in Ruby sounds like a contradiction, but seeds make it easy: how pseudo-random generators work, fixed seeds for tests, debugging, and procedural generation, creative ways to pick seeds, and the pitfalls that quietly break determinism.
Latest
Event Sourcing in practice: Lessons from the trenches
Event Sourcing can be introduced to legacy systems incrementally, no big rewrite required. Lessons from production: the migration event technique, upcasting old events, right-sizing aggregates, stream lifecycles, and payoffs in audits, analytics, and debugging.
OJ is not as safe as you think for your JSON
OJ speeds up JSON in Ruby, but Oj.mimic_JSON silently drops the script_safe option, opening the door to XSS, and adds time precision quirks. What its monkey patching really changes, the stability risks, and best practices for using OJ without surprises.
Dealing with legacy code that uses different method naming conventions
Legacy services with mismatched method names (validate, execute!, run!) can be unified with Ruby method objects. How to build one dispatcher that calls the right method on each class, why it beats conditionals, and what it does for readability.
The Truth About Password Security: Beyond Special Characters
Password security depends on entropy, not special characters. The math behind entropy = N * log2(R), why length beats complexity rules, why database breaches (not login guessing) are the real threat, and implementation tips for saner password policies.
What is Devcontainer? Short and easy guide on how to use it
DevContainers pack your whole development environment into a container: app, database, Redis, and tooling isolated from your machine. A short guide to Rails 7.2's built-in devcontainer generator, the files it creates, and opening the project in VS Code.
BiomeJS - A 35x faster alternative to Prettier for formatting and linting
BiomeJS formats and lints JavaScript, TypeScript, JSX, and JSON up to 35x faster than Prettier, with almost 97% compatibility. How to install it, migrate your Prettier config to biome.json, and cut minutes off CI without changing how your code looks.
Simplify complicated Typescript - KISS
Simplifying complicated TypeScript with the KISS principle: refactoring examples show when explicit types improve a simple function and when clever type gymnastics make code harder to review, test, and maintain.
Painting 'Lady with a weasel' using genetic algorithms and Ractor parallelism in Ruby
Genetic algorithms meet Ruby Ractors: a script that repaints Lady with a Weasel generation by generation. Follow the full lifecycle (mutation, fitness scoring, crossover), see how Ractor parallelism speeds up scoring specimens, and view the final result.
How to set domain and subdomain during the development stage for HTTP and HTTPS in Rails?
Need a real domain, subdomains, or HTTPS while developing a Rails app? nip.io gives any local IP a wildcard DNS name without touching your hosts file. How to configure Rails for it, enable local HTTPS, and quickly find your local IP address.
What is instance and class variable in Ruby?
Instance variables versus class variables in Ruby: what @ and @@ actually mean, why an @ variable set at the class level stays empty when read from an instance, and how @@ values are shared by every instance. Short code samples make each behavior easy to verify.
Understanding TypeScript Function Generators
TypeScript function generators can pause and resume execution, returning values one at a time instead of all at once. What generators are, how yield works in a simple example, and a practical number sum generator that shows where they beat regular functions.
Ruby Hash destruction like from Javascript world (and reconstruction)
Ruby hash destructuring can feel as smooth as JavaScript: the rightward pattern matching syntax extracts values from a hash in one line, renames them, destructures arrays, groups elements, and rebuilds hashes afterwards. Practical examples for cleaner Ruby code.
Powerful switch statement with pattern matching in Ruby
Pattern matching in Ruby turns case statements into a precise switch over data shapes: match and destructure hashes from an API response, combine several patterns in one branch, capture values across patterns, and validate configuration. Ruby 2.7+ syntax examples.
Finding the slowest tests in Minitest and Rspec using profiler
Slow test suites usually hide a few expensive tests. Minitest and RSpec both ship a built-in profiler: bin/rails test --profile and rspec --profile 10 list your slowest examples with execution times, so you know exactly which tests to optimize first.
How to set up XML in Grape API
XML support in Grape API takes two steps: register the additional content_type so endpoints accept and return application/xml, then change the root element name of the XML output. Complete Ruby examples built around a products endpoint you can adapt to your API.
Multiple ways to execute a shell command via Ruby
Running shell commands from Ruby: system, backticks, exec, the IO class, spawn, and Open3.popen3 compared with pros and cons, from quick one-liners to capturing stdout, stderr, and exit status, so you can pick the right method for scripts and production code.
Solutions to paginate data in your databse and which one is the best
Database pagination goes beyond LIMIT and OFFSET: ROW_NUMBER(), the FETCH clause, and keyset pagination each behave differently as tables grow. SQL examples for every approach, why offsets get slow on big datasets, and a verdict on which method scales best.
Database shrading and database partitioning in Rails
Database sharding in Rails step by step: create a separate database per shard, wire them up in database.yml, and query across them. Plus how sharding differs from partitioning, with a native PostgreSQL partitioning example done through Rails migrations.
Sidekiq basic_fetch and super_fetch differences
Sidekiq basic_fetch vs super_fetch: open source Sidekiq fetches jobs with BRPOP and loses them when a process crashes, while Sidekiq Pro's super_fetch uses RPOPLPUSH with private per-process queues to recover orphaned jobs. What that means for queue reliability.
Understanding generic types in Typescript
Generic types in TypeScript let one function, class, or interface work safely with many data types. What generics are, how a type parameter beats hardcoding a concrete entity type in a validation helper, and honest pros and cons before you use them everywhere.