Vote Charlie!

November 2011 Archives

Anything You Want’ by Derek Sivers

Posted at age 23.

Mom lent me the book "Anything You Want" a few months ago, and I finally lay down to read it. Overall I liked it a lot. It's in line with my recent endeavors to reduce my belongings and simplify things. I own way more crap than I should, and motivated by my impending transplant across the country, I've been finding it quite rewarding to get rid of stuff.

DSC_8529.JPG

About 110 books and 50 DVDs, rendered unnecessary after digitization. Awesome!

Read more

Use PHP to output first two paragraphs of MT entries

Posted at age 23.

This is a quick and dirty solution for use in Movable Type templates, but it should work!


<?php
$body = <<<EOT
<$mt:EntryBody encode_php="here"$>
EOT;
preg_match_all('#<p>(.+?)</p>#is', $body, $matches);
switch(count($matches[0])) {
case 0: break;
case 1: echo $matches[0][0]; break;
case 2: echo $matches[0][0].$matches[0][1]; break;
default: echo $matches[0][0]."<p>".$matches[1][1].' <a href="<mt:EntryPermalink>" class="actionlink">Read more &raquo;</a>'; break;
}
?>


Read more