Skip to content

Instantly share code, notes, and snippets.

View PonomareVlad's full-sized avatar

Vladislav Ponomarev PonomareVlad

View GitHub Profile
@PonomareVlad
PonomareVlad / QIWI.svg
Last active January 14, 2023 10:10
QIWI SVG Logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PonomareVlad
PonomareVlad / YooMoney.svg
Last active January 14, 2023 09:34
YooMoney SVG Logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
if (typeof navigator.serviceWorker !== 'undefined')
navigator.serviceWorker.register('/sw.js');
let deferredPrompt;
const addBtn = document.querySelector("#install-button");
window.addEventListener("beforeinstallprompt", (e) => {
e.preventDefault();
deferredPrompt = e;
addBtn.addEventListener("click", (e) => {
@PonomareVlad
PonomareVlad / bot.mjs
Created October 11, 2022 08:48
Telebot error handling case
const handleError = async error => {
console.error(error)
this.log.push(error)
try {
switch (error.error_code) {
case 429:
this.abort = true;
console.debug('Task reverted', await this.updateTask(this.task, {status: 'new'}))
break;
default:
{
"basics": {
"name": "Vladislav Ponomarev",
"label": "Full-stack Developer",
"image": "https://avatars.githubusercontent.com/u/2877584",
"website": "https://PonomareVlad.ru"
}
}

Keybase proof

I hereby claim:

  • I am ponomarevlad on github.
  • I am ponomarevlad (https://keybase.io/ponomarevlad) on keybase.
  • I have a public key ASBqXlEHLrE2hEwVnx2EAF5oQEsR1qj5veO8nLgTd_KFywo

To claim this, I am signing this object:

@PonomareVlad
PonomareVlad / index.php
Last active May 15, 2021 09:30
Adding product to cart in PHP
// Шаг 1
// Выводим артикул (книга_id) в аттрибут value у кнопки
<button type="submit" id="hello" name="hello" value="$row[1]">КУПИТЬ</button>
// Шаг 2
// Если после клика на кнопку, пользователь должен сразу переместится на страницу корзины или оформления заказа,
// то можно просто обернуть кнопку в тег формы и указать для нее адрес страницы (скрипта) который примет данные о
// выбранном артикуле в GET или POST параметрах (получить их можно будет в переменной $_REQUEST['book_id'])
@PonomareVlad
PonomareVlad / rooms.json
Created December 29, 2020 17:03
Chat Rooms Backup
[
{
"_id": "5fe3f8c29320010008796423",
"id": "MKwgAZsAcS1fujpjKaNX",
"host": "Еееее",
"client": "👨🏻‍💻"
},
{
"_id": "5fe3f9c0932001000879642d",
"id": "UwaTTS8CWuLyTqkx8HAt",
<?xml version="1.0" encoding="utf-8"?>
<disqus xmlns="http://disqus.com" xmlns:dsq="http://disqus.com/disqus-internals" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://disqus.com/api/schemas/1.0/disqus.xsd http://disqus.com/api/schemas/1.0/disqus-internals.xsd">
<category dsq:id="8737668">
<forum>ponomarevlad</forum>
<title>General</title>
<isDefault>true</isDefault>
</category>
<thread dsq:id="8324622202">
<id />
<forum>ponomarevlad</forum>
<?php
/*
* Tool to parse disqus comments xml file.
*
* @author Prahlad Yeri<[email protected]>
* @date 2017-09-06
* */
function find_url($root, $thid) {
foreach($root->thread as $thread) {