Skip to content

Instantly share code, notes, and snippets.

View evgrezanov's full-sized avatar
:octocat:
Working remote, weather is hot

Evgeniy R evgrezanov

:octocat:
Working remote, weather is hot
View GitHub Profile
@evgrezanov
evgrezanov / readme.md
Created November 14, 2024 04:01 — forked from SanariSan/readme.md
Telegram HTTP bot API via CURL | Send text, photos, documents, etc.

Here are some examples on how to use Telegram bot api via CURL

Prerequisites

For getting messages in private chat with bot

  • Create a bot using @BotFather, get it's token
  • Start conversation with bot
  • Run following curl command
curl https://api.telegram.org/bot/getUpdates | grep -Po '"from":{"id":.+?,'
@evgrezanov
evgrezanov / TgBigMessage.php
Created October 3, 2024 09:52
Чтобы отправить большое сообщение (до 4096 символов) в телеграм бота, с картинкой внизу, используйте следующий код
<?php
//https://core.telegram.org/bots/api?utm_source=botlist#sendmessage
$bot_token = '99999999999:AFDSDSDSDS_nbdfdgDSFDSFGFbcvbfghdfhU'; // токен бота
$img = '<a href="https://site.ru/img_fon/2.jpg">&#8205;</a>'; // урл картинки в ссылке
$tg_url = '<a href="'.$url_post.'" target="_blank">'.$title.'</a>
'; // отступ нужен
@evgrezanov
evgrezanov / keybase.md
Created October 19, 2023 20:40
keybase

Keybase proof

I hereby claim:

  • I am evgrezanov on github.
  • I am redmonkey73 (https://keybase.io/redmonkey73) on keybase.
  • I have a public key ASDaWBFVw_AvIRylcb7ZcF7O-VoT_nvUUUTyQeUE2NFC0Qo

To claim this, I am signing this object:

@evgrezanov
evgrezanov / add-taxonomy-to-woocommerce-export.php
Created April 30, 2021 19:56 — forked from helgatheviking/add-taxonomy-to-woocommerce-export.php
Add a custom taxonomy to WooCommerce import/export
<?php
/*
* Plugin Name: WooCommerce Add Taxonomy to Export
* Plugin URI: https://gist.github.com/helgatheviking/114c8df50cabb7119b3c895b1d854533/
* Description: Add a custom taxonomy to WooCommerce import/export.
* Version: 1.0.1
* Author: Kathy Darling
* Author URI: https://kathyisawesome.com/
*
* Woo: 18716:fbca839929aaddc78797a5b511c14da9
@evgrezanov
evgrezanov / new-user-login-cookie-based-redirect.php
Created February 5, 2021 08:39
New user login redirect, Cookie-based solution
@evgrezanov
evgrezanov / code-review-checklist.md
Created January 8, 2021 05:35 — forked from nerandell/code-review-checklist.md
PHP Code Review Guidelines

Make sure these boxes are checked before submitting/approving the PR

General

  • The code works
  • The code is easy to understand
  • Follows coding conventions
  • Names are simple and if possible short
  • Names are spelt correctly
  • Names contain units where applicable
  • There are no usages of magic numbers
<?php
// https://gist.github.com/evgrezanov/44c03e61ea5a68b5c6ed507f12f57c02
add_action( 'pmxi_saved_post', 'mst_company_jobs_mapping', 10, 1);
function mst_company_jobs_mapping($post_id){
$import_id = ( isset( $_GET['id'] ) ? $_GET['id'] : ( isset( $_GET['import_id'] ) ? $_GET['import_id'] : 'new' ) );
if ( $import_id == '161' || $import_id == '145') :
global $wpdb;
// choоse table
$is_test = false;
@evgrezanov
evgrezanov / mst_company_jobs_mapping.php
Last active November 22, 2020 10:00
mst_company_jobs_mapping.php
<?php
add_action( 'pmxi_saved_post', 'mst_company_jobs_mapping', 10, 1);
function mst_company_jobs_mapping($post_id){
$import_id = ( isset( $_GET['id'] ) ? $_GET['id'] : ( isset( $_GET['import_id'] ) ? $_GET['import_id'] : 'new' ) );
if ( $import_id == '161' || $import_id == '145') :
global $wpdb;
// choоse table
$is_test = false;
if ($is_test):
@evgrezanov
evgrezanov / wprss-add-meta-hook.php
Last active October 6, 2020 09:37
Add meta field to wprss aggregator CPT (for mybiglife.com)
<?php
// https://gist.github.com/evgrezanov/2045bef6d5f1f904bef71b2423d62aeb
// add this function to your theme functions.php
// start
add_filter('wprss_ftp_post_meta', 'mybl_custom_post_meta', 10, 4);
function mybl_custom_post_meta($meta, $post_id, $feed_source, $feed_item){
$feed = $feed_item->get_feed();
$date = $feed_item->get_date('Y-m-d');
$meta['!post-type'] = array(
<?php
//filter query before request (company with open jobs, pagination, terms matches)
add_filter( 'wpv_filter_query', 'show_only_hiring_now_companies', 99, 3 );
function show_only_hiring_now_companies( $query_args, $view_settings, $view_id ) {
if ( $view_id == 72 ){
// post per pagination page
$post_per_page = 9;
$query_args['posts_per_page'] = $post_per_page;