makandra dev

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 style and various alternative...

...styles that you might encounter in older projects. The difference between the various styles are mostly a matter of taste and optics. I do recommend to not mix styles and...

...popup on all browsers. When you integrate a date picker popup, remember to also set autocomplete="off" on the text input that opens the calendar on click. Otherwise the autocomplete...

...suggestions will cover the calendar box and make it unusable: If you are using a tool like Unpoly you might want to set autocomplete="off" in the JavaScript that also...

...the test, as if the callback function is not executed in the test. However, since the test does not fail, the method :my_method must have been called during the...

...where the method :my_method should be called This will execute the original implementation (see here...

github.com

...investigate by running that example again using rspec . However, this does not work with shared examples, since Rspec doesn't know in which context the shared example should be run...

...But there is a different way: You can run the shared example using the -e, --example option. It takes a string value and runs all scenarios containing that substring in...

Somewhat regularly, you will need to filter a list down to some items and then map them to another value. You can of course chain map and compact, or select/filter...

...if i.even? }.compact => [4, 8, 12] or >> [1, 2, 3, 4, 5, 6].select(&:even?).map { |i| i * 2 } => [4, 8, 12] you can just do...

If you're using a Redis cache in Rails (e.g. :redis_cache_store), it's possible to configure additional parameters for your Redis connection. Example config for Rails 7.2

...store = :redis_cache_store, { pool: { timeout: 0.5 }, read_timeout: 0.2, # default 1 second write_timeout: 0.2, # default 1 second # Attempt two reconnects with some wait time in between reconnect_attempts...

Option 1: Creating a self-signed certificate with the openssl binary As igalic commented on this gist. openssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout server.key...

make it an X.509 certificate, not a Certificate Signing Request. Option 2: Creating a self-signed certificate with the mkcert binary The linked tool mkcert helps you to setup...

...offset, e.g. Thu, 28 Mar 2019 16:00:00 CET +01:00. Ruby's stdlib TZInfo also has time zones, but with different identifiers. Unfortunately, not all timezone codes can...

...time zone has a pretty abbreviation. In such cases, you'll end up with a semi-broken offset identifier that humans won't understand. What to do?

When you have string contents (e.g. a generated binary stream, or data from a remote source) that you want to store as a file using Carrierwave, here is a simple...

While you could write your string to a file and pass that file to Carrierwave, why even bother? You already have your string (or stream). However, a plain StringIO...

...to run JS tests. Given a Vue project that uses Jest (via vue-cli-service) with the following package.json: { "scripts": { "test": "vue-cli-service test:unit --testMatch='**/tests/**/*.test.js' --watch...

...allows us to run Jest tests with yarn test. The only downside of this setup is that debugger statements are ignored with the CLI approach - there are no Browser Devtools...

regular-expressions.info

...ae]y => grey or gray => but NOT graay or graey [0-9] matches a SINGLE digit in the range from 0 to 9 [0-9a-fA-F] hexadecimal digit...

...with caution. Mostly you'll want to use it for small expressions, e.g. for nested sub-regexes. For more details have a look at the card on quantifier modes.

...universe multiverse deb-src http://de.archive.ubuntu.com/ubuntu/ yakkety-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu yakkety-security main restricted universe multiverse deb-src http://security.ubuntu.com/ubuntu yakkety-security...

10 http://de.archive.ubuntu.com/ubuntu yakkety-updates/main amd64 Packages 10 http://security.ubuntu.com/ubuntu yakkety-security/main amd64 Packages 2:7.4.1829-1ubuntu2 10 10 http://de.archive.ubuntu.com/ubuntu yakkety/main...

When you need to add a event listener to hundreds of elements, this might slow down the browser. An alternative is to register an event listener at the root of...

...for events to bubble up and check whether the triggering element (event.target) matches the selector before you run your callback. This technique is called event delegation. Performance considerations

github.com

...really want to get their arguments processable as keyword arguments. Don't change the syntax, or you'll experience pain. Always call super inside of your overridden #initialize method. A...

...things happen in the ActiveRecord world. Just let them happen, otherwise kittens will die somewhere. You don't want that. Example class Item < ActiveType::Object def initialize(attributes) super

...window manager that provides neat features like automatic layouting of windows, good multi-display support with per display workspaces and more. Since it is only a window manager, you will...

...menus, automatic updates etc. Fortunately, you can run Awesome within MATE, by following these steps (tested on Ubuntu MATE 16.04): Awesome + MATE Create the following file at /usr/share/xsessions/Xsession.desktop: [Desktop Entry...

...or every even-numbered item. However, :nth-child can do more. In modern CSS specifications (Level 4), there’s an additional feature that lets you use :nth-child in combination...

...with a list of css selectors. This way, you can target the nth-child within a subset of siblings matching a selector. For example: .container .foo %span.my-selector .bar

tenderlovemaking.com

...are usually believed to have worse performance than those defined via def. Hence, developers sometimes prefer using class_eval to define methods using def, like this: class_eval "def #{attribute...

...for_realsies?; do_things; end" You can benchmark methods defined like this and will see that those defined via def actually do perform better. Basically, it ranks like this:

...set the Sass options. Webpacker const sassLoaderConfig = environment.loaders.get('sass') const sassLoaderIndex = sassLoaderConfig.use.findIndex(config => { return config.loader === 'sass-loader' }) // Disable deprecation warnings inside dependencies sassLoaderConfig.use[sassLoaderIndex].options.sassOptions.quietDeps = true sassLoaderConfig.use[sassLoaderIndex].options.sassOptions.silenceDeprecations = ['import...

module.exports = { module: { rules: [ { test: /\.s[ac]ss$/i, use: [ "style-loader", "css-loader", { loader: "sass-loader", options: { sassOptions: { quietDeps: true, silenceDeprecations: ['import'], }, }, }, ], }, ], }, }; ESBuild esbuild.build({ // ... plugins: [ sassPlugin({ quietDeps: true, silenceDeprecations...

Ctrl + Alt + S > search "rubocop on save" Under "Inspections", check the highlighted box on rubocop -a Caveat: This adds a little time overhead to saving. When you're editing many...

unpoly.com

Version 3.7.0 broke some things in complex forms. Sorry for that. Concurrent user input is hard. 3.7.1 This change fixes two regressions for form field watchers, introduced by 3.7.0:

...a validation for a fragment while a validation request for the same target is still loading. Validations no longer throw an error if a targeted fragment is destroyed while a...

If the project team consists of at least 2 members, do a daily standup. It should not take much longer than 15 minutes. Format Tell everyone else

if there are new developments everyone needs to know about A "still working on X, will probably be done today" is totally fine. No need to tell...

...with additional margin towards their container. Starting with version 121, Chrome now also supports the spec-compliant properties scrollbar-width and scrollbar-color. These allow less styling. You may only...

...track and thumb colors, and a non-specific width like auto, thin, or none. .example { scrollbar-width: thin; scrollbar-color: blue lightblue; } Styling the -webkit-scrollbar-* pseudo elements is still...

In order to have monitoring for Sidekiq (like queue sizes, last run of Sidekiq) your application should have a monitoring route which returns a json looking like this: { "sidekiq": {

...queue_sizes": { "dead": 0, "retries": 0, "monitoring": 0, "low_priority": 0, "mails": 0, "default": 0, "elasticsearch": 0, "high_priority": 0, "file_upload": 0, "scheduled": 0 }, "active_workers": 0 }, "timestamps": {

Update: This is now documented on Edgeguides Ruby on Rails: If you set the :validate option to true, then associated objects will be validated whenever you save this...

...default, this is false: associated objects will not be validated when this object is saved. Setup # post.rb class Post < ActiveRecord::Base has_one :attachment end # attachment.rb class Attachment < ActiveRecord::Base...