You should probably load your JavaScript with <script defer>
Loading JavaScript with defer avoids blocking rendering, runs after parsing, and still before DOMContentLoaded, making it the safer default for head scripts.
How to: Context-dependent word expansion in RubyMine
Context-dependent word completion in RubyMine speeds coding and reduces typos; Cyclic Expand Word can be remapped on German keyboards.
Disable PostgreSQL's Write-Ahead Log to speed up tests
Unlogged PostgreSQL tables can speed up Rails test suites by skipping the write-ahead log, but they raise crash-related data loss risk and stay unsuitable for production.
RSpec: be_true does not actually check if a value is true
be_true matches any truthy value, not only true; be_false likewise checks for falsiness. Use exact equality with == or eq when boolean values must be verified.
ActiveRecord: When aggregating nested children, always exclude children marked for destruction
Nested form deletions can inflate aggregated totals when child records marked for removal are still counted. marked_for_destruction? filters them out before saving.
open-next-failure: An alias to speed up test debugging
Open the next failing spec directly in the IDE to cut down the back-and-forth between test runs and debugging. RSpec --next-failure and JSON output support the workflow.
Capistrano 3: Running a command on all servers
Capistrano 3 can execute an arbitrary shell command across all app servers, useful for grepping logs or bulk remote checks.
Regular tasks for long-running projects
Long-running projects need regular upkeep to avoid stale dependencies, growing data, and bloated storage that raise costs and slow applications.
Summarizing heredoc in Ruby and Rails
Heredoc indentation and newline handling in Ruby and Rails varies by syntax and helper. <<~, strip_heredoc, and squish control unindentation and whitespace cleanup.
Databases don't order rows unless you tell them so
Database tables have no inherent row order; pagination with LIMIT needs a unique ORDER BY, and Rails first/last default to id.
Gitlab: How to cancel redundant pipelines
Redundant GitLab CI pipelines can waste runner capacity when new pushes arrive. interruptible: true and auto-cancel help stop outdated test runs and keep the latest commit building.
CSS has a built-in clearfix
Floated children can collapse their container, but display: flow-root creates a new block formatting context without clearfix hacks. IE11 lacks support.
Difference between respond_to/format and params[:format]
Non-HTML Rails responses can differ from params[:format]; respond_to also matches MIME negotiation, so authorization should not depend on a URL suffix alone.
7 Rules for Creating Gorgeous UI
Practical UI design tricks for non-designers: improving layout, typography, contrast, and image overlays to make screens look polished.
OpenAI TTS: How to generate audio samples with more than 4096 characters
OpenAI TTS requests are capped at 4096 characters, so longer text needs chunking and MP3 merging to generate complete audio.
Capistrano: creating a database dump if migrating
Create a database dump only when Capistrano will run Rails migrations, using conditional migration checks and a deploy hook.
Rails: Pluck across associated tables
pluck can fetch values from joined tables in one query, returning columns from associated records without loading full Active Record objects.
RailsStateMachine 2.2.0 released
RailsStateMachine 2.2.0 adds :prefix for multiple state machines on one model and fixes repeated RailsStateMachine::Model inclusion resetting existing machines.
Livereload + esbuild
Live CSS and JS reloading in Rails with esbuild is awkward because generated assets change on every build. A guard-livereload plus livereload-js setup can avoid full-page reloads for stylesheet changes.
Webpack: How to split your bundles
Large JavaScript libraries can bloat the main bundle; import() lets webpack load them asynchronously and keep rarely used code out of the initial payload.
MySQL: CONCAT with NULL fields
CONCAT() with NULL returns NULL in MySQL, so text can disappear unexpectedly; CONCAT_WS('', ...) treats NULL as empty strings, while PostgreSQL concatenation ignores NULL.
Simple database lock for MySQL
MySQL can coordinate multiple Rails processes with a database-backed mutex when code must not run concurrently. It is for model-level synchronization, not record locking.
Javascript: Avoid using innerHTML for unsafe arguments
Unsafe innerHTML use can introduce XSS when user content is inserted into HTML. textContent or text keeps values escaped for safe text updates.
Transfer records to restore database entries (with Marshal)
Move exact database records between systems by serializing Ruby objects with Marshal and Base64 when a direct export/import needs to preserve IDs and state.