...as the video is free for end users." (MDN) H.265 / HEVC see H.264 (successor, better compression as H.264) VP8 royalty free VP9 royalty free (sucessor, better bit rate as VP8...
royalty free (planned successor of VP9 with better compression rates) Further reading: MDN: Web video codec guide Audio Codec Format Matrix A broader comparison of many audio codecs can...
...Rails code is doing the delivery you can do your usual authentication and authorization beforehand. There are few exceptions where you want to store confidential files in the public folder...
...However, users with limited bandwidth (i.e. on mobile) need to mine their data budget better. One popular strategy to improve the website performance is to not load images until they...
...via jQuery, as it does not support capturing events. JS-only: not working The "best" strategy would be to hide the src attribute of image tags from the browser with...
...ms long. Once a frame renders longer than 16ms, the page will begin to feel staggering and slow. Google Chrome DevTools The Chrome DevTools enable you to precisely investigate and...
...complex. Deeply nested rules and slow selectors are the main cost factors. Using a BEM pattern for CSS should produce relatively fast CSS. Performance issue 4: Slow repaints
...the number and last point in time when autovacuum and autoanalyze happened for tables belonging to the currently connected database. SELECT relation::regclass, * FROM pg_locks WHERE not granted;
Static error pages To add a few basic styles to the default error pages in Rails, just edit the default...
When testing JavaScript functionality in Selenium (E2E), you may need to access a class or function inside of a evaluate...
...The bash functions above are only an iteration from my previous bash alias. It became quite unreadable over time and and copies the raw XML to the clipboard (not files...
...I am really pleased with it -- but only on a desktop computer. Have you benchmarked the framework also on smartphones and tablets? Unfortunately I must say, that it does not...
...as a jQuery collection: let $element = $(element) An API object to call additional JavaScript behavior added by a library: var player = flowplayer($element) player.play() Framework activation layers (like Angular directives...
...confident about upgrading Rails, have a look at Rails LTS. How many update steps? Besides the Rails upgrade itself, you might also want to upgrade your other gems and upgrade...
...many cases updating to the highest subversion of the specific rails version is the best choice (e.g. when updating to rails 5 you would update to 5.2.8.12), since the most...
When Paperclip attachments should only be downloadable for selected users, there are three ways to go. The same applies to...
Basic validations Read the Rails Guide on ActiveRecord Validations. You should have an overview which kinds of validations are built...
In a JavaScript console, type this: > 9112347935156469760 9112347935156470000 Ooops. And that's not a float! This occurs because JavaScript uses...
When working with feature branches, stale branches pile up over time. It's best to remove them right after merge, locally and on the remote, but it is a little...
if [[ "$merged_branch_name" =~ ^(master|main|production|Fast-forward)$ ]]; then exit 0 fi # Begin output echo " " echo "> You have just merged the branch \"$merged_branch_name\" into \"$branch_name...
...or use a more mature solution like Webpack. Modules shared between entry points always become chunks When two entry points import the same module, that module automatically a separate file...
...a way to set a minimum file size for chunking, or to control chunking behavior per import. However there is currently no configuration at all. Modules imported by multiple entry...
...instead of downloading and bundling font files yourself. (See below for a list of benefits.) Usage Go to fontsource.org and search for the font you want to add (or a...
...s Fontsource details page for available settings. Why? Using an NPM package has some benefits over placing fonts into your repo: All font weights and glyphs are included.
...with power comes responsibility. Code comments can go wrong in many ways: they may become outdated, silently move away from the code they're referring to, restate the obvious, or...
...a comment, prefer improving the code: use descriptive variable/method names, extract more variables/methods to better describe what is happening, have a simple structure. However, there are things code cannot express...
The standard way to abort async code is that your function takes a AbortSignal { signal } property. The caller can use...
Ruby has the class Rational which allows you to store exact fractions. Any calculation on these variables will now use...
The Truemail gem (not to be confused with truemail.io) allows validating email addresses, e.g. when users enter them into a...
...users". The red area corresponds to the records in the resulting scope. # NAND: Default behavior for Hash with multiple attributes # Excludes only users who are BOTH admins AND trashed. User.where.not...
...points to an Array of values, Rails applies standard SQL NOT IN logic. This behaves effectively as a NOR condition relative to the values in the array (neither A nor...
...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...
...actually all browsers pretend to support SVG, some barely complex use cases get you beyond common browser support. In the basic scenario, you use SVGs instead of PNG or JPG...
...future we will be able to transition to display: none by using the transition-behavior: allow-discrete property. This will delay the display change until the transition ends. This is...
When working with file uploads, we sometimes need to process intrinsic properties like the page count or page dimensions of...