Skip to content

Instantly share code, notes, and snippets.

Avatar

Denis Mamaev ExileofAranei

View GitHub Profile
@ExileofAranei
ExileofAranei / _decimal.scss
Created Jan 13, 2021 — forked from terkel/_decimal.scss
Rounding decimals in Sass
View _decimal.scss
// _decimal.scss | MIT License | gist.github.com/terkel/4373420
// Round a number to specified digits.
//
// @param {Number} $number A number to round
// @param {Number} [$digits:0] Digits to output
// @param {String} [$mode:round] (round|ceil|floor) How to round a number
// @return {Number} A rounded number
// @example
// decimal-round(0.333) => 0
@ExileofAranei
ExileofAranei / services.js
Created Sep 16, 2020 — forked from bullgare/services.js
form serialization in pure js
View services.js
serialize: function serialize(form)
{
if (!form || form.nodeName !== "FORM") {
return;
}
var i, j,
obj = {};
for (i = form.elements.length - 1; i >= 0; i = i - 1) {
if (form.elements[i].name === "") {
continue;
View gist:61bcc2c643c9d3c89f98ff0c64febf46
<?php
$step = 5;
$offset = isset($_SESSION['galgenoffset']) && $_SESSION['galgenoffset'] ? $_SESSION['galgenoffset'] : 0;
$ms2Gallery = $modx->getService('ms2gallery', 'ms2Gallery', MODX_CORE_PATH . 'components/ms2gallery/model/ms2gallery/');
$modx->setLogLevel(MODX_LOG_LEVEL_ERROR);
$q = $modx->newQuery('msResourceFile', array('parent' => 0));
$total = $modx->getCount('msResourceFile', $q);
$q->sortby('resource_id', 'ASC');
$q->sortby('rank', 'DESC');
$q->limit($step,$offset);
@ExileofAranei
ExileofAranei / Lamodul: console update
Last active Oct 11, 2019
Lamodul: update modules, phpthumb images and etc.
View Lamodul: console update
<?php
$pdoFetch = $modx->getService('pdoFetch');
$parents = '30641';
$counter = 0;
$origin_context = null;
if ($modx->context->key == 'mgr') {
$origin_context = $modx->context->key;
$modx->switchContext('web');