Skip to content

Instantly share code, notes, and snippets.

@Mark-H
Mark-H / gist:3761566
Created September 21, 2012 13:49
Dutch Lexicon Status 21/9/2012
about.inc.php
The value of key "credits" is the same as the default (Credits... vs. Credits...)
The value of key "help_title" is the same as the default (Help... vs. Help...)
access.inc.php
The key "resource_group_access_contexts" doesn't exists in translated file
The key "resource_group_automatic_access" doesn't exists in translated file
The key "resource_group_automatic_access_desc" doesn't exists in translated file
The key "resource_group_access_admin" doesn't exists in translated file
The key "resource_group_access_admin_desc" doesn't exists in translated file
@Mark-H
Mark-H / gist:3761096
Created September 21, 2012 12:01
Simple snippet to dump profiler data on screen
<?php
if ($modx->profiler) {
echo '<pre>';
foreach ($modx->profiler->timing[modProfiler::VIEW_CHRONOLOGICAL] as $node) {
echo $node['namespace'] . '-' . $node['action'] . ' | Start: ' . $node['start'] . ' | Duration: ' . number_format($node['duration'],7) . "s\n";
}
echo '</pre>';
}
@Mark-H
Mark-H / gist:3494789
Created August 28, 2012 03:49 — forked from amdbuilder/gist:3494701
Busted
<?php
$eventName = $modx->event->name;
switch ($eventName) {
case 'OnLoadWebDocument' :
$output = $GLOBALS['code_content'] = $modx->resource->get('content');
preg_match_all('/<pre.*?>(.*?)<\/pre>/ims', $output, $matches);
$i = 0;
$GLOBALS['code_matches'] = array();
foreach ($matches[1] as $key => $match) {
@Mark-H
Mark-H / file.php
Created July 30, 2012 22:26
Find missing item in array 1-100
<?php
/* Generate random array */
$m = rand(1,100);
echo '<p>Answer: '.$m.'</p>';
$list = array();
for ($i=1;$i<=100;$i++) $list[] = $i;
unset($list[array_search($m,$list)]);
function findMissing ($list, $idx = 1) {
@Mark-H
Mark-H / gist:3163236
Created July 23, 2012 11:55
MODX revolution/release-2.2 Dutch lexicon check
about.inc.php
access.inc.php
The key "resource_group_access_contexts" doesn't exists in translated file
The key "resource_group_automatic_access" doesn't exists in translated file
The key "resource_group_automatic_access_desc" doesn't exists in translated file
The key "resource_group_access_admin" doesn't exists in translated file
The key "resource_group_access_admin_desc" doesn't exists in translated file
The key "resource_group_access_anon" doesn't exists in translated file
The key "resource_group_access_anon_desc" doesn't exists in translated file
@Mark-H
Mark-H / gist:3104835
Created July 13, 2012 13:14
Adding transparent watermark to a PhpThumb thumbnail.
{"fltr":{"":"wmi|assets/images/logo-watermark.png|385x220|20|350|58"}}
@Mark-H
Mark-H / instructions.md
Created July 2, 2012 20:37
SFTPing from command line from remote server
  1. SSH to target server
  2. sftp user@server.com and auth if needed.
  3. cd to the directory the file you want to transfer is
  4. get archive.tar.gz
  5. to pull out of transfer use exit
@Mark-H
Mark-H / gist:3035509
Created July 2, 2012 20:29
Creating / Extracting a tar gzip archive via command line
Creating a tar gzipped archive:
tar -cvzf archive_name.tar.gz dirname/
Extracting a gzipped archive:
tar -xvzf archive_name.tar.gz
@Mark-H
Mark-H / snippet.php
Created May 7, 2012 14:47
MODX Snippet to take a database backup and to email that.
<?php
$mailto = (isset($mailto)) ? $mailto : '@@ DEFAULT EMAIL HERE @@';
$warningMail = '@@ EMAIL TO SEND WARNING TO IN CASE OF A SMALL BACKUP FILE @@';
include MODX_CORE_PATH.'/config/'.MODX_CONFIG_KEY.'.inc.php';
$host = $database_server; // database host
$dbuser = $database_user; // database user name
$dbpswd = $database_password; // database password
$mysqldb = $dbase; // name of database
@Mark-H
Mark-H / chunk.html
Created March 8, 2012 14:11
Plugin to send email notifications to all members of a user group
<p>Hi there!</p>
<p>The resource [[+pagetitle]] (ID: [[+id]]) has been [[+mode]].</p>
<p>You can login to the manager at www.mysite.com/manager/ to review and if needed publish the resource.</p>
<p>Thank you!</p>