Skip to content

Instantly share code, notes, and snippets.

View pavel-one's full-sized avatar

Pavel Zarubin pavel-one

View GitHub Profile
@pavel-one
pavel-one / plugin.php
Created April 30, 2018 16:01
MODX Extjs Интересные методы
<?php
$eventName = $modx->event->name;
switch($eventName) {
case 'OnDocFormPrerender':
// Для ресурсов с индетификатором шаблона 2
// а также для всех новых ресурсов ( $resource == null )
if( $resource && $resource->get('template') == 2 || !$resource){
$modx->regClientStartupHTMLBlock('<script>
Ext.onReady(function() {
@pavel-one
pavel-one / SimpleBuilder.php
Last active February 26, 2022 12:48
Simple sql builder for modx & minishop2
<?php
namespace ExportPackage;
class SimpleBuilder
{
const MS2_ALIAS_TABLE = 'ms2';
const SITE_CONTENT_ALIAS_TABLE = 'resource';
protected $ms2 = [];
@pavel-one
pavel-one / .zshrc
Last active November 27, 2020 10:12
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
## Options section
setopt correct # Auto correct mistakes
setopt extendedglob # Extended globbing. Allows using regular expressions with *
@pavel-one
pavel-one / msEmail.tpl
Created May 15, 2018 02:58
minishop2 custom email
{var $style = [
'logo' => 'display:block;margin: auto;',
'a' => 'color:#348eda;',
'p' => 'font-family: Arial;color: #666666;font-size: 12px;',
'h' => 'font-family:Arial;color: #111111;font-weight: 200;line-height: 1.2em;margin: 40px 20px;text-align:center;',
'h1' => 'font-size: 36px;',
'h2' => 'font-size: 28px;',
'h3' => 'font-size: 22px;',
'th' => 'font-family: Arial;text-align: left;color: #111111;',
'td' => 'font-family: Arial;text-align: left;color: #111111;border: 1px solid #eee;padding: 10px;',
@pavel-one
pavel-one / .p10k.zsh
Last active September 24, 2020 01:04
# Generated by Powerlevel10k configuration wizard on 2020-09-24 at 00:49 UTC.
# Based on romkatv/powerlevel10k/config/p10k-lean-8colors.zsh, checksum 36327.
# Wizard options: nerdfont-complete + powerline, small icons, lean_8colors, unicode,
# 24h time, 1 line, sparse, many icons, concise, transient_prompt,
# instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with 8-color lean prompt style. Type `p10k configure` to generate
# your own config based on it.
#
@pavel-one
pavel-one / csv2array.php
Created September 17, 2019 08:41
Csv2Array
<?php
/**
* parse_csv
* parse CSV file into big array
*
* @param string $file
* @param string $separator
* @param array $meta
* @return array
*/
@pavel-one
pavel-one / UserFiles.tpl
Last active September 16, 2019 11:55
UserFiles select one thumbinails
{'!pdoResources' | snippet: [
'parents' => $_modx->resource.id,
'limit' => 0,
'tvPrefix' => '',
'tpl' => '',
'leftJoin' => [
'UF' => [
'class' => 'UserFile',
'on' => 'UF.parent = modResource.id AND UF.rank = 0'
]
@pavel-one
pavel-one / getlist.class.php
Created August 18, 2019 20:13
core/components/msrussianpost/processors/web/country/getlist.class.php
<?php
class rpCountryGetListProcessor extends modProcessor
{
public function process()
{
$countryList = $this->getCountryList();
$countries = array();
@pavel-one
pavel-one / getTVcustomData.php
Created May 12, 2018 04:31
Кастомные данные для тв
<?php
//@EVAL return $modx->runSnippet('getDepartament');
$pdo = $modx->getService('pdoFetch');
$pdo->setConfig(array(
'parents' => 137,
'limit' => 0,
'sortby' => 'id',
'select' => 'id,pagetitle',
'return' => 'data',
'where' => [
<?php
$trans = array("Monday" => "Понедельник",
"Tuesday" => "Вторник",
"Wednesday" => "Среда",
"Thursday" => "Четверг",
"Friday" => "Пятница",
"Saturday" => "Суббота",
"Sunday" => "Воскресенье"
);