makandra dev

...within the diff. Colors The value for color configuration variables is a list of 1-2 colors and 0-1 attributes, separated by spaces. Colors: normal, black, red, green, yellow...

...Read the following chapters from The Pragmatic Programmer, anniversary edition (in our library): Chapter 1, Topic 3: Software Entropy Chapter 2, Topic 9: The Evils of Duplication Chapter 2, Topic...

...10: Orthogonality Chapter 5, Topic 28: Decoupling (and the Law of Demeter) Read the following chapters from Clean Code (in our library): Chapter 1: Clean Code Chapter 2: Meaningful Names...

Why nouns from the client domain do not always map to Ruby models 1:1. E.g. although an "address book contact" and a "user" are both human beings, it...

mise.jdx.dev

...install -dm 755 /etc/apt/keyrings wget -qO - https://mise.jdx.dev/gpg-key.pub | gpg --dearmor | sudo tee /etc/apt/keyrings/mise-archive-keyring.gpg 1> /dev/null echo "deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.gpg arch=amd64] https://mise.jdx.dev/deb stable main" | sudo tee...

...a version string) is easy: $ mkdir -p ~/.config/mise/config.toml $ echo '[tools]' > ~/.config/mise/config.toml $ sed -i 's/\([^ ]*\).*/\1 = "latest"/' .tool-versions >> ~/.config/mise/config.toml Now you can just run mise upgrade and it will bring...

makandra dev

end def db_number # Returns a number between 2 and n. # Redis db#1 is used for development. db_number = 1 if rails_env == 'test' normalized_test_number = [ENV...

...TEST_ENV_NUMBER'].to_i, 1].max db_number += normalized_test_number end db_number end def port case rails_env when 'staging' # when 'production' # else 6379 # default Redis port...

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

...is to encode the string using JSON, and then escaping all code points above 127 using unicode escape sequences: escapeHighASCII('{"foo":"xäy"}') // => '{"foo":"x\\u00e4y"}' Escaping high ASCII in JavaScript...

...function escapeHighASCII(string) { let unicodeEscape = (char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, '0') return string.replace(/[^\x00-\x7F]/g, unicodeEscape) } Escaping high ASCII in Ruby def escape_high_ascii(string...

...shutdown the Elasticsearch cluster, as soon as everything works as expected. flowchart TB subgraph "1" A0[App]-- Search -->ES0[Elasticsearch] A0[App]-- Update -->ES0[Elasticsearch] OS0[OpenSearch] end

...please refer to the breaking changes linked below. On request we may provide OpenSearch 1.x corresponding to Elasticsearch 7.x. How do you update your application? This depends on...

...setup such a layout nvme0n1 259:0 0 931.5G 0 disk ├─nvme0n1p1 259:1 0 1G 0 part /boot/efi ├─nvme0n1p2 259:2 0 2G 0 part /boot

...crypt-0 252:0 0 928.4G 0 crypt └─ubuntu--vg-ubuntu--lv 252:1 0 928.4G 0 lvm / Reboot Install BTRFS tools: apt install btrfs-progs Set filesystem...

...S3 Bucket ohne Public access erstellt Wende das Modul für die Region eu-west-1 an Füge zu deinem Modul das managen eines VPC hinzu. Das VPC soll jeweils...

...Public und 3 Private Subnetze (je eines für 1 AZ) aber nur 1 public NAT Gateway haben. Die 3 Private Subnetze sollen Internet Zugriff haben. Erweitere dein Terraform modul um...

...you might want to enable logging for the chromedriver itself. Here is how. Option 1: Use Selenium::WebDriver::Service In your test setup, you may already have something like Capybara...

...can also start chromedriver yourself in a terminal on a custom port: chromedriver --port=12345 --verbose --log-path=/tmp/chromedriver.log Then configure Selenium to connect to that port. Like in option...

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

makandra Curriculum

...distinction between virtual pixels vs. physical pixels. Understand how raster images prepared for a 1:1 pixel ratio look like on high density displays. Understand which classes of devices typically...

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

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

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

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

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

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

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

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

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

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