FirstDEV blog
  • Home
  • Ruby
  • Ruby On Rails
  • Tips
  • Solutions
  • About
Subscribe
cdrrazan

Rajan Bhattarai

Full Stack Software Developer! πŸ’» 🏑 Grad. Student, MCS. πŸŽ“ Class of '23. GitKraken Ambassador πŸ‡³πŸ‡΅ 2021/22. Works with Ruby / Rails. Photography when no coding. Also tweets a lot at TW / @cdrrazan!

118 posts •
Ruby-code

Find All Pairs In An Array That Sum To A Target Value In Ruby

Return every pair of distinct elements that add up to a target β€” a classic interview problem with an efficient hash-based O(n) solution.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby 3

Ruby Threads and Thread Safety β€” Practical Concurrency Without the Chaos

Threads in Ruby have a complicated reputation β€” partly because of the Global Interpreter Lock (GIL) in MRI Ruby, partly because concurrent code genuinely is harder to reason about, and partly because most

Rajan Bhattarai Rajan Bhattarai 10 min read
Rails

Action Mailer in Rails β€” Production-Ready Email Without the Footguns

Email in Rails looks deceptively simple β€” generate a mailer, write a template, call deliver_later. The basics take ten minutes. The production footguns take longer to find: emails sent synchronously blocking requests, views

Rajan Bhattarai Rajan Bhattarai 8 min read
Developer tips

Remote Work Survival Guide β€” What Nobody Tells Developers Before They Start

Remote work sounds like the obvious upgrade: no commute, flexible hours, work from anywhere. And for many developers, it is. But there’s a specific failure mode that’s invisible in job descriptions and glossy

Rajan Bhattarai Rajan Bhattarai 10 min read
Ruby-code

Calculate A Running Total Of An Array In Ruby

Compute cumulative sums (running totals) β€” each element in the result is the sum of all preceding elements plus itself. Useful for financial calculations, progress tracking, and time series data.

Rajan Bhattarai Rajan Bhattarai 1 min read
Ruby 3

Metaprogramming with define_method β€” Writing Code That Writes Code in Ruby

Metaprogramming gets a reputation for being either magic or dangerous, depending on who you ask. Used carelessly, it produces code that’s impossible to trace and impossible to test. Used deliberately, it eliminates repetitive

Rajan Bhattarai Rajan Bhattarai 9 min read
Rails

N+1 Queries in ActiveRecord β€” Diagnosis, Eager Loading, and When Preloading Backfires

N+1 queries are one of those problems that makes perfect sense once you understand them, and that silently degrades production performance until a request that touches 500 records starts taking four seconds. The

Rajan Bhattarai Rajan Bhattarai 10 min read
Developer tips

How to Write a Technical Blog Post That People Actually Read

Most technical blog posts fail at the same place: the opening. They start with a definition, a history of the problem, or a tour of all the things they won’t cover. By the

Rajan Bhattarai Rajan Bhattarai 10 min read
Ruby-code

Find The Most Frequently Occurring Element In An Array In Ruby

Count element occurrences and return the one that appears most often β€” useful for analytics, voting systems, and mode calculations.

Rajan Bhattarai Rajan Bhattarai 1 min read
« Newer Posts Page 3 of 14 Older Posts »
FirstDEV blog © 2026
Proudly published with Jekyll & using Jasper2
Latest Posts Twitter
FirstDEV blog

Check viewARU - Brand Newsletter!

Newsletter to DEVs by DEVs - boost your Personal Brand & career! πŸš€