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 / 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 / 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 / content-single-product.md
Last active September 1, 2021 12:56
1 пункт, скрыть sidebar, цены
  1. Открыть wp-content/themes/royal/functions.php
  2. Добавить функцию
/**
 * Check whether user is a cardholder or not.
 * @return bool
 */
function is_cardholder()
{
    if (!is_user_logged_in()) {
@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 / 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 / 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 / createServerAdmin.js
Created July 7, 2015 18:02
createNewAdmin jQuery script
/*
* This function is operatin with tables.
* It created opens up new form after the row
* that is being cliked. It slideToggles each
* of the active tr (if required) and removes
* name="" attribute if it is required.
*/
function createServerAdmin($this) {
// Element that is bein clicked
var thiz = $this;
@bologer
bologer / tablenestingjq.js
Created July 5, 2015 09:23
Table nesting with jQuery
#http://stackoverflow.com/a/1278557/4897308
$("#tableID").find('tbody')
.append($('<tr>')
.append($('<td>')
.append($('<img>')
.attr('src', 'img.png')
.text('Image cell')
)
)
);