Skip to content

Instantly share code, notes, and snippets.

View splittingred's full-sized avatar
💭
🚀

Shaun McCormick splittingred

💭
🚀
View GitHub Profile
@splittingred
splittingred / gist:1018793
Created June 10, 2011 13:05
Hide left trees in MODX Revolution
Ext.onReady(function() {
Ext.getCmp('modx-layout').hideLeftbar();
});
@splittingred
splittingred / gist:2353708
Created April 10, 2012 19:03
twitter search criteria for #modx hashtag
modx -2by2host -from:modx -from:modx_feeds -to:modx -from:wehatejbieber -modx_ch -mr_modx -/logs/modx -noon_modx lang:en
@splittingred
splittingred / simple-benchmark.php
Created March 9, 2012 05:37
simple-benchmark.php
<?php
set_time_limit(0);
class Timer {
public $timer = 0;
public function start() {
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$this->timer = $mtime;
@splittingred
splittingred / gist:1435521
Created December 5, 2011 21:46
MODX 2.2 line count report, 12/5/2011
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
PHP 2218 24654 71713 180956
Javascript 223 3906 5440 49419
CSS 99 5030 1072 24588
XML 16 469 303 2903
Java 1 47 62 182
SQL 4 20 37 120
Smarty 3 5 0 58
@splittingred
splittingred / update.class.php
Created November 2, 2011 18:53
The nice and short Category update processor in MODX 2.2
<?php
class modElementCategoryUpdateProcessor extends modObjectUpdateProcessor {
public $classKey = 'modCategory';
public $languageTopics = array('category');
public $permission = 'save_category';
public $objectType = 'category';
}
return 'modElementCategoryUpdateProcessor';
<?php
require_once (dirname(dirname(__FILE__)).'/create.class.php');
/**
* Create a snippet.
*
* @param string $name The name of the element
* @param string $snippet The code of the snippet.
* @param string $description (optional) A brief description.
* @param integer $category (optional) The category to assign to. Defaults to no
* category.
@splittingred
splittingred / create.class.php
Created November 1, 2011 21:26
2.2 Chunk Create Processor
<?php
require_once (dirname(dirname(__FILE__)).'/create.class.php');
/**
* Creates a chunk.
*
* @param string $name The name of the chunk.
* @param string $description (optional) The description of the chunk.
* @param integer $category The category the chunk is assigned to.
* @param string $snippet The code of the chunk.
* @param boolean $locked Whether or not the chunk can only be accessed by
@splittingred
splittingred / updatefromgrid.class.php
Created September 29, 2011 15:40
Example of a derivative processor extending functionality
<?php
require_once (dirname(__FILE__) . '/update.class.php');
/**
* Update a setting from a grid
*
* @param string $key The key of the setting
* @param string $oldkey The old key of the setting
* @param string $value The value of the setting
* @param string $area The area for the setting
@splittingred
splittingred / create.class.php (new)
Created September 28, 2011 20:59
Old vs New MODX Processors (as of 2.2)
<?php
class modActionCreateProcessor extends modProcessor {
/** @var modAction $action */
public $action;
public function checkPermissions() {
return $this->modx->hasPermission('actions');
}
public function getLanguageTopics() {
return array('action','menu','namespace');
@splittingred
splittingred / getlist.php
Created September 28, 2011 22:07
Driver-specific processor in MODX 2.2. This is the databasetables/getlist processor.
<?php
/**
* Gets a list of database tables
*
* @package modx
* @subpackage processors.system.databasetable
*/
class modDatabaseTableGetListProcessor extends modDriverSpecificProcessor {
public function checkPermissions() {
return $this->modx->hasPermission('database');