Skip to content

Instantly share code, notes, and snippets.

@chronon
Created August 22, 2010 03:32
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 chronon/543247 to your computer and use it in GitHub Desktop.
Save chronon/543247 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/php
<?php
$base = $_SERVER['HOME'].'/Library/Application Support/TextMate/Bundles/CakePHP.tmbundle/Snippets/';
foreach (glob($base.'*.tmSnippet') as $file) {
$xmlString = file_get_contents($file);
$xml = new SimpleXMLElement($xmlString);
$trigger = 'snippet '.$xml->dict->string[3];
$snip = $xml->dict->string[0];
$snip = str_replace(array('\\', '$0'),'',$snip);
$snippet = "$trigger\n\t$snip\n";
$snipFile = file_put_contents($_SERVER['HOME'].'/Desktop/cakephp.snippets', $snippet, FILE_APPEND);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment