Skip to content

Instantly share code, notes, and snippets.

View Rachind's full-sized avatar

rachind Rachind

  • Webservice
  • Saint-Petersburg, Russia
View GitHub Profile
@Rachind
Rachind / modx-permissions-for-content-editor.txt
Last active July 14, 2020 16:18
MODX: Additional Permissions form Content Editor
directory_create
directory_list
directory_remove
directory_update
empty_cache
file_list
file_manager
file_remove
file_upload
publish_document
@Rachind
Rachind / change-count-by-buttons.js
Created May 1, 2017 08:50
Изменение количества кнопками
$input = $(this).parent().find('input[name=count]'),
input_val = parseInt($input.val());
if($(this).hasClass('m')) {
if(input_val > 1) $input.val(input_val-1);
} else {
$input.val(input_val+1);
}
$(this).parent('form').trigger('submit');
})
@Rachind
Rachind / modx-minishop2-carttable-row-cost-update.txt
Created May 1, 2017 08:48
Обновление суммы в строчке корзины miniShop2
Обновление суммы в строчке корзины miniShop2
Javascript:
---------------------------------
change: function () {
var callbacks = miniShop2.Cart.callbacks;
callbacks.change.response.success = function (response) {
var num_v = $('#'+response.data.key).find('input[name=count]').val();
var pri = $('#'+response.data.key).find('input[name=price]').val();
var td_pri = parseFloat(pri)*num_v;
@Rachind
Rachind / jquery-scroll-lock.js
Last active March 1, 2017 21:06
Jquery scroll lock
$.scrollLock = ( function scrollLockClosure() {
'use strict';
var $html = $( 'html' ),
// State: unlocked by default
locked = false,
// State: scroll to revert to
prevScroll = {
scrollLeft : $( window ).scrollLeft(),
scrollTop : $( window ).scrollTop()
@Rachind
Rachind / linux-useful-commands.txt
Last active December 4, 2021 21:46
Linux Useful Commands
Вызов коммандера
mc
Подключиться по FTP
Логин:Пароль@Адрес сервера
Синхронизировать папки
rsync -avzP test/ [email protected]:public_html/test/
Экспорт базы на исходном сервере:
@Rachind
Rachind / modx-regenerate-preview.php
Created October 19, 2016 09:43
MODX Regenerate Preview Minishop2
<?php
$step = 5;
$offset = isset($_SESSION['galgenoffset']) && $_SESSION['galgenoffset'] ? $_SESSION['galgenoffset'] : 0;
$miniShop2 = $modx->getService('minishop2');
$modx->setLogLevel(MODX_LOG_LEVEL_ERROR);
$q = $modx->newQuery('msProduct');
$total = $modx->getCount('msProduct', $q);
$q->sortby('id','ASC');
$q->limit($step,$offset);
$resources = $modx->getCollection('msProduct', $q);
@Rachind
Rachind / modx-introtext-richtext.php
Created October 11, 2016 06:57
MODX Introtext Richtext
<?php
// Add RTE for introtext if richtext option is enabled for the resource
// check "OnDocFormRender" event
$templates_arr = explode(',', $templates);
if(!empty($resource) && in_array($resource->template, $templates_arr)) {
$modx->regClientStartupHTMLBlock('<script>Ext.onReady(function() {
if(MODx.loadRTE) MODx.loadRTE("modx-resource-introtext");
});</script>');
}
@Rachind
Rachind / tabs.simple.js
Last active August 5, 2017 13:06
Jquery Tabs Simple
$('ul.tabnav').on('click', 'li:not(.active)', function(e) {
e.preventDefault();
$(this).addClass('active').siblings().removeClass('active').parents('div.boxes').find('div.box').eq($(this).index()).fadeIn(150).siblings('div.box').hide();
});
@Rachind
Rachind / modx-create-migx-tv-value.php
Created October 3, 2016 21:00
MODX create MIGX tv value
<?
$pics = array();
$i = 1;
foreach ($api_value->animalPictures as $animalPictures) {
$pic = array();
$pic['image'] = $animalPictures->urlSecureFullsize;
$pic['MIGX_id'] = $i;
$pics[] = $pic;
$i++;
}
@Rachind
Rachind / request-filter.php
Created October 3, 2016 19:52
REQUEST filter
<?php
function flt($input_text) {
return mysql_escape_string(htmlspecialchars(strip_tags(trim($input_text))));
}