...single in an example application writes to the Rails log. Started GET "/rails/active_storage/blobs/redirect/..." for ::1 at ... Processing by ActiveStorage::Blobs::RedirectController#show as SVG Parameters: ... ActiveStorage::Blob Load (0.4ms...

...at key:...

...(http://localhost:3000/rails/active_storage/disk/...) Redirected to http://localhost:3000/rails/active_storage/disk/... Completed 302 Found in 18ms (ActiveRecord: 0.4ms (1 query, 0 cached) | GC: 13.3ms) Started GET "/rails/active_storage/disk/..." for ::1...

...digits and decimal separators, an "e" is also allowed (to allow scientific notation like "1e3"). Non-technical users will be confused by this. Your server needs to understand that syntax...

...digits (e.g. to_i in Ruby) you'll end up with wrong values (like 1 instead of 1000). Users can change values with the up and down arrow keys.

...It's good to know them all, but we recommend Option 0 or Option 1. Option 0: Sub-query with conditions from a scope You may also pass the existing...

...FROM posts WHERE user_id IN (SELECT id FROM users WHERE trashed=f); Option 1: Pluck foreign keys and make a second query We can first fetch the IDs of...

...User < ApplicationRecord end User.first #=> SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 class User < ApplicationRecord self.implicit_order_column = ['updated_at'] end User.first #=> SELECT "users".* FROM "users" ORDER...

...BY "users"."updated_at" ASC, "users"."id" ASC LIMIT 1

relishapp.com

When you are using lambdas in RSpec to assert certain changes of a call, you know this syntax: expect { playlist.destroy...

When Rails releases a new version of their gems, they also release a number of npm packages like @rails/activestorage or...

...browser.execute_cdp('Network.clearBrowserCache') browser.execute_cdp('Network.emulateNetworkConditions', offline: false, latency: -1, # ms, unlimited downloadThroughput: kbps * 1024 / 8, uploadThroughput: kbps * 1024 / 8, ) end Then 'the Cumulative Layout Shift score should be good...

...entries = entryList.getEntries() entries = dedupe(entries, 'startTime') // Debugging // entries.forEach((item, i) => { // console.dir(item) // console.log( // `${i + 1} current LCP item : ${item.element}: ${Math.max(item.startTime - getActivationStart(), 0)}`, // ) // if (item.element) item.element.style = 'border: 5px dotted lime...

...function takes a third argument with a normalization setting. For example, a normalization of 1 will divide the rank by 1 + the logarithm of the document length: class Message < ApplicationRecord...

...Arel.sql("search_tsvector @@ #{query_sql}")) .order(Arel.sql("ts_rank_cd(search_tsvector, #{query_sql}, 1) DESC")) } # ... end There are many normalization strategies. See the PostgreSQL documentation for a list.

makandra dev

...NOTE: this image ships with a recent version of chrome! services: postgres: image: postgres:17 env: POSTGRES_DB: test POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres PGTZ: "Europe/Berlin" options: >- # Set health...

...checks to wait until postgres has started --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 ports: [ '5432:5432' ] env: DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL...

...constraint. For example, you can tell Sentry to notify you only if it occurs 10 times per hour. Sentry currently offers three constraints when ignoring an issue:

Occurrences (1 time, 10 times, ..) Number of affected users

Install the latest bundler version: gem install bundler Fetching bundler-2.3.5.gem Successfully installed bundler-2.3.5 1 gem installed Update the bundler version in Gemfile.lock: bundle update --bundler Confirm it worked:

...cannot use the latest bundler 2 version, so you need to stay on bundler 1...

...match?(/[[:space:]]/) # => true "\n".match?(/[[:space:]]/) # => true nbsp = "\xC2\xA0".encode!(Encoding::ISO_8859_1) # => "\xA0" nbsp.match?(/[[:space:]]/) # => Encoding::CompatibilityError (incompatible encoding regexp match (UTF-8 regexp with ISO...

# => true "\n".match?(/\p{Zs}/) # => false nbsp = "\xC2\xA0".encode!(Encoding::ISO_8859_1) # => "\xA0" nbsp.match?(/\p{Zs}/) # => Encoding::CompatibilityError (incompatible encoding regexp match (UTF-8 regexp with ISO...

makandracards.com

...Elasticsearch to Opensearch This card deals with specifics concerning the use of searchkick. Step 1: Make Opensearch available for Searchkick In your Gemfile # Search gem 'searchkick' # needs to be...

...if forces connections via https, which we don't have in local environments. Option 1: With plugins Create a Dockerfile FROM opensearchproject/opensearch:2.11.0 RUN /usr/share/opensearch/bin/opensearch-plugin list | grep 'ingest-attachment' || /usr/share/opensearch/bin/opensearch-plugin...

...first argument. Compare these two different ways of calling fun() in Ruby: # Ruby array = [1, 2, 3] fun(array) # same as fun([1, 2, 3]) (1 argument) fun(*array) # same...

...as fun(1, 2, 3) (3 arguments) Depending on your culture the spreading of array elements into multiple argument slots is called "splat args" or "spread args" or "rest operator...

So according to IEEE floating point definition only numbers between -(2^53 - 1) (-9007199254740991) and 2^53 - 1 (9007199254740991) can safely be represented in JavaScript. Note that ECMAScript...

...fully permitted parameters object. You never want that. Why? Because it introduces potential vulnerabilities. [1] Even if you are sure that nobody else accesses the params object after your code...

...be. Be careful what you use it; we have a separate card on that. [1] For example: If params are assigned to model attributes, your model won't complain, since...

...user_input, { class: 'paragraph' }, { sanitize_options: { tags: [], attributes: [] } }) will result in Hello World alert(1) For Rails versions that don't support this option, consider using a custom method...

...change completely for 2.0, so you might find a bunch of unrelated documentation for 1.2 Here is an example, what smarter_csv does for you: Input: first name,last name...

Dan,McAllister,2,,, Lucy,Laweless,,5,, Miles,O'Brian,,,,21 Nancy,Homes,2,,1, Output: [ {first_name: 'Dan', last_name: 'McAllister', dogs: '2'}, {first_name: 'Lucy', last_name: 'Laweless...

...slider--item.is-current, [aria-label="slider's item that is current"]' when /^the (.*)$/ match = $1 match =~ /^(.+?)(?:'s (.+?))?(?: that (.+))?$/ bem_selector = '.' bem_selector << selectorify($1) bem_selector << '--' << selectorify($2) if...

...selector = '[aria-label="' aria_selector << match.gsub('"', '\\"') aria_selector << '"]' [bem_selector, aria_selector].join(', ') when /^"(.+)"$/ $1 else raise "Can't find mapping from \"#{locator}\" to a selector.\n" + "Now, go and...

I, [2024-01-21T06:22:17.484221 #2698200] INFO -- : [4cdad7a4-8617-4bc9-84e9-c40364eea2e4] test I, [2024-01-21T06:22:17.484221 #2698200] INFO -- : [4cdad7a4-8617-4bc9...

...84e9-c40364eea2e4] more I, [2024-01-21T06:22:17.484221 #2698200] INFO -- : [6e047fb3-05df-4df7-808e-efa9fcd05f87] test I, [2024-01-21T06:22:17.484221 #2698200] INFO -- : [6e047fb3...

...integration tests: Capybara.register_driver :chrome do |app| options = Selenium::WebDriver::Chrome::Options.new options.browser_version = '138.0.7204.183' Capybara::Selenium::Driver.new(app, browser: :chrome, options:) end The first time you run a test...

...chromedriver version is installed to the cache ~/.cache/selenium/. You will notice a delay of ~1 minute. Note: This setup does not work, when you use the Rails driven_by method...

...is also suggested by Rubocop's Style/GlobalVars cop. Example before: if 'foo' =~ /foo/ puts $~[1] # => foo end Example after: if 'foo' =~ /foo/ puts $LAST_MATCH_INFO[1] # => foo end

...sort the number of requests for a single IP address. Bash Command awk '{ print $1}' test.log | sort | uniq --count Result 1 87.140.79.41 3 87.140.79.42 Explain awk '{ print $1}' test.log...

87.140.79.41 87.140.79.42 87.140.79.42 87.140.79.42 uniq --count [1] 1 87.140.79.41 3 87.140.79.42 [1] -c, --count: prefix lines by the number of occurrence

...example.metadata[:type] # => "controller" From an example itself or a before block, query self.class.metadata. RSpec 1 Unfortunately, RSpec 1 doesn't offer such filters, and the helpful metadata isn't around...

...in a spec that knows about request and response You can use the RSpec 1 approach to find out if your current example knows about RSpec's request and response...