Please note that iconv('UTF-8', 'ASCII//TRANSLIT', ...) doesn't work properly when locale category LC_CTYPE is set to C or POSIX. You must choose another locale otherwise all non-ASCII characters will be replaced with question marks. This is at least true with glibc 2.5.
input = document.querySelector('#my');
input.value = 'Вставляемый текст';
input.dispatchEvent(new KeyboardEvent('keydown', { bubbles: true }));
input.dispatchEvent(new KeyboardEvent('keypress', { bubbles: true }));
input.dispatchEvent(new KeyboardEvent('keyup', { bubbles: true }));
input.dispatchEvent(new Event('input', { bubbles: true }));
input.dispatchEvent(new Event('change', { bubbles: true }));
cat sites.json | jq -r '.sites[] | "\(.title)\tadmin\t\(.admin[])\n\(.title)\tfront\t\(.front[])"' | sort -u | fzf -m --delimiter "\t" --nth 1,2 | awk '{print $3}'
#!/bin/bash
select site in $(jq -r '.sites[].title' sites.json)
do
select area in "admin" "front"
do
# get links for "area"
links=$(jq '.sites[] | select(.title == "'${site}'") | .'${area}' |.[]' sites.json)
# here you can do whatever you want - iterate through links, opening them with xdg-open, or just print them out
echo $links
break
done
break;
done
select area in "admin" "front"
select area in $(jq -r '.sites[] | select(.title == "'${site}'") | keys | .[] | select(. != "title")' sites.json)
for a in 1 2; do
for b in 1 3; do
select list; do
while something; do
break
done
done
done
done
jsonlist="$(jq '.[][]|keys[]' sites.json|tr -d \")"
select action in ${jsonlist};do
echo "[$action]"
test "$action" == "title" && break
newlist="$(jq ".[][][\"$action\"][]" sites.json)"
echo "$newlist"
done
awk -F: '
/\{|\}|border|max-width|^$/ { print $0 }
!/\{|\}|border|max-width|^$/ {
split( substr($2, 1, length($2)-1) , a," ");
res = "";
for (i in a) {
ind = match(a[i], /[0-9]+px/)
if (ind != 0) {
a[i] = sprintf ("%.2frem", a[i]/10);
}
res=a[i] " " res;
}
res = substr(res, 1, length(res)-1);
print $1 ": " res ";"
}
' some.css
Arrays in awk are different—they are associative. This means that each array is a collection of pairs—an index and its corresponding array element value...
The pairs are shown in jumbled order because their order is irrelevant.
awk -F: '{
if ($0 ~ /\{|\}|border|max-width|^$/ ) { print $0 }
else {
res = "";
split( substr($2, 1, length($2)-1) , a, " ");
for (i=1; i<= length(a);i++) res = res " " ((match(a[i], /[0-9]+px/) != 0)? a[i]/10"rem" : a[i]);
print $1 ": " res";"
}
}' some.css
#!/bin/bash
css_file="$1"
while read -r line; do
if [[ $line == *"border"* || $line == *"max-width"* ]]; then
echo "$line"
continue
else
# Use regular expressions to find pixel values (e.g., "10px", "20px", etc.)
px_values=$(echo "$line" | grep -oE "[0-9]+px")
new_line="$line"
# Iterate through each found pixel value
for px_value in $px_values; do
# Extract the numeric value from the pixel value
numeric_value=$(echo "$px_value" | grep -oE "[0-9]+")
# Convert the pixel value to rem and divide by 10
rem_value=$(awk "BEGIN { printf \"%.2f\", $numeric_value / 10 }")
# Replace the pixel value with the calculated rem value
new_line=$(echo "$new_line" | sed "s/$px_value/${rem_value}rem/g")
# sed -i "s/$line/$new_line/" $css_file
done
# Print the modified line
echo "$new_line"
fi
done < "$css_file"
:options="{ scrollWheelZoom: false }"
@update:zoom="zoom = $event"
@wheel.native="onWheel"
methods: {
onWheel(e) {
if (e.deltaY < 0) {
this.zoom++;
e.preventDefault();
}
},
},
local mappings = {
n = {
["b"] = { "<Plug>Sneak_S", desc = "Sneak back" },
["<M-l>"] = { ":wa<CR>", desc = "close all" },
["<leader>;"] = { ":vsplit<CR>", desc = "split" },
["<S-l>"] = {
function() require("astronvim.utils.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end,
desc = "Next buffer",
},
["<S-h>"] = {
function() require("astronvim.utils.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end,
desc = "Previous buffer",
},
},
i = {
["<C-l>"] = { "copilot#Accept('\\<CR>')", desc = "copilot expand", silent = true, expr = true, script = true },
},
}
-- Функция для удаления непечатных символов
local function removeNonPrintableChars(str)
return str:gsub("[%z\1-\31\127-\255]", "")
end
-- Удалить непечатные символы из значений таблицы mappings
for _, mode in pairs(mappings) do
for _, mapping in pairs(mode) do
if type(mapping) == "table" and mapping.desc then
mapping.desc = removeNonPrintableChars(mapping.desc)
end
end
end
return mappings