Skip to content

Instantly share code, notes, and snippets.

Ian Young ijy

Block or report user

Report or block ijy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ijy
ijy / sym-custom-datasource.php
Created Jan 12, 2014
A bare-bones example of a custom datasource for use with Symphony 2.3.
View sym-custom-datasource.php
<?php
/**
* Custom Datasource Skeleton
*
* A bare-bones example of a custom datasource for use with Symphony 2.3
*
* @author: Ian Young
* @email: i.young@me.com
* @date: 12.01.2014
@ijy
ijy / sublime-text-3-setup.md
Last active Dec 8, 2019
My Sublime Text 3 setup.
View sublime-text-3-setup.md

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@ijy
ijy / sym-next-characteristics.md
Last active Dec 27, 2015
A list of core characteristics for Symphony Next from varying user roles and perspectives.
View sym-next-characteristics.md

Symphony Next - Core Characteristics

A list of requirements for Symphony Next from differing user roles and perspectives.

Roles & Perspectives:

  • Content publisher: User of the system. Front-line of the operation responsible for publishing/editing content on a regular basis. Isn't concerned with anything else other than what is required to do their job well.
  • Content Manager: User of the system. Manages content publishers with more control of the overall system and more permissive user permissions.
  • Website Builder (evaluating): Site developer/designer. Looking for a CMS/platform to use as the basis for their web work but needs to make a choice which will be a good fit for a number of projects of varying sizes for the foreseable future.
  • Website Builder (building a system): Site developer/designer. Will most likely work primarily via the GUI in building the website but may or may not have other developent skills.
View iterm2-shortcuts.md
Function Shortcut
previous tab ⌘ + left arrow
next tab ⌘ + right arrow
go to tab ⌘ + number
go to window ⌘ + Option + Number
go to split pane by direction ⌘ + Option + arrow
go to split pane by order of use ⌘ + ] , ⌘ + [
split window horizontally (same profile) ⌘ + D
split window vertically (same profile) ⌘ + d
View symphony-cms-caching-extensions.md

There are many types of caching that will improve website performance. Here are just five:

MySQL query caching

Every read query that Symphony executes is cached by MySQL. It is important to understand that this is not the result of the query, but the SQL statement itself. MySQL retains a pool of these statements so that they are quicker to execute in the future. This is pretty standard, and you can use it in your own applications too by using SELECT SQL_CACHE for your read queries.

Object caching

Once the database has been queried, the results are used to build objects (pages, data sources, sections, field, entries etc.). These objects are alive only for the lifespan of each page, and are destroyed at the end of each request. Systems such as Wordpress allow these objects to be cached and persisted between each page request (using APC, Memcache, flat files or MySQL), thereby shared between all users. Symphony doesn't do this, but it really should.

Fragment caching

If you have one piece of a p

View xslt-random-no-generator.xsl
<!-- Add the 'math' namespace to your XML stylesheet (so we can use 'math:random') -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:math="http://exslt.org/math"
extension-element-prefixes="math">
<!-- Pick a random number between 1 - 10 and set as a variable -->
<xsl:value-of select="(floor(math:random()*10) mod 10) + 1" />
@ijy
ijy / xslt-random-bg-image.xml
Created Sep 18, 2013
Generate a random background image with XSLT, CSS, and Symphony CMS.
View xslt-random-bg-image.xml
<!-- Add the 'math' namespace to your XML stylesheet (so we can use 'math:random') -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:math="http://exslt.org/math"
extension-element-prefixes="math">
<!-- Pick a random number between 1 - 10 and set as a variable -->
<xsl:variable name="random-bg">
<xsl:value-of select="(floor(math:random()*10) mod 10) + 1" />
</xsl:variable>
@ijy
ijy / xsl-output-html5.xsl
Created Sep 15, 2013
Force use of a dummy DTD (about:legacy-compat), which is the W3C recommended way of not using a standard DTD URI. Now the W3C validator will happily validate against the HTML5 specification rather than the XHTML 1.0 specification.
View xsl-output-html5.xsl
<xsl:output
method="xml"
doctype-system="about:legacy-compat"
encoding="UTF-8"
indent="yes" />
@ijy
ijy / 1.nodestring.xsl
Last active Dec 23, 2015
Converts a node-set into a string (allows you to insert code blocks as text rather than being interpreted). Useful for things such as JSON conversions and displaying code snippets. @href: http://www.getsymphony.com/download/xslt-utilities/view/103039/ @href: http://www.getsymphony.com/discuss/thread/103015/
View 1.nodestring.xsl
<xsl:variable name="html-ready">
<!-- prepare the HTML as you want it -->
</xsl:variable>
<!-- stringify it -->
<xsl:call-template name="nodetostring">
<xsl:with-param name="node" select="$html-ready"/>
<xsl:with-param name="esc-dblq" select="true()"/>
</xsl:template>
@ijy
ijy / check-null-empty.xsl
Created Sep 15, 2013
XSLT: Check if a string is null or empty.
View check-null-empty.xsl
<!--
CHECK IF A STRING IS NULL OR EMPTY
-->
<!-- Example XML -->
<group>
<item>
<id>item 1</id>
<CategoryName>blue</CategoryName>
</item>
You can’t perform that action at this time.