ruby
ruby
bash
How to run a command in the background and then kill it under bash terminal?
Run any command in the background in bash by appending &, check it with jobs, and stop it with kill -9 %. A short guide using a Rails server as the example, so long-running processes stop blocking your terminal while you keep working.
ios
Adjusting padding bottom for navigation in iOS and Android
Bottom navigation sitting too close to the screen edge on iPhone X and newer? The fix for iOS and Android PWAs is the safe area: use CSS env(safe-area-inset-bottom) to adjust the bottom padding so the bar clears rounded corners and the home indicator.
Latest
What is prototype in Javascript?
JavaScript prototypes explained through a working example: turning a standalone myCustomForEach helper into an Array.prototype method you can call directly on any array. See how prototypes share properties and methods between instances of the same object type.
How to setup simple multi-auth for SAML and OAuth2 using Rails and Devise
Multi-auth in Rails with Devise: one app accepting both Google OAuth2 and SAML logins via OneLogin or Okta. Covers IdP and SP basics, provider setup, Devise integration, plus fixes for local domain problems and CORS errors during login and logout.
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.
Who is the product owner?
A product owner is defined by real decision-making power: controlling the budget, setting the vision and strategy, and owning the backlog. What each responsibility means in practice, plus a blunt list of cases where, despite the title, you are not the product owner.
Understanding the Singleton Pattern in Javascript
The Singleton pattern in JavaScript ensures one shared instance with a global access point. A practical implementation using an object literal and Object.freeze, a shared bucket example, and where a singleton fits: configuration, logging, or a central data store.
Understanding the Singleton Pattern in Ruby
The Singleton pattern in Ruby, shown two ways: a hand-rolled class using private_class_method :new with a self.instance accessor, then a cleaner refactor with the built-in Singleton module. What the pattern guarantees and when one shared instance is worth it.
What is ACID?
ACID stands for Atomicity, Consistency, Isolation, and Durability: the four guarantees behind reliable database transactions. Each property explained with a concrete Rails example, like wrapping a money transfer in a transaction so it fully succeeds or rolls back.
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.
What is cattr_accesor and mattr_accessor, thread_cattr or thread_mattr in Ruby and in Rails?
cattr_accessor, mattr_accessor, and the thread_cattr and thread_mattr variants explained: ActiveSupport helpers for class-level and module-level attributes, plus thread-safe versions that avoid data inconsistencies in multi-threaded apps. Examples for each accessor, reader, and writer.
Extend, prepend and include in Ruby
Extend, prepend, and include in Ruby each add module code to a class differently: prepend puts the module before the class so its methods win, extend adds class methods, include adds instance methods. Short runnable examples show how each changes the method lookup chain.
Understanding anonymous functions: Blocks, Procs, and Lambdas in Ruby
Blocks, procs, and lambdas in Ruby all wrap code you can pass around, but they differ in how they check arguments and handle return. Implicit and explicit blocks with yield, building reusable procs, and when a lambda is the safer pick, all shown with runnable examples.
class_eval, instance_eval and instance_exec in Ruby
class_eval, instance_eval, and instance_exec power Ruby metaprogramming: reopening classes, running blocks inside an object, and passing arguments in. All explained through one MyWebServer class with a configure DSL, ending in a reusable AppConfig settings pattern.
Attribute selector power in CSS
CSS attribute selectors give you styling control beyond classes and IDs: target inputs by type, style elements with custom attributes, match specific class values, and automatically mark external links. Copy-ready snippets for each case, no extra classes needed.
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 deal with infinite scroll in React
Infinite scroll in React gets much easier with react-query: the useInfiniteQuery hook fetches posts page by page, cancels stale requests with AbortSignal, and exposes fetchNextPage for loading more. A complete typed example wrapped in a reusable usePosts hook.
How to simplify TypeScript types and reduce documentation overhead
TypeScript types with many optional fields need comments to explain what goes together. Discriminated unions fix that: split a Task type into per-status variants so invalid combinations fail to compile and the type documents itself. Before and after code included.
Monkey patching in Ruby done right - refine method with prepend and include
Monkey patching in Ruby without global damage: why reopening a class like DateTime directly backfires, how prepend and include change the ancestor chain safely, and how refine limits your patch to a single scope so the rest of the codebase stays untouched.