...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
...original `setTimeout()` before it is mocked by `jasmine.clock.install()`. const unmockedTimeout = window.setTimeout function wait(ms = 1) { return new Promise((resolve) => { unmockedTimeout(resolve, ms) }) } it('handles an event', async () => { triggerAnEventOn(this.form)
...bit for a certain condition to occur: async function waitFor(callback) { let msToWait = [0, 1, 5, 10, 100] // we use some exponential fall-off while (true) { let [msToWaitNow, ...msToWaitNext] = msToWait...
...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...
...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...
...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.
...Ruby: Get started with the greatest programming language made for humans. Note that chapters 16 (RDoc), 23 (Multi Threading) and everything after chapter 27 is irrelevant for now References
...lines and paragraphs, and outputs the result. For example: $ ruby count_words.rb test.txt test.txt has 123 words test.txt has 13 lines test.txt has 4 paragraphs Hint Find out about ARGV.
...array-like already. The behaviour is a bit saner than Array[...]. Array.wrap(nil) # => [] Array.wrap([1,2,3]) # => [1,2,3] Array.wrap(1) # => [1] Array.wrap("foo \n bar") # => ["foo \n bar...
Subclass.setting # => false Base.setting # => true Float#round round to a given number of decimals 1.2345.round(2) # => 1.23 1.2345.round(3) # => 1.235 Hash#deep_merge(!) merge hashes recursively String#squish(!) removes leading...
...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...
When you are using lambdas in RSpec to assert certain changes of a call, you know this syntax: expect { playlist.destroy...
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. Number.MAX_SAFE_INTEGER...
...BigInt objects can be used in all major browsers. You can write bigints as 1234567n...
...for an MP4 and an WebM version: Container / Codecs Chrome 80 FF 74 Safari 13 IE 11 Android Browser 80 iOs Safari Samsung Internet MP4, H.264 + AAC ✓ ✓ ✓ ✓ ✓ ✓ ✓ WebM, VP8 + AAC...
...audio playback was verified unless stated otherwise. Operating system Chrome 80 FF 74 Safari 13/9 IE 11 Mobile Chrome Mobile Safari / Samsung Mobile Firefox Ubuntu 18.04 webm webm / / / / /
...foreign key when using Rails’ has_one relationship. This ensures the database enforces the 1:1 constraint and raises an error if your application logic ever violates it.
...S3 Bucket ohne Public access erstellt Wende das Modul für die Region eu-west-1 an Füge zu deinem Modul das managen eines VPC hinzu. Das VPC soll jeweils...
...Public und 3 Private Subnetze (je eines für 1 AZ) aber nur 1 public NAT Gateway haben. Die 3 Private Subnetze sollen Internet Zugriff haben. Erweitere dein Terraform modul um...
...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...
...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...
When Rails releases a new version of their gems, they also release a number of npm packages like @rails/activestorage or...
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...
...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...
...have so far found this fix necessary and tested it on Lenovo P14s Gen 1 Lenovo T14 Gen 1 Observing the situation To get a good overview about load, cpu...
...system and install throttled: $ sudo apt install git build-essential python3-dev libdbus-glib-1-dev libgirepository1.0-dev libcairo2-dev python3-cairo-dev python3-venv python3-wheel $ git clone https://github.com...
...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
...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...
...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...
...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...