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 / 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
@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 / 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 / plugin.php
Created June 10, 2018 04:55 — forked from rtripault/plugin.php
Plugin to add a "created by" field on a MODX Revolution resource form, listening on the "OnDocFormPrerender" event
<?php
/**
* Sample plugin to add a "created by" field on a resource form
*
* @var modX $modx
* @var array $scriptProperties
*
* @event OnDocFormPrerender
*/
@CrazyBoy49z
CrazyBoy49z / Вывод количества товаров в категории.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);
@CrazyBoy49z
CrazyBoy49z / msDisplayFields.php
Created June 10, 2018 04:52 — forked from Advanc8d/msDisplayFields.php
Скрываем поля и закладки [MiniShop2] в зависимости от шаблона - http://2geek.pro/solutions/70-skryivaem-polya-minishop2-v-zavisimosti-ot-shablona
<?php
/* OnManagerPageBeforeRender */
switch ($modx->event->name) {
case 'OnDocFormPrerender':
if ($mode !== 'upd') {
return '';
}
if (!$template = $resource->get('template')) {
return '';
// composer.json
{
"name": "roots/bedrock",
"type": "project",
"license": "MIT",
"description": "A modern WordPress stack",
"homepage": "http://roots.io/wordpress-stack/",
"authors": [
<?php
// provider id => array of packages
$listPackagesToInstall = array(
1 => array( // standart modx provider
'AjaxManager',
'translit',
'pdoTools',
'FormIt',
'phpThumbOn',
<?php
// provider id => array of packages
$listPackagesToInstall = array(
1 => array( // standart modx provider
'sdStore'
, 'translit'
, 'TinyMCE'
, 'FormIt'
, 'Analytics'
@CrazyBoy49z
CrazyBoy49z / delete-dir.php
Created June 10, 2018 02:55 — forked from famoser/delete-dir.php
zip utilities php
<?php
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);