...When I erase my query, the popup disappears. - The popup contains a maximum of 10 suggestions. - When I click outside the popup, it disappears. - If I click on a suggestion...
...the issue turns out to be more complicated than anticipated. We suggest a 0,1,2,3 point scale, with the following meaning: 0 points: <= 1h 1 points: <= half a...
...Time.new will initialize with the current Time in your Timezone, DateTime.new initializes at January 1, at an undefined year, without a timezone offset. Comparing or calculating with both datastructures mixed...
...and formatting time of day objects, some of them are listed below: Tod::TimeOfDay.parse "15:30" # => 15:30:00 Tod::TimeOfDay.parse "3:30:45pm" # => 15:30:45 Tod::TimeOfDay.new...
...on Ubuntu 24.04 with Xorg. Background Ubuntu always sets the primary display to the 1st (i.e. internal) display whenever I connect to a new Dock/Hub. I want my primary display...
...assumes that external display order is left to right. If displays are ordered e.g. 1, 3, 2, connect displays differently. Script The script's comments should explain what is going...
...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...
...for performance measurements. I wrote a small script that runs each query to benchmark 100 times and calculates the 95th percentile. Note: The script requires sudo permissions to drop RAM...
...runner lib/scripts/benchmark.rb` require 'open3' # For debugging # Rails.logger = Logger.new(STDOUT) # ActiveRecord::Base.logger = Logger.new(STDOUT) ITERATIONS = 100 PERCENTILE = 0.95 def system!(*) stdout_str, error_str, status = Open3.capture3(*) unless status.success? puts [status, stdout...
...each array element: users = User.all user_names_by_id = users.to_h { |user| [user.id, user.name] } { 1 => "Alice", 2 => "Bob" } Array#to_h on an array of key/value tuples (Ruby 2.1+)
users = User.all user_names_by_id = users.map { |user| [user.id, user.name] }.to_h { 1 => "Alice", 2 => "Bob" } Enumerable#index_by (any Rails version) users = User.all users_by_id = users.index...
...browser process crashes on your users. Although this guide has been written for Angular 1 originally, most of the advice is relevant for all client-side JavaScript code.
link: (scope, element, attributes) -> updateTime = -> var now = new Date(); element.text(now.toString()) setInterval updateTime, 1000 The version below clears the interval and doesn't leak memory: @app.directive 'clock', -> link: (scope...
...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.
...for hash equality other.name == name end end bob = Person.new('bob') phone_list = { bob => '0821 123', } phone_list[bob] # returns '0821 123' phone_list[Person.new('bob')] # returns nil [bob, Person.new('bob...
[ [0] #<Person:0x0000559054263420 @name="bob">, [1] #<Person:0x000055905404ee50 @name="bob"> ] Only after implementing hash we get the expected results: class Person ... def hash name.hash end end bob = Person.new('bob...
>> tel_to '(01234) 555 6789' => (01234) 555 6789 >> tel_to '+1 555 123-456' => +1 555 123-456 If you have user-provided phone numbers, you may want...
...should not include that zero. def tel_to(text) groups = text.to_s.scan(/(?:^\+)?\d+/) if groups.size > 1 && groups[0][0] == '+' # remove leading 0 in area code if this is an international number...
...OpenGraph image Some social networks display your image with an aspect ratio of 2:1 (wide), some with (1:1), some both. Facebook supports only 1.91:1. Images that do...
...make sure relevant content is still visible when cropped. We recommend a resolution of 1200x630. Note that Facebook does not support SVG images for og:image. You should use PNG...
Run the test to see it fail bundle exec rspec F Failures: 1) File "/entrypoint.sh" is expected to exist Failure/Error: it { should exist} expected File "/entrypoint.sh" to exist...
.../spec/dockerfile_spec.rb:10:in `block (2 levels) in <top (required)>' Finished in 1.94 seconds (files took 0.31723 seconds to load) 1 example, 1 failure Failed examples: rspec ./spec/dockerfile_spec.rb:10 # File "/entrypoint.sh...
config.cache_store = :redis_cache_store, { pool: { timeout: 0.5 }, read_timeout: 0.2, # default 1 second write_timeout: 0.2, # default 1 second # Attempt two reconnects with some wait time in...
reconnect_attempts: [1, 5], # default `1` attempt in Redis 5+ url: REDIS_URL, error_handler: ->(method:, returning:, exception:) { Sentry.capture_exception(exception) }, } Timeouts You probably want to adapt these settings...
...nmap -A makandracards.com -p 443 Starting Nmap 6.40 ( http://nmap.org ) at 2016-07-26 13:45 CEST Nmap scan report for makandracards.com (92.51.173.90) Host is up (0.014s latency).
...Service detection performed. Please report any incorrect results at http://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 6.63 seconds
...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 / / / / /
...it might still be a good idea to use the same path of proof. 1. Identify the query your application produces query = User.order(:last_name, :created_at).to_sql
...Scan using index_users_on_last_name_and_created_at on users (cost=0.28..140.10 rows=1164 width=187) (actual time=0.045..0.499 rows=1164 loops=1)"} # => {"QUERY PLAN"=>"Planning...
...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.
...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...
...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...
...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 Rails releases a new version of their gems, they also release a number of npm packages like @rails/activestorage or...
...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
...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