Skip to content

Instantly share code, notes, and snippets.

View bologer's full-sized avatar
🎯
Focusing

Alexander Teshabaev bologer

🎯
Focusing
View GitHub Profile
@bologer
bologer / mainservers.php
Created August 9, 2015 09:26
how to parse data from the status of the server
<?php
#https://www.tutorials.de/threads/rcon-in-php-um-eine-funktion-erweitern.393275/
$data = 'hostname: Web4f.de [ Countersrike 1.6 - Fun Server ]
version : 48/1.1.2.7/Stdio 5787 secure (10)
tcp/ip : 178.254.6.180:27015
map : fy_buzzkill at: 0 x, 0 y, 0 z
players : 1 active (16 max)
# name userid uniqueid frag time ping loss adr
# 1 "GuyPrayer" 2 STEAM_0:0:64036919 0 00:22 61 35 91.66.225.231:27005
@bologer
bologer / preg_match.php
Last active September 14, 2015 11:01
preg_match php
// get: Steam_id
if( preg_match('^STEAM_[0-1]:[0-1]:(\d+)^', $values[0][$k], $m) ) {
$players[$key]['SteamId'] = $m[0];
}
if( preg_match('/\\s/([0-9]{1,4})/\\s/', $value[0][$k], $m) ) {
$players[$key]['Frags'] = $m[0];
}
// get: Time
if( preg_match('^[0-9][0-9]:[0-9][0-9]^', $values[0][$k], $m) ) {
@bologer
bologer / gradients.css
Created December 9, 2015 17:23
Nice css gredients
.bg-gradient-1 {
background: radial-gradient(circle at 8.75% 8.45%,#003973,transparent 100%),radial-gradient(circle at 94.06% 82.83%,#E5E5BE,transparent 100%),radial-gradient(circle at 50% 50%,#668cc2,#668cc2 100%);
}
.bg-gradient-2 {
background: radial-gradient(circle at 1.98% 3%,#348F50,transparent 100%),radial-gradient(circle at 98.02% 98%,#56B4D3,transparent 100%),radial-gradient(circle at 50% 50%,#668cc2,#668cc2 100%);
}
.bg-gradient-3 {
background: radial-gradient(circle at 1.98% 74.02%,#E55D87,transparent 100%),radial-gradient(circle at 98.02% 35.97%,#5FC3E4,transparent 100%),radial-gradient(circle at 50% 50%,#0cc285,#0cc285 100%);
@bologer
bologer / cloudflare-challenge.js
Created February 27, 2017 17:46 — forked from alexwilson/cloudflare-challenge.js
This is a project designed to get around sites using Cloudflare's "I'm under attack" mode. Using the PhantomJS headless browser, it queries a site given to it as the second parameter, waits six seconds and returns the cookies required to continue using this site. With this, it is possible to automate scrapers or spiders that would otherwise be t…
/**
* This is a project designed to get around sites using Cloudflare's "I'm under attack" mode.
* Using the PhantomJS headless browser, it queries a site given to it as the second parameter,
* waits six seconds and returns the cookies required to continue using this site. With this,
* it is possible to automate scrapers or spiders that would otherwise be thwarted by Cloudflare's
* anti-bot protection.
*
* To run this: phantomjs cloudflare-challenge.js http://www.example.org/
*
* Copyright © 2015 by Alex Wilson <antoligy@antoligy.com>
@bologer
bologer / hidden-products.md
Last active October 19, 2017 18:23
Show hidden products
  1. Open wp-content/themes/royal/woocommerce/content-product-gift.php and delete/comment the following lines:
//if ( ! $product || ! $product->is_visible() )
//	return;
  1. Open wp-content/themes/royal/page-profile-template.php

Change:

@bologer
bologer / converTablesToCollation.php
Created September 6, 2018 08:44
Convert tables to the required collation in Yii2
$wantedCollation = 'utf8_unicode_ci';
$command = Yii::$app->getDb()->createCommand('SHOW TABLE STATUS');
$tableCollations = $command->queryAll();
if (!empty($tableCollations)) {
foreach ($tableCollations as $tableCollation) {
$tableName = $tableCollation['Name'] ?? null;
@bologer
bologer / functions.php
Last active November 3, 2018 09:44
Add custom classes to #comments for AnyComment
<?php
function anycomment_custom_js() {
?>
jQuery(document).on('ready', function($) {
$('#comments').addClass('gridlove-comments gridlove-box box-inner-p-bigger');
});
<?php
}
add_action('wp_footer', 'anycomment_custom_js');
@bologer
bologer / functions.php
Created November 3, 2018 17:20
Hide admin bar from users who cannot manage options
<?php
/**
* Disable admin bar for users who cannot manage options.
*/
function anycomment_disable_admin_bar() {
if ( is_plugin_active( 'anycomment/anycomment.php' ) ) {
if ( ! current_user_can( 'manage_options' ) ) {
show_admin_bar( false );
}
@bologer
bologer / gist:70e5513f35c9020a9961a768c1c56c14
Created January 7, 2019 09:16 — forked from saippuakauppias/gist:4714695
javascript vkontakte api wall post: постинг на стену к текущему пользователю на JS vk API. С помощью этого кода так же можно отправлять записи на стены групп, пользователей и публичных страниц (пабликов). Используется в iframe приложениях вконтакте.
/*
* message - сообщение, которое будет опубликовано
* image - картинка для постинга
* user_id - id текущего пользователя (к нему будет осуществлён постинг)
*/
function wallPost(message, image, user_id) {
VK.api('photos.getWallUploadServer', {
uid: user_id
}, function (data) {
if (data.response) {