Sass: Use black or white foreground color depending on the lightness of the background
Colored buttons can keep readable text by switching between black and white based on background lightness. A simple Sass mixin uses @if and @else for this choice.
Find out your SSH key's fingerprint (e.g. to authenticate on GitHub)
ssh-keygen -lf prints a public key fingerprint for GitHub SSH key audits and similar authentication checks. Compare the fingerprint with the local key file before approving access.
Setup or update Passenger to use Ruby Enterprise
Passenger can be configured or upgraded to use Ruby Enterprise instead of MRI, then Apache is restarted with the generated module instructions.
Spec "content_for" calls in helpers
RSpec helper specs can leak content_for state between examples, making repeated checks fail. A fresh helper instance avoids stale instance variables.
RubyMine: Disable window animations
RubyMine window animations can be disabled in Appearance settings, reducing distracting UI motion. The option may no longer be available in newer versions.
Gherkin: Error during installation
gherkin gem installation can fail because native extension warnings are treated as errors. Disabling warnings with --with-cflags=-w lets bundle install succeed.
Debugging Google Analytics
Analytics tracking can be hard to verify in the browser; a Chrome extension swaps in a debug version and prints tracking details to the JavaScript console.
Compare two XML strings as hashes
XML strings with different element order can still represent the same data. Nori parses them into hashes for order-insensitive comparison.
Git: Remove information on branches that were deleted on origin
Remote-tracking branches remain listed after deletion on origin; prune stale references locally with git remote prune origin or git fetch --prune.
Markdown/Commonmarker examples
Markdown formatting in CommonMarker supports bold, italics, links, headings, lists, code blocks, and line breaks for card content.
ActiveRecord: Overwriting a setter causes trouble with attributes depending on each other
Overriding a setter can break when attribute assignment order changes during update_attributes!, causing nil errors; before_validation or custom ordering avoids the dependency.
TodoMVC - A common learning application for popular JavaScript MV* frameworks
Choosing a JavaScript MV* framework is difficult when options look similar; TodoMVC provides the same Todo app across popular frameworks for side-by-side comparison.
Creating the inverse of a Rails migration
Reverting an old Rails change can reuse the original migration’s up and down logic instead of copying SQL, but only for simple cases.
RubyMine: Find and execute a menu action by its name
Ctrl+Shift+A opens RubyMine’s Find Action box to run menu commands by name when the shortcut or menu location is unknown.
RubyMine: Exclude data and log directories from a project
Exclude log, data, and other irrelevant directories in RubyMine to speed up searches and reduce noisy results without deleting files.
Git: Diff changes in a long line efficiently
git diff --word-diff highlights inline changes within long lines, and disabling the pager can keep the output directly in the terminal.
WebMock 1.8.0 does not play nice with Curb < 0.7.16
Updating WebMock to 1.8.0 can let unstubbed specs send real HTTP requests when Curb is older than 0.7.16.
TeamViewer 7 finally works with multiple screens under Linux
TeamViewer 6 and earlier treated multi-monitor Linux desktops as one large display. Version 7 adds proper screen selection for remote sessions.
will_paginate on complex scopes may be slow (workaround)
Complex will_paginate scopes can trigger a slow total-count query, especially with many includes, delaying search results pages.
Sunspot and Solr on Tomcat: Trouble with Umlauts
Umlauts in Sunspot and Solr can fail on Tomcat even when local Jetty-based searches work; a UTF-8 bug in RSolr caused empty results until version 1.0.6.
Issues with has_select?
has_select? can fail with Cucumber, Capybara, and Selenium when the selected option has no value, so driver-specific handling may be needed.
Convert Virtualbox .ova Image to .ovf
.ova packages are tar archives containing an .ovf descriptor, so extracting them yields the virtual machine definition and related files.
Nicer alternatives to def_delegator or def_delegators
def_delegator and def_delegators are hard to read; delegate or a small wrapper method makes Rails delegation clearer.
Moment.js - A lightweight javascript date library
A lightweight JavaScript date library for parsing, manipulating, and formatting dates.