Understand all the terms in How Ruby method lookup works, in particular: include extend singleton class prepend Do you understand why object.extend(SomeModule) is the same as object.singleton_class.include...

How does include and extend work together with inheritance? You may also read more about the Ruby Object Model, if all of this is quite confusing to you. Metaprogramming...

...the filename "([^\"]*)"$/ do |filename| patiently do match = page.all('img').find do |img| img[:src].include?("/#{filename}") end expect(match).to be_present end end Note that the check needs to...

...helper since the DOM might change between page.all('img') and the check img[:src].include?, causing a Selenium::WebDriver::Error::StaleElementReferenceError. If you can express a check in a readable...

You can not use the hash_including argument matcher with a nested hash: describe 'user' do let(:user) { {id: 1, name: 'Foo', thread: {id: 1, title: 'Bar'} } it do

...user).to match( hash_including( id: 1, thread: {id: 1} ) ) end end The example will fail and returns a not very helpful error message: expected {:id => 1, :name => "Foo", :thread...

makandra dev

...it, you may use the following GitHub Actions template for the CI integration. It includes jobs for rspec (parallelized using knapsack, unit + feature specs), rubocop, eslint, coverage and license_finder...

...matrix.partition }} path: tmp/artifacts/capybara - name: Upload coverage results uses: actions/upload-artifact@v4 with: name: coverage-report-${{ matrix.partition }} include-hidden-files: true path: tmp/coverage/**/* rubocop: name: Lint Ruby Code runs-on: ubuntu-latest...

DevOps Curriculum

...makandra.de. 155 IN TXT "v=spf1 ip4:195.226.174.184 ip4:195.226.174.185 ip4:62.116.166.45 ip4:62.116.166.112 include:_spf.google.com include:_spf.makandra.de -all" Du weißt, was sich hinter "DNS Round Robin" verbirgt und was...

...users, relations, extensions,...

...in form of a script (text) file. Delete statements will be included to remove existing databases when sourcing this dump. This is useful for moving the content...

...single database A dump of the given database will be created. This does not include the user. When restoring this dump you must create the user and the database before...

makandra dev

...of the given parent's descendants matching the given selector. The list will also include the parent element if it matches the selector itself. up.element.closest() Returns the first element that...

...could have happened earlier. Recommendation for our projects New projects New projects should not include jQuery Use a Polyfill like dom4 to normalize browser support Use up.element, Umbrella.js oder even...

...Sprockets) does not seem to be affected by this issue, as every generated file includes a BOM. The first rule above is fulfilled. You can check if a file has...

...a BOM with the file command, e.g. file styles.css should include the text "(with BOM)". Webpack Webpack does not include a BOM per default. Adding the unpopular library webpack-utf8...

validates_attachment_presence :attachment validates_format_of :attachment_file_name, :with => /^\d+\.jpg$/ include DoesCopyErrors[from: :attachment_file_name, to: :attachment] end If you'd like to remove the...

...once they are copied to the target attribute, you can use the :move option: include DoesCopyErors[from: :attachment_file_name, to: :attachment, move: true...

...this for packages like jQuery. Otherwise the jQuery library attached to window might not include the functions of your packages that depend on jQuery. Note: This is only an issue...

...within the application. Background By default yarn will create a folder node_modules that includes all packages and their dependencies. In the example below we see two packages of jQuery...

Rails Database Best Practices ActiveRecord: Specifying conditions on an associated table Preload, Eagerload, Includes and Joins Battling n+1 Queries in Rails Tips Preventing scopes from loading

...AND title="Foo" Preloading associations When you preload associations with #preload or #includes Rails will make one query for each table: Card.where(title: 'Foo').preload(:user).to_a # SELECT * FROM...

In the discussion of the difference between include and extend in Ruby, there is a misconception that extend would add methods to the singleton class of a ruby object as...

...module ClassMethods def foo puts "Foo!" super end end end class User singleton_class.include(A) include B end User.instance_eval do def foo puts 'Foo' super end end User.foo # => "Foo Foo...

...valid_content_type errors.add(:portrait, "is an invalid file type") unless %w(image/jpeg image/png).include? file.sanitized_file.content_type end end class ImageUploader < BaseUploader end This works perfectly fine, but now every...

...Configure tsconfig.spec.json to compile the new main.ts file, e.g.: { // other options like "extents":, "compilerOptions":, "include": "files": [ "src/app/shared/spec/setup/main.ts" ], } Why Use a Custom Test Entry Configure global test environment providers Register custom...

...options aligned with CLI defaults (strict error checking) Note: Runs for every test execution, including ng test --include for individual specs Patterns Custom Entry Point with Strict Options // angular.json

makandra Curriculum

...better matchers Which of the following two lines is better? Why? expect(array).to include(5) expect(array.include?(5)).to eq(true) Custom matchers Write a custom matcher called have...

Consul 0.6.1+ gives you a way to dynamically access and query powers for a given name, model class or record...

...e.g. the superclass of the superclass): ActiveRecord::RecordNotFound.ancestors.include?(StandardError) # => true Note that ancestors also includes the receiving class itself as well as any included modules (which is quite practical for...

makandra dev
github.com

...as simple as I could. More often than not, real JSON endpoints may also include data from (hopefully preloaded) associated records or data that needs to be transformed at render...

Inspect the record scope that is used to generate the JSON. Does scope.explain include a reference to an index it's using? Does it come with an ORDER that...

...testing uncomfortable. Automatic insertion of soft hyphens You can use JavaScript libraries like hypher (includes LGPL patterns!) to automatically insert soft hyphens into the text of a DOM node.

...language like URLs or source code. Unlike soft hyphens a tag will not be included in the clipboard when copying text. Option 4: overflow-wrap CSS property

When you eagerly load an association list using the .include option, and at the same time have a .where on an included table, two things happen: Rails tries to load...

...the activity from above now suddenly no longer contains any other users: activity = Activity. .includes(:users) .where(users: { id: [4] }) .find(42) activity.users.ids # here happens the unexpected # => [4] Workarounds

...being sent to the user. Vary: Accept in Rails Vary: Accept is unfortunately not included by default in Rails < 6.1. That is a bug and differs from the HTTP-specification...

...in RFC 2616 14.44 which states: An HTTP/1.1 server SHOULD include a Vary header field with any cacheable response that is subject to server-driven negotiation. Doing so allows a...

makandracards.com

...the plugin being installed and in the end wasn't sure if it was included in the standard image or not. With the above command, it will be installed, if...

...it is not already included. In your docker-compose.yml add: opensearch: image: registry.makandra.de/makandra/my-project/opensearch:1.0 build: ./docker/opensearch command: ["./opensearch-docker-entrypoint.sh", "-Ediscovery.type=single-node"] ports: - "127.0.0.1:9200:9200" environment: - "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m...

...also works for more complex conditions, e.g. with ranges like where(created_at: 2.days.ago..), including orphan checks via where.missing(...). Important The inverted scope will not return rows where role is...

...for example for: Scopes using joins or similar, as where_values_hash does not include those. Conditions where values are ranges, e.g. where(created_at: 1.week.ago..) has an empty where...

Let's have a look at the internal transformation process of ffmpeg. It includes (de)muxing packets and de/encoding frames to keep everything in sync. The ASCII illustration is...

...Video Playback" section). The result can be verified with ffmpeg -i output.mp4 and should include lines similar to these: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':