Skip to content

Instantly share code, notes, and snippets.

<!-- Not displaying $root -->
<xsl:template match="page" mode="url">
<xsl:apply-templates select="parent::page" mode="url"/>
<xsl:value-of select="concat(@handle,'/')"/>
</xsl:template>
@michael-e
michael-e / AddExtension.sh
Created December 15, 2011 16:44
Use Symphony and Extensions as subtrees in your own project git repository.
#!/usr/bin/env bash
DEFAULT_BRANCH="master"
. .symbuilder
extensions=$webroot"/extensions/"
if [ $# -eq 1 ]
then
# get a name for new project from command line arguments
extension_name="$1"
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
<link rel="stylesheet" href="workspace/assets/style.css"/>
</head>
<body>
<div id="head">
<h1>Title</h1>
</div>
<div id="package">
@michael-e
michael-e / Example
Created April 7, 2012 18:39 — forked from designermonkey/Example
Wildcard Subdomains
# Define specified subdomains first
<VirtualHost *:80>
ServerName subdomain.domain.com
DocumentRoot "/path/to/domain.com/subdomains/subdomain"
</VirtualHost>
# Define domain and wildcard subdomains second
<VirtualHost *:80>
ServerName domain.com
DocumentRoot "/path/to/domain.com/httpdocs"
@michael-e
michael-e / gist:2352730
Created April 10, 2012 16:41 — forked from panicsteve/gist:1641705
Form letter template for acquired startups
Dear soon-to-be-former user,
We've got some fantastic news! Well, it's great news for us anyway. You, on
the other hand, are fucked.
We've just been acquired by:
[ ] Facebook
[ ] Google
[ ] Twitter
@michael-e
michael-e / class.general.php
Created November 21, 2012 09:53
Symphony 1.7.0.1 /symphony/lib/core/class.general.php
<?php
###
#
# Symphony web publishing system
#
# Copyright 2004 - 2006 Twenty One Degrees Pty. Ltd. This code cannot be
# modified or redistributed without permission.
#
# For terms of use please visit http://21degrees.com.au/products/symphony/terms/
@michael-e
michael-e / mysql-alter-tables.php
Last active July 11, 2020 09:59
Loop over all tables of a MySQL database and convert them to `utf8` character set. Also make them use `utf8_unicode_ci` collation. You are encouraged to use the PHP CLI (i.e. run the script from the command line), simply because it may take a while. (On the webserver the script may timeout.)
<?php
// configuration
mysql_connect("host","username","password");
mysql_select_db("database");
// do it
$resource = mysql_query("SHOW TABLES");
while ($row = mysql_fetch_array($resource)) {
$table = $row[0];
/*-------------------------------------------------------------------------
Role Manager: (replace in members/extension.driver.php when using Abffilter)
-------------------------------------------------------------------------*/
public function checkFrontendPagePermissions($context) {
$isLoggedIn = false;
$errors = array();
// Checks $_REQUEST to see if a Member Action has been requested,
// member-action['login'] and member-action['logout']/?member-action=logout
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(EXTENSIONS . '/remote_datasource/data-sources/datasource.remote.php');
Class datasourcetwitter extends RemoteDatasource {
public $dsParamROOTELEMENT = 'twitter';
public $dsParamURL = 'https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=ACCOUNT_NAME&count=10';
public $dsParamFORMAT = 'json';
public $dsParamXPATH = '/';