Skip to content

Instantly share code, notes, and snippets.

@astrocosa
astrocosa / slug.php
Created January 7, 2012 03:11
Function slug
<?php
function slug($str, $cat=false) {
$ene = ($cat === true) ? 'ny' : 'n';
$str = (function_exists('mb_strtolower')) ? mb_strtolower($str, 'UTF-8') : strtolower($str);
$str = preg_replace('(à|á|â|ã|ä|å)', 'a', $str);
$str = preg_replace('(è|é|ê|ë)', 'e', $str);
$str = preg_replace('(ì|í|î|ï)', 'i', $str);
$str = preg_replace('(ò|ó|ô|õ|ö|ø|ō)', 'o', $str);
$str = preg_replace('(ù|ú|û|ü|ū)', 'u', $str);
@astrocosa
astrocosa / adjust.py
Created December 2, 2010 00:31
Python port of adjust.js
#!/usr/bin/python
"""
adjust.py
Python port of adjust.js (original by Bratliff: <http://www.polyarc.us/adjust.js>)
Ported by Gatubit <[email protected]>
"""
import math