Skip to content

Instantly share code, notes, and snippets.

@patrickatwsrn
patrickatwsrn / result.js
Created May 4, 2022 16:21 — forked from larscwallin/result.js
XPDO to simple ExtJS 3 Stores
var SimplxStudio = {};
SimplxStudio.modx = {};
/* Creating JSON representation for modAccess */
SimplxStudio.modx.modAccess={
"class": "modAccess",
"extends":"xPDOSimpleObject",
"fields": [
"id","alias","target","principal_class","principal","authority","policy"
@patrickatwsrn
patrickatwsrn / WebHook.php
Created November 27, 2021 19:27 — forked from bwente/WebHook.php
Very basic webhook for MODX, posts JSON to a URL. Works well with Zapier.
<?php
// [[!WebHook? &secret=`dh730>soteW` &runsnippet=`updateSettings` &params=`setting=savings`]]
$mySecret = $modx->getOption('secret', $scriptProperties);
$mySnippet = $modx->getOption('runsnippet', $scriptProperties);
$myParams = $modx->getOption('params', $scriptProperties);
$achunks = array_chunk(preg_split('/(=|,)/', $myParams), 2);
$myParams = array_combine(array_column($achunks, 0), array_column($achunks, 1));
$webhookContent = "";
@patrickatwsrn
patrickatwsrn / curl.with.cookie.php
Created November 15, 2021 14:27 — forked from nazt/curl.with.cookie.php
curl.with.cookie.php
@patrickatwsrn
patrickatwsrn / multicolumn.js
Last active July 19, 2021 13:25
Display children of element in multiple columns if the number of children is equal to or higher than a certain number.
const multiColumns = document.querySelectorAll('.multiColumn');
if(multiColumns.length > 0){
multiColumns.forEach(multiColumn => {
/* options may be changed by data-atributes */
var columnCount = multiColumn.getAttribute('data-column-count') ? multiColumn.getAttribute('data-column-count') : 2;
var columnGap = multiColumn.getAttribute('data-column.gap') ? multiColumn.getAttribute('data-column.gap') : '4rem';
/* don't change anything below this point */
@patrickatwsrn
patrickatwsrn / modx_bootstrap_breakpoints.chunk.html
Last active May 10, 2021 15:01
Add breakpoint navagation buttons to your website if you are logged into the modx manager
[[!+modx.user.id:userinfo=`username`:is=`pepebe`:then=``:else=``]]
<script>
var buttons = {
xs: {
minWidth: "0"
,onClass: "d-block d-sm-none"
,offClass: "d-none d-sm-block"
}
,sm: {
01-autoResizeOnUpload.php - Plugin to automatically resize images uploaded via MODX that are larger than the dimensions specified
in the config within the plugin code. This should be considered experimental but has been tested
successfully on MODX Revolution 2.3.2-pl (traditional) running on Windows Server 2008.
02-set-expires-headers.php - Sets expires headers to value defined in plugin