Skip to content

Instantly share code, notes, and snippets.

Получаем цены для товаров

/**
 * @var array $resultObjectList - Массив объектов
 * @var VirtueMartModelProduct $productModel
 */
$productModel = VmModel::getModel('product');
// Получаем цены для товаров
@gartes
gartes / phpstorm-node_sass-config.txt
Created December 3, 2022 10:50 — forked from mediaformat/phpstorm-node_sass-config.txt
node-sass with sourcemap in phpstorm
Getting node-sass to output a sourcemap took a bit of trial & error
Mostly because phpstorm does not allow for the same colon syntax that most sources reference,
specifically the Output paths to reference only took 1 argument
---
Add File Watcher SCSS in settings
Watcher Settings
Program :
C:\Users\%username%\AppData\Roaming\npm\node-sass.cmd
Arguments :
--no-cache --update --source-map=$FileNameWithoutExtension$.css.map $FileName$ $FileNameWithoutExtension$.css
@gartes
gartes / defines.php
Last active November 23, 2022 12:16
Переопределение расположения CONFIGURATION
/**
* Переопределение расположения CONFIGURATION
*
* Добавить - этот код в низ файлов :
* -- /includes/defines.php
* -- /administrator/includes/defines.php
* Удалить в этих файлах стандартное определение константы define('JPATH_CONFIGURATION', JPATH_ROOT);
*
* Скопировать файл /configuration.php в директорию - /includes/dev/
* - в место *.*.*.* - вставить свой IP
@gartes
gartes / parallax.js
Created February 7, 2022 10:28 — forked from Dexdot/parallax.js
animations on scroll
const math = {
map: (x, a, b, c, d) => ((x - a) * (d - c)) / (b - a) + c,
lerp: (a, b, n) => (1 - n) * a + n * b
};
const { body } = document;
// Window
let winsize;
const calcWinsize = () => {
winsize = { width: window.innerWidth, height: window.innerHeight };
@gartes
gartes / jq.viewport.js
Created February 7, 2022 10:26 — forked from Dexdot/jq.viewport.js
jQuery viewport checker
$.fn.isInViewport = function() {
const elementTop = $(this).offset().top;
const elementBottom = elementTop + $(this).outerHeight();
const viewportTop = $(window).scrollTop();
const viewportBottom = viewportTop + $(window).height();
return elementBottom > viewportTop && elementTop < viewportBottom;
};
@gartes
gartes / htaccess.expires.headers
Created January 3, 2022 08:10 — forked from solancer/htaccess.expires.headers
htaccess expires headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 year"
# Data interchange
ExpiresByType application/atom+xml "access plus 1 hour"
@gartes
gartes / getCategoryTree.php
Last active November 27, 2021 22:54
Получить дерево категорий товар (OpenCart)
/**
* Создать дерево категорий для товара
* Использовано для CMS - OpenCart
*
* @param int $product_id
* @param int $categoryId
* @param string $categoryTreeArray
*
* @return array|mixed|string
* @since 3.9
@gartes
gartes / _WebStorm Babel file-watcher setup basics.md
Last active November 26, 2021 09:56
WebStorm/PHPStorm (and so on...) Babel file-watcher setup basics

Basic Babel file-watcher setup

ZXCV

This requires NPM to be installed.

Adding file-watchers

package.json file

@gartes
gartes / my-counter.js
Created October 17, 2021 19:22
Web Component Example
const template = document.createElement('template');
template.innerHTML = `
<style>
* {
font-size: 200%;
}
span {
width: 4rem;
display: inline-block;