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 / reallink.php
Last active August 29, 2015 14:23
Real link php
foreach ($res as $mod) {
$db->update('mods', array(
'mod_icon' => lgsl_icon_game1($mod['short_name'], $mod['short_name'])
),
'short_name="' . $mod['short_name'] . '"'
);
$result = $db->getResult();
print_r($result);
// echo '<img src="' . lgsl_icon_game1($mod['short_name'], $mod['short_name']) . '" /> <br/>';
}
//Source: http://stackoverflow.com/questions/467336/how-to-use-slidedown-or-show-function-on-a-table-row
// SlideUp
$('#my_table > tbody > tr.my_row')
.find('td')
.wrapInner('<div style="display: block;" />')
.parent()
.find('td > div')
.slideUp(700, function(){
@bologer
bologer / Rcon.class.php
Last active August 29, 2015 14:23
Rcon для получения данных о сервере
<?php
class Rcon
{
public $host, $port, $pass;
private $fp, $challenge_number;
public function __construct($host, $pass)
{
$_host = explode(":", $host);
// Rcon connection
$rcon = new Rcon("217.106.106.217:27015", "ddfgioijio34234knWEFSDknggd");
if( $rcon->Connect() ) {
$result = $rcon->Command("status");
$rcon->Disconnect();
echo $result;
}
@bologer
bologer / category.php
Last active August 29, 2015 14:23
Wordpress вывод категорий
<?php
if (is_category()):
$this_category = get_category($cat);
endif;
?>
<?php
if($this_category->category_parent):
$this_category = wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->category_parent."&echo=0");
else:
$this_category = wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID."&echo=0");
@bologer
bologer / gist:2465a3694be0574fd66f
Last active August 29, 2015 14:23
category-wordpress.old.php
<?php
// abs path function
function url_origin($s, $use_forwarded_host = false){
$ssl = (!empty($s['HTTPS']) && $s['HTTPS'] == 'on') ? true:false;
$sp = strtolower($s['SERVER_PROTOCOL']);
$protocol = substr($sp, 0, strpos($sp, '/')) . (($ssl) ? 's' : '');
$port = $s['SERVER_PORT'];
$port = ((!$ssl && $port=='80') || ($ssl && $port=='443')) ? '' : ':'.$port;
$host = ($use_forwarded_host && isset($s['HTTP_X_FORWARDED_HOST'])) ? $s['HTTP_X_FORWARDED_HOST'] : (isset($s['HTTP_HOST']) ? $s['HTTP_HOST'] : null);
@bologer
bologer / wordpress.post.php
Created June 30, 2015 20:41
Wordpress sub-categories of parent category from the current post
<?php
# https://wordpress.org/support/topic/how-to-only-show-the-posts-child-category-inside-the-loop
$post_child_cat = array();
foreach( (get_the_category()) as $cats) {
$args = array( 'child_of' => $cats->cat_ID );
$categories = get_categories( $args );
if( $categories ) foreach( $categories as $category ) echo '<li><a href="/cat='. $category->cat_ID.'">' . $category->cat_name . '</a></li>';
}
@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')
)
)
);
@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;