Skip to content

Instantly share code, notes, and snippets.

@mkay
mkay / multitail.conf.txt
Last active December 18, 2015 19:38
Simple Multitail colorscheme for Dovecot http://www.vanheusden.com/multitail/
# dovecot
colorscheme:dovecot
cs_re:cyan::
cs_re:blue|blue,,bold:^... .. ..:..:..
cs_re:yellow,,bold:imap-login
cs_re:yellow,,bold:pop3-login
cs_re:green:<[^>]*>
cs_re:red:auth failed
cs_re:magenta:TLS
@mkay
mkay / conf.dovecot
Created June 26, 2013 10:57
colour scheme for monitoring dovecot via mail.log, using grc (http://kassiopeia.juls.savba.sk/~garabik/software/grc/)
# dovecot mail.log conf for grc
# install: save as /usr/share/grc/conf.dovecot
# usage: grc -c conf.dovecot tail -f /var/log/mail.log
regexp=(?<=<)(.*)(?=>)
colours=green
count=more
======
regexp=imap-login: Login
colours=yellow
count=more
@mkay
mkay / conf.exim
Created June 26, 2013 11:55
colour scheme for monitoring exim4 via /var/log/exim4/mainlog, using grc (http://kassiopeia.juls.savba.sk/~garabik/software/grc/)
# exim/mainlog conf for grc
# installation: save as /usr/share/grc/conf.exim
# usage: grc -c conf.exim tail -f /var/log/exim4/mainlog
regexp==> *[^ ]*
colours=green
count=more
======
regexp=<= *[^ ]*
colours=green
count=more
@mkay
mkay / README - Foundation Tabs in MODX.md
Last active January 3, 2016 14:59
MODX: auto create Foundation CSS tabs from a container's child ressources using getResources. Copy & paste example.

Call

[[*isfolder:is=`1`:then=`
    <dl class="tabs" data-tab>
    [[!getResources?  
        &parent=`[[*id]]`
        &tpl=`fdTabTpl`
        &tplFirst=`fdTabTpl_first`
        &limit=`0`  
@mkay
mkay / AndIf.php
Created January 17, 2014 19:40
AndIf snippet for MODX. Extended version of the 'If' snippet.
<?php
/**
* AndIf - for MODx Revolution
*
* Copyright 2011 by Luke Bagshaw (MODx forum user 'lucas')
* This is a modified (extended) version of the 'If' snippet, created by
* Jason Coward <jason@modx.com> and Shaun McCormick <shaun@modx.com>
*
* AndIf is free software; you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software
@mkay
mkay / randomImage.php
Created January 17, 2014 20:14
MODX snippet to generate a phpthumb sized random image from a given directory.
<?php
/*
Requirements: MODX, phpthumbof
*/
$folder = 'img/random/'; // change to your random img dir
$height = 120; // desired height in px
$width = 940; // desired width in px
$crop = 'C'; // zoom crop where? T,R,B,L,C (top,right,bottom,left,center)
// space seperated list of extensions
@mkay
mkay / LoadTemplate.php
Created January 17, 2014 20:15
MODX snippet to use file based templates.
<?php
# Snippet to include file based templates
# USAGE: [[LoadTemplate? &tpl=`template.tpl`]]
$base_path = $modx->config['base_path'];
if ( !isset($tpl) || $tpl== "" ) return "Missing Template file!";
$tpl = $base_path .'assets/templates/'.$tpl; // change to your tpl dir path
ob_start();
include($tpl);
return ob_get_clean();
@mkay
mkay / recipient.php
Created January 18, 2014 10:08
MODX FormIt custom hook example.
<?php
// Type: Snippet
$recipient = $hook->getValue('reason');
if($recipient == 'one'){
$email = '';
}
elseif($recipient == 'two'){
$email = '';
}
@mkay
mkay / index.php
Created January 22, 2014 09:52
Example switch for handling multiple websites with MODX. In your /index.php: search & replace (+/- line 68)... $modx->initialize('web'); ...with this gist:
// $modx->initialize('web');
switch(strtolower(MODX_HTTP_HOST)) {
case 'www.example.com:80':
case 'www.example.com':
$modx->initialize('my-example-context'); // context for example.com
break;
case 'www.example2.com:80':
case 'www.example2.com':
$modx->initialize('my-example2-context'); // context for example2.com
@mkay
mkay / check-all.js
Created February 4, 2014 11:10
toggle check-all checkboxes
$(function(){
$('#checkAll').live('change', function(){
var isChecked = !$('.checkbox').prop('checked');
if($(this).is(':checked')){
$('.checkbox').prop('checked', isChecked);
} else {
$('.checkbox').removeAttr('checked');
}
});