Skip to content

Instantly share code, notes, and snippets.

@buzan92
buzan92 / .eslintrc
Created April 26, 2019 07:32
eslint
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"allowImportExportEverywhere": true,
@buzan92
buzan92 / .gitconfig
Created April 26, 2019 07:29
gitconfig
[user]
email = [email protected]
name = f.dotsenko
[alias]
st = status
unstage = reset HEAD --
co = checkout
br = branch
ci = commit
l = log --graph --stat --pretty=\"--------------------------------------------------------------------------------------------------%n %h | %s %n [%cd]\"
@buzan92
buzan92 / Toast.swift
Last active December 21, 2017 16:24
Toast notification class for swift 4 like android
import Foundation
import UIKit
public extension UIView {
public func showToast(message:String, duration:Int = 2000) {
let toastLabel = UIPaddingLabel();
toastLabel.padding = 10;
toastLabel.translatesAutoresizingMaskIntoConstraints = false;
@buzan92
buzan92 / Вывод количества товаров в категории.php Вывод количества товаров в категории minishop2 Сниппет получает сумму всех товаров в категории, с учетом мультикатегорий MS2. Можно указать нужную категорию параметром $parent.
<?php
if (empty($parent)) {$parent = $modx->resource->id;}
$pids = array_merge(array($parent), $modx->getChildIds($parent));
$ids = array();
$q = $modx->newQuery('msProduct');
$q->where(array('class_key' => 'msProduct','parent:IN' => $pids,'published' => 1,'deleted' => 0));
$q->select('`msProduct`.`id`');
if ($q->prepare() && $q->stmt->execute()) {
$ids = $q->stmt->fetchAll(PDO::FETCH_COLUMN);