Skip to content

Instantly share code, notes, and snippets.

View matthewpennell's full-sized avatar

Matthew Pennell matthewpennell

View GitHub Profile
@matthewpennell
matthewpennell / EE Master Comments Feed
Created January 27, 2009 21:15
Example ExpressionEngine RSS template for creating a feed of all your recent comments, reverse date ordered
{assign_variable:master_weblog_name="journal|linklog|sidebar"}
{exp:rss:feed weblog="{master_weblog_name}"}
<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>{exp:xml_encode}My Comments Feed{/exp:xml_encode}</title>
<link>http://www.example.com/</link>
<description>Comments on my site</description>
<dc:language>{weblog_language}</dc:language>
<dc:creator>[email protected]</dc:creator>
# !/bin/bash
# Set up an new github repository
GITHUB_USERNAME="timkelty"
# from github instructions page after creating a repo
mkdir "$1"
cd "$1"
git init
touch README
@matthewpennell
matthewpennell / gist:973194
Created May 15, 2011 14:18
Regular expressions in .htaccess
# Set browser and version environment variables based on the visitor's browser
SetEnvIfNoCase User-Agent (Opera|Chrome|Version|Firefox|MSIE)[\/|\s](\d+)\. browser=$1 version=$2
SetEnvIf browser Version browser=Safari
SetEnvIf browser MSIE browser=IE
@matthewpennell
matthewpennell / gist:973198
Created May 15, 2011 14:25
Browser sniffing with regular expressions in PHP
<?php
# Set browser and version environment variables based on the visitor's browser
preg_match_all("/(Opera|Chrome|Version|Firefox|MSIE)[\/|\s](\d+)/", $_SERVER['HTTP_USER_AGENT'], $matches, PREG_SET_ORDER);
list($browser, $version) = array($matches[0][1], $matches[0][2]);
?>
@matthewpennell
matthewpennell / gist:3098465
Created July 12, 2012 14:30
Quick and dirty ExpressionEngine blank page debugging
// Switch on all error displays, both by trying to override php.ini, and using the reporting function.
ini_set('display_errors', 1);
error_reporting(E_ALL);
// Also try upping the memory limit for the PHP script, in case we're hitting that limit.
ini_set('memory_limit', '256M');
@matthewpennell
matthewpennell / Column layout
Created July 8, 2013 18:58
Creating column layouts with CSS3
#content {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
-webkit-column-gap: 50px;
-moz-column-gap: 50px;
column-gap: 50px;
-webkit-column-rule: 1px solid #ccc;
-moz-column-rule: 1px solid #ccc;
column-rule: 1px solid #ccc;
@matthewpennell
matthewpennell / gist:5951589
Created July 8, 2013 19:10
.columns class.
.columns {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
-webkit-column-gap: 50px;
-moz-column-gap: 50px;
column-gap: 50px;
margin-bottom: 300px;
padding-bottom: 100px;
background: url(divider.png) no-repeat 50% 100%;
@matthewpennell
matthewpennell / css_selector
Created December 4, 2014 11:26
CSS selector
.demo {
display: inline-block;
overflow: visible;
background-color: #e6edf6;
color: #666;
font-weight: normal;
text-decoration: none;
white-space: nowrap;
vertical-align: top;
margin-left: 1em;
.sprite-source-foo, .sprite-source-bar, .sprite-source-baz {
background-image:url('source.png');
background-repeat:no-repeat;
}
.sprite-source-foo {
background-position: 0 0;
width: 25px;
height: 25px;
}
/* This file is generated by an automatic script.
Do not attempt to make changes to it manually! */
.sprite {
background-image: url('/path/to/sprite.png');
background-repeat: no-repeat;
}
.foo {
background-position: 0 0;
width: 25px;