Skip to content

Instantly share code, notes, and snippets.

@fawx
fawx / php linkify
Created October 7, 2010 19:03
php linkify
function linkify($text)
{
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'<a href="\\1">\\1</a>', $text);
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
'\\1<a href="http://\\2">\\2</a>', $text);
$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})',
'<a href="mailto:\\1">\\1</a>', $text);
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Name: RSS feed date format to Symphony date format
Version: 1.0
Author: Brian Zerangue <brian.zerangue@gmail.com>
URL: http://symphony21.com/downloads/xslt/file/20457/
Description:
Convert RSS feed date format to Symphony date format
Convert RFC 2822 timestamp format to ISO date format (Symphony CMS date format)
@fawx
fawx / format-date-time-advanced.xsl
Created August 14, 2011 20:46
rowan's format date/time advanced (modified)
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times"
extension-element-prefixes="date">
<!--
Description:
This is a date formatting utility. The named template "format-date" takes 2 parameters:
1. date - [required] takes an ISO date (2005-12-01T13:45:00)
@fawx
fawx / .vimrc
Created February 29, 2012 20:03
.vimrc, now with commented goodness
au! BufWritePost .vimrc source % " automatically reload when editing .vimrc
" 4 spaces for tabs and automatically inherit previous line's indentation.
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
Array
(
[0] => Array
(
[number] => 2
[message] => XSLTProcessor::importStylesheet(): </xsl:template>
[file] => /Users/fox/Sites/mercytrials/symphony/lib/toolkit/class.xsltprocess.php
[line] => 145
[type] => xsl
[context] => <?xml version="1.0" encoding="UTF-8"?>
@fawx
fawx / symphony.sh
Created June 14, 2012 18:41
symphony install script
#!/bin/bash
echo "creating project directory.."
mkdir $1
cd $1
git init
echo "downloading symphony files.."
git remote add core git://github.com/symphonycms/symphony-2.git
git pull core master
@fawx
fawx / script.js
Created July 6, 2012 20:34
sugar js
/*
* page functions are grouped by <body>'s class.
* all pages in a class fire init().
* named functions are fired according to <body>'s id.
* hyphens are stripped from classes and ids automatically.
*
*/
SUGAR = {
<?php
require_once(TOOLKIT . '/class.datasource.php');
Class datasourceblog_tags extends SectionDatasource{
public $dsParamROOTELEMENT = 'blog-tags';
public $dsParamORDER = 'desc';
public $dsParamPAGINATERESULTS = 'no';
public $dsParamLIMIT = '20';
@fawx
fawx / symphony.sh
Created October 1, 2012 16:05
automatic symphony setup
#!/bin/bash
echo "creating project directory.."
mkdir $1
cd $1
git init
echo "downloading symphony files.."
git remote add core git://github.com/symphonycms/symphony-2.git > /dev/null
git pull core master > /dev/null
@fawx
fawx / install.markdown
Created October 1, 2012 16:12 — forked from landonlewis/install.markdown
New Machine Setup

New Machine

What I do after I do a fresh install. Things are sorta grouped by type.

First Things First

  1. Turn on TRIM if machine has a non-Apple SSD

General Config