...Experts Group JFIF format) Class: DirectClass Geometry: 5472x3648+0+0 Resolution: 350x350 Print size: 15.6343x10.4229 Units: PixelsPerInch Type: TrueColor Endianess: Undefined Colorspace: sRGB Depth: 8-bit Channel depth:
blue: 8-bit Channel statistics: Red: min: 0 (0) max: 255 (1) mean: 110.006 (0.431397) standard deviation: 56.3503 (0.220982) kurtosis: -0.715336 skewness: 0.213533 Green:
...Power.new(build(:user)) Power.with_power(power) do expect(power).to receive(:buildings).at_least(1).time.and_return [building, other_building] expect(build(:unit)).to allow_association_values(building, other_building...
...assignable_values generates: ... Power.with_power(power) do expect(power).to receive(:buildings).at_least(1).time.and_return [building, other_building] unit = build(:unit) expect(unit.assignable_buildings).to contain_exactly(building...
...newIndex > -1 && newIndex < array.length) { // Remove the element from the array const removedElement = array.splice(index, 1)[0] // At "newIndex", remove 0 elements and insert the removed element array.splice(newIndex, 0, removedElement...
...negative to move towards the beginning): const list = [object1, object2, object3] moveArrayElement(list, object2, 1) // list => [object1, object3, object2] moveArrayElement(list, object2, -2) // list => [object2, object1, object3]
...with Selenium and Capybara despite these issues. Both have different advantages and drawbacks. Method 1: Inspecting the file without navigation There are ways to download and inspect a file without...
features/support/download_helpers.rb # This is an adapted approach from # https://collectiveidea.com/blog/archives/2012/01/27/testing-file-downloads-with-capybara-and-chromedriver module DownloadHelpers TIMEOUT = 10 module_function def download_path download_path = Rails.root.join("tmp/test_downloads#{ENV['TEST_ENV_NUMBER']}") FileUtils.mkdir_p...
...you will only synchronize changes from hour 6-29, but forget changes from hour 1-4. Instead your cronjob should remember the last time a sync was performed successfully, and...
...by allowlisting specific directories directories %w[app config public spec] allowed_js_reload_window = 10 # seconds last_js_change = Time.at(0) guard 'livereload', apply_css_live: true, host: '127.0.0.1' do...
...css)$)) do |match| # Any generated CSS changed, send its name to livereload-js match[1] end watch(%r(^app/assets/.*\.js$)) do |_match| # Any source Javascript changed. Assume the next changes...
...hello', 'universe'].each_with_index do |value, index| puts "#{index}: #{value}" end # 0: hello # 1: universe This also works on hashes. However, mind the required syntax: { hello: 'universe', foo: 'bar...
...with_index do |(key, value), index| puts "#{index}: #{key} => #{value}" end # 0: hello => universe # 1: foo => bar The reason is that each_with_index yields 2 elements to the block...
...mx), but set config.not_rfc_mx_lookup_flow = true. Validation methods explained Regex validation (1) is pretty straight-forward and basically "free" since you're not making and network connections...
...all known emails from a production application with a very "typo-heavy" user base (108k+ emails with 5.2k+ unique domains) and found no false positives. So I suggest you...
...Now you should have the build packages: $ ls -l ../ total 7968 drwxr-xr-x 16 root root 4096 Sep 9 22:08 exim4-4.86.2 -rw-r--r-- 1 root root...
...Sep 9 22:09 exim4_4.86.2-2ubuntu2.5_all.deb -rw-r--r-- 1 root root 140620 Sep 9 22:09 exim4_4.86.2-2ubuntu2.5_amd64.build -rw-r--r-- 1 root root 5251 Sep 9 22:09 exim4_4.86.2-2ubuntu2.5_amd64.changes
...Enumerator for chaining with other methods: Person.find_each.with_index do |person, index| person.award_trophy(index + 1) end Ruby's map with index Similarly, you may need an index when using other...
...Here is an example for map: people.map.with_index do |person, index| person.at_rank(index + 1)
...blocks or methods n times. If you accidentally stepped, you can return with finish 1. next [n] -- Runs n lines of code within the same frame Stacktrace frame [n] -- Moves...
...the mocked property is a simple value, it will not work: const x = { foo: 1 } console.log(x.foo) // 1 spyOnProperty(x, 'foo').and.returnValue(2) // Throws: Error: : Property foo does not have...
...can be mocked with Jasmine. You can use it like this: const x = { foo: 1 } console.log(x.foo) // 1 spyOnValueProperty(x, 'foo').and.returnValue(2) expect(x.foo).toBe(2)
...something like: Unable to find visible checkbox "Some label" that is not disabled Solution 1 Use the keyword argument allow_label_click: true within the method call.
...environment. Depending on your CSS framework you also need to adjust the z-index: 1. [data-environment=test] input
Ubuntu 18.04 uses systemd to manage services. There are basically two commands for listing all services and manipulating the state of a certain service: service and systemctl: service manages System...
...overrides LSB defaults (2 3 4 5). insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `bluetooth' overrides LSB defaults (0 1 6).
...might want to validate the MIME type in addition to the name extension. Solution 1 The solution you will see most often is that the model that has a Carrierwave...
Eine ASG skaliert abhängig von der CPU Auslastung, skaliert aber immer maximal 1 Instanz dazu und das nur alle 5 Minuten. Jeden Tag um 20 Uhr steigt der...
Exercise 1: XML On the start page of your Movie DB, show the title of a random movie that is coming soon to theaters. There's an XML feed for...
...a dependency of cucumber-rails), which will break all your tests. The fix Bundler >= 1.14 has a --conservative flag. Using the conservative flag allows bundle update GEM to update the...
The options below might be relevant if you're stuck with Bundler < 1.14: Option 1 This will work if all dependencies for the update are already satisfied.
Given you have a strict CSP that only allows elements from your own domain: Content-Security-Policy: script-src 'self' This will block JavaScript handlers inlined as attribute into your HTML elements. Clicking on the following link will only log an error with a strict CSP: click me click me Solution 1: Move the handler into your JavaScript The recommended solution is to move the handler from the HTML to the allowed JavaScript file that we loaded via . In the example above we could invent a new [data-alert] attribute with the alert message: click me Then our JavaScript intercepts clicks on elements with that attribute: document.addEventListener('click', function(event) { let link = event.target.closest('[data-alert]') if (link) { let message = link.dataset.alert alert(message) event.preventDefault() } }) Solution 2: Allow that one handler in your CSP Some browsers allow the CSP directive script-src-attr. This lets you allow the hashes of actual JavaScript code. The SHA256 hash of alert('hello') is vIsp2avtxDy0157AryO+jEJVpLdmka7PI7o7C4q5ABE= (in Base64). We can allow this one event handlers like this: Content-Security-Policy: script-src 'self'; script-src-attr 'unsafe-hashes' 'sha256-vIsp2avtxDy0157AryO+jEJVpLdmka7PI7o7C4q5ABE=' Note the sha256- prefix. This event handler now works when clicked: click me But any other script will still be blocked: click me Dealing with legacy browsers Currently (November 2023) about 75% of browsers support script-src-attr. Here is a forward-looking compromise that many users use with new CSP features: Have a liberal CSP with old directives supported by all browsers Make your CSP stricter with new, more specific directives for browsers that support it The CSP spec supports that approach in that using newer, more specific directives disable older, more general features. In our case this means: For old browsers, allow all inline scripts For new browsers, disallow inline scripts but allow inline handlers with given hashes Here is a CSP directive that works like this: Content-Security-Policy: script-src 'self' 'unsafe-inline'; script-src-elem 'self'; script-src-attr 'unsafe-hashes' 'sha256-vIsp2avtxDy0157AryO+jEJVpLdmka7PI7o7C4q5ABE=' Old browsers will only use script-src. New browsers will use script-src-elem (for tags) and script-src-attr (for inline event handlers), which override the more liberal rules from script-src.
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...
raise ArgumentError, "Unknown type #{type}" end end end pretty_print_redis(Redis.new(host: "10.0.1.1", port: 6380, db: 15...
...execute all queued jobs perform_enqueued_jobs do HelloJob.perform_later('matthew') assert_performed_jobs 1 end Further Reading Concurrent Ruby ThreadPoolExecutor: The thread pool backing :async Rails AsyncAdapter source: How...
# passes expect(movie1).to have_same_attributes_as(movie3) # Fails with 'Expected movie #112 to have same attributes as movie #113, but the attributes #title and #year differed'
...the setup's scope. describe Klass do describe '#foo' do it 'does basic thing 1' do # isolated test without shared setup here end it 'does basic thing 2' do # isolated...
...Advanced configuration It is helpful to set the global git config git config status.submodulesummary 1. This will add a short summary of the commits in the git submodules. Example:
...config status.submodulesummary 1 $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add ..." to update what will be committed...