Skip to content

Instantly share code, notes, and snippets.

View klaftertief's full-sized avatar

Jonas Coch klaftertief

View GitHub Profile
server {
listen 80;
server_name localhost;
access_log /path/to/log/access.log;
error_log /path/to/log/error.log;
location / {
root /path/to/root;
index index.php;
<?php
require_once(TOOLKIT . '/class.datasource.php');
Class datasourceblog_post_moderated_comment_count extends Datasource{
var $dsParamROOTELEMENT = 'blog-post-moderated-comment-count';
var $dsParamORDER = 'desc';
var $dsParamLIMIT = '9999';
var $dsParamREDIRECTONEMPTY = 'no';
<?php
require_once(TOOLKIT . '/class.datasource.php');
require_once(DOCROOT . '/extensions/asdc/lib/class.asdc.php');
Class datasourceforum_discussions_by_category extends Datasource{
private static $_fields;
private static $_sections;
<?php
require_once(TOOLKIT . '/class.datasource.php');
Class datasourcedays extends Datasource{
public $dsParamROOTELEMENT = 'days';
public $dsParamURL = 'http://symphony.dev';
public $dsParamXPATH = '/';
public $dsParamCACHE = '60';
// everyone's new favorite closure pattern:
(function(window,document,undefined){ ... })(this,this.document);
// when minified:
(function(w,d,u){ ... })(this,this.document);
// which means all uses of window/document/undefined inside the closure
// will be single-lettered, so big gains in minification.
// it also will speed up scope chain traversal a tiny tiny little bit.
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
public function grab(&$param_pool=NULL){
// I am not able to access $param_pool, so I'm taking a detour via Frontend::Page()
$page = Frontend::Page();
// CREATE XML DOCUMENT
$doc = new DOMDocument;
$root = $doc->createElement($this->dsParamROOTELEMENT);
$doc->appendChild($root);
// APPEND ARTICLES
@klaftertief
klaftertief / gist:857392
Created March 6, 2011 16:47
Clickable utilities in the XSLT editor
// Clickable utilities in the XSLT editor
$('#utilities li').click(function(event) {
if ($(event.target).is('a')) return;
var editor = $('textarea.code'),
lines = editor.val().split('\n'),
statement = '<xsl:import href="../utilities/' + $(this).find('a').text() + '"/>',
regexp = '^' + statement.replace('/>', '').replace('../utilities/', '(?:\.\./utilities/)?'),
newLine = '\n',
numberOfNewLines = 1,
@klaftertief
klaftertief / gist:858462
Created March 7, 2011 12:48
reducing duplicator
/**
* @package assets
*/
(function($) {
/**
* This plugin creates a Symphony duplicator.
*
* @param {Object} custom_settings
server {
server_name "~^((?<subdomain>www)\.)?(?<domain>location\.com)$";
index index.php index.htm index.html default.asp;
## Performs 301 redirects to non-www plus other minor things.
#include templates/server.main.conf;
# ----------------------------------------------------------------------->
# set main domain root to _
if ($subdomain = "") {