...Open-source software (OSS) is great. Anyone can use virtually any open-source code in their projects." Well, it depends. Licenses can make things difficult, especially when you are developing...

...gem by following these steps: Move all contents of vendor/asset-libs/$library-$version to a new sub-directory vendor/asset-libs/$library-$version/lib/assets/javascripts. That's simply a path sprockets will consider, it is...

By pressing Ctrl + Shift + V you can select a recently copied string for pasting...

track down warnings and to see failing specs immediately or to get an overview of the core functionalities, you can use RSpec's "nested" format. It looks...

Tool validations should require model to be set should require place_id to be set #identifier should include the model and tag if the tool has a tag...

...ve built a few gems over the years. Some of these are quite popular: spreewald (> 1M downloads), active_type (> 1M downloads), and geordi (> 200k downloads) Developing a Ruby gem is...

...Rails applications, with the biggest difference: there is no Rails. This means: no defined structure (neither for code nor directories) no autoloading of classes, i.e. you need to require all...

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

...breakpoint tier in JavaScript, employ this CSS: :root { --current-breakpoint-tier: xs; @media (min-width: $screen-sm-min) { --current-breakpoint-tier: sm; } @media (min-width: $screen-md-min) { --current-breakpoint...

} @media (min-width: $screen-lg-min) { --current-breakpoint-tier: lg; } @media (min-width: $screen-xl-min) { --current-breakpoint-tier: xl; } @media (min-width: $screen-xxl-min) { --current-breakpoint...

umaar.com

Similar to the Webpack Bundle Analyzer, Chrome's new Lighthouse feature … … shows a visualisation of your JavaScript bundles. It's compatible with sourcemaps and is great for understanding large JavaScript...

...in development. It also works on production code, where its usefulness depends on the structure of the productive Javascript code. Warning This will only work when your bundler emits source...

Orca is a Linux screen reader. Since it is part of the GNOME project it should come preinstalled with Ubuntu installations. Getting started To turn on the screen reader you...

...can either go to Settings > Accessibility and then activate Screen Reader in the "Seeing" section or you can simply type orca in your terminal. Alternatively you can use the default...

...binary file. This method might be telling the truth most of the time. But sometimes it doesn't, and that's what causes pain. The method is defined as follows...

...not guaranteed to be 100% accurate. It performs a "best guess" based # on a simple test of the first +File.blksize+ characters. # # Example: # # File.binary?('somefile.exe') # => true # File.binary?('somefile.txt') # => false #--

Sometimes you will need an input field which wraps content and grows in height as soon as content gets longer than the input fields width. There is no way to...

...get a "normal" string input field to wrap as desired, but there are other ways. Here is one pretty easy solution to get what you want: Step 1

...partial template. # _weather.html.erb The weather is <%= condition %> # index.html.erb render partial: 'weather', locals: { condition: 'good' } Since this is a common use-case, there's a shorthand way of rendering the partial...

...Notice that it's not possible to mix the explicit partial: 'template' and the shorthand arguments for defining local variables. So either use longform variant or the shorthand variant, but...

In a nutshell: return statements inside blocks cause a method's return value to change. This is by design (and probably not even new to you, see below) -- but can...

...a problem, for example for the capture method of Rails. Consider these methods: def stuff puts 'yielding...' yield puts 'yielded.' true end We can call our stuff method with a...

api.rubyonrails.org

When working with file uploads, we sometimes need to process intrinsic properties like the page count or page dimensions of PDF files. Retrieving those properties requires us to download (from...

...a blob, as it could leak across different contexts. Ad-hoc Metadata Caching For isolated, single-use requirements, you can write directly to the blob's metadata hash. This evaluates...

github.com

Maintenance mode is enabled on application server as soon as the file /public/system/maintenance.html is present. Note that the servers must be configured accordingly. Installation Add this line to your...

...application's web interface by writing a #{maintenance_basename}.html file to each web server. By default, the maintenance page will just say the site is down for "maintenance", and...

When you need to store structured data (like Ruby hashes) in a single database column with ActiveRecord, a simple way is to use PostgreSQL's jsonb columns. ActiveRecord will automatically...

...serialize and deserialize your Hash to and from JSON, and you can index JSON paths for fast reads. As an alternative, ActiveRecord::Store offers a way to store hashes in...

In a Jasmine spec you want to spy on a function that is imported by the code under test. This card explores various methods to achieve this. Example

...a function hello(): // lib.js function hello() { console.log("hi world") } export hello We have a second module 'client' that exports a function helloTwice(). All this does is call hello() two times...

makandra dev

...Capybara will wait for a short time before raising NoSuchElementError. This is sufficient for basic, server-rendered application. However, as frontends become more complex (more JavaScript, AJAX requests, animations), race...

...scrolling by default. You can address this by disabling smooth scrolling in tests: body, html { scroll-behavior: auto !important; } If you have other scrolling elements with overflow-y: scroll or...

...that is responsible for some (unexpected) behavior. You can use DOM Breakpoints for debugging subtree modifications, attribute modifications or node removal. Here you can see a very simple example that...

...shows what JavaScript lines are responsible for a text change (subtree modification): You can use this Code Pen if you want to try it yourself...

TLS/SSL certificates are often used for HTTPS traffic. Occasionally a service may also use their TLS certificate to support public-key encrypting data (e.g. when it is part of the...

...URI and visible to the user, but contains sensitive information). Here is how to easily fetch such certificate data. certificate = Net::HTTP.start('example.com', 443, use_ssl: true) { |http| http.peer_cert...

makandra dev

...have the same permissions as yourself. Claude Code can run its code in a sandbox. This card explains how to configure it. What the sandbox does and doesn't do...

...A sandbox is not a silver bullet. Commands are still executed. However, the sandbox limits file system access and network traffic. The default configuration in Claude Code is fairly relaxed...

codepen.io

...where elements break the layout's horizontal container width, like navigation buttons of a slider that should be at the left/right of the browser window, or simply by applying a...

...that. Like margin: 0 -10000px plus overflow-x: hidden. There is a much saner approach. Consider the following markup: Hello Let's say .container encloses its contents like so...

...can use find and replace with capture groups (.*?) and backreferences $1 (if you have several groups: $[Capture-Group ID]). Named captures (? .*) are also supported. Examples Replace double quotes with single...

If you want to replace double quotes with single quotes, replacing every " with a ' is prone to errors. Regular expressions can help you out here. Open find and replace...

If Sunspot does not work and fails with a backtrace similar to this: /project/shared/bundle/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:227:in `adapt_response' /project/shared/bundle/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:164:in `execute' /project/shared/bundle/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:158:in `send_and_receive'

then the schema.xml that is shipped with Sunspot is not loaded into Solr correctly. Often the latter can be found in /etc/solr/conf/schema.xml. So copy Sunspot's schema.xml there...

The httpclient gem comes with a custom SSL cert store.

...customizable, application-level cert store is great when you need to deal with broken or self-signed certificates, you usually want to use the cert store from the underlying Linux...