Fixing authentication in legacy applications
Legacy authentication setups often miss SSL, cookie, CSRF, and session-fixation protections, leaving logins and browser-stored data easy to compromise.
Bookmarklet: cards Markup Link Bookmarklet
Create Markdown links to cards in other decks with a bookmarklet that copies the current card title and path into link format.
How to display an unsaved changes alert
Unsaved form edits can be lost when a tab closes or a full page unload occurs. beforeunload with preventDefault() triggers the browser's standard warning.
Copy to clipboard without flash (clipboard.js)
Flash-free copy-to-clipboard handling with clipboard.js, including success and error callbacks, text selection feedback, and support for text fields or data attributes.
Selector for finding the currently selected option in a <select> tag
Use option:checked to read the current selection in a <select>; option[selected] only matches the markup, not later user changes.
Virtual scrolling: A solution for scrolling wide content on desktops
Wide tables on desktop can be hard to scroll without moving the rest of the page or hiding the scrollbar off screen. Reusing the page scrollbar with position: sticky and translateX keeps the content centered.
Middleman configuration for Rails Developers
Rails-friendly Middleman setup for live reload, asset pipeline, i18n, environment-specific config, browser testing, and Capistrano deployment.
Capturing signatures on a touch device
Touch-device signature capture for web forms with jQuery Signature Pad, plus server-side PNG generation from the stored stroke data.
Jasmine: Testing complex types for equality
toBe only checks reference identity; toEqual handles arrays, objects, dates, regular expressions, NaN, exceptions, and custom equality testers.
Capybara: Pretending to interact with the document
Browsers block autoplay and popup APIs until a user gesture occurs; a tiny clicked element can unlock them in Capybara tests.
parallel_tests: Disable parallel run for tagged scenarios
Tag specific Cucumber scenarios so they avoid running together when they contend for a shared resource or browser focus, at the cost of slower tests.
Asset Pipeline Basics
Rails asset delivery relies on manifests and explicit requires; precompilation output helps verify URLs and troubleshoot missing or misplaced assets.
Nested Spreewald patiently blocks are now patient
Nested patiently blocks now wait independently in Spreewald, preventing detached DOM failures when with_scope reuses cached elements.
Capybara: Most okayest helper to download and inspect files
Reliable file-download testing in Capybara, including filename, content type, disposition, and text inspection across Selenium and Rack::Test without leaving the page.
Testing focus/blur events with Cucumber
Firefox and Selenium can delay real blur events in Cucumber tests, making focus-dependent listeners hard to exercise; ChromeDriver and a custom event workaround avoid the issue.
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.
Rails 3: Make "link_to :remote => true" replace HTML elements with jQuery
Rails 3 remote links can replace page content with returned HTML, restoring the Rails 2 link_to_remote update behavior through jQuery and rails-ujs.
Clicking issues with chromedriver
ChromeDriver click targeting can hit the wrong point on an element, causing intercepted or non-clickable errors when overlays or nearby elements overlap.
How to detect touch-capable browsers
Touch-capable browser detection is imperfect, but checking for touch events offers the best tradeoff when feature-based detection is needed instead of device detection.
Cucumber: Wait until CKEditor is loaded
Timing issues can cause undefined errors when interacting with CKEditor in Cucumber tests. Waiting for the editor to reach ready avoids flaky WYSIWYG input steps.
How to call overwritten methods of parent classes in Backbone.js
Backbone models often need overridden methods to keep parent behavior. __super__ lets an երեխա class call inherited initialize with the same arguments.
How to open a new tab with Selenium
Browser popup blocking prevents window.open from Selenium; injecting a clickable temporary link opens a new tab reliably in Chrome.
How to make Webpacker compile once for parallel tests, and only if necessary
Compile Webpacker assets once in parallel test runs and skip recompilation when files are unchanged, avoiding duplicate work and Capybara timeouts.
Force absolute URLs in views throughout a response
Relative view helpers generate path-only links and persistent asset hosts; enforcing full URLs needs separate handling for asset_host and rewrite_options.