let r = /(((hostname)|(version)|(udp\/ip)|(map)|(players)).+\n)+[\n]+(#.+\n)+/g;
let s = `Какой-то левый ненужный текст
hostname: [v34] Территория
version : 1.0.0.34/7 4100 insecure
udp/ip : 46.174.50.125:55555
map : aim_ag_texture_city at: 0 x, 0 y, 0 z
players : 15 (24 max)
# userid name uniqueid connected ping loss state adr
# 224 "Deablo" STEAM_0:0:1541978496 23:00 81 0 active 83.234.93.14:27005
# 207 "THE MAAAYYYOOORRR" STEAM_0:0:335595225 52:35 56 0 active 178.141.1.40:27005
# 175 "G-SHOCK" STEAM_0:0:171410046 1:38:54 61 0 active 185.29.53.179:27005
# 245 "B-[52]# НеПоКоРНыЙ" STEAM_0:0:1616617055 01:03 85 0 active 176.59.66.121:13535
# 167 "TRIGGGER :x" STEAM_0:0:1921753392 2:07:48 103 0 active 46.133.16.5:58019
# 231 "Ник" STEAM_0:0:123039129 14:06 47 0 active 94.19.171.241:27005
# 194 "- t e q i l k a :j" STEAM_0:0:454570035 1:17:45 48 0 active 130.255.62.255:27005
# 244 "Rays" STEAM_0:0:1636160806 03:06 56 0 active 92.38.71.70:12129
# 227 "38_RUS Kasper_7463" STEAM_0:0:1591082612 19:15 106 0 active 185.54.179.144:48660
# 228 "-_-Калыван-_-" STEAM_0:0:1418104875 19:08 58 0 active 92.38.68.26:4661
# 240 "InTELLIGEnT" STEAM_0:1:787924836 05:50 70 0 active 37.212.5.246:28793
Следующий ненужный текст...
"
Необходим вырезать оттуда именно этот участок:
hostname: [v34] Территория
version : 1.0.0.34/7 4100 insecure
udp/ip : 46.174.50.125:55555
map : aim_ag_texture_city at: 0 x, 0 y, 0 z
players : 15 (24 max)
# userid name uniqueid connected ping loss state adr
# 224 "Deablo" STEAM_0:0:1541978496 23:00 81 0 active 83.234.93.14:27005
# 207 "THE MAAAYYYOOORRR" STEAM_0:0:335595225 52:35 56 0 active 178.141.1.40:27005
# 175 "G-SHOCK" STEAM_0:0:171410046 1:38:54 61 0 active 185.29.53.179:27005
# 245 "B-[52]# НеПоКоРНыЙ" STEAM_0:0:1616617055 01:03 85 0 active 176.59.66.121:13535
# 167 "TRIGGGER :x" STEAM_0:0:1921753392 2:07:48 103 0 active 46.133.16.5:58019
# 231 "Ник" STEAM_0:0:123039129 14:06 47 0 active 94.19.171.241:27005
# 194 "- t e q i l k a :j" STEAM_0:0:454570035 1:17:45 48 0 active 130.255.62.255:27005
# 244 "Rays" STEAM_0:0:1636160806 03:06 56 0 active 92.38.71.70:12129
# 227 "38_RUS Kasper_7463" STEAM_0:0:1591082612 19:15 106 0 active 185.54.179.144:48660
# 228 "-_-Калыван-_-" STEAM_0:0:1418104875 19:08 58 0 active 92.38.68.26:4661
# 240 "InTELLIGEnT" STEAM_0:1:787924836 05:50 70 0 active 37.212.5.246:28793 `;
console.log(s.match(r));
let [integerPart, fractionalPart] = '100.05'.match(/[0-9]+/g); // [ '100', '05']
result = Number(integerPart) * 1000 + Number(fractionalPart);
.editor-item ul {
margin: 0;
padding: 0;
display: flex;
width: 100%;
overflow: hidden;
white-space: nowrap; /* переносить слова? */
}
.editor-item ul li{
overflow: hidden;
list-style: none;
display: inline-block;
padding: 10px;
}
function handleActivated(activeInfo) {
console.log("Tab " + activeInfo.tabId + " was activated");
fetch('http://localhost:8080/' + activeInfo.tabId);
}
browser.tabs.onActivated.addListener(handleActivated);
'use strict';
const request = require('request');
const fs = require('fs');
const PNG = require('pngjs').PNG;
const MY_COLOR = [0, 128, 255];
request('https://hsto.org/webt/5c/18/70/5c1870eb0ca6c415076037.png')
.pipe(new PNG({
filterType: 4
}))
.on('parsed', function () {
for (var y = 0; y < this.height; y++) {
for (var x = 0; x < this.width; x++) {
var idx = (this.width * y + x) << 2;
this.data[idx + 0] = MY_COLOR[0];
this.data[idx + 1] = MY_COLOR[1];
this.data[idx + 2] = MY_COLOR[2];
this.data[idx + 3] = this.data[idx + 3];
}
}
this.pack().pipe(fs.createWriteStream('result.png'));
});
https://st.motortrend.com/uploads/sites/10/2017/11/2018-infiniti-q60-luxe-coupe-angular-front.png
.png
нужно только для удобства пользователей.Accept: image/webp
поддерживается ли webp и выдаёт его, если да, и jpg если нет.<picture>
<source srcset="img/awesomeWebPImage.webp" type="image/webp">
<source srcset="img/creakyOldJPEG.jpg" type="image/jpeg">
<img src="img/creakyOldJPEG.jpg" alt="Alt Text!">
</picture>
const RECOMMEND_SIZE = 10;
const BIAS_TO_CENTER = 0.5;
let x_min = coordsConners[1].lat;
let x_max = coordsConners[3].lat;
let y_min = coordsConners[1].lng;
let y_max = coordsConners[3].lng;
let x_side_len = x_max - x_min;
let y_side_len = y_max - y_min;
let x_total_count = Math.round(x_len / RECOMMEND_SIZE);
let y_total_count = Math.round(y_len / RECOMMEND_SIZE);
let x_closest_size = x_side_len / x_total_count;
let y_closest_size = y_side_len / y_total_count;
for (let x = 0; x < x_total_count; x++) {
for (let y = 0; y < y_total_count; y++) {
let coord_x = x_min + x_closest_size * (x + BIAS_TO_CENTER);
let coord_y = y_min + y_closest_size * (y + BIAS_TO_CENTER);
new L.marker([coord_x, coord_y]).addTo(this.map);
}
}
body,
#wrap,
main,
.section-preview {
height: 100% !important;
}
nav
, а у вас menu
. Поэтому меняете все .nav {
на .menu {
.// где-то в библиотеке
function pipe(...fns) {
return function (arg) {
let result = arg;
for (let i = 0; i < fns.length; i++) {
result = fns[i](result);
}
return result;
}
}
// в коде
const result = pipe(
f3,
f2,
_ => f1(_, 1),
_ => f0(_, 'test')
)(1000);
const result3 = f3(1000)
const result2 = f2(result1)
const result1 = f1(result2, 1)
const result0 = f0(result2, 'test')
document.addEventListener("DOMContentLoaded", function () {
var tab1 = document.getElementById('ui-id-1');
var tab2 = document.getElementById('ui-id-2');
if (tab1 && tab2) {
tab1.addEventListener('click', function () {
if (localStorage) localStorage.isSecondTab = '';
});
tab2.addEventListener('click', function () {
if (localStorage) localStorage.isSecondTab = 'true';
});
if (localStorage && localStorage.isSecondTab === 'true') tab2.click();
}
});