Skip to content

Instantly share code, notes, and snippets.

View CrazyBoy49z's full-sized avatar
💭
I may be slow to respond.

Yurij Finiv CrazyBoy49z

💭
I may be slow to respond.
View GitHub Profile
@CrazyBoy49z
CrazyBoy49z / modal.css
Created September 17, 2018 00:30 — forked from vgrish/modal.css
.modal {
/*! adjust transition time */
-webkit-transition: all ease-out !important;
-moz-transition: all 0.3s ease-out !important;
-o-transition: all 0.3s ease-out !important;
transition: all 0.3s ease-out !important;
}
.modal.in .modal-dialog {
/*! editthis transform to any transform you want */
-webkit-transform: scale(1, 1) !important;
@CrazyBoy49z
CrazyBoy49z / gist:c5cc79766ace8c4a82fc4d9cba05bfc7
Created September 17, 2018 00:30 — forked from vgrish/gist:190d3313253a7af6d63e
Media queries for mobile devices - Requires at least requires the meta viewport tag with content 'width=device-width'
/*http://i-skool.co.uk/mobile-development/web-design-for-mobiles-and-tablets-viewport-sizes/*/
/*At least requires the meta viewport tag with content 'width=device-width'*/
@media only screen and (max-width: 1080px) and (orientation : portrait) {
/* PORTRAIT:
Windows Surface Pro*/
}
@media only screen and (max-width: 800px) and (orientation : portrait) {
/* PORTRAIT:
Acer Iconia Tab A100
@CrazyBoy49z
CrazyBoy49z / gist:f71c3376546807737cec4b940426855e
Created September 17, 2018 00:46 — forked from vgrish/gist:14d9eaa8fa189b12353f
Reset the password and email of an existing user
<?php
define('MODX_API_MODE', true); // Gotta set this one constant.
// Reset the password and email of an existing user
// and ensure they are a member of the specified group
$username = 'theusername';
$password = 'newpassword';
$email = '[email protected]';
$user_group = 1; // 1 for Administrator
<?php
switch ($modx->event->name) {
case 'OnLoadWebDocument':
$id = 1; // id ресурса куда послать в случае чего
$res = array(1,2,3); // id ресурсов
if($modx->user->isAuthenticated(‘mgr’) && in_array($modx->resource->id, $res)) {
//разрешаем показать
}
elseif(!$modx->user->isAuthenticated(‘mgr’) && in_array($modx->resource->id, $res)) {
<?php
/** @var msDiscount $msDiscount */
/** @var pdoTools $pdoTools */
$pdoTools = $modx->getService('pdoTools');
$msDiscount = $modx->getService('msDiscount');
$date = $pdoTools->getStore('msd_date');
$usergroups = array_keys($msDiscount->getUserGroups($modx->user->id));
$sales = !empty($date)
? $msDiscount->getSales($date, true)
: $msDiscount->getSales();
@CrazyBoy49z
CrazyBoy49z / gist:a350f688940e4bfe3d3d59b8f93d7b0f
Created September 17, 2018 00:48 — forked from vgrish/gist:45ef44246aedfca9a83d
товары в корзину одним набюором
$(document).on('click', 'button[name="ms2_action_set"][value="cart/addset"]', function(e) {
var parentSelector = '.mssetincart-row';
var formSelector = '.ms2_form';
var sets = {
action: 'cart/add',
ctx: miniShop2Config.ctx,
id: 0,
count: 1,
options: []
<?php
/* @var miniShop2 $miniShop2 */
$miniShop2 = $modx->getService('minishop2');
$miniShop2->initialize($modx->context->key);
$cart = $miniShop2->cart->status();
$cart['total_cost'] = $miniShop2->formatPrice($cart['total_cost']);
$cart['total_weight'] = $miniShop2->formatWeight($cart['total_weight']);
$cart['total_my_count'] = count(array_count_values(array_values(array_map('array_shift',$_SESSION['minishop2']['cart']))))
return !empty($tpl) ? $modx->getChunk($tpl, $cart) : print_r($cart,1);
<?php
/**
* Password generate
*
* @category generate
* @version 0.1
* @license GNU General Public License (GPL), http://www.gnu.org/copyleft/gpl.html
* @param string $len длина пароля
* @param string $data правила генерации пароля
* @return string Строка с паролем
@CrazyBoy49z
CrazyBoy49z / printPlaceholders.php
Created September 17, 2018 17:11 — forked from vgrish/printPlaceholders.php
смотрим плейсходеры на странице
<?php
if (!$modx->user->isAuthenticated('mgr')) return;
$placeholders = $prefix ? array() : $modx->placeholders;
if ($prefix) {
foreach ($modx->placeholders as $key => $ph) {
if (strpos($key, $prefix) === 0) {
$placeholders[$key] = $ph;
}
<?php
/*
* WP Import, Ver 2015.01.04
* (C) 2015 by ZoRg Soft
* MODx Notes - WP Import модуь для импорта записей из Wordpress
* http://agarkov.org/modx-x/evo-wpimport
*/
$theme = $modx->config['manager_theme'];
$basePath = $modx->config['base_path'];