Markdown Live Preview

Online markdown preview lets writers see formatting changes instantly, with or without GitHub Flavoured Markdown support.

postgres: window functions

Window functions in PostgreSQL support running totals, rankings, and per-group calculations without collapsing rows; common table expressions can simplify complex analytical queries.

Web Typography for non-designers - Presslabs

Web typography choices strongly affect readability and visual hierarchy, and common mistakes can make text hard to scan or unbalanced.

Remove URLs from the Google index

Remove individual pages from Google search results on a site you control by using Webmaster Tools and the Google Index removal feature.

Compiling Javascript template functions with the asset pipeline

Compile .jst templates into JavaScript functions via the asset pipeline for rendering with JST[...], including EJS and Eco templates.

Carrierwave: Efficiently converting images

Multiple image-processing steps on a CarrierWave version can trigger extra MiniMagick commands; combining options into one process keeps them in a single mogrify call.

How to coordinate distributed work with MySQL's GET_LOCK

MySQL GET_LOCK provides a simple distributed mutex for ensuring only one instance runs across machines without creating lock rows.

Using PostgreSQL and jsonb with Ruby on Rails

jsonb in PostgreSQL 9.4 stores JSON differently from json and suits queries, indexing, and Rails 4.2 integration better for many use cases.

An auto-mapper for BEM classes in Cucumber selectors

BEM-style selectors can be generated from plain-language Cucumber locators, reducing repetitive typing when mapping readable step text to CSS classes.

Ruby: Counting occurrences of an item in an array / enumerable

Enumerable#count returns the total number of elements, the number equal to a given value, or the number matching a block condition.

Ruby: Flatten arrays by only one level

Array#flatten recursively removes nested arrays by default; an optional depth argument limits flattening to one level or any chosen level.

Fix error UDPSocket.open: wrong number of arguments (0 for 1)

Updating selenium-webdriver can trigger UDPSocket.open argument errors on Ruby 1.8.7 when an incompatible backports version overrides core behavior.

grosser/rspec-instafail

Gem for instantly showing failing specs while continuing to run the rest of the suite, instead of aborting on the first failure.

Rails: Running specific migrations

Targeted database migrations in Rails use STEP and VERSION to run, redo, rollback, or revert a chosen migration without processing the full history.

Did you know 'tig status' ?

tig status provides a keyboard-driven GUI for git add -p, letting you stage or unstage whole files, chunks, and individual lines.

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.

Beware: Coffeescript "in" is not the Javascript "in"

CoffeeScript in checks array membership, not object properties; JavaScript in tests whether an object has a property. Use of for property lookup in CoffeeScript.

Block formatting contexts

CSS block formatting contexts isolate floats and clearing within a container, preventing layout interference between separate sections and enabling reliable two-column layouts.

LibreOffice Writer: Prevent a table row from being split across pages

Table rows in LibreOffice Writer can break across pages and columns, making layouts harder to read and control. Disabling row breaks keeps each row together.

RSpec: How to get a full backtrace

Use rspec -b to print a full backtrace for failing examples and make the origin of an error easier to trace.

Ruby: Find a hash key given it's value

Reverse lookup in a Ruby hash returns the first key for a given value, or nil when the value is absent. Hash#key is available in Ruby 1.9+.

Git: How to get a useful diff when renaming files

git diff treats moved files as delete/add pairs by default, hiding renames in reviews. -M or --find-renames makes the diff show file moves instead.

Angular + ui-router: Make links work in a new tab

Angular apps served from a subpath can break ui-router links in new tabs; a matching <base> href keeps generated URLs working.

hanklords/flickraw

Ruby library for simple Flickr API access with methods mapped to the official documentation and data returned in an intuitive format.