<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: microformats code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 06:50:38 GMT</pubDate>
    <description>DZone Snippets: microformats code</description>
    <item>
      <title>ISO 8601 date format for microformats</title>
      <link>http://snippets.dzone.com/posts/show/5364</link>
      <description>Strftime to get the ISO 8601 (see RFC 3339) full date format for an hEvent Microformat. Doubtless usable in other situations.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;strftime('%Y-%m-%dT%H:%M:%S%z');&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you're in Ruby, you can access this the quick way with:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ irb&lt;br /&gt;&gt;&gt; require 'time'&lt;br /&gt;=&gt; true&lt;br /&gt;&gt;&gt; Time.now.iso8601&lt;br /&gt;=&gt; "2008-07-09T16:13:30+12:00"&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Rails example:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;abbr class="dtstart" title="&lt;%= event.start_date.iso8601"&gt;&lt;%= event.start_date.to_s(:long) %&gt;&lt;/abbr&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 15 Apr 2008 05:03:22 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5364</guid>
      <author>Aupajo (Pete)</author>
    </item>
    <item>
      <title>hCard to JSON bridge</title>
      <link>http://snippets.dzone.com/posts/show/4102</link>
      <description>// Requires http://pear.php.net/pepr/pepr-proposal-show.php?id=198 and http://allinthehead.com/hkit&lt;br /&gt;// Many thanks to the authors of these libraries and to the microformats community.&lt;br /&gt;// Demo: http://simplelogica.net/cajondesastre/hcard2json/index.php?url=http://11870.com/pro/19483&lt;br /&gt;// Manuel Gonz&#225;lez Noriega for Simplel&#243;gica. Hire us at http://simplelogica.net&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;    include('hkit.class.php');&lt;br /&gt;    include('JSON.class.php');&lt;br /&gt;		&lt;br /&gt;    $debug = true;&lt;br /&gt;		&lt;br /&gt;    $status = '200';&lt;br /&gt;    $ct = 'text/plain';&lt;br /&gt;		&lt;br /&gt;    $hKit = new hKit;&lt;br /&gt;    $json = new Services_JSON();&lt;br /&gt;&lt;br /&gt;    if ($_GET['url']) {&lt;br /&gt;      $result = $hKit-&gt;getByURL('hcard', $_GET['url']);&lt;br /&gt;	    &lt;br /&gt;      if ($result) {&lt;br /&gt;	$o = ($json-&gt;encode($result));&lt;br /&gt;	$ct = ($debug) ? 'text/plain' : 'application/json';			&lt;br /&gt;      }&lt;br /&gt;      else {&lt;br /&gt;	$o = '404 Not Found';&lt;br /&gt;	$status = '404';&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    else {&lt;br /&gt;      $o = '400 Bad Request';&lt;br /&gt;      $status = '400';&lt;br /&gt;    }&lt;br /&gt;	&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;  header('Content-type: '.$ct);&lt;br /&gt;  &lt;br /&gt;  switch($status) {&lt;br /&gt;    case '400':&lt;br /&gt;      header("HTTP/1.0 400 Bad Request");&lt;br /&gt;    break;&lt;br /&gt;	&lt;br /&gt;    case '404':&lt;br /&gt;      header("HTTP/1.0 404 Not Found");&lt;br /&gt;    break;&lt;br /&gt;&lt;br /&gt;    case '200':&lt;br /&gt;    default:&lt;br /&gt;      header("HTTP/1.0 200 OK");&lt;br /&gt;    break;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print $o;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 03 Jun 2007 23:01:45 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4102</guid>
      <author>mort (Manuel Gonzalez Noriega)</author>
    </item>
    <item>
      <title>Mofo - Parse Microformats with Ruby</title>
      <link>http://snippets.dzone.com/posts/show/3750</link>
      <description>&lt;code&gt;&lt;br /&gt;$ sudo gem install mofo &lt;br /&gt;Successfully installed mofo-0.2.1&lt;br /&gt;$ irb -rubygems&lt;br /&gt;&gt;&gt; require 'mofo'&lt;br /&gt;=&gt; true&lt;br /&gt;&gt;&gt; HResume.find("http://resume.jnewland.com").tags.uniq.sort&lt;br /&gt;=&gt; ["AJAX", "Apache", "CSS", "Capistrano", "DNS", "GNU/Linux", "HTML", "Javascript", "LAMP", "Mongrel", "Movable Type", "MySQL", "PHP", "Perl", "REST", "RSS", "Ruby", "Ruby on Rails", "SEO", "XHTML", "XML", "XSLT", "high availability", "lighttpd", "load-balanced"]&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 30 Mar 2007 16:58:34 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3750</guid>
      <author>jnewland (Jesse Newland)</author>
    </item>
  </channel>
</rss>
