Skip to content

Instantly share code, notes, and snippets.

@matdave
matdave / Creative One Page Theme.template.html
Created January 27, 2021 21:23
Fred (Creative One Page Theme)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
@matdave
matdave / Shadow of the Ninja (USA).cht
Created January 15, 2021 19:41
Shadow of the Ninja Cheats
SCf55d:a5:c6:Infinite continues
SCac6d:2c:9d:Don't lose energy from enemy attacks
SC9564:00:04:Don't lose energy from falling
SC8c19:10:04:Maximum energy gained from potion
SC8c31:28:14:40 throwing stars on pick-up
SC8c46:14:05:20 bombs on pick-up
@matdave
matdave / modx_site_templates.sql
Last active September 22, 2023 19:37
MODX count number of times a template is used
SELECT a.id, a.templatename, COUNT(b.id) as resources FROM modx_site_templates AS a
LEFT JOIN modx_site_content AS b ON a.id = b.template AND b.published = 1 AND b.deleted = 0
WHERE b.id IS NOT NULL
GROUP BY a.id;
@matdave
matdave / createdBy.plugin.php
Created August 12, 2020 21:05
MODX change author plugin
<?php
/**
* Plugin to add a "created by" field on a resource form and moves "published on" to document tab
*
* @var modX $modx
* @var array $scriptProperties
*
* @event OnDocFormPrerender
*/
$dateFormat = $modx->getOption('manager_date_format',null,'d.m.Y');
@matdave
matdave / recaptchav3.post.snippet.php
Last active April 14, 2020 22:36
MODX reCaptchaV3 POST
<?php
/**
* recaptchav3 POST Validator for use with MODX form processors
*
* Based on https://github.com/google/recaptcha
*
* @copyright Copyright (c) 2014, Google Inc.
* @link http://www.google.com/recaptcha
*
* Ported to MODX by YJ Tso @sepiariver
@matdave
matdave / codeSample.snippet.php
Last active April 10, 2020 16:24
MODX codeSamples
<?php
/**
* codeSample Snippet for rendering ASCII characters of element calls in MODX frontend
* e.g.
* [[codeSample?&element=`QuickEmail`&properties=`debug=1` &cachedFlag=`true`]]
* outputs [[!QuickEmail? &debug=`1`]]
**/
$element = $modx->getOption('element', $scriptProperties, null);
$type = $modx->getOption('elementClass', $scriptProperties, 'modSnippet');
@matdave
matdave / imageRotate.2.x.plugin.php
Last active October 2, 2023 07:35
MODX imageRotate Plugin
<?php
// run plugin OnFileManagerUpload
switch ($modx->event->name) {
case "OnFileManagerUpload":
if(!empty($files)){
foreach($files as $file){
if ($file['type'] != "image/jpeg" && $file['type'] != "image/png")
return;
// max number of pixels wide or high
$max_image_dimension = $modx->getOption('max_image_dimension',$scriptProperties,0);
BuiltWith
javascript:void(window.open('http://builtwith.com?'+location.hostname,'_blank'))
DNS Whois IP
javascript:void(window.open('https://dnslytics.com/domain/'+location.hostname,'_blank'))
MX Toolbox
javascript:void(window.open('https://mxtoolbox.com/SuperTool.aspx?action=mx%3a'+location.hostname+'&run=toolpage','_blank'))
Wayback Machine
@matdave
matdave / tablePresentation.php
Created December 20, 2019 17:03
MODX tablePresentation plugin
<?php
// Run OnWebPagePrereneder
$modx->resource->_output = str_replace('<table', '<table role="presentation"', $modx->resource->_output);
@matdave
matdave / delayClearCache.plugin.php
Created October 16, 2019 20:35
Delay Clearing Cache on Resource Save
<?php
switch ($modx->event->name) {
case 'OnBeforeDocFormSave':
$now = mktime();
$lastcache = $modx->cacheManager->get('delaycache');
if(!empty($lastcache) && ($now - $lastcache) < 300){
$_POST['syncsite'] = 0;
}
return;
break;