-
А что если размеры блока (или окружающего контента) изменятся? У тебя там случаем не захардкожено
3px? -
Сколько мест в коде придётся изменить, чтобы изменить цвет? А размер?
-
А что если шрифт будет не как у тебя? Даже одна и та же гарнитура в разных браузерах рендерится по-разному.
-
А что если текста будет больше? А что если прям совсем дохрена?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| img { | |
| /* Every css property should have its default value */ | |
| aspect-ratio: intrinsic; | |
| /* same as */ | |
| aspect-ratio: initial; | |
| } | |
| /** | |
| * Keyword `intrinsic` tells brower to try to get the ratio | |
| * from the element itself. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find . -name "package.json" -not -path "*/node_modules/*" | while read d; do (cd `dirname $d`; pwd; npm prune; npm update); done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { BrowserWindow, app } = require('electron'); | |
| const imagePath = require('url').format({ | |
| protocol: 'file', | |
| slashes: true, | |
| pathname: require('path').join(__dirname, 'emoji_1f61c.svg') | |
| }); | |
| app.once('ready', () => { | |
| const win = new BrowserWindow({ show: false }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (module | |
| (memory 1) | |
| (func (export "duplicateText") (param $ptr i32) | |
| (local $len i32) | |
| (local $max i32) | |
| (loop $continueLen | |
| (if | |
| (i32.load8_u | |
| (i32.add (get_local $ptr) (get_local $len)) | |
| ) |
devicePixelRatio is an amount of device pixels in a css pixel, in one dimension.
For example, devicePixelRatio = 2 means, 2 x 2 = 4 device pixels acts as one css pixel.
It depends both on physical device properties ("retina") and a page scaling set in browser.
Here's a top-10:
devicePixelRatio |
Percentage | Comment |
|---|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myStrictFunction = function(){ | |
| "use strict"; | |
| console.log('strict', this); | |
| }; | |
| var myLooseFunction = function(){ | |
| console.log('loose', this); | |
| }; | |
| [myStrictFunction, myLooseFunction].map(function(fn){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| if (!process.stdout.isTTY) { | |
| process.stderr.write('stdout is not a terminal'); | |
| process.exit(1); | |
| } | |
| const clearScreenSeq = '\u001b[H\u001b[2J'; | |
| const clearScreenSeqLen = Buffer.byteLength(clearScreenSeq); | |
| const maths = (x, y, now, tie) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h2>100%</h2> | |
| <p><strong>129 585</strong> PNG, 1x<br><img src="oeOGvICT_mid.png" width="466" height="275"><br> | |
| <p><strong>90 931</strong> PNG, 2x pngquant<br><img src="oeOGvICT_mid-2x-fs8.png" width="466" height="275"><br> | |
| <p><strong>44 510</strong> WebP, 2x 70% q<br><img src="oeOGvICT_mid-2x.webp" width="466" height="275"><br> | |
| <h2>200%</h2> | |
| <p><strong>129 585</strong> PNG, 1x<br><img src="oeOGvICT_mid.png" width="932" height="550"><br> | |
| <p><strong>90 931</strong> PNG, 2x pngquant<br><img src="oeOGvICT_mid-2x-fs8.png" width="932" height="550"><br> | |
| <p><strong>44 510</strong> WebP, 2x 70% q<br><img src="oeOGvICT_mid-2x.webp" width="932" height="550"><br> |