Skip to content

Instantly share code, notes, and snippets.

View shzk's full-sized avatar
👨‍💻
coding…

Denis Tokarev shzk

👨‍💻
coding…
  • Saint Petersburg, Russia
View GitHub Profile
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;

GitHub Gist - настройка и установка в JetBrains PhpStorm

  1. Установка плагина Get Gist Beta в PhpStorm
  1. В настройках плагина вводим пароль или генерируем токен на GitHub

P.S. К сожалению в Windows плагин работает не корректно c кодировкой Win-1251. Проблема до сих пор актуальна.

@shzk
shzk / ALTERNATIVES.adoc
Created April 15, 2020 14:48 — forked from mbbx6spp/ALTERNATIVES.adoc
Super quick list of alternatives to Jira and/or Confluence, Stash, Crucible, etc.
function cl_print_r ($var, $label = '')
{
$str = json_encode(print_r ($var, true));
echo "<script>console.group('".$label."');console.log('".$str."');console.groupEnd();</script>";
}
function cl_var_dump ($var, $label = '')
{
ob_start();
var_dump($var);
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- favicon -->
<link rel="icon" type="image/png" sizes="16x16" href="assets/favicon/favicon-16x16.png">
<!-- Bootstrap CSS -->
@shzk
shzk / gist:addaf2a785ced2336a4288358a4d3396
Created November 17, 2018 15:58 — forked from quoidautre/gist:3781733
PHP: PDO snippets
// PDO Connection to MySQL
$conn = new PDO('mysql:host=localhost;dbname=yourdbname', 'username', 'password');
// PDO Connection to PostgreSQL
$conn = new PDO('pgsql:host=localhost;dbname=yourdbname', 'username', 'password');
// A quick Select Query with For Loop
foreach ($conn->query("SELECT * FROM profile") as $row)
echo $row['fullname'];
@shzk
shzk / microtime.php
Created November 3, 2018 09:13
how to get script running time
<?php
$start = microtime(true);
$sum = 0;
for ($i = 0; $i < 100000; $i++) $sum += $i;
echo "Время выполнения скрипта: ".(microtime(true) - $start);
@shzk
shzk / GIT Deploy.md
Last active August 31, 2018 18:26 — forked from nichtich/README.md
How to automatically deploy from GitHub

Deploy your site with git

This gist assumes:

  • you have an online remote repository (github / bitbucket etc.)
  • you have a local git repo
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by Apache
  • the Apache user is named www-data (may be apache on other systems)
@shzk
shzk / functions.php
Created July 3, 2018 08:06 — forked from jameskoster/functions.php
WooCommerce - set image dimensions upon theme activation
<?php
/**
* Hook in on activation
*/
/**
* Define image sizes
*/
function yourtheme_woocommerce_image_dimensions() {
global $pagenow;
public static function checkName($name) {
if (strlen($name) >= 2) {
return true;
}
return false;
}