JSONP - Wikipedia

Cross-origin web pages cannot normally communicate, but <script> requests can pull executable JavaScript around same-origin limits. JSONP uses this loophole to load dynamic data from other origins.

Debugging failed AJAX requests with better_errors

better_errors adds enhanced development error pages with a live REPL, and /__better_errors lets you inspect exceptions from AJAX requests.

travisliu/traim: Resource-oriented microframework for RESTful APIs

Build a RESTful API for ActiveRecord models with very little code. Traim emits a Rack application that can run standalone or inside Rails, but the 1:1 resource model can become limiting.

Unpoly: Passing Data to Compilers

Rails data can be passed to Unpoly compilers through data-* for simple strings and up-data for objects, arrays, and nested values.

nginx: How to drop connections for a location

return 444 makes nginx close a connection without sending a response, useful for rejecting specific routes or simulating dropped requests behind a reverse proxy.

Git: See all unpushed commits or commits that are not in another branch

Local commits missing from a remote or upstream branch are easy to identify with git cherry -v, which lists the commits not shared by both branches.

Rails 7.1: Take care of the new production log default to standard out

Rails 7.1 changes production logging to standard out, which can break file-based logs in opscomplete setups unless the previous logger configuration is restored.

Execution of shell code in Ruby scripts

Deprecated Ruby ways to run shell commands can be unsafe or behave differently; capture3 is the preferred option for new code.

Carrierwave: Custom file validations inside custom Uploaders

MIME type checks can live in a CarrierWave uploader instead of every mounted model, keeping file-type validation centralized and raising CarrierWave::IntegrityError for bad uploads.

Tearing Down Capybara Tests of AJAX Pages

Pending AJAX requests can die when a Capybara test ends or switches scenarios, causing flaky JavaScript specs. Waiting for the page to load helps avoid the failure.

Let the browser choose the protocol

Protocol-dependent links break mixed-content embeds and tests; protocol-relative URLs let the browser pick http or https from the page context.

How to disable logging for ActiveStorage's Disk Service routes

ActiveStorage disk-service requests can clutter development logs with redundant route, record-load, and URL-generation messages. Selective silencing keeps Rails output readable.

defunkt/jquery-pjax

pjax loads HTML into the current page without a full reload, preserving permalinks, page titles, and back-button behavior with graceful fallback.

Debugging SPF records

SPF records can be hard to validate, especially when syntax errors or DNS lookup limits break mail delivery. Online checkers help test coverage and new policies before deployment.

Exclude your staging site from Google with robots.txt and not shoot yourself in the foot

Staging sites can be kept out of Google with robots.txt while avoiding a forgotten block on launch by serving a separate exclude file on staging only.

Cucumber: Wait for any requests to finish before moving on to the next scenario

Selenium/Cucumber scenarios can finish before browser requests and redirects are done, leaving the session busy and breaking later steps and hooks.

When Date.today and Date.tomorrow return the same day...

Date.today and Date.tomorrow can return the same day when Rails has no configured time zone, causing date handling to drift between UTC and local time.

Creating a Rails application in a single file

Running Rails in one file is useful for quick experiments, debugging bugs, or embedding an app in tests, but version and dependency drift can cause surprises.

Rails 4.1+: New locale files require a Spring restart

Rails 4.1 development can ignore newly added I18n YAML files because Spring caches the load path; restarting Spring makes new translations appear.

VCR: Alternative way of mocking remote APIs

VCR records real HTTP interactions and replays them from YAML, making network-dependent tests run offline without manual stubs.

Installing multiple MySQL versions on the same Linux with mysql-sandbox

Run several MySQL releases side by side in one Linux account for testing or Rails development, using isolated sandboxes on separate ports.

Bash: How to count and sort requests by IP from the access logs

Count and sort request frequencies by client IP in access logs with a short awk pipeline for quick traffic checks and abuse spotting.

Puma: How to force a single threaded boot in development

Single-threaded Puma in development avoids overlapping requests and noisy console output when debugging. Setting -t 0:1 makes other requests wait.

Web development: Accepting a self-signed certificate in Google Chrome

Chrome can reject locally generated self-signed certificates and hide HTTPS even when they work. Importing the certificate or launching with --ignore-certificate-errors allows testing.