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

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

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

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

Getting started with Claude Code is super simple. Once you've made yourself familiar with it, you may want to improve your workflow. Here are a few quick tips that...

...are relevant to most users. Keyboard Shortcuts There are lots of keyboard shortcuts. Here are the most relevant ones. Insert a Newline To add a newline without submitting your prompt...

We usually ship applications that self-host webfonts to comply with GDPR. Many popular web fonts are available as NPM packages provided by Fontsource. We recommend using those instead of...

...downloading and bundling font files yourself. (See below for a list of benefits.) Usage Go to fontsource.org and search for the font you want to add (or a font that...

kukicola.io

Using ActiveRecord's #signed_id and .find_signed methods you can create URLs that expire after some time. No conditionals or additional database columns required...

Sometimes huge refactorings or refactoring of core concepts of your application are necessary for being able to meet new requirements or to keep your application maintainable on the long run...

...different parts. Try to make tests green for each part of your refactoring as soon as possible and only move to the next big part if your tests are fixed...

...applications can be used by multiple users at the same time. A typical application server like Passenger has multiple worker processes for a single app. In a distributed deployment setup...

...like we use at makandra you will even have multiple application servers, each with their own worker pool. This means that your code needs to deal with concurrent data access...

AuthExternal pwauth Require group admin You need to first install libapache2-mod-auth-sys-group. You don't get any error message if you haven't installed it but...

...it doesn't work. sudo apt-get install libapache2-mod-auth-sys-group

...full trace reveals that ActionPack's action_controller/integration.rb is breaking while doing this: cookies = @headers['Set-Cookie'] cookies = cookies.to_s.split("\n") unless cookies.is_a?(Array) cookies.each do |cookie| name, value = cookie.match...

...happened for me. That is how my cookie looked when debugging: (rdb:1) puts headers['Set-Cookie'] remember_token=abcdef123456; path=/; expires=Mon, 31-Dec-2029 23:03:29 GMT...

There are cases when you need to select DOM elements without jQuery, such as: when jQuery is not available when your code is is extremely performance-sensitive

...an entire HTML document (which is hard to represent as a jQuery collection). To select descendants of a vanilla DOM element (i.e. not a jQuery collection), one option is to...

...translation data {...

...} can not be used with :count => 1. key 'one' is missing. They seem to appear out of the blue and the error message is more confusing than helpful...

...all models on the activerecord.attributes level (or activemodel.attributes) instead of having the same translation string in each model's attribute block: # I18n file like en.yml en: activerecord: attributes: updated_at...

stackoverflow.com

This card will show you how to use git rebase --onto without confusion. Use case You've got two feature branches (one and two), where two depends on one. Now...

...branched two from it (i.e. after code review the commits of branch one are squashed). Thus the commit history of branch one has changed. Branch two's history however didn...

...to know them all, but we recommend Option 0 or Option 1. Option 0 (recommended): Sub-query with conditions from a scope You may also pass the existing User.active scope...

...the joined table: Post.where(user: User.active) This will make a single query. It uses a sub-query, which is slow in MySQL, but fast in PostgreSQL: SELECT * FROM posts WHERE...

Sometimes it might be helpful to have a version history for a gem, e.g. when you want to see if there is a newer Rails 2 version of your currently...

At first you should search your gem at RubyGems. Example: will_paginate version history. The "Tags" tab at GitHub might be helpful as well...

DirectUpload allows you to upload files to your file storage without having to wait for the form to submit. It creates AJAX requests to persist the file within your form...

...and wraps them in a little API. This card will show you how to use it in order to create in-place file uploads with progress and a remove button...

Use this MySQL command to show further info about a table: SHOW CREATE TABLE tags; This will output a table schema like this: CREATE TABLE `tags` ( `id` int(11) NOT...

...t find a complete and working documentation on how to do this. But this steps succeeded (at least once). Install build dependencies $ sudo apt-get install pbuilder devscripts dpatch grep...

...sources to apt sources list (if you don't have it yet) deb-src http://security.ubuntu.com/ubuntu xenial-security main universe multiverse restricted Start the process: $ mkdir exim

A flaky test is a test that is often green, but sometimes red. It may only fail on some PCs, or only when the entire test suite is run.

...JavaScript periodically requests updates from a server to keep a in sync with the latest server-site data. Sometimes the test ended right after a polling request was sent, but...

This card compares patterns to store trees in a relation database like MySQL or PostgreSQL. Implementation examples are for the ActiveRecord ORM used with Ruby on Rails, but the techniques...

We will be using this example tree (from the acts_as_nested_set docs): root | +-- Child 1 | | | +-- Child 1.1 | | | +-- Child 1.2 | +-- Child 2 | +-- Child 2.1 | +-- Child 2.2