...s presentation about asynchronous Javascript (there's also a German video presentation in our shared folder) Read about Promises on MDN and this visualization Read about async / await.
Read about canceling promises Error handling in event listeners Tasks, microtasks, queues and schedules Picking the Right Tool for Maneuvering JavaScript's Event Loop Browse the internet to answer...
...or not to gem": Gem is really needed (prefer writing your own code for simple requirements without many edge cases) Gem is tested well (coverage and quality)
...the project requirement Try to avoid gems that do much more than your requirement scope needs Gem has a good maturity and maintenance Gem has a good / familiar DSL
Icon fonts like Font Awesome are infinitely scalable, look great on high-DPI displays and will give your app a modern look. However, icon fonts can be very awkward to...
...use compared to raster icons. Elements are given icons by giving them a special class like icon-plus or icon-home: Create The icon font's stylesheet will then recognize...
...latest commits are not ready for production? Then use git merge master~n to skip the n-last commits. Tip A big advantage of merging vs. cherry-picking is that...
Browsers come with a set of built-in elements like or . When we need a new component not covered by that, we often build it from and tags. An alternative...
...Custom elements will be ignored for the purposes HTML validation, but their children will still be validated. Styling new elements Browsers will give unknown elements a default style of display...
...topic of this card. Read following chapters: (1) Security Principles (3.3) Sessions and Cookies (3.5) Same-Origin-Policy (4.2) Angriffsfläche / Attack Surface (4.3) Speicherung von Passwörtern (6) Kryptographische Grundlagen...
...Authentifikation (8) Authorization (9) Session Management Ohne (9.4) JSON Web Tokens (10) Federation / Single-Sign on (11) Serverseitige Angriffe (12) Clientseitige Angriffe (13) Clientseitige Schutzmaßnahmen Read through the most known...
...config={}). There also is a generate method which will run the generator in a subprocess. Call it with generate 'generator_name', 'command line args'. Expected (hard-coded) directory structure of...
... #{generator name, e.g. model}_generator.rb USAGE Templates If you want to use the supplied template, directory and other template methods, you must call source_root 'path/to/templates' inside your generator...
...least one external REST API, machine-to-machine communication via GraphQL is less commonly seen. In this card, I'd like to give a quick intro on how to query...
Interacting with GraphQL feels a bit like querying a local database. You are submitting queries to fetch data in a given structure (like SELECT in SQL) or mutations to...
...are automagically available through accessors on the Active Record object. When you need to specialize this behavior, you may override the default accessors (using the same name as the attribute...
...and simply call the original implementation with a modified value. Example: class Poet < ApplicationRecord def name=(value) super(value.strip) end end Note that you can also avoid the original setter...
Phusion Passenger changed the way how it gets restarted several times. Through the project's history, these all were valid: touch tmp/restart.txt sudo passenger-config restart-app /path/to/app passenger-config...
gem 'capistrano-passenger', require: false Add to your Capfile: require 'capistrano/passenger' Declare which server role should be restarted (optional). Usually passenger tries to restart all servers with the app...
...exception, Rails will look at the exception's class and choose an appropriate HTTP status code and error page for the response. For instance, an ActiveRecord::RecordNotFound will cause Rails...
...render a red "The page you were looking for doesn't exist" with a status code of "404" (not found). The mapping from exception classes to error types is a...
Why secure-only cookies used to be necessary Cookies have an optional secure flag. It tells the browser to not send the cookie for a non-https request.
...users from http:// to https://. The reason was that most users will only enter a scheme-less domain like makandra.de into their location bar, which will default to http://makandra.de...
Understanding your type of cronjob Some cronjobs must only run on a single server. E.g. when you run nightly batch operations on the database, it should probably run on a...
...single server. Running it on multiple servers would likely result in deadlocks or corrupt data. Some cronjobs must always run on all servers. E.g. starting a sidekiq process on reboot...
Migrating data from a legacy into a new system can be a surprisingly large undertaking. We have done this a few times. While there are significant differences from project to...
...project, we do have a list of general suggestions. Before you start, talk to someone who has done it before, and read the following hints: Understand the old system
...can reset the min-width. Say you have a simple grid layout: .container .first-item .second-item .third-item .container display: grid grid-template-columns: 100px 1fr 100px Your expectation...
...correct as the grid layout will try to do that: +---------+----------------------------+---------+ | | - 10 characters long | | +---------+----------------------------+---------+ However, if .second-item's content is too large to fit into the reserved space, it will...
The following two hints are taken from Github's Ruby style guide: If your regular expression mentions a lot of forward slashes, you can use the alternative delimiters %r(...), %r...
...complex, you can use the /x modifier to ignore whitespace and comments: regexp = %r{ start # some text \s # white space char (group) # first group (?:alt1|alt2) # some alternation end
In a nutshell: Use git rebase --onto target-branch source-commit target-branch means "branch you want to be based on" source-commit means "commit before your first feature commit...
...Let's say my-feature-branch is based on master and we want it to be based on production. Consider this history: %%{init: { 'gitGraph': {'showCommitLabel': true, 'mainBranchName': 'production'}} }%% gitGraph
...Doing that enables e.g. man in the middle attacks. If you accept only a single expired and known certificate, you are much less in trouble. Setup All the solutions described...
...below use a verify_callback for the request's OpenSSL::X509::Store where you can specify a lambda to adjust its verification response. Your callback must return either true or...
...default to using the element as the main document viewport. In CSS, prefer to set overflow properties to html (or :root). Scrolling the main viewport with JavaScript
...main document viewport is also scrollable by default. The element that corresponds to the main viewport is either (document.documentElement) or (document.body). Which one depends on the browser.
When you need to find out in which kind of spec you are during run-time, it's definitely possible. It's a lot easier in RSpec 2+.
...consider this global before block where you'd want to run some code for specific specs only: config.before do # stuff that_fancy_method # more stuff end RSpec 2+
...maintain. There are some good practices for writing a changelog that adds value, please stick to these. Add a notice to the README's contribute section about the changelog
...this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## Unreleased - Added `Foo#foo` method. ## 1.0.0 - 2017-06-20 ### Breaking changes - Renamed `Foo...
Slow test suites are a major pain point in projects, often due to RSpec and FactoryBot. Although minitest and fixtures are sometimes viewed as outdated, they can greatly improve test...
We adopted a project using minitest and fixtures, and while it required some initial refactoring and establishing good practices, the faster test suite was well worth it! Stick with...
Add apt source: apt update -y && apt install -y gpg sudo wget curl sudo install -dm...
.../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 /etc/apt/sources.list.d/mise.list
SVG is an acronym for "scalable vector graphics". SVGs should be used whenever an image can be described with vector instructions like "draw a line there" or "fill that space...
...they're not suited for photographs and the like). Benefits are the MUCH smaller file size and the crisp and sharp rendering at any scale. It's a simple, old...