Skip to content

Instantly share code, notes, and snippets.

View Edarlingen's full-sized avatar

Aleksey Karagodnikov Edarlingen

  • Russian Federation
View GitHub Profile
@Edarlingen
Edarlingen / function.inc.php
Last active November 12, 2020 21:03
Установка H1 в NetCat
<?php
function get_seo_h1() {
global $current_sub;
global $current_cc;
global $action;
global $message;
$nc_core = nc_Core::get_object();
// По умолчанию даем NetCat определить значение
@Edarlingen
Edarlingen / jquery.transitionduration.js
Created September 30, 2015 00:40 — forked from jayeb/jquery.transitionduration.js
jQuery plugin for easily parsing an element's CSS transition duration
(function($){
$.fn.transitionDuration = function() {
var d = $(this).css("transitionDuration") || "0s";
return (parseFloat(d) * (/ms/.test(d)?1:1000)).toFixed(0);
}
})(jQuery);
@Edarlingen
Edarlingen / function.inc.php
Last active November 12, 2020 21:02
Установка Title в NetCat
<?php
function get_seo_title($title_delimeter = ' :: ') {
global $parent_sub_tree;
global $current_sub;
global $current_cc;
global $action;
global $message;
global $title_tail;
$nc_core = nc_Core::get_object();
@Edarlingen
Edarlingen / breadcrumbs.php
Last active May 22, 2024 11:08
Хлебные крошки в Netcat.
<?php
$url = $nc_core->catalogue->get_url_by_id($catalogue);
$full_url_without_query = $url . $nc_core->url->get_parsed_url('path');
$h1 = $nc_core->page->get_h1();
$breadcrumb_position = 1;
$current_cc_subdivision_id = $current_cc['Subdivision_ID'] ?: 0;
?>
<ol class='breadcrumb' itemscope='' itemtype='https://schema.org/BreadcrumbList'>
@Edarlingen
Edarlingen / gist:d63b413fc765a8fcae0f8ef3e773b4d9
Created August 20, 2016 21:56 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@Edarlingen
Edarlingen / prefix.php
Last active November 12, 2020 21:02
Использование дополнительных шаблонов внутри компонента
<?
// Имя дополнительного шаблона
$partial_template_name = 'Test';
// Данные для передачи в дополнительный шаблон
$data = array('example' => 'string');
// Переменная с набором свойств текущего шаблона
global $template_env;
// Функция определяет корневой родительский шаблон для указанного шаблона
@Edarlingen
Edarlingen / isp-update.sh
Created March 2, 2017 11:47
Обновление ISP Manager
/usr/local/mgr5/sbin/licctl fetch ispmgr
/usr/local/mgr5/sbin/pkgupgrade.sh coremanager
@Edarlingen
Edarlingen / .htaccess
Created April 5, 2017 11:45
Шаблон для оптимизации
<IfModule mod_deflate.c>
#The following line is enough for .js and .css
AddOutputFilter DEFLATE js css
AddOutputFilterByType DEFLATE text/plain text/xml application/xhtml+xml text/css application/xml application/rss+xml application/atom_xml application/x-javascript application/x-httpd-php application/x-httpd-fastphp text/html
#The following lines are to avoid bugs with some browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
@Edarlingen
Edarlingen / nginx.conf
Created April 10, 2017 06:33
nginx: кэш
location ~ ^.+\.(css|txt|js)$ {
root $root_path;
gzip_static on;
access_log off; # не пишем логи
add_header Cache-Control public;
expires 7d; # кешируем у клиента на 7 дней
add_header ETag "";
}
location ~ ^.+\.(jpg|jpeg|gif|png|ico|pdf|ppt|bmp|js)$ {
@Edarlingen
Edarlingen / nginx.conf
Created April 10, 2017 06:35
nginx: if-modified-since
location @fallback {
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header If-Modified-Since $http_if_modified_since;
access_log off ;
}