Skip to content

Instantly share code, notes, and snippets.

@b3cft
Created May 19, 2010 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b3cft/406106 to your computer and use it in GitHub Desktop.
Save b3cft/406106 to your computer and use it in GitHub Desktop.
/**
* Once every few years, a jobbing programmer must commit an act of great evil.
*
* See the following bug for why this massive heap of fail exists.
*
* http://bug.corp.yahoo.com/show_bug.cgi?id=3505022&mark=6#c6
*
*/
private function generateUrlByUsingEvil($show)
{
.... Some time later in the method ....
/*
.ed"""" """$$$$be.
-" ^""**$$$e.
." '$$$c _____
/ "4$$b |L O L|
d 3 $$$$ /-----
$ * .$$$$$$ /
.$ ^c $$$$$e$$$$$$$$.
d$L 4. 4$$$$$$$$$$$$$$b
$$$$b ^ceeeee. 4$$ECL.F*$$$$$$$
e$""=. $$$$P d$$$$F $ $$$$$$$$$- $$$$$$
z$$b. ^c 3$$$F "$$$$b $"$$$$$$$ $$$$*" .=""$c
4$$$$L \ $$P" "$$b .$ $$$$$...e$$ .= e$$$.
^*$$$$$c %.. *c .. $$ 3$$$$$$$$$$eF zP d$$$$$
"**$$$ec "\ %ce"" $$$ $$$$$$$$$$* .r" =$$$$P""
"*$b. "c *$e. *** d$$$$$"L$$ .d" e$$***"
^*$$c ^$c $$$ 4J$$$$$% $$$ .e*".eeP"
"$$$$$$"'$=e....$*$$**$cz$$" "..d$*"
"*$$$ *=%4.$ L L$ P3$$$F $$$P"
"$ "%*ebJLzb$e$$$$$b $P"
%.. 4$$$$$$$$$$ "
$$$e z$$$$$$$$$$%
"*$c "$$$$$$$P"
."""*$$$$$$$$bc
.-" .$***$$$"""*e.
.-" .e$" "*$c ^*b.
.=*"""" .e$*" "*bc "*$e..
.$" .z*" ^*$e. "*****e.
$$ee$c .d" "*$. 3.
^*$E")$..$" * .ee==d%
$.d$$$* * J$$$e*
""""" "$$$"
*/
$string = strtolower( $string );
$map = array(
'/[àáåâ]/u' => 'a',
'/[èéê?ë]/u' => 'e',
'/[ìíî]/u' => 'i',
'/[òóôø]/u' => 'o',
'/[ùú?û]/u' => 'u',
'/ç/u' => 'c',
'/ñ/u' => 'n',
'/[äæ]/u' => 'ae',
'/ö/u' => 'oe',
'/ü/u' => 'ue',
'/Ä/u' => 'ae',
'/Ü/u' => 'ue',
'/Ö/u' => 'oe',
'/ß/u' => 'ss',
"/['\"]/ieu" => '',
'/[^\w\s-]+/u' => ' ',
'/\s+/u' => '-',
'/-+/u' => '-'
);
$string = preg_replace( array_keys( $map ), array_values( $map ), $string );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment