Output the descriptions of RSpec examples while they are running
RSpec’s nested documentation format prints example descriptions while specs run, making warnings and failures visible immediately and giving a quick view of core behavior.
Speed up response time in development after a Sass change
Large Sass files delay the first request after edits because CSS is compiled on demand; watching files and compiling ahead of time removes the startup lag.
Delete all MySQL records while keeping the database schema
Clear MySQL data without dropping tables, useful after bad migrations or frozen tests. DatabaseCleaner truncation keeps the schema intact and can be wrapped in a Rake task.
Synchronize a Selenium-controlled browser with Capybara
Selenium actions can return before a page finishes loading, so Ruby updates may race with browser-side changes. A Capybara resynchronization step prevents flaky Cucumber features.
Monitoring Theory
Around the time in my life when I stopped ordering drinks made with more than one ingredient, I was woken up for the last time by a hypochondriac Nagios monitoring installation. If you are on-call long enough, you cultivate a violent reaction to the sound of your cell phone's text message alert. If your monitoring is overconfigured, that reaction boils over hastily, as it will interrupt you during meals, sex, sleep — all of the basics — with the excruciating operational details of your web site.
I've since developed, with the help of some n...
plus2/whereuat - GitHub
Adds a slide out panel to your Rails application that directs clients to test stories that have been marked as 'delivered' in Pivotal Tracker.
Prevent floating sibling elements from wrapping in CSS
Floating sibling blocks line up horizontally but wrap at the container edge; a very wide inner wrapper keeps them on one line without visible overflow.
Unexpected behavior when changing both an association and its foreign key attribute in ActiveRecord
Changing an association and its foreign key on the same ActiveRecord object can lose the later assignment; the association value wins on save.
Remove quotes from Sass mixin arguments
Quoted Sass mixin arguments can produce invalid CSS for multi-part values like box-shadow. unquote removes the quotes so generated properties stay valid.
Check that a Range covers an element in both Ruby 1.9 and 1.8.7
Range#include? becomes slow for non-numeric ranges in Ruby 1.9, while Range#cover? is unavailable in 1.8.7. A compatibility method keeps one check working across both versions.
Fix Capistrano with RubyGems 1.6
RubyGems 1.6 can break Capistrano by activating incompatible net-ssh versions; isolating Capistrano in a dedicated Bundler Gemfile restores deployment commands.
Keyboard shortcuts for Pivotal Tracker
Pivotal Tracker supports keyboard shortcuts for quick navigation, search, help, story creation, and toggling backlog, charts, current, done, history, icebox, my work, and labels.
Fixing "uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)"
RubyGems 1.6.0 can break Rails 2.x with ActiveSupport::Dependencies::Mutex NameError during startup; loading thread before boot.rb prevents the failure.
Convert Adobe Flash FLA files into HTML5 with Wallaby
Wallaby converts artwork and animation from Adobe Flash Professional FLA files into HTML for wider reach on devices without Flash runtime support.
Check whether a getter is an attribute or an association
Distinguish between a simple attribute and an associated object in Person; reflect_on_association lets code branch when a getter refers to a relation.
Closures in Ruby
If you want to get a deep understanding of how closures, blocks, procs & lambdas in Ruby work, check out the code at the attached link.
Here the summary:
^
---------------------------- Section 6: Summary ----------------------------
So, what's the final verdict on those 7 closure-like entities?
"return" returns from closure
True closure? or declaring context...? Arity check?
...
Function to return the minimum or maximum value per row with MySQL
MIN() and MAX() aggregate across rows, not within one row; LEAST() and GREATEST() return the smaller or larger value for the current row.
Export more than 500 rows in Google Analytics
Currently, only up to 500 rows of Analytics table data can be exported at a time into CSV format. If you need to export larger data sets, like exporting all keywords that sent traffic to your site, you can export multiple times as long as each batch contains at maximum 500 rows.
If you have thousands of rows that require multiple exports, you can use the convenient workaround below to export all your rows in one go.
Dual monitors crashing Linux with NVIDIA drivers
Dual-monitor setups with NVIDIA on Linux can crash X when DDC/CI is enabled on Dell displays; disabling DDC/CI avoids the failure.
Add a prefix to form field IDs
Rails form fields can clash when the same form is rendered multiple times; a prefix keeps field IDs unique without changing submitted names.
Exchange messages between Javascript and Flash
Flash movies can exchange data with JavaScript in the same page, with ExternalInterface as the preferred bridge and fscommand or SetVariable() as legacy options.
Insert an ndash and other special characters using the Compose key on Linux
Typing en-dashes, em-dashes, and other symbols is awkward without a compose key. A configured compose key enables cross-application input of special characters on Linux.
Configuring User Agents with Capybara + Selenium Webdriver
A while ago we were working on an application that had an entire version specially created for mobiles, such as the iPhone. This specific application was entirely tested with Capybara, Steak and Selenium Webdriver. Although the test suite wasn’t the fastest one in the world, the web application was very well tested, and to guarantee that we would also be testing the mobile version, we would have to simulate an iPhone user agent accessing the application.
But wait, you might be thinking that we are not able to change browser headers while ...
Paperclip: Image resize options
Paperclip supports ImageMagick resize flags for scaling, cropping, and fitting images to specific dimensions without distorting them.