makandra dev

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

masilotti.com

...quite manageable. Let’s dive into how this works. Only few fixture per model (1-2 is enough in most cases) You should only have a minimal amount of fixtures...

...User.count == 3 end Good example: test "user can be created" do assert_difference "User.count", 1 do post users_path, params: { first_name: "Foo", last_name: "Bar" } end end Conclusion

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

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

makandra dev
github.com

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

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

...explains some options to make browsers wrap inside a long word like "Donaudampfschifffahrt". Option 1: hyphens CSS property (preferred) Modern browsers can hyphenate natively. Use the hyphens CSS property:

The hyphens property has good browser support. If you need to support Safari < 17, you may need to also set -webkit-hyphen. If a browser lacks the dictionary for...

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

...to use our own daho.im service. All daho.im subdomains resolve to your local IP (127.0.0.1). That means you can use a different hostname for different apps, and you will stay...

...logged in in each app: http://foo-app.daho.im:3000 => 127.0.0.1 http://bar-app.daho.im:3000 => 127.0.0.1 http://bam-app.daho.im:3000 => 127.0.0.1 Caution It's safe to use daho.im since it's our own domain. Don't use...

makandra dev

$ ruby --yjit -e "puts RubyVM::YJIT.enabled?" true # via ENV variable $ RUBY_YJIT_ENABLE=1 ruby -e "puts RubyVM::YJIT.enabled?" true # Start Ruby without YJIT, but enable it later

...to not use the CLI flag --yjit or the ENV variable RUBY_YJIT_ENABLE=1 for starting Rails processes on your server...

end describe '#age' do it { is_expected.to validate_inclusion_of(:age).in_range(1..100) } end end See the shoulda-matchers README for a full list of matchers provided...

...with Rails 6 and below, or when the inverse scope may contain NULL values. [1] There are two different ways of "inverting a scope": As an example, consider the following...

...role" IN ('admin', 'superuser')) That also works with range conditions like where(created_at: 1.week.ago..), but does not work for missing (because its join statement is lost). So, sadly this...

...and straightforward) Enable caching for individual test Enable caching for individual test (file cache) 1. Leave the default configuration 2. Add a caching helper which gives you a unique file...

...some_key')).to be(true) end end Enable caching for individual test (memory store) 1. Leave the default configuration 2. Now stub the Rails cache and clear it before each...

Always optimize: Don't do stupid things with the database. Avoid "n + 1" queries. Don't do costly calculations live when you can precalculate and cache. Don't...

...instantiate 1000s of records. Use query_diet. Add database indexes. Don't descend into callback hell. Use form models. Optimize on demand: Don't optimize without knowing what's actually...

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

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

...class that includes your module, and no longer exists after your test has finished. 1. Defining the class and assigning to a constant (preferred) describe Notifier do before do

Example Compound selectors like ... .datepicker .prev, .datepicker .next, .datepicker .switch padding-bottom: 1rem ul li, ol li list-style-type: none can be simplified by using the :is...

...pseudo selector ... .datepicker :is(.prev, .next, .switch) padding-bottom: 1rem :is(ul, ol) li list-style-type: none Hint The specificity of :is() is equals to its most specific argument...

linux.die.net

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

...when constructing an array ['foo', *nil] # => ['foo'] Remove blank values from collections Array array = [1, "", nil, 2, " ", [], {}, false, true] # Any Rails version array.reject(&:blank?) # => [1, 2, true]

...array.compact_blank # => [1, 2, true] Hash hash = { a: 1, b: "", c: nil, d: 2, e: " ", f: [], g: {}, h: false, i: true } # Any Rails version hash.reject { |key, value| value.blank? }

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

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

Redis database size via Ruby client irb(main):002> Redis.new(url: 'redis://localhost:16380/1').info.fetch('maxmemory_human') => "512.00M" Redis database size via CLI $ redis-cli --port 16380 --database...

...1 INFO memory | grep maxmemory_human maxmemory_human:512.00M Memory footprint If you want to calculate the estimated Redis memory usage of a job, you can measure the consumed...

end (::) failed steps (::) Got 2 failures from failure aggregation block "multiple expectations": 1) first expectation failed 2) second expectation failed As you can see, the test is not...