This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function video_frame_resize(iframe_selector){ | |
var v = {}; | |
v.ww = $(window).width(); | |
v.wh = $(window).height(); | |
v.parent_w = $( iframe_selector ).parent().width(); | |
v.parent_h = $( iframe_selector ).parent().height(); | |
v.frame_w = $( iframe_selector ).attr('width'); | |
v.frame_h = $( iframe_selector ).attr('height'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// - это комментарии которые в коде не видны есть аналог /* тут комментарий */ (это работает в javascript, css) | |
<?php //это начало файла и обозначает что тут код php | |
//тут код php пишется | |
?> //это завершает область php кода | |
<?php | |
$var // это переменная в неё можно что то положить из нескольких типов данных | |
$var = 'привет'; //в переременной $var теперь тип данных строка с текстом (string) | |
$var = 0; //в переременной $var теперь тип данных число (number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$currentCatId = '1,2'; | |
function is_var_ok( $var, $reg ){ | |
if(isset($reg)){ | |
$is_filter_ok = $reg; | |
} else { | |
$is_filter_ok = '#^[0-9,\s]+$#'; //проверка на вхождения в струку только 0-9 запятой и пробелов |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//### STYLES | |
function include_style( $style_name, $file, $array = '', $is_child){ | |
if( $is_child || $is_child == 'child'){ | |
$file_uri = get_stylesheet_directory_uri() . $file; | |
$file_path = get_stylesheet_directory() . $file; | |
} else { | |
$file_uri = get_template_directory_uri() . $file; | |
$file_path = get_template_directory() . $file; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find_replace(selector, attr, find, replace, v){ | |
v = {}; | |
$(selector).each(function(){ | |
v.img_src = $(this).attr(attr); | |
v.out = v.img_src.replace(find, replace); | |
$(this).attr(attr, v.out); | |
}); | |
} | |
find_replace('img', 'src', /site.ru/i, '127.0.0.1'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function each_table_td( selector, td_num, find_regexp, replace_regexp, replace_mask, _e){ | |
_e = {}; | |
$( selector ).each(function(index_1, el) { | |
_e.num = 0; | |
$(el).find('tr td').each(function(index_2, el_2) { | |
_e.num++; | |
if ( (_e.num % td_num) === 0) { | |
_e.td = $(this).html(); | |
//$(this).addClass('this_test'); | |
if (find_regexp.test(_e.td)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//js | |
function n( num, plus, num2 ){ | |
if( num < 1 && num2 < 1 ){ | |
num = num * 10; | |
num2 = num2 * 10; | |
} | |
var num_out = ''+num+plus+num2; | |
num_out = eval(num_out); | |
return num_out/10; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.isset = function(v_var) { | |
if(typeof(v_var) == 'number'){ if(isNaN(v_var)){return false;}} | |
if(typeof(v_var) == 'undefined' || v_var === null){return false;} | |
return true; | |
}; | |
// if( typeof(v_var) == 'undefined' ) | |
// or | |
// if( v_var === [][[]] ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global.timer_start = {}; //if browser replace all to window.timer_start | |
const jr = { //if browser js replace 'const' to 'var' | |
timer: { | |
start: function(timer_name) { | |
global.timer_start[timer_name] = new Date().getTime(); | |
}, | |
stop: function(timer_name) { | |
var timer_stop = new Date().getTime(); | |
var out = timer_stop - global.timer_start[timer_name]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dr=$1 | |
set_user=$2 | |
set_group=$3 | |
zDir="latest-ru_RU.zip" | |
wpInstall="https://ru.wordpress.org/"$zDir | |
eval "mkdir -p "$dr" && cd "$dr" && wget "$wpInstall" && unzip "$zDir" && cp -r "$dr"/wordpress/* "$dr" && rm -rf "$dr"/wordpress && rm -f -r "$zDir" && chown -R "$set_user":"$set_group" "$dr" && find "$dr" -type d -exec chmod 0755 {} \; && find "$dr" -type f -exec chmod 0644 {} \; && echo WordPress installation in directory "$dr" is done. " |