Parsing JSON with edge cases
Ruby json accepts duplicate keys by keeping the last value, tolerates comment-like truncation in some cases, and can decode huge exponents to Infinity.
Webmock < 3.12.1 cannot handle IPv6 addresses correctly
WebMock fails on IPv6 URLs because addresses need brackets before the port, causing invalid URI and port parsing errors in CarrierWave and SsrfFilter.
Making ZSH the default shell on Ubuntu 20.04
ZSH can replace Bash on Ubuntu 20.04 and adds command-line conveniences like completion, corrections, themes, and plugins.
Mixed Content Examples
Mixed content behavior differs when secure pages load assets over HTTPS versus HTTP, exposing browser handling of blocked or downgraded resources.
Rails: Parsing a time in a desired timezone
Create a Time in a fixed timezone regardless of Rails or system settings; useful for tests and API date comparisons when parsing otherwise shifts by environment.
How to fix: WrongScopeError when using rspec_rails with Rails 6.1
rspec_rails with Rails 6.1 can raise WrongScopeError; upgrading the gem to 4.0.1 or later resolves the failure.
Best practices for REST API design
REST API design often fails on timestamps, number handling, pagination, filtering, and versioning. Consistent conventions improve interoperability and client stability.
Running old ImageMagick versions in a Docker container
Legacy ImageMagick installs can be kept available when the system package is unavailable by running convert and related tools in a Docker container with absolute paths.
Make your Rails console (and irb) output better readable
Colorized, structured output in Rails console and irb makes long strings, objects, and classes easier to inspect. awesome_print adds the ap command for readable formatting.
Some tips for upgrading Bootstrap from 3 to 4
Migrating a larger Rails app from Bootstrap 3 to 4 often breaks styles, components and helper gems; planning library upgrades and rebuilding variables reduces the pain.
ActiveType #change_association: Define { autosave: true } on parent models
Nested form records on overridden associations are not persisted unless the parent association enables autosave.
How to fix: Version in "./docker-compose.yml" is unsupported
Old docker-compose versions can reject modern Compose file formats and report an unsupported version in docker-compose.yml. Upgrading to a newer Compose release resolves the mismatch.
WYSIWYG with Action Text
Rails 6 Action Text provides a built-in WYSIWYG editor for rich text fields, with Trix hooks for custom toolbar buttons and attachment handling.
Rails: Postgres Partial Indexing
PostgreSQL partial indexes reduce index size and write overhead by indexing only rows that match a condition, useful for conditional uniqueness and large tables.
How to fix "Command "webpack" not found"
Deployment asset precompilation can fail with Command "webpack" not found when Yarn dependencies are missing. A bin/yarn binstub lets yarn install run during deploy.
InfoQ: How to Design a Good API & Why it Matters
Well-designed APIs improve adoption and maintainability for both library authors and users; Joshua Bloch presents practical guidance and examples of good and bad API design.
Rails: How to use custom flash types in controllers
Custom flash types let controllers use extra redirect messages such as success, useful for Bootstrap-style alerts beyond notice and alert.
Git: Parsing large diffs as a human
Large codebase diffs can become unreadable after migrations, renames, and mass file moves; git options help isolate moved code and reduce review noise.
Ruby: How to load a file with a known encoding
Ruby can misdetect a file’s encoding; specifying it manually keeps the resulting string in the expected Encoding and avoids hidden byte conversion.
Fixing memory leaks in the browser
Browser memory leaks often come from forgotten listeners, timers, observers, unresolved promises, global stores, or unbounded DOM growth.
How to communicate between processes in Ruby with sockets
Interprocess communication in Ruby can use UNIX sockets for parent-child coordination, parallel test synchronization, and waiting for child cleanup after fork.
ExceptionNotification: Fix DNS lookup before plugins call external APIs
External notification plugins can stop delivering exceptions when DNS lookup fails, affecting Slack or Microsoft Teams alerts. Loading resolv-replace before ExceptionNotification forces Ruby DNS resolution to work reliably.
Call original method when monkey patching
Ruby monkey patches can reuse the overridden behavior by calling super from a prepended module, letting extensions wrap existing methods instead of replacing them outright.
Transporting blank values in URL queries
Blank query values are not equivalent to missing parameters in URLs: foo= is an empty string, foo is null, and /path has no key.