Skip to content

Instantly share code, notes, and snippets.

<?php
$output = '';
$tElementClass = !empty($tElementClass) ? $tElementClass : 'modSnippet';
$tStart = $modx->getMicroTime();
if (!empty($tElement)) {
switch ($tElementClass) {
case 'modChunk':
$output = $modx->getChunk($tElement, $scriptProperties);
break;
@Mark-H
Mark-H / plugin.php
Created August 20, 2014 22:24
Auto Login Plugin for MODX Demo Sites. Add to OnManagerLoginFormRender event.
<?php
if ($modx->getOption('http_host') == 'YOUR_DOMAIN_HERE') {
$op = '<script type="text/javascript">
Ext.onReady(function() {
document.getElementById("modx-login-username").value = "USER";
document.getElementById("modx-login-password").value = "PASS";
document.getElementById("modx-login-btn").click();
});
</script>';
@iglvzx
iglvzx / KiTTY-Monokai.session
Last active September 20, 2018 11:10 — forked from paulchrablass/putty-monokai.reg
Monokai Theme for KiTTY
Colour21\255,255,255\
Colour20\245,222,179\
Colour19\200,240,240\
Colour18\0,217,217\
Colour17\179,146,239\
Colour16\174,129,255\
Colour15\122,204,218\
Colour14\102,217,239\
Colour13\209,202,137\
Colour12\230,219,116\
@fomigo
fomigo / defaultTemplateByParentTv.plugin.php
Created April 9, 2012 15:37 — forked from bfncs/defaultTemplateByParentTv.plugin.php
Default Children Template by Parent TV - modX Revolution Plugin
<?php
/**
* =========================
* defaultTemplateByParentTv
* =========================
*
* Plugin for modX Revolution
* Set default template for children of a ressource
*
* Author:
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
namespace PerformanceCounterTest
{
public class Program
@sepiariver
sepiariver / sample_csv_import.php
Last active May 31, 2022 21:03
Consumes CSV as output by the sample_csv_export.php script
<?php
// Only ssh users can execute
if (PHP_SAPI !== 'cli') return;
// Comes in handy sometimes
ini_set('memory_limit', '2048M');
// Instantiate MODX
@include(dirname(__FILE__) . '/config.core.php');
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(__FILE__) . '/core/');
include_once (MODX_CORE_PATH . "model/modx/modx.class.php");
$modx= new modX();
@sepiariver
sepiariver / sample_csv_export.php
Last active January 16, 2023 11:53
Example export script to turn MODX Resources into CSV entries for importing in another site.
<?php
// Only run this via SSH
if (PHP_SAPI !== 'cli') return;
// Sometimes helpful if processing lots of Resources
ini_set('memory_limit', '2048M');
// Init @modx
@include(dirname(__FILE__) . '/config.core.php');
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(__FILE__) . '/core/');
include_once (MODX_CORE_PATH . "model/modx/modx.class.php");
$modx= new modX();
@barryvdh
barryvdh / gist:2834636
Last active March 7, 2023 23:38
custom grid
/* ===== Primary Styles =====================================================
Author: Fruitcake Studio (Barry vd. Heuvel)
========================================================================== */
//Generate a custom (semantic) grid
.customGrid(@gridColumnWidth, @gridGutterWidth){
#header, #main {
.row();
}
.block {
@vasia123
vasia123 / packages.php
Last active July 25, 2023 09:24 — forked from govza/packages.php
Автоматическая смена провайдера
<?php
// provider id => array of packages
$listPackagesToInstall = array(
1 => array( // standart modx provider
'sdStore'
, 'translit'
, 'SanitizeUpload'
, 'TinyMCE'
, 'FormIt'

Serving Flask under a subpath

Your Flask app object implements the __call__ method, which means it can be called like a regular function. When your WSGI container receives a HTTP request it calls your app with the environ dict and the start_response callable. WSGI is specified in PEP 0333. The two relevant environ variables are:

SCRIPT_NAME
The initial portion of the request URL's "path" that corresponds to the application object, so that the application knows its virtual "location". This may be an empty string, if the application corresponds to the "root" of the server.