Skip to content

Instantly share code, notes, and snippets.

@opengeek
opengeek / src-Middleware-MODSlim.php
Created June 9, 2015 15:52
This is a proof of concept for using MODX 2.x as a dependency in a Slim application
<?php
/*
* This file is part of the MODSlim package.
*
* Copyright (c) Jason Coward <jason@opengeek.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@opengeek
opengeek / Changeset configuration example
Last active February 8, 2023 12:19
Adding the following config_options entries to your MODX Revolution config file will allow you to track changes made to any xPDOObject class via the `xPDOObject::save()`, `xPDOObject::remove()`, `xPDO::updateCollection()`, or `xPDO::removeCollection()` methods. This example records changes into a database register called `changes` under a config…
<?php
$config_options = array (
'callback_excludes' => array(
'modSession',
'modManagerLog',
'modActiveUser',
'modDbRegisterQueue',
'modDbRegisterTopic',
'modDbRegisterMessage',
'modUser',
@tdm00
tdm00 / gist:5151726
Created March 13, 2013 12:44
gitlab logrotate config
# Place this file in /etc/logrotate.d/gitlab
/home/gitlab/gitlab/log/*.log {
daily
rotate 52
missingok
delaycompress
compress
copytruncate
}
@grindars
grindars / steam_bootstrap.sh
Created December 7, 2012 07:53
Steam installer for Debian
#!/bin/bash
#
# Steam installer for Debian wheezy (32- and 64-bit)
#
# Place into empty directory and run.
#
download() {
local url="$1"
local filename="$(basename "$url")"
@krismas
krismas / resource.grid.js
Created November 2, 2012 13:19
"Refresh Cache" an extension for MODX Batcher
// 02/06/12 - Gildas - g.noel@ackwa.fr
// - assets/components/batcher/js/widgets/resource.grid.js patch to Add "Refresh Cache" Option
// 05/11/12 - Gildas - g.noel@ackwa.fr
// - Add custom log
// - Force timeout to 30s for each request
Batcher.grid.Resources = function(config) {
config = config || {};
this.sm = new Ext.grid.CheckboxSelectionModel();
Ext.applyIf(config,{
@pepebe
pepebe / gist:3957784
Created October 26, 2012 09:12
MODx - All-purpose-snippet
<?php
/* runFn Snippet
* by info@pepebe.de
*
* Pass the snippet a php function name and pipe delimited list of parameters.
*
* Example: Format a large number with number_format()
* See: www.php.net/manual/en/function.number-format.php
*
* [[!runFn? &fn=`number_format` &args=`123456789||2||,||.`]]
@gadamiak
gadamiak / LangRouter.php
Created October 1, 2012 16:31
Language context router for use with Babel extra for MODX Revolution
<?php
/* LangRouter
* ==========
*
* This plugin is meant to be used with Babel extra for MODX Revolution. It
* takes care of switching contexts, which hold translations, depending on URL
* requested by client. LangRouter works with so called subfolder based setup,
* in which many languages are served under a single domain but are
* differentiated by a virtual subfolder indicating the language, eg.
* mydomain.com/pl/.
@opengeek
opengeek / useTranslitService.php
Created September 20, 2012 13:26
Example of using the MODX transliteration service
<?php
$translitClassPath = $this->xpdo->getOption(
'friendly_alias_translit_class_path',
$options,
$this->xpdo->getOption('core_path', $options, MODX_CORE_PATH) . 'components/'
);
if ($this->xpdo->getService('translit', $translitClass, $translitClassPath, $options)) {
$alias = $this->xpdo->translit->translate($stringToApplyTransliterationTo, $translitTableName);
}
@netProphET
netProphET / manager_leftpanel_width.plugin.php
Created June 22, 2012 15:05
plugin fragment for setting width of MODX Manager left panel
<?php
/**
* plugin fragment for setting width of MODX Manager left panel
*/
if($modx->event->name == 'OnBeforeManagerPageInit') {
// update layout manager state
$state = $modx->controller->getDefaultState();
$state['modx-leftbar-tabs']['width'] = 525;
$response = $modx->runProcessor('system/registry/register/send',array(
'register' => 'state',
@christianhanvey
christianhanvey / convertMarkdown.php
Created June 21, 2012 13:20
convert from Markdown to HTML - MODX custom output filter
<?php
/* convertMarkdown - a custom output filter
* by Christian Hanvey
* WTFPL License
*
* ORIGINAL PHP MARKDOWN CLASS by Michel Fortin
* http://michelf.com/projects/php-markdown/
*
*