Skip to content

Instantly share code, notes, and snippets.

View nathanhornby's full-sized avatar

Nathan Hornby nathanhornby

View GitHub Profile
@nathanhornby
nathanhornby / master.xsl
Last active July 11, 2022 20:06
An HTML5 master utility template for SymphonyCMS (XSLT).
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">&lt;</xsl:text>!DOCTYPE html<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
<xsl:text disable-output-escaping="yes"><![CDATA[
<!--[if lt IE 7 ]> <html lang="en" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js lt-ie9 lt-ie8"> <![endif]-->
@nathanhornby
nathanhornby / XML Country List
Last active January 5, 2024 06:18
XML Country list, with country code, ISO number, continent, handle and alternative spelling attributes.
<?xml version='1.0' encoding='UTF-8'?>
<countries>
<country code='af' handle='afghanistan' continent='asia' iso='4'>Afghanistan</country>
<country code='al' handle='albania' continent='europe' iso='8'>Albania</country>
<country code='dz' handle='algeria' continent='africa' iso='12'>Algeria</country>
<country code='as' handle='american-samoa' continent='polynesia' iso='16'>American Samoa</country>
<country code='ad' handle='andorra' continent='europe' iso='20'>Andorra</country>
<country code='ao' handle='angola' continent='africa' iso='24'>Angola</country>
<country code='ai' handle='anguilla' continent='north america' iso='660'>Anguilla</country>
<country code='aq' handle='antarctica' continent='antarctica' iso='10'>Antarctica</country>
@nathanhornby
nathanhornby / pagination.php
Created April 14, 2014 15:00
CodeIgniter table pagination
<?php
$order_by = ''; // URL segment 2
$sort = 'desc'; // URL segment 3
$page = '1'; // URL segment 4
$data_total = ''; // Total number of entries
$number_of_rows = 10; // Number of table rows per page
$page_limit = 10; // Max pages shown in pagination at a time
if($this->uri->segment(2)){
$order_by = $this->uri->segment(2);
@nathanhornby
nathanhornby / Abffilter Role Manager replacement
Created July 26, 2014 19:24
Replace in members/extension.driver.php when using Symphony's Abffilter
/*-------------------------------------------------------------------------
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
<airports>
<airport iata="AAA">Anaa Airport</airport>
<airport iata="AAB">Arrabury Airport</airport>
<airport iata="AAC">El Arish International Airport</airport>
<airport iata="AAE">Annaba Airport</airport>
<airport iata="AAF">Apalachicola Regional Airport</airport>
<airport iata="AAG">Arapoti Airport</airport>
<airport iata="AAH"></airport>
<airport iata="AAI">Arraias Airport</airport>
<airport iata="AAJ">Cayana Airstrip</airport>
<!-- Start -->
<xsl:apply-templates select="airports/airport">
<xsl:with-param name="position" select="'start'" />
</xsl:apply-templates>
<!-- End -->
<xsl:apply-templates select="airports/airport">
<xsl:with-param name="position" select="'end'" />
</xsl:apply-templates>
@nathanhornby
nathanhornby / General notification template
Last active August 29, 2015 14:06
An email template for Symphony CMS notifications
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
omit-xml-declaration="yes"
encoding="UTF-8"
indent="yes" />
<xsl:template match="/">
<?php
class extension_custom_api extends Extension {
public function about() {
return array(
'name' => 'Custom API',
'version' => '1.0',
'release-date' => '2012-22-08',
'author' => array(
'name' => '3Degrees Agency',
@nathanhornby
nathanhornby / twitter_cards.html
Last active April 13, 2018 18:49
Twitter Cards
<!-- Summary card https://dev.twitter.com/cards/types/summary -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@thisisduo" />
<meta name="twitter:title" content="Utilising Twitter Cards for better social engagement" />
<meta name="twitter:description" content="Twitter card reference guide." />
<meta name="twitter:image" content="http://shot.li/cage/300/300/" />
<meta name="twitter:url" content="http://duo.agency/blog/post/Q9GZ6/" />
<!-- Summary card with large image https://dev.twitter.com/cards/types/summary-large-image -->
<meta name="twitter:card" content="summary_large_image" />
@nathanhornby
nathanhornby / .htaccess
Created February 25, 2015 10:51
Browser caching
<IfModule mod_mime.c>
AddType text/css .css
AddType text/x-component .htc
AddType application/x-javascript .js
AddType application/javascript .js2
AddType text/javascript .js3
AddType text/x-js .js4
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz