Skip to content

Instantly share code, notes, and snippets.

@jwcobb
Created June 14, 2013 23:21
Show Gist options
  • Save jwcobb/5786037 to your computer and use it in GitHub Desktop.
Save jwcobb/5786037 to your computer and use it in GitHub Desktop.
Attempting to convert [MonkeyFighter](https://github.com/TeamOneTickets/Monkey-Fighter) to dynamically handle all grawlix replacements in order to un-censor words.
/**
* Symbols that could be used to replace letters
*
* @var string
*/
protected $_grawlix = '[!@#$%&*-]';
/**
* Associative array of replacements to make
*
* @var array
* @lol http://www.youtube.com/watch?v=vbZhpf3sQxQ
*/
protected $_replacements = array(
'/S' . $this->_grawlix . '{2}T/' => 'SHIT',
'/([Ss])' . $this->_grawlix . '{2}t/' => "$1" . 'hit',
'/P' . $this->_grawlix . '{2}s/' => 'PISS',
'/([Ss])' . $this->_grawlix . '{2}s/' => "$1" . 'iss',
'/F' . $this->_grawlix . '{2}K/' => 'FUCK',
'/([Ff])' . $this->_grawlix . '{2}k/' => "$1" . 'uck',
'/F' . $this->_grawlix . '{3}ING/' => 'FUCK',
'/([Ff])' . $this->_grawlix . '{3}ing/' => "$1" . 'ucking',
'/C' . $this->_grawlix . '{2}T/' => 'CUNT',
'/([Cc])' . $this->_grawlix . '{2}T/' => "$1" . 'unt',
'/C' . $this->_grawlix . '{2}K/' => 'COCK',
'/([Cc])' . $this->_grawlix . '{2}k/' => "$1" . 'ock',
'/P' . $this->_grawlix . '{4}Y/' => 'PUSSY',
'/([Pp])' . $this->_grawlix . '{4}y/' => "$1" . 'ussy',
);
@spikegrobstein
Copy link

Also, I like your implementation of a grawlix character better than mine. I was thinking about the best way to do that on the plane, but I would have used yours had I had access on the plane, but was just trying to get it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment