react
react
typescript
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.
domain-driven-design
Sample DDD explanation in Ruby with Event-sourcing and Event-driven development
Domain Driven Design in Ruby with a working example: aggregates, entities, value objects, and repositories built around a ProductCatalog, then extended with event-driven design and event sourcing, where projections rebuild state from events instead of a database.
Latest
Rails optimistic locking, pessimistic locking and how to solve StaleObjectError
Rails locking strategies for concurrent updates: optimistic locking with a lock_version column that works out of the box, pessimistic locking with lock! and with_lock, and practical ways to rescue and resolve the StaleObjectError that optimistic locking raises.
Enums with Typescript - why it's bad? Possible solutions
TypeScript enums generate extra JavaScript at compile time and numeric enums are not even type-safe. Why enums can hurt bundle size and correctness, and two safer alternatives: assigning explicit string values or replacing enums with plain objects.
Differences between load, autoload, require, and require_relative in Ruby
Ruby has four ways to load code and each behaves differently: load re-executes a file every time, autoload waits until first use, require loads once from the load path, require_relative resolves from the current file. Examples plus a summary of when to use each.
Ruby in browser via WebAssembly
Ruby 3.2 runs in the browser through WebAssembly: embed Ruby in a script tag with ruby-wasm-wasi or drive the Ruby VM from JavaScript and mix it with HTML. Working examples plus honest limits: no threading or networking, and no extra gems without a custom wasm image.
Map vs WeakMap in practice
Map vs WeakMap in JavaScript comes down to keys and memory: WeakMap only accepts object keys and lets garbage collection reclaim unused entries, while Map holds onto everything. Differences, similarities, and practical guidance on when each one is the right choice.
Ruby SOLID in practice with minimizing nesting rule
SOLID in Ruby with working code for every principle: Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion, plus a bonus rule on minimizing nesting and a fair look at the criticisms of SOLID.
Anonymous Arguments Passing Improvements in Ruby 3.2
Ruby 3.2 adds new syntax for anonymous arguments: forward positional and keyword arguments with bare * and ** and unpack them inside the method, no more digging through kwargs hashes. A before-and-after example shows how much cleaner argument passing gets.
How to write Naive Bayes classification algorithm in Ruby
Naive Bayes classification in plain Ruby: how prior and posterior probabilities decide the winning class, then a working spam filter that classifies email titles. Also where the algorithm shines: sentiment analysis, recommendations, and fraud detection.
How to debug cookies in Rails and how to solve CookieOverflow issue
Rails CookieOverflow strikes when a cookie exceeds 4096 bytes. How to inspect cookies in Chrome dev tools, read the session dump on the error page, and use the cookie_debugger gem to log exactly which session key is eating the space, even in production.
How to auto-remove files from trash in Google Drive
Google Drive trash can quietly eat the space you free up when rotating files like CCTV recordings. A short Google Apps Script fixes it: an emptyTrash function, the Drive API service, and a time-based trigger that wipes the trash every hour, fully automatic and free.