caniuse.com

All major browsers (IE8+, FF3.5+, Safari 4+, any Chrome) support sessionStorage, a JavaScript storage object that survives page reloads and browser restores, but is different per new tab/window (in contrast...

...to localStorage which is shared across all tabs). MDN says: The sessionStorage object is most useful for hanging on to temporary data that should be saved and restored if the...

makandra dev

...to add some custom functionality. This card contains some tips how to achieve this. Setup Basically, follow the guide in the Rails documentation. The automated script may not work with...

...it should be easy to fix. If you don't want the default css shipped with Action Text, you can copy the stylesheet from basecamp's github into your project...

...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...

makandra dev

Ever wondered how you can create a simple table output in bash? You can use the tool column for creating a simple table output. Column gives you the possibility to...

...same level. Pipe output to column -t (maybe configure the delimeter with -s) and see the magic happening. detailed example I needed to separate a list of databases and their...

...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

...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...

Whenever you have to deal with randomness in a jasmine test there are some spy strategies to help you out! Let's say we have a method Random.shuffle(array) to...

...shuffle an array randomly and a class that uses shuffle within the constructor. returnValue & returnValues it('shuffles the array', () => { spyOn(Random, 'shuffle').and.returnValue([3, 2, 1])

...for an option like Yarn's --frozen-lockfile which validates that. Here is what seems to be the way to do it. Using npm clean-install Running npm clean-install...

...versions while npm clean-install will complain. You can use npm ci as a shortcut for npm clean-install. Combine with a cache The idea of a "clean install" is...

When using Rails to truncate strings, you may end up with strings that are still too long for their container or are not as long as they could be. You...

...did not use it. Since Firefox 7 you can! Note that this only works for single-line texts. If you want to truncate tests across multiple lines, use a JavaScript...

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...

For searching in large database tables we usually use PostgreSQL's fulltext search capabilities. While this works reasonably well for content primarily consisting of prose, it is not necessarily a...

...good solution for all use cases. The main issue is that it is only possible to search for prefixes of text tokens, which can potentially be unexpected for users.

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

...Chrome to check if the problem disappears. Keep in mind though that running outdated software, especially web browsers, is in most cases not a good idea. Please verify periodically if...

...you still need to run the old version or if an even more recently updated version fixes the problems introduced in your version. Here's how to get old versions...

makandra dev

...they reach approx. 100MB: $ ls -lh log/ -rw-r--r-- 1 user group 55M Sep 15 09:54 development.log -rw-r--r-- 1 user group 101M Aug...

...development.log.0 This behavior is a built-in feature of Ruby's standard Logger class, which Rails uses by default. To control the maximum file size, set config.log_file_size...

Detecting if a Javascript is running under Selenium WebDriver is super-painful. It's much easier to detect the current Rails environment instead. You might be better of checking against...

...the name of the current Rails environment. To do this, store the environment name in a data-environment of your . E.g., in your application layout: <html data-environment=<%= Rails.env %>>

Most of the time, when you are interested in any log output, you see the logs directly on your console or you tail / grep some logfile in a separate terminal...

...In rare cases it's helpful to redirect the Logger output temporary to e.g. STDOUT. Rails.logger = Logger.new(STDOUT) ActiveRecord::Base.logger = Logger.new(STDOUT) User.save! #=> D, [2025-09-08T11...

...t easily customizable. Example usage /slackfont Comic Neue to use "Comic Neue" (if installed) /slackfont system-ui to use your desktop's system font in Slack. /slackfont (without an argument...

...the default font. Some fonts may be unavailable If you installed Slack through Snap, only system-wide installed fonts (i.e. fonts located in /usr/share/fonts/ or /usr/local/share/fonts/) are available.

...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...

...Before merging back: reinstate reverted features in a temporary branch, then merge that branch. Scenario Consider your team has been working on several features in a branch, made many changes...

...fix them, if necessary. Maybe tests were added that expect the removed functionality as a side-effect. Merge the master into your branch regularly, especially when you have multiple teams...

open-ui.org

tl;dr When browsers start to adapt proposals from Open UI, it might not be necessary to use any 3rd party libraries to have nice components and controls in web...

...applications e.g. selects. It would require only a minimum of CSS and Javascript to get them working and looking good. The purpose of the Open UI, a W3C Community Group...

...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...

To set a cookie in your test browser for cucumber tests, you need to know which driver you are using. Use the step below according to your driver.

...to "([^\"]+)"$/ do |key, value| headers = {} Rack::Utils.set_cookie_header!(headers, key, value) cookie_string = headers['Set-Cookie'] Capybara.current_session.driver.browser.set_cookie(cookie_string) end Note that Rack::Utils is only used to...

Select2 is a fantastic library for advanced dropdown boxes, but it depends on jQuery. Alternatives Tom Select There is a selectize.js fork called Tom Select. It is well tested, comes...

...with Bootstrap 3, Bootstrap 4 and Bootstrap 5 styles and is easy to use. You might miss some advanced features. Known issues: Dynamic opt-groups in AJAX requests are not...

Sometimes the need arises for SSL in local development. We have guides for different webservers, this one is for puma. make sure mkcert is installed create an SSL certificate for...

...bundle exec rails s Accept the certificate in your browser See also Creating a self-signed certificate for local HTTPS development