makandra dev
gist.github.com

...cases beyond that to make your life easier. For this cheatsheat I tried to structure the most useful commands by different use cases, such that a practical oriented overview of...

...some commands I added some tips for their usage and further details on their subcommands For most of the commands shortly explained here, there are some examples along with a...

...lesson you fetch data from external XML and JSON APIs in Ruby, and learn several techniques for testing code that talks to the network without making your test suite slow...

...no results, ambiguous results. You can test code that talks to the network in several ways — real calls, stubs, request-level mocking (e.g. WebMock), recorded responses (e.g. VCR) — and explain...

By default, Rails views escape HTML in any strings you insert. If you want to insert HTML verbatim, you need to call #html_safe. However, #html_safe does not "unescape...

...a string. It merely marks a string as safe for unescaped insertion. How html_safe works Calling html_safe on a String returns a new object that looks and acts...

DevOps Curriculum

...diesen verschiedenen Verbindungsversuchen erklären: nc makandra.de 22 nc ccc.de 22 nc app02-stage.makandra.makandra.de 22 Du kannst Sequence-Numbers erklären Du kennst die Unterschiede zwischen UDP und TCP und kannst Beispiele nennen...

...makandra.de aufbauen und die Datei robots.txt abrufen (Siehe https://richj.co/talking-http-1.1/) Du weisst, was dieser Server-Header bedeutet: Strict-Transport-Security: max-age=31536000 IPv6 Wie werden MAC Adressen bei...

richfrog.curzons.net

Get "PuTTY Link" and "Pageant" (an SSH key agent) from the PuTTY download page. Run pageant.exe, find its icon inside your system tray and add your SSH key.

...a cmd and put the full path to PuTTY's plink.exe into the GIT_SSH environment variable, e.g.: set GIT_SSH=D:\PuTTY\plink.exe You can then use Git like...

apidock.com

2.ordinalize # => "2nd" 1002.ordinalize # => "1002nd" 1003.ordinalize # => "1003rd" -11.ordinalize # => "-11th" -1001.ordinalize # => "-1001st...

TL;DR When using Cache-Control on a Rails application, make sure the Vary: Accept header is set. Proxy caching is a good feature to serve your publicly visible application...

...server SHOULD include a Vary header field with any cacheable response that is subject to server-driven negotiation. Doing so allows a cache to properly interpret future requests on that...

When storing floating-point numbers such as prices or totals in an SQL database, always use a DECIMAL column. Never use FLOAT or kittens will die. DECIMAL columns are parametrized...

...with a precision and a scale. These parameters describe which numbers can be stored in that column. E.g. a decimal with a precision of 5 and a scale of...

Is your application doing something expensive every few seconds? Maybe an animated slider that rotates images? Maybe you are updating data over the network every five minutes? It's a...

...this if the your document tab is not even visible to the user. This saves your user's battery and data plan. You can ask document.visibilityState or document.hidden whether this...

developer.mozilla.org

...HTML's accepts a single file. You can allow multiple files via . But sometimes, selecting multiple files is not enough and can be cumbersome for the user. Enter webkitdirectory:

...webkitdirectory switches the browser's file picker to select a directory. All files inside that directory, and inside any nested subdirectories, will be selected for the file input.

...external commands from within Ruby, but the most powerful ones are Open3.capture3 and Open3.popen3. Since those can do almost everything you would possibly need in a clean way, I prefer...

...to simply always use them. Behind the scenes, Open3 actually just uses Ruby's spawn command, but gives you a much better API. Open3.capture3 Basic usage is require 'open3'

Note: We are talking about Machinist 1 here, Machinist 2 may have solved this or might require a different approach. Machinist allows named blueprints (e.g. User.blueprint(:admin)) that inherit from...

...for the vip blueprint go here inherit :premium end ...put the attached code into spec/support/machinist_inherit.rb and require 'spec/support/machinist_inherit' in your blueprints.rb. Note that it might not be sufficient to put...

...method to automatically compute an ETag from the given record, array of records or scope of records: class UsersController < ApplicationController def show @user = User.find(params[:id]) fresh_when @user

...by passing an array of ETaggable objects to fresh_when. class UsersController < ApplicationController def show @user = User.find(params[:id]) # The show template also renders the user's posts. fresh_when...

...records as deleted instead of removing them — and how listing, finding and associations behave for soft-deleted records. You can decide between :dependent and soft delete from the shape of...

...make this more convenient we like to define a scope :active, -> { where(trashed: false) } on soft-deletable models. Controllers should no longer deliver show views or forms for a soft...

When testing JavaScript functionality in Selenium (E2E), you may need to access a class or function inside of a evaluate_script block in one of your steps. Capybara may only...

...your tests (and neither in the dev console). The following principles/concepts also apply to Sprockets. Say we have a StreetMap class: // street_map.js class StreetMap { function getLatitude() { // ... } function renderOn(mapElement) { // ... } }

Spreewald comes with a selector_for helper that matches an English term like the user's profile into a CSS selector. This is useful for steps that refer to a...

...particular section of the page, like the following: Then I should see "Bruce" within the user's profile ^^^^^^^^^^^^^^^^^^ If you're too lazy to manually translate English to a CSS...

...manage to find the cause of this behaivour yet, but I think it has something to do with the start order of the nova services. (When nova-network isn't...

...present at nova-compute startup, no rules will be applied at all) You can restart the nova-compute service and nova should insert the rules one by one (you can...

Code splitting is a feature of esbuild that can keep huge libraries out of the main bundle. How code splitting works Like Webpack esbuild lets you use the await import...

...code on demand: // application.js const { fun } = await import('library.js') fun() However, esbuild's code splitting is disabled by default. The code above would simply inline (copy) library.js into application.js:

stackoverflow.com

The solution in this card is based on a stack overflow post by Leventix. If you need to make request come from a fixed IP address for the duration of...

...a Cucumber scenario, the code below lets you write this: Given my IP address is 188.174.117.205 Rails 3 Given /^my IP address is "(.*?)"$/ do |ip| ActionDispatch::Request.any_instance.stub(:remote_ip).and...

github.com

I was recently asked to optimize the response time of a notoriously slow JSON API endpoint that was backed by a Rails application. While every existing app will have different...

...be used to reproduce the results. I tried to mimic the case where things started out fast but did not scale well: There is an existing Rails App with a...

Use the click method on the DOM element: let link = document.querySelector('a') link.click()

This looks like it is safe to use: 2.2.1 :001 > a = b = "hello world" "hello world" 2.2.1 :002 > a "hello world" 2.2.1 :003 > b "hello world" 2.2.1 :004 > b = " goodbye...

...happening when we do a = b = "hello world"? First, b is assigned to a String object "hello world", then a is assigned to b. a and b are now assigned...

github.com

For my computer science bachelor's thesis I programmed and evaluated a CLI Test Case Prioritization (TCP) tool for makandra. It has been written as a Ruby Gem and was...

...as T2 > T3> T1 > T4 > T5 > T6. Selection of a strategy In the preselection coverage-, search-based, model- and combinations of different prioritization methods. History- and fault-based approaches could...

...Thunderbird 3 put there. Though the CompactHeader addon is often claimed to be a solution it does way too much for me -- I like the headers the way they are...

...very well for me (keeps the date and "other actions" menu on the right, see the screenshot below): Open up your profile directory (~/.thunderbird/ /) Create a chrome directory inside it...