Simple Naming for Modular CSS Class Names ··· Nico Hagenburger
An opinion how to implement BEM Show archive.org snapshot . I don't agree with all of Nico's choices, but I applaud his approach to compile a simple and short list of rules.
Related cards:
Unicode for CSS Class Names - Snook.ca
I've used a number of the box drawing entities, namely U+250C, U+2510, U+2514, U+2518 and the square is U+25A1.
Consul: Dynamically access and query powers for a given name, model class or record
Consul 0.6.1+ gives you a way to dynamically access and query powers for a given name, model class or record.
A common use case for this are generic helper methods, e.g. a method to display an "edit" link for ...
How to implement simple queue limiting/throttling for Sidekiq
The sidekiq-rate-limiter gem allows rate-limiting Sidekiq jobs and works like a charm. However, it needs to be integrated on a per-worker basis.
If you want to limit a whole queue instead, and if y...
How to enable pretty IRB inspection for your Ruby class
When Ruby objects are inspected in any modern IRB, some objects (like ActiveRecord instances) are rendered with neat colors and line breaks.
You will not get that for custom classes by default -- which can be annoying if your inspection contains l...
Rails I18n scope for humanized attribute names
ActiveModel classes have a class method .human_attribute_name
. This returns a human-readable form of the attribute:
Person.human_attribute_name(:first_name) # => "First name"
By default Rails will use [String#humanize
](https://ap...
How to emulate simple classes with plain JavaScript
If you want a class-like construct in JavaScript, you can use the module pattern below. The module pattern gives you basic class concepts like a constructor, private state, public methods.
Since the module pattern only uses basic JavaScript, your...
Simple database lock for MySQL
Note: For PostgreSQL you should use advisory locks. For MySQL we still recommend the solution in this card.
If you need to synchronize multiple rails...
Styling and scaling for mobile devices
If you want your application to display properly on iPad, iPhone or Android there are two things to do:
Define a stylesheet for mobile devices
Using the media
attribute on stylesheet
HTML tags allows you to have a CSS for mobile browsers...
BEM naming conventions
We structure our CSS using the BEM pattern.
Our naming convention for blocks, elements and modifiers has evolved over the years. This card shows our current sty...
An auto-mapper for ARIA labels and BEM classes in Cucumber selectors
Spreewald comes with a selector_for
helper that matches an English term like the user's profile
into a CSS selector. This is useful for steps that refer to a particular section of the page, like the fol...