...saves CPU time and reduces the bandwidth cost for a request/response exchange to about 1 KB. The most efficient way to produce and compare ETags are the fresh_when and...
...exploit, especially in 2023: The attacker needs to force the victim to make about 1000 requests. The attacker needs to be within the same local network as the victim, so...
Rails log files rotate automatically when they reach approx. 100MB: $ ls -lh log/ -rw-r--r-- 1 user group 55M Sep 15 09:54 development.log -rw-r--r-- 1 user...
...group 101M Aug 22 13:45 development.log.0 This behavior is a built-in feature of Ruby's standard Logger class, which Rails uses by default. To control the maximum...
Rails.logger = Logger.new(STDOUT) ActiveRecord::Base.logger = Logger.new(STDOUT) User.save! #=> D, [2025-09-08T11:12:26.683106 #1094157] DEBUG -- : User Load (1.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id...
...DESC LIMIT $1 [["LIMIT", 1]] Many frameworks in Rails have their own logger configuration and are set on boot. The example above configures the ActiveRecord::Base.logger, but logger also exists...
...and times incomparisons, mind to not compare datetimes with date ranges in MySQL. Visualisation 1. ------- ------- AAA AAA BBB BBB ------- ------- 2. ------- AAA B ------- 3. ------- A BBB ------- 4. ------- AAA BBB ------- 5. -------
...rows, migration performance becomes an issue. We will talk about this in another card. 1. Use the full power of SQL Plain SQL can be very powerful. Once you get...
select_all('SELECT * FROM articles') # => [ { 'name': 'Bioshock Infinite', 'price': 40.0 }, { 'name': 'EVOLAND', 'price': 19.0 } ] As an example, we have Article has_many :vendors. We now introduce a boolean flag...
Execute one query per involved table with a condition like...
...WHERE id IN (123, 125, 170). Execute a single query for a huge table joined from all involved tables...
ActiveRecord prefers option 1, probably because it is less costly. But as soon as your conditions reference another table (like other_table.column), ActiveRecord will go with option 2 and build a...
...adds a new feature called capsules. Use cases: a chrome queue limited to 1 for e.g. PDF processing to not overload the application server an api queue, that limits a...
...jobs from the `unsafe` queue one at a time config.capsule("unsafe") do |cap| cap.concurrency = 1 cap.queues = %w[unsafe] end end Some notes: To know the total threads per sidekiq server...
...There is no upper or lower character limit (except for the absolute maximum of 1 GB). The documentation states: There is no performance difference among these three types, apart from...
...a video with a very low resolution and framerate) Create a 21s video with 1fps and 10x10 resolution: ffmpeg -t 21 -s 10x10 -r 1 -f rawvideo -pix_fmt rgb24...
.../dev/zero sample_21_seconds.mp4 Option Explanation -t 21 set the length to 21s -s 10x10 set the resolution the 10 by 10 pixel -r 1 set the framerate to 1...
...margin_top: '200px', # Height of the header, can be px or mm margin_bottom: '150px', # Height of the footer, can be px or mm header_spacing: 52.197, # margin_top converted...
...number or the custom JSON encoded hash: function allQueryInformation() { var pdfInfo = {}; var queryStrings = document.location.search.substring(1).split('&'); for (var query in queryStrings) { if (queryStrings.hasOwnProperty(query)) { var keyValuePair = queryStrings[query].split...
ActiveRecord::Base.clear_active_connections # <- close additional database connections end render json: Hash[*group_ids_and_html.flatten(1)] end private def load_group(group_id) Group.find(group_id) end def render_group_html...
...this releases the commit we need c67e8d8 o Merge pull request #44641 from SkipKayhil/fix-rubocop-errors 1afe117 o Update CHANGELOG [ci skip] 87528db o Revert "Merge pull request #43209 from mpestov/check-basic-auth-credentials"
...branch '6-1-sec' into 6-1-stable 6607333 │ o Preparing for 6.1.4.7 release 1f66424 │ o bumping version b0b5eaf │ o Added image trasnformation validation via configurable allow-list
...fingerprint and stack trace rules at https://sentry.io/settings/projects/$project-id/issue-grouping. Fingerprint rules have this syntax: 1 or more key:value conditions, followed by ->, followed by your custom fingerprint string. Read the...
...address_group(self) do pp.seplist(inspections_tuples, proc { pp.text "," }) do |(name, value)| pp.breakable " " pp.group(1) do pp.text name pp.text ":" pp.breakable pp.text value end end end end private def inspections_tuples...
...rendering and DB query durations Good for spotting problematic endpoints The "Recent requests" screen (1 hour history) Shows individual requests Provides the full list of DB queries per request, color...
...commits into patch files. Those can be used to apply to a different repository [1] or by someone else (e.g. sent when sent to them via e-mail).
...the patch file created earlier. More information git format-patch git apply git am [1] Note that you can add other git repositories/directories as a remote source. Sometimes you don...
...from hogging too many resources: In inactive tabs, timeouts and intervals are throttled to 1+ seconds After a longer period of inactivity, some browsers will completely unload your tab, stopping...
...of my favorites: console.log takes many arguments E.g. console.log("Current string:", string, "Current number:", 12) Your output can have hyperlinks to Javascript objects E.g. console.log("Check out the current %o...
...of objects) to console.table(). Example: console.table(["apples", "oranges", "bananas"]) prints: (index) Values 0 "apples" 1 "oranges" 2 "bananas" Grouping output in nested, collapsible sections Great for debugging deeply nested or...
...Both requests scan the users table and see that the name is available Worker #1 passes validation and sucessfully creates a user with the available name Worker #2 passes validation...
manufacturer, serial_number = product.match(PRODUCT_PATTERN)&.captures # or manufacturer = product[PRODUCT_PATTERN, 1] serial_number = product[PRODUCT_PATTERN, 2] Example with named groups (<2.4) PRODUCT_PATTERN = /\A(? .+) S...
...remove) certain lines through navigating in the changes and select the current line with 1 Split a chunk with...
You should look for rows with State: LISTEN. Rows for local address 127.0.0.1 or ::1 (IPv6) can only be reached from your own PC: Netid State Recv-Q...
...Send-Q Local Address:Port Peer Address:Port Process tcp LISTEN 0 1024 127.0.0.1:3000 0.0.0.0:* users:(("ruby",pid=33985,fd=18)) Rows for local address 0.0.0.0 can be reached...
...def full_filename 'thumbnail.jpg' end process(take_frame: [at: 0.seconds]) process(resize_to_limit: [1280, 720]) end def take_frame(at:) raise TakeFrameError, "Input file does not exist, capturing a...
...File.exist?(current_path) run_ffmpeg! '-ss', ffmpeg_target_second(at), '-i', current_path, '-vframes', '1', '-qscale:v', '2', current_path raise TakeFrameError, "Something went wrong while capturing a frame for...
...tagname.. for "everything after that tag" Example output for spreewald: 60 Tobias Kraze 12 Henning Koch 7 Dominik Schöler 6 Thomas Eisenbarth 5 Martin Straub 3 Minh Hemmer...
1 Manuel Kallenbach 1 Andreas Robecke Alternatives There is a powerful CLI tool called git who...