Skip to content

Instantly share code, notes, and snippets.

@saetia
Created March 7, 2013 20:41
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 saetia/5111624 to your computer and use it in GitHub Desktop.
Save saetia/5111624 to your computer and use it in GitHub Desktop.
<? $lines = explode("\n",shell_exec("find ~/vhosts -name '*.md' -type f -print0 | xargs -0 fgrep ".escapeshellarg(params('search'))));?>
found <?=pluralize(count($lines),'results')?> for “<?=h(params('search'))?>
<? foreach ($lines as $l){
$e = explode('.md:',$l);
$path = basename(reset($e));
$excerpt = end($e); ?>
<li><?=highlight(h(strip_tags(markdown($excerpt))),params('search'))?><a href="/doc/<?=$path?>"><?=humanize($path)?></a></li>
<? } ?>
@saetia
Copy link
Author

saetia commented Mar 7, 2013

http://i.imgur.com/Y9iMEKw.png

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