Webservice to mock HTTP responses
Need a simple way to fake server replies during development when external APIs are unavailable or unreliable.
The Chokehold of Calendars
Calendars often turn work into a chain of interruptions, leaving little protected time for deep focus. Intentional scheduling can restore control over the day.
Consul 0.9 lets you optimize records checks
Record-level permission checks can be optimized by replacing scope lookups with a direct predicate, avoiding database ID scans for large collections.
Maker's Schedule, Manager's Schedule
Programmers lose more time to meetings because creative work needs long, uninterrupted blocks, while manager-style schedules fragment the day.
Cryptic Ruby Global Variables and Their Meanings
Ruby’s dollar-prefixed globals can make obscure code hard to read; knowing ARGV, process status, PID, and regex match variables helps decode them.
Short lambda syntax in Ruby 1.9
Ruby 1.9 adds a compact -> syntax for lambdas, making anonymous function definitions shorter while staying equivalent to lambda { |x| ... }.
Do not try to "slice" on an ActionController::CookieJar
ActionController::CookieJar looks like a Hash, but slice fails when selecting cookie subsets because Hash#slice instantiates the wrong class.
Bash: How to generate a random number within given boundaries
Generate bounded integers in Bash using $RANDOM; simple modulus limits the range, but it biases results toward lower values.
ActionView::Template::Error (dump format error for symbol(0x6d))
Selenium tests can fail with ActionView::Template::Error and a dump format error for a symbol, often caused by stale cached files in tmp/cache.
Switch to a recently opened tab with Cucumber
I switch to the new browser tab lets Selenium-enabled tests handle links that open a new tab or window, such as link_to(..., :target => '_blank').
iOS 5 "position: fixed" and virtual keyboard issues
On iPad in iOS 5, the onscreen keyboard can force position: fixed elements to behave like position: static, breaking forms and search fields.
Batch-process text files with ruby
In-place batch editing of many text files with plain Ruby can replace patterns across files without a separate script runner.
List keys stored in memcached / Amazon AWS ElastiCache server
Memcached keys can be enumerated by querying slab statistics and dumping cached items, including AWS ElastiCache instances exposed on port 11211.
Howto remove the location hash without causing the page to scroll
Removing a URL fragment without jumping the page avoids unwanted scrolling; assigning a dummy hash like window.location.hash = "_" keeps the view in place.
How to inspect XML files in a terminal
xmllint pretty-prints XML in the terminal and can write formatted output to a file, including gzipped XML inputs.
How I Explained REST to my Wife
A friendly introduction to the web and HTTP’s purpose, using REST as a simple mental model for understanding request and response behavior.
Riding Rails: Rails 4.0: Final version released!
Rails 4.0 is ready after betas and release candidates, bringing new features and removing older ones past their expiration date.
Upgrading Rails 2 from 2.3.8 through 2.3.18 to Rails LTS
Rails 2.3.x upgrades fix security vulnerabilities and API changes across patch levels, with extra CSRF, XSS, and JSON gem updates needed on some releases.
ActiveRecord.select
Selecting specific columns limits loaded attributes and can make records read only, while SQL expressions can add computed fields for sorting and display.
Help me, there is a zombie process!
Zombie processes appear when child processes exit but the parent never waits, leaving defunct entries in ps; fixing or restarting the parent removes them.
asciidisco/Backbone.Mutators · GitHub
Backbone plugin for custom getter and setter logic on model attributes, enabling computed values and validation without changing core model code.
Rails: Have different session secrets for all environments
Using the same Rails session secret in staging and production can let a cookie from one environment authenticate in another. Separate secrets per environment reduce session hijacking risk.
Rails: Send links in emails with the right protocol
ActionMailer defaults to http in email links, which can expose session cookies to SSL-stripping. Set default_url_options or the link protocol to use https where needed.