Git: Merge a single commit from another branch
Selects one commit from another branch without merging the whole branch. cherry-pick copies the change with a new hash, which can lead to duplicate history later.
How to prevent Nokogiri from fixing invalid HTML
Nokogiri can repair invalid HTML during parsing, which may break markup and SEO expectations. Using Nokogiri::XML with HTML save options preserves the original structure.
FactoryBot: Traits for enums
Enum values can become FactoryBot traits automatically, reducing manual trait definitions and making new roles or states available in tests with less setup.
The HTML5 video element
Browser video playback needs format fallbacks, subtitles, and careful state handling; poster, controls, and the HTMLVideoElement API help build reliable players.
The JavaScript Object Model: Prototypes and properties
JavaScript’s object model hinges on prototypes, property descriptors, and this binding; understanding constructor functions, inheritance, and Object.getPrototypeOf() prevents common OOP pitfalls.
Merging two JavaScript objects
Combining properties from two JavaScript objects depends on the runtime: spread syntax, Object.assign(), or up.util.merge() can create a new object with later values winning.
Select2 alternatives without jQuery
jQuery-free dropdown components for advanced selects are needed when Select2 is too dependent on jQuery or missing features.
How to use Active Job to decouple your background processing from a gem
Background jobs in Rails can stay adapter-agnostic by using ActiveJob, making Sidekiq or Resque easy to swap without changing worker code.
Howto: Select2 with AJAX
Load large choice lists on demand with AJAX in Select2 to avoid huge HTML and support paged, infinite-scrolling results.
Testing for XSS in Markdown Fields
Markdown fields can become XSS sinks when user input is rendered unsafely, allowing javascript: links, image event handlers, and filter bypasses.
Ruby: Using the pry debugger in projects with older Ruby versions
Older Ruby versions need pinned pry and debugger gems; incompatible releases trigger native extension build failures and frozen-string errors.
The ultimate guide to Ruby timeouts
Unresponsive network calls can stall a Ruby system, and many gems default to no timeout. Safer timeout settings avoid hangs, with Ruby’s Timeout module best avoided.
Migrate data between Redis servers
Move existing Redis data to another server by temporarily turning the target into a replica, then detaching it after synchronization.
Nokogiri: CSS syntax for XML namespaces
Selecting XML namespace elements with CSS in Nokogiri requires | instead of : for namespaced names like soapenv|Envelope.
Cucumber may complain about cucumber.yml being invalid when it is valid
Cucumber can report cucumber.yml as invalid even when it parses correctly; an invalid rerun file like tmp/rerun.txt may trigger the error.
Legacy CarrierWave: How to generate versions with different file extensions
CarrierWave can create versions with fixed extensions like mp4, but it needs custom uploader logic to keep filenames, MIME types, and cache handling consistent.
How Rails and MySQL are handling time zones
Rails and MySQL handle datetimes differently: local-zone storage can avoid conversions, while UTC mode supports per-request zones but requires Time.current and careful timestamp handling.
You don't need each, collect or select in Coffeescript
CoffeeScript for comprehensions replace _.each, _.map, and _.select for cleaner list processing without underscore helpers.
Rspec: How to write better specs
RSpec tests are easier to maintain with clearer structure and disciplined style, but recommendations still need judgment; the Self-Contained Test is a complementary approach.
How to reset a Mock
Mock expectations in RSpec can linger across examples; resetting a proxy removes the configured doubles and returns the object to its original state.
whenever: Installing cron jobs only for a given Rails environment or Capistrano stage
Conditional cron jobs in whenever can target only one Rails environment or Capistrano stage, avoiding unwanted tasks on other deployments.
How Ruby method lookup works
Ruby method dispatch follows a fixed lookup chain across singleton classes, prepended modules, class methods, included modules, and superclasses.
Rspec: Expecting a Rake task to be called
Rake tasks can be verified in RSpec by expecting Rake::Task to receive invoke, useful for testing task-triggered side effects without putting logic in tasks.
How to use git fixup
git commit --fixup creates a follow-up commit that git rebase --autosquash can fold into an earlier change, keeping feature-branch history tidy.