Amazon S3: Give a user write-access to selected buckets

AWS IAM users need a custom policy for access to only selected S3 buckets; bucket listing and object actions require separate resource ARNs.

Sass: How to do math with shorthand values inside variables

Adding math to Sass shorthand variables is awkward: whole-value arithmetic concatenates incorrectly, while nth can access individual sides for manual adjustment.

How to human-join an array in JavaScript

Human-friendly list formatting in JavaScript is awkward; joinSentence produces an Oxford-comma sentence from array items, similar to Rails to_sentence.

Puppet 3.x: Convert a float to an integer

Puppet 3.x lacks a built-in float-to-integer conversion; inline_template with to_i can render the numeric value as an integer.

Browsers have built-in pretty printing for JSON

Format a JSON object with built-in pretty printing by passing an indentation value to JSON.stringify.

Detect the language of a string

Ruby strings can be language-detected with whatlanguage, but short texts are unreliable and restricting the candidate languages improves accuracy.

Rails: How to get PostgreSQL version being used

Get the PostgreSQL server version from a Rails app or console using ActiveRecord::Base.connection.select_value('SELECT version()') when you need database details at runtime.

Middleman does not fingerprint asset paths by default

Middleman static sites serve stable asset URLs by default, so cached JavaScript and CSS can stay outdated. :asset_hash adds fingerprinted paths to force cache refreshes.

About Piwik

Open-source web analytics with self-hosting improves privacy and data protection, but reports are delayed and often limited to date ranges.

The Current State of Telephone Links | CSS-Tricks

Desktop browsers often handle tel: links poorly, while mobile browsers open the phone app automatically. Detecting useful phone-link support is not possible.

Represent astral Unicode characters in Javascript, HTML or Ruby

Unicode symbols can be hard to enter reliably across tools, and astral characters or non-breaking spaces often need escapes or entities instead of pasted text.

Ubuntu MATE: Shortcut launcher for a web application

Launching a web app from the MATE panel avoids unreliable Chrome desktop shortcuts and opens sites like Google Calendar in a separate app-like window.

Google Chrome: How to find out your currently installed theme

Finding a Chrome theme again can be hard when the name is forgotten. The installed theme name or Chrome Web Store ID can be recovered from Chrome settings or the Preferences file.

Name that Color

Maps a hex color code to a standard-sounding color name, making it easier to choose readable Sass variable names for extracted palette values.

About the HTML and the BODY tag

html and body behave differently from normal elements, making them poor choices for layout, sizing, and positioning; use them mainly for global defaults.

Ubuntu MATE: Add a new panel

Adding a second MATE panel lets you place separate launchers, menus, or indicators on another screen or position without replacing the existing one.

Using Google Analytics with Unpoly

Google Analytics pageviews can be missed in Unpoly apps because only the first full page load runs the tracking script. Track fragment updates with up:location:changed or a custom up.compiler.

There is no real performance difference between "def" and "define_method"

def and define_method have no meaningful performance gap in typical Ruby code; only very short methods show a small difference, while closures can affect garbage collection.

ActiveRecord subselects - Today I Learned

Passing a second scope into a hash condition turns it into a subselect, useful when simpler querying matters more than performance.

Images darken when getting converted with ImageMagick

CMYK images can appear darker after conversion with newer ImageMagick versions because RGB and sRGB handling changed. Using -colorspace sRGB preserves the expected brightness.

The Codeless Code

A series of short stories about monks and nuns in a programming monastery, blending software lessons with parable-style lessons.

has_one association may silently drop associated record when it is invalid

has_one autosave can drop an invalid associated record without failing the parent save, leaving the parent persisted and the child unsaved.

ActiveRecord autosave

Child objects can be saved automatically with their parent in Rails, reducing manual persistence work and keeping associated records consistent.

Ruby's default encodings can be unexpected

Plain Ruby strings can inherit inconsistent encodings from Encoding.default_external, causing incompatibility errors when text comes from StringIO, CSV, files, or IRB.