This morning I learned about the hidden attribute that can be added to <option> tags within a <select> tag. The hidden attribute causes the option to simply not be shown in the list. Hidden elements will are also not selectable and will not return any selected value. The hidden attribute works in most browsers, with ~97.5% of browsers supported. For...
It’s been a while since I’ve worked with transactional email directly with Rails. This is because I’ve previously been working on some larger projects that have justified the use of an external mailing system like Mandrill, where email templates were used to generate email within that system, and sending an email from the Rails app was just an API call....
Yesterday I learned about toLocaleString, a Javascript function defined on the Number prototype since ECMAScript 3. It has had a couple of iterations of arguments, but the version supported by most browsers provides a very convenient API for formatting currency in a user’s locale: Examples: Note: Wherever I have passed undefined as the first argument to toLocaleString, this simply means...
Chrome’s DevTools are something that I use for a decent portion of my day whenever I’m doing frontend work. I really appreciate how much work has gone into making for a great developer experience, and I’m always stumbing across new tricks to help make me more efficient. Just one of these tricks I picked up this morning from Wes Bos’...
If you are working with a template that has been rendered by a Rails engine (the example I most commonly have is refinery, but any mounted Rails engine behaves the same way), then you will frequently run into a strange problem where route helpers (such as widgets_path, new_whatever_path, etc), result in an undefined method error, which can be quite frustrating...
As a companion to [my post describing how to run tests with docker-compose on Gitlab CI], I converted the build steps this morning to work with Bitbucket Pipelines. Here’s the adapted bitbucket-pipelines.yml file: image: docker:stable pipelines: default: - step: services: - docker script: - apk add --no-cache py-pip bash - pip install --no-cache-dir docker-compose - docker-compose -v - docker-compose run...
I’ve been implementing a style guide this week, and in particular have been trying to focus on creating clean, decoupled, and reusable components. Part of this effort has involved ensuring that all “global” settings that are represented in the style guide are contained in a single settings file. A perfect example of one of these settings is the colour palette....
I’ve been working for some time to get Pawfit (my pet project, literally), continuously deploying. I’ve only recently added tests, so now that I have them, I want a green check each time I push. I run just about all my Rails apps now using Docker and docker-compose, almost always using my own base Docker* files. I choose not to...
I normally work within an RSpec testing envionment, but I definitely enjoy working with more traditional Test::Unit tests when I get the chance. Today I discovered that Minitest, the testing toolkit that has been part of the Ruby standard library since 2.0 has built-in support for mocks and stubs. To use this in a Test::Unit test, simply require "minitest/mocks". Mocking...
I’ve just come across this issue. It’s minor, but it tripped me up! In RSpec, there are three methods I find myself using all the time: before - this is equivalent to the setup method present in many assertion-based test frameworks, and runs before each test. let - this is a lazy-evaluated variable that will be made available to the...