Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Oakley matoakley

View GitHub Profile
@matoakley
matoakley / gist:1092571
Created Jul 19, 2011
MySQL to convert a string into a slug
View gist:1092571
LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM('My String'), ':', ''), ')', ''), '(', ''), ',', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-')) AS `post_name`
@matoakley
matoakley / date.php
Created Apr 19, 2011
Extend Kohana's Date helper to return month given as integer to string
View date.php
<?php defined('SYSPATH') or die('No direct script access.');
class Date extends Kohana_Date
{
/**
* Take a numerical representation of a month (e.g. '04') and return it as a human readable string (e.g. 'April')
*
* @param mixed numerical representation of month
* @return string
*/