<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>Mike Enriquez</title>
 <link href="http://blog.enriquez.me/atom.xml" rel="self"/>
 <link href="http://blog.enriquez.me/"/>
 <updated>2013-04-13T12:06:05-07:00</updated>
 <id>http://blog.enriquez.me/</id>
 <author>
   <name>Mike Enriquez</name>
   <email>mike@enriquez.me</email>
 </author>

 
 <entry>
   <title>The End for gMessage and BigPhone</title>
   <link href="http://blog.enriquez.me/2013/4/13/the-end-for-gmessage-and-bigphone"/>
   <updated>2013-04-13T00:00:00-07:00</updated>
   <id>http://blog.enriquez.me/2013/4/13/the-end-for-gmessage-and-bigphone</id>
   <content type="html">&lt;p&gt;A few days ago, the Google Voice apps I developed stopped working. It turns out that Google changed something on their side that brought down gMessage and BigPhone. I don&amp;#8217;t believe they were targetted specifically, but they simply made an update to how their authentication works. Since there is no official API for Google Voice, my &amp;#8220;hack&amp;#8221; for authentiation doesn&amp;#8217;t work anymore.&lt;/p&gt;

&lt;p&gt;I attempted to fix it this morning, but it turns out that it is not an easy fix. Even if I did find a fix, there&amp;#8217;s no guarantee that Google won&amp;#8217;t change anything again. Therefore, I&amp;#8217;ve decided that it is not worth fixing and to take down both apps from the App Store.&lt;/p&gt;

&lt;p&gt;It sucks, but I think it&amp;#8217;s the right thing to do. gMessage and BigPhone were always fun side projects for me. I used both apps everyday for myself. Luckily there are alternatives in the App Store that still work.&lt;/p&gt;

&lt;p&gt;It has been over two years since I released the first version of BigPhone. Thanks to those of you who supported me along the way, and sorry it had to end. It was really fun to see these apps get some press and see how useful they were for people. I learned a lot, and maybe I&amp;#8217;ll be ambitious enough to roll a better Google Voice type of service in the future. Until then, follow &lt;a href='http://twitter.com/enriquez'&gt;@enriquez on Twitter&lt;/a&gt; to see what I&amp;#8217;m working on these days.&lt;/p&gt;

&lt;p&gt;Peace and pizza grease,&lt;/p&gt;

&lt;p&gt;Mike&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>awakeFromNib not called</title>
   <link href="http://blog.enriquez.me/2013/2/6/awakefromnib-not-called"/>
   <updated>2013-02-06T00:00:00-08:00</updated>
   <id>http://blog.enriquez.me/2013/2/6/awakefromnib-not-called</id>
   <content type="html">&lt;p&gt;If you&amp;#8217;re wondering why your &lt;code&gt;awakeFromNib&lt;/code&gt; method is not getting called, check out #4 in the docs on &lt;a href='https://developer.apple.com/library/mac/#DOCUMENTATION/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW19'&gt;The Object Loading Process&lt;/a&gt;. Basically, &lt;code&gt;awakeFromNib&lt;/code&gt; is not called on placeholder objects such as File&amp;#8217;s Owner and First Responder in iOS.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>UIAlertView and UIActionSheet with Blocks and Target/Action Invocations</title>
   <link href="http://blog.enriquez.me/2013/1/26/uialertview-and-uiactionsheet-with-blocks-and-target-action-invocations"/>
   <updated>2013-01-26T00:00:00-08:00</updated>
   <id>http://blog.enriquez.me/2013/1/26/uialertview-and-uiactionsheet-with-blocks-and-target-action-invocations</id>
   <content type="html">&lt;p&gt;The delegate methods for UIAlertView and UIActionSheet in my app were getting out of control, so I had to refactor. I came up with subclasses that added a block and target-action API. Instead of having a long delegate method to handle all the button actions, you can now specify the action in a block or a separate method.&lt;/p&gt;

&lt;p&gt;Check out &lt;a href='http://github.com/enriquez/MEAlertView'&gt;MEAlertView&lt;/a&gt; and &lt;a href='http://github.com/enriquez/MEAlertView'&gt;MEActionSheet&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Namespaced controller and url generation gotcha in Rails</title>
   <link href="http://blog.enriquez.me/2010/2/21/namespaced-controller-and-link-to-helper-in-rails"/>
   <updated>2010-02-21T00:00:00-08:00</updated>
   <id>http://blog.enriquez.me/2010/2/21/namespaced-controller-and-link-to-helper-in-rails</id>
   <content type="html">&lt;p&gt;I ran into a gotcha while working on a Rails app that was written a few years ago, before the idea of &lt;span class=&quot;caps&quot;&gt;REST&lt;/span&gt; came about.&lt;/p&gt;
&lt;p&gt;What is the path generated from the following?&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;erb&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;link_to&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Clicky&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:controller&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;posts&amp;quot;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Normally, you would expect &lt;code&gt;/posts&lt;/code&gt;, but that&amp;#8217;s not always the case. It depends upon the context of where this is being called. If you&amp;#8217;re inside a namespaced controller such as &lt;code&gt;Admin::CommentsController&lt;/code&gt;, then the generated url is &lt;code&gt;/admin/posts&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It turns out that Rails assumes that if you&amp;#8217;re within the context of a namespace that you want to stay in that namespace. You can read more about it &lt;a href=&quot;http://api.rubyonrails.org/classes/ActionController/Base.html#M000649&quot;&gt;in the documentation for url_for&lt;/a&gt;. It&amp;#8217;s a bit of a &lt;span class=&quot;caps&quot;&gt;WTF&lt;/span&gt; moment when you specify a controller and you end up with something else.&lt;/p&gt;
&lt;p&gt;Here are 2 ways to get around this behavior.&lt;/p&gt;
&lt;h3&gt;Workaround #1: Add a leading slash&lt;/h3&gt;
&lt;p&gt;The leading slash forces the url generation to ignore the defaults.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;erb&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;%=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;link_to&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Clicky&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:controller&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;/posts&amp;quot;&lt;/span&gt; &lt;span class=&quot;cp&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span class=&quot;x&quot;&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Workaround #2: Override url_for&lt;/h3&gt;
&lt;p&gt;In the app I was working on, changing every generated url wasn&amp;#8217;t doable given time constraints. I came up with a little hack to override &lt;code&gt;url_for&lt;/code&gt; in the controller to always add the leading slash.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# app/controllers/admin/comments_controller.rb&lt;/span&gt;

&lt;span class=&quot;kp&quot;&gt;protected&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;url_for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;options&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{})&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;is_a?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Hash&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;has_key?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:controller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:controller&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;/&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:controller&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I haven&amp;#8217;t investigated any side effects to this, so be warned and run your tests.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Don't forget about respond_to? when implementing method_missing</title>
   <link href="http://blog.enriquez.me/2010/2/21/dont-forget-about-respond-to-when-implementing-method-missing"/>
   <updated>2010-02-21T00:00:00-08:00</updated>
   <id>http://blog.enriquez.me/2010/2/21/dont-forget-about-respond-to-when-implementing-method-missing</id>
   <content type="html">&lt;p&gt;&lt;code&gt;method_missing&lt;/code&gt; can be used to do some really cool things in Ruby, but it can also cause some headaches when done improperly. One cause for headache is when &lt;code&gt;method_missing&lt;/code&gt; comes with a broken or missing &lt;code&gt;respond_to?&lt;/code&gt; implementation.&lt;/p&gt;
&lt;h3&gt;Example Proxy class&lt;/h3&gt;
&lt;p&gt;Consider the following example of a &lt;a href=&quot;http://railstips.org/blog/archives/2009/08/07/patterns-are-not-scary-method-missing-proxy/&quot;&gt;proxy class&lt;/a&gt; that uses &lt;code&gt;method_missing&lt;/code&gt;, but doesn&amp;#8217;t implement &lt;code&gt;respond_to?&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Proxy&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@subject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;method_missing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@subject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;proxy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;respond_to?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# =&amp;gt; false&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Fri Feb 05 00:34:53 -0500 2010&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Our proxy object is a dirty liar. When we ask if it responds to &lt;code&gt;now&lt;/code&gt; it returns &lt;code&gt;false&lt;/code&gt;, but when we actually call &lt;code&gt;now&lt;/code&gt; it responds successfully.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s a better implementation for Proxy:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Proxy&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@subject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;subject&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;method_missing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@subject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;respond_to?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;vi&quot;&gt;@subject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;send&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;respond_to?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;include_private&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;super&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@subject&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;respond_to?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;include_private&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;proxy&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;respond_to?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# =&amp;gt; true&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;proxy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# =&amp;gt; Fri Feb 05 00:34:53 -0500 2010&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;#8217;s better. We added an implementation for &lt;code&gt;respond_to?&lt;/code&gt; and some calls to &lt;code&gt;super&lt;/code&gt;. Keep in mind that we&amp;#8217;re overriding existing methods, and we want to add behavior to them unobtrusively. You can learn some techniques for DRYing and testing &lt;code&gt;method_missing&lt;/code&gt; and &lt;code&gt;respond_to?&lt;/code&gt; at &lt;a href=&quot;http://technicalpickles.com/posts/using-method_missing-and-respond_to-to-create-dynamic-methods/&quot;&gt;Technical Pickles&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s examine a bug with &lt;code&gt;respond_to?&lt;/code&gt; in a Rails plugin you&amp;#8217;re probably using&amp;#8230;&lt;/p&gt;
&lt;h3&gt;will_paginate and respond_to?&lt;/h3&gt;
&lt;p&gt;Here is a Post model that contains a class method called &lt;code&gt;paginate_by_something&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# will_paginate is installed&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Post&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:Base&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;paginate_by_something&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# &amp;quot;something&amp;quot; is not an attribute&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;Post&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;respond_to?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:paginate_by_something&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# =&amp;gt; false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What!? We explicitly define a class level method, but when we interrogate it with &lt;code&gt;respond_to?&lt;/code&gt; it returns &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The problem is with will_paginate&amp;#8217;s &lt;code&gt;respond_to?&lt;/code&gt;. Below is a snippet of code from will_paginate that gets mixed into your models.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;respond_to?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;include_priv&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;#:nodoc:&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_sym&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;when&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:paginate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:paginate_by_sql&lt;/span&gt;
    &lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sub&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/^paginate/&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;find&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;include_priv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first thing will_paginate does is return true for its obvious methods: &lt;code&gt;paginate&lt;/code&gt; and &lt;code&gt;paginate_by_sql&lt;/code&gt;. Then the interesting part of this code is the call to &lt;code&gt;super&lt;/code&gt;. It turns a method like &lt;code&gt;paginate_by_author&lt;/code&gt; into &lt;code&gt;find_by_author&lt;/code&gt;, which &lt;code&gt;respond_to?&lt;/code&gt; would return &lt;code&gt;true&lt;/code&gt; for, if it is an ActiveRecord dynamic finder. Going back to the &lt;code&gt;paginate_by_something&lt;/code&gt; example in our Post model, we can see that &lt;code&gt;respond_to?&lt;/code&gt; returns &lt;code&gt;false&lt;/code&gt; because &lt;code&gt;find_by_something&lt;/code&gt; is &lt;span class=&quot;caps&quot;&gt;NOT&lt;/span&gt; a dynamic finder (when &amp;#8220;something&amp;#8221; is not an attribute).&lt;/p&gt;
&lt;p&gt;The fix to will_paginate is fairly simple, and &lt;a href=&quot;http://github.com/enriquez/will_paginate/commit/26e5cf73f37338a8b7c78abddaccc22910d839ff&quot;&gt;I&amp;#8217;ve already submitted a patch&lt;/a&gt;. Props to Ryan Briones for pairing with me while debugging the problem on a project at Chase.&lt;/p&gt;
&lt;p&gt;On a side note, if you have a particular RSpec test that fails when you run the whole test suite, but pass when ran individually; Check your mocks on methods that don&amp;#8217;t implement &lt;code&gt;respond_to?&lt;/code&gt; correctly. RSpec uses &lt;code&gt;respond_to?&lt;/code&gt; internally when using mocks, and RSpec expects it to work!&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>How to build a personal mashup page with jQuery</title>
   <link href="http://blog.enriquez.me/2009/5/1/how-to-build-a-personal-mashup-page-with-jquery"/>
   <updated>2009-05-01T00:00:00-07:00</updated>
   <id>http://blog.enriquez.me/2009/5/1/how-to-build-a-personal-mashup-page-with-jquery</id>
   <content type="html">&lt;p&gt;After finding out about &lt;a href=&quot;http://pages.github.com&quot;&gt;GitHub pages&lt;/a&gt;, I decided to put mine to good use by building a mashup for my online content. Since we don&amp;#8217;t have any control on the server side, we&amp;#8217;re going to use only javascript to make it dynamic. This tutorial will show you how to use jQuery and &lt;span class=&quot;caps&quot;&gt;JSONP&lt;/span&gt; to pull data from Twitter, GitHub, and an &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feed (without any server side magic). The techniques here can easily be used to interact with any other &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;For a demo, visit &lt;a href=&quot;http://enriquez.github.com&quot;&gt;my personal mashup page hosted on GitHub&lt;/a&gt;. Get the code from &lt;a href=&quot;http://github.com/enriquez/enriquez.github.com&quot;&gt;GitHub&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;What is &lt;span class=&quot;caps&quot;&gt;JSONP&lt;/span&gt;, and why do I need to use it?&lt;/h3&gt;
&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;JSONP&lt;/span&gt; is &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt; with padding. For security reasons, browsers do not allow for scripts from a remote domain to run. This is known as the same origin policy. There a couple ways to get around this restriction, but we&amp;#8217;re going to use &lt;span class=&quot;caps&quot;&gt;JSONP&lt;/span&gt; in this tutorial because it is a purely javascript solution. Plus, &lt;a href=&quot;http://docs.jquery.com/Release:jQuery_1.2/Ajax#Cross-Domain_getJSON_.28using_JSONP.29&quot;&gt;jQuery 1.2 and greater makes it easy to work with &lt;span class=&quot;caps&quot;&gt;JSONP&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;jQuery and Twitter&lt;/h3&gt;
&lt;p&gt;First thing you need to do is get familiar with the &lt;a href=&quot;http://apiwiki.twitter.com/Twitter-API-Documentation&quot;&gt;Twitter &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; Documentation&lt;/a&gt;. Let&amp;#8217;s list a user&amp;#8217;s status updates using the &lt;a href=&quot;http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses-user_timeline&quot;&gt;statuses/user_timeline&lt;/a&gt; method.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This method is called with a &lt;span class=&quot;caps&quot;&gt;GET&lt;/span&gt; request and does not require any authentication. It might not be a good idea to use a method that requires authentication using javascript. Try to stick with publicly available data or methods.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Twitter supports a couple different data formats. Since we want &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt;, the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; to get a user&amp;#8217;s timeline is &lt;code&gt;http://twitter.com/statuses/user_timeline/&amp;lt;username&amp;gt;.json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s build a wrapper for the Twitter &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;, and create a &lt;code&gt;Statuses.user_timeline&lt;/code&gt; function. Let&amp;#8217;s also create a &lt;code&gt;Users.show&lt;/code&gt; function for kicks.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// Twitter API wrapper. http://apiwiki.twitter.com/Twitter-API-Documentation&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;TwitterAPI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;TwitterAPI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Users&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){}&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;TwitterAPI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Statuses&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Statuses&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-users%C2%A0show&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;TwitterAPI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Users&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;show&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;requestURL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;http://twitter.com/users/show/&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;username&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;.json?callback=?&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;requestURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses-user_timeline&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;TwitterAPI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Statuses&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user_timeline&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;requestURL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;http://twitter.com/statuses/user_timeline/&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;username&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;.json?callback=?&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;requestURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This wrapper simply takes a username and callback function, builds the &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;, then passes it off to jQuery&amp;#8217;s &lt;code&gt;$.getJSON&lt;/code&gt; function. Notice in the &lt;code&gt;requestURL&lt;/code&gt; that we had to add &lt;code&gt;?callback=?&lt;/code&gt;. Without it we would get a security error because of the same origin policy.&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s build a list of tweets for the Twitter user &lt;a href=&quot;http://twitter.com/enriquez&quot;&gt;enriquez&lt;/a&gt; using the TwitterAPI wrapper:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;TwitterAPI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Statuses&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user_timeline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;enriquez&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;tweet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;text&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;lt;li class=\&amp;quot;tweets\&amp;quot;&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tweet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;lt;/li&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;ul#tweets&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can see that our callback function is given a parameter called &lt;code&gt;json&lt;/code&gt;. This is from jQuery&amp;#8217;s &lt;code&gt;$.getJSON&lt;/code&gt;, and it contains a collection of statuses. The above example loops through each status and places the text in a list. You can see what else is available in this object by studying the response structure from the &lt;a href=&quot;http://apiwiki.twitter.com/Twitter-REST-API-Method%3A-statuses-user_timeline&quot;&gt;Twitter &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; documentation for user_timeline&lt;/a&gt;. For example, if you want to get the &amp;#8220;tweeted date&amp;#8221; you would access the &lt;code&gt;created_at&lt;/code&gt; attrbute and call it like this: &lt;code&gt;this['created_at']&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;jQuery and GitHub&lt;/h3&gt;
&lt;p&gt;The process for retrieving data from GitHub is similar to Twitter. The following is the GitHub &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; wrapper with a function for getting a user&amp;#8217;s list of repos.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// http://develop.github.com/p/repo.html&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;GitHubAPI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Repos&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;requestURL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;http://github.com/api/v2/json/repos/show/&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;username&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;?callback=?&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;requestURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;repositories&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Notice that I&amp;#8217;m passing in &lt;code&gt;json.repositories&lt;/code&gt;, instead of just &lt;code&gt;json&lt;/code&gt;. This is just for convenience. Building a list of a user&amp;#8217;s repositories is accomplished like so:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;GitHubAPI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Repos&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;enriquez&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;projectName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;lt;li class=\&amp;quot;project\&amp;quot;&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;projectName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;lt;/li&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;ul#projects&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;jQuery and an &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feed&lt;/h3&gt;
&lt;p&gt;An &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feed isn&amp;#8217;t an &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt;, but it is an &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt; file. Because it is an &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt; file, it takes a bit more work to read it in with jQuery. Not only do we need to work around the same origin policy, we need the data in &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt; format&amp;#8230; not &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt;. We could write a server side script to turn &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt; into &lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt;, but its easier to use&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://pipes.yahoo.com/pipes/&quot;&gt;Yahoo! Pipes&lt;/a&gt; to do this for us. Yahoo! Pipes is great for building mashups. It allows you to work with API&amp;#8217;s easily and better yet, it can expose an existing &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; with &lt;span class=&quot;caps&quot;&gt;JSONP&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve already created a Yahoo! Pipe that you can use to read an &lt;span class=&quot;caps&quot;&gt;RSS&lt;/span&gt; Feed. Below is the wrapper for it.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// RSS Feed wrapper&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;RSSFeed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Yahoo pipe for turning an RSS XML feed into JSONP&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// http://pipes.yahoo.com/pipes/pipe.run?_id=NvfW_c9m3hGRjX4hoRWqPg&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;RSSFeed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Entries&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;feed_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;requestURL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;http://pipes.yahoo.com/pipes/pipe.run?_id=NvfW_c9m3hGRjX4hoRWqPg&amp;amp;_render=json&amp;amp;_callback=?&amp;amp;feed=&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;feed_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getJSON&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;requestURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Just pass this your feed url, and you&amp;#8217;ll be given an object containing a collection of &amp;#8220;entries&amp;#8221; or articles. Use the wrapper like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;RSSFeed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Entries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;http://feeds2.feedburner.com/theezpzway&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;json&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;postTitle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;lt;a href=\&amp;quot;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;link&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;\&amp;quot;&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;title&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;lt;/a&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;lt;p class=\&amp;quot;posts\&amp;quot;&amp;gt;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;postTitle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;&amp;lt;/p&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;div#posts&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Using jQuery and some API&amp;#8217;s you can build a dynamic mashup site without the need any server side logic. The code for &lt;a href=&quot;http://enriquez.github.com&quot;&gt;my mashup&lt;/a&gt; is on &lt;a href=&quot;http://github.com/enriquez/enriquez.github.com&quot;&gt;GitHub&lt;/a&gt;. Bonus points to whoever finds the easter egg!&lt;/p&gt;
&lt;h3&gt;Resources&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;http://apiwiki.twitter.com/Twitter-API-Documentation&quot;&gt;Twitter &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; Documentation&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://develop.github.com&quot;&gt;GitHub &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; Documentation&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback&quot;&gt;jQuery docs for $.getJSON&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.ibm.com/developerworks/library/wa-aj-jsonp1/?ca=dgr-lnxw9dJSONP-jQuery&amp;amp;S_TACT=105AGX59&amp;amp;S_CMP=grsitelnxw9d&quot;&gt;&lt;span class=&quot;caps&quot;&gt;IBM&lt;/span&gt; Article: Combine &lt;span class=&quot;caps&quot;&gt;JSONP&lt;/span&gt; and jQuery to quickly build powerful mashups&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://pipes.yahoo.com/pipes/&quot;&gt;Yahoo! Pipes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content>
 </entry>
 
 <entry>
   <title>jQuery plugin EZPZ Hint</title>
   <link href="http://blog.enriquez.me/2009/3/28/jquery-plugin-ezpz-hint"/>
   <updated>2009-03-28T00:00:00-07:00</updated>
   <id>http://blog.enriquez.me/2009/3/28/jquery-plugin-ezpz-hint</id>
   <content type="html">&lt;p&gt;A simple jQuery plugin for showing a text field&amp;#8217;s label inside the textbox itself. The hint disappears when it is given focus, and appears again if the inputted text is empty. Typically used for search and login forms.&lt;/p&gt;
&lt;p&gt;This plugin works in all modern browsers, and it even works with password field hints.&lt;/p&gt;
&lt;p&gt;Check out &lt;a href=&quot;/demos/ezpz-hint&quot;&gt;the demo here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Features&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Hint text is re-displayed when field is empty&lt;/strong&gt;. If the user erases the text in the input, the hint will be shown again.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Works with password fields&lt;/strong&gt;. This is achieved with dummy inputs to hold the hint text. Tested in all modern browsers.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Allows default values&lt;/strong&gt;. If the form is pre-populated, the plugin works as expected.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;How it works&lt;/h3&gt;
&lt;p&gt;The hint text is taken from the title attribute of the input. Sorry, no graceful degradation. Disabled javascript users will see a bunch of unlabeled text boxes. A future version will use a label tag to get the hint text.&lt;/p&gt;
&lt;p&gt;Since IE doesn&amp;#8217;t allow a password field to be changed into a text field, a dummy text field is dynamically created to hold the hint text. The dummy input and real input swap visibility on focus and blur to give the illusion that the hint text is appearing and disappearing. The only problem with this technique is that the dummy text field is not a direct copy of the real text field. The plugin only copies over the &lt;code&gt;class&lt;/code&gt; and &lt;code&gt;size&lt;/code&gt; attributes&lt;/p&gt;
&lt;p&gt;This plugin disables the remember password feature of most browsers by setting autocomplete to &amp;#8220;off&amp;#8221;. The text hint gets confused with it on, and the browser actually remembers the dummy inputs instead of the real inputs. This can be fixed in the future to move all the dummy inputs to the top of the form, and the replacement would have to be done by absolutely positioning the dummys over the real text fields (that&amp;#8217;s the theory anyway, I don&amp;#8217;t know if it would work).&lt;/p&gt;
&lt;h3&gt;Download&lt;/h3&gt;
&lt;p&gt;As always, the &lt;a href=&quot;http://github.com/enriquez/ezpz-hint&quot;&gt;code is available on GitHub&lt;/a&gt;. It can also be downloaded below.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://cloud.github.com/downloads/enriquez/ezpz-hint/jquery.ezpz_hint.js&quot;&gt;jquery.ezpz_hint.js&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://cloud.github.com/downloads/enriquez/ezpz-hint/jquery.ezpz_hint.min.js&quot;&gt;jquery.ezpz_hint.min.js&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>jQuery plugin EZPZ Tooltip</title>
   <link href="http://blog.enriquez.me/2009/3/17/jquery-plugin-ezpz-tooltip"/>
   <updated>2009-03-17T00:00:00-07:00</updated>
   <id>http://blog.enriquez.me/2009/3/17/jquery-plugin-ezpz-tooltip</id>
   <content type="html">&lt;p class=&quot;update&quot;&gt;&lt;strong&gt;&lt;span class=&quot;caps&quot;&gt;UPDATE&lt;/span&gt; April 12, 2009&lt;/strong&gt;. Added the showContent and hideContent callbacks. Use these for custom effects. Also updated the demo for examples.&lt;/p&gt;
&lt;p&gt;There are a &lt;a href=&quot;http://www.google.com/search?q=jquery+tooltip&quot;&gt;ton of tooltip plugins&lt;/a&gt; for jQuery out there, but I couldn&amp;#8217;t find one that works with the way I think. To me, it&amp;#8217;s a simple concept: You hover over a target element, then some content shows up. It should be flexible enough to customize the look and feel without requiring the bloat of any &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; or images. Hover targets should be mapped to their content counterparts by convention. I think I&amp;#8217;ve built &lt;em&gt;just that&lt;/em&gt; with the &lt;span class=&quot;caps&quot;&gt;EZPZ&lt;/span&gt; Tooltip.&lt;/p&gt;
&lt;p&gt;Check out &lt;a href=&quot;/demos/ezpz-tooltip&quot;&gt;the demo here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Features&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Clean and semantic &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;&lt;/strong&gt;. This tooltip does not rely on putting a bunch of crap in the title attribute. The content is defined in its own &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt; element.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Convention over configuration&lt;/strong&gt;. The content element is inferred from the name of the target element.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Flexible appearance&lt;/strong&gt;. Since the elements are just plain old &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;, they are styled by using &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;. If you want stems or rounded corners, just give the content element a background image.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Flexible content positioning&lt;/strong&gt;. The position of the content can be customized by specifying one of the built in positions, but if you&amp;#8217;re feeling ambitious you can write your own positioning algorithm if you need something more customized.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Simple and lightweight&lt;/strong&gt;. This tooltip doesn&amp;#8217;t try to do everything for you, but if you want it to do something you can make it happen.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;Custom effects&lt;/strong&gt;. fadeIn and fadeOut (or any other effect) can be achieved by defining the showContent and hideContent callbacks.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Basic Usage&lt;/h3&gt;
&lt;h4&gt;The &lt;span class=&quot;caps&quot;&gt;HTML&lt;/span&gt;&lt;/h4&gt;
&lt;p&gt;We need two elements, one for the target and one for the content. Take note of the id attribute.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;span&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;example-target-1&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Hover over me&lt;span class=&quot;nt&quot;&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;example-content-1&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Tooltip content&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The content can be any block level element. We can easily use an image for the content by doing something like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;example-content-1&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;276&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;110&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;http://google.com/intl/en_ALL/images/logo.gif&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;Google&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;The Javascript&lt;/h4&gt;
&lt;p&gt;Bind the hover event by calling &lt;code&gt;ezpz_tooltip()&lt;/code&gt; on the target element on the document ready event. I&amp;#8217;ll explain the naming convention for the target and content elements later.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;#example-target-1&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ezpz_tooltip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;The &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt;&lt;/h4&gt;
&lt;p&gt;We need to hide the content of the tooltip and give it an absolute position (this may be done automatically in future versions of this plugin). This is where you can customize the look of the content by giving it a background image, borders, colors, etc&amp;#8230;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;&lt;span class=&quot;nf&quot;&gt;#example-content-1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* required */&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;absolute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* required */&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1px&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;solid&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;black&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;white&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;The Convention&lt;/h4&gt;
&lt;p&gt;By convention, the target and content elements are bound together by the name of their id attribute. The convention is this: (name)-target-(unique id) will be bound to (name)-content-(unique id). You can &lt;strong&gt;override this behavior&lt;/strong&gt; by passing the id of the content to &lt;code&gt;ezpz_tooltip()&lt;/code&gt; like so:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;#target&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ezpz_tooltip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contentId&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;content&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;target&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Hover over me&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;content&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;I&amp;#39;m target&amp;#39;s hover content&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;Advanced Usage&lt;/h3&gt;
&lt;h4&gt;Bind multiple tooltips&lt;/h4&gt;
&lt;p&gt;Typically, your page will have multiple tooltips on it.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tooltip-target&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;example-target-1&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;First Target&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tooltip-target&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;example-target-2&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Second Target&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tooltip-target&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;example-target-3&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Third Target&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tooltip-content&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;example-content-1&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Content for first&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tooltip-content&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;example-content-2&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Content for second&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;tooltip-content&amp;quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;example-content-3&amp;quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Content for third&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To bind all of the targets to their corresponding content, it takes only one line:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;.tooltip-target&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ezpz_tooltip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Calling &lt;code&gt;ezpz_tooltip()&lt;/code&gt; on a class will bind the hover event to each element, and because of the naming convention it will know which content to display.&lt;/p&gt;
&lt;h4&gt;Custom content position&lt;/h4&gt;
&lt;p&gt;Defining and using a position function is done like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ezpz_tooltip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;positions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;topLeft&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contentInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mouseX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mouseY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;targetInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;contentInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;top&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;contentInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;left&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;contentInfo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;#tooltip-target-1&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ezpz_tooltip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;contentPosition&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;topLeft&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This &lt;code&gt;topLeft&lt;/code&gt; example will position the content to the upper left corner of the window. You&amp;#8217;ll probably need to use the parameters for your custom position, so here&amp;#8217;s some detail on them:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;contentInfo&lt;/strong&gt;: This contains the &lt;code&gt;top&lt;/code&gt;, &lt;code&gt;left&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, and &lt;code&gt;height&lt;/code&gt; information for the content element.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;mouseX&lt;/strong&gt;: The X position of the mouse.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;mouseY&lt;/strong&gt;: The Y position of the mouse.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;offset&lt;/strong&gt;: The user defined offset.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;targetInfo&lt;/strong&gt;: This contains the &lt;code&gt;top&lt;/code&gt;, &lt;code&gt;left&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, and &lt;code&gt;height&lt;/code&gt; information for the target element.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more examples of position functions, look towards the bottom of the &lt;code&gt;jquery.ezpz_tooltip.js&lt;/code&gt; file.&lt;/p&gt;
&lt;h4&gt;Options and their defaults&lt;/h4&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;contentPosition&lt;/strong&gt;: &lt;code&gt;'aboveRightFollow'&lt;/code&gt;. This takes the name of the position function. Other possible values are &lt;code&gt;aboveFollow&lt;/code&gt;, &lt;code&gt;rightFollow&lt;/code&gt;, &lt;code&gt;belowRightFollow&lt;/code&gt;, &lt;code&gt;belowFollow&lt;/code&gt;, &lt;code&gt;aboveStatic&lt;/code&gt;, &lt;code&gt;rightStatic&lt;/code&gt;, and &lt;code&gt;belowStatic&lt;/code&gt;.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;stayOnContent&lt;/strong&gt;: &lt;code&gt;false&lt;/code&gt;. Set to &lt;code&gt;true&lt;/code&gt; if you want the content to stay visible when the user hovers over the content.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;offset&lt;/strong&gt;: &lt;code&gt;10&lt;/code&gt;. Number of pixels to offset.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;contentInfo&lt;/strong&gt;: &lt;code&gt;&quot;&quot;&lt;/code&gt;. Give the id attribute of the content here if it can&amp;#8217;t be found by convention.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;beforeShow&lt;/strong&gt;: &lt;code&gt;function(content){}&lt;/code&gt;. Define this function to do something before the content is shown. Usually, an &lt;span class=&quot;caps&quot;&gt;AJAX&lt;/span&gt; call is used here to populate the content.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;afterHide&lt;/strong&gt;: &lt;code&gt;function(){}&lt;/code&gt;. Define this function to do something after the content is hidden.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Download&lt;/h3&gt;
&lt;p&gt;The code is &lt;a href=&quot;http://github.com/enriquez/ezpz-tooltip/tree/master&quot;&gt;available on GitHub&lt;/a&gt;. The &lt;em&gt;master&lt;/em&gt; branch contains the code for development. The &lt;em&gt;minified&lt;/em&gt; branch contains the compacted version that should be used in production. The latest stable version can be downloaded below:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://cloud.github.com/downloads/enriquez/ezpz-tooltip/jquery.ezpz_tooltip.js&quot;&gt;jquery.ezpz_tooltip.js&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://cloud.github.com/downloads/enriquez/ezpz-tooltip/jquery.ezpz_tooltip.min.js&quot;&gt;jquery.ezpz_tooltip.min.js&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>How to integrate Ultraviolet into Mephisto</title>
   <link href="http://blog.enriquez.me/2009/3/8/how-to-integrate-ultraviolet-into-mephisto"/>
   <updated>2009-03-08T00:00:00-08:00</updated>
   <id>http://blog.enriquez.me/2009/3/8/how-to-integrate-ultraviolet-into-mephisto</id>
   <content type="html">&lt;p&gt;I couldn&amp;#8217;t find a theme I liked for CodeRay, and I wasn&amp;#8217;t up for creating/modifying my own. I ended up finding a different syntax highlighter called &lt;a href='http://ultraviolet.rubyforge.org'&gt;Ultraviolet&lt;/a&gt;. It uses TextMate&amp;#8217;s syntax files which is pretty cool. The code in this article is highlighted using the &amp;#8220;lazy&amp;#8221; theme.&lt;/p&gt;&lt;p&gt;Integrating Ultraviolet into Mephisto (or more specifically the filtered_column_code_macro plugin) can be done in 3 steps.&lt;/p&gt;&lt;h3&gt;Step 1: Install Ultraviolet&lt;/h3&gt;&lt;p&gt;I won&amp;#8217;t get into too much detail here. You can follow the directions here: &lt;a href='http://ultraviolet.rubyforge.org/'&gt;http://ultraviolet.rubyforge.org/&lt;/a&gt;.&lt;/p&gt;&lt;h3&gt;Step 2: Hack filtered_column_code_macro&lt;/h3&gt;&lt;p&gt;I consider this a dirty hack. Ideally, &lt;code&gt;filtered_column_code_macro&lt;/code&gt; would be written to give the user options to use either CodeRay or Ultraviolet. Kinda like how &lt;code&gt;filtered_column&lt;/code&gt; supports Markdown and Textile. This works for now&amp;#8230;&lt;/p&gt;&lt;p&gt;Modify code_macro.rb to look like the following:&lt;/p&gt;&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='ruby'&gt;&lt;span class='c1'&gt;# plugins/filtered_column_code_macro/lib/code_macro.rb&lt;/span&gt;

&lt;span class='nb'&gt;require&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;uv&amp;#39;&lt;/span&gt;

&lt;span class='k'&gt;class&lt;/span&gt; &lt;span class='nc'&gt;CodeMacro&lt;/span&gt; &lt;span class='o'&gt;&amp;lt;&lt;/span&gt; &lt;span class='ss'&gt;FilteredColumn&lt;/span&gt;&lt;span class='p'&gt;:&lt;/span&gt;&lt;span class='ss'&gt;:Macros&lt;/span&gt;&lt;span class='o'&gt;::&lt;/span&gt;&lt;span class='no'&gt;Base&lt;/span&gt;
  &lt;span class='no'&gt;DEFAULT_OPTIONS&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;&lt;span class='ss'&gt;:wrap&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='ss'&gt;:div&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='ss'&gt;:line_numbers&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='ss'&gt;:table&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='ss'&gt;:tab_width&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='mi'&gt;2&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='ss'&gt;:bold_every&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='mi'&gt;5&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='ss'&gt;:hint&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='kp'&gt;false&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='ss'&gt;:line_number_start&lt;/span&gt; &lt;span class='o'&gt;=&amp;gt;&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;}&lt;/span&gt;
  &lt;span class='k'&gt;def&lt;/span&gt; &lt;span class='nc'&gt;self&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='nf'&gt;filter&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='n'&gt;inner_text&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='n'&gt;text&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
    &lt;span class='c1'&gt;# It&amp;#39;s a whole lot easier to just set your attributes statically&lt;/span&gt;
    &lt;span class='c1'&gt;# I think for most of us the only option we&amp;#39;re gonna change is &amp;#39;lang&amp;#39;&lt;/span&gt;
    &lt;span class='c1'&gt;# refer to http://rd.cycnus.de/coderay/doc/classes/CodeRay/Encoders/HTML.html for more info&lt;/span&gt;
    &lt;span class='c1'&gt;# use code_highlighter.css to change highlighting&lt;/span&gt;
    &lt;span class='c1'&gt;# don&amp;#39;t change, formats code so code_highlighter.css can be used&lt;/span&gt;

    &lt;span class='n'&gt;lang&lt;/span&gt;    &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:lang&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;blank?&lt;/span&gt; &lt;span class='p'&gt;?&lt;/span&gt; &lt;span class='kp'&gt;nil&lt;/span&gt; &lt;span class='p'&gt;:&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:lang&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;to_sym&lt;/span&gt;
    &lt;span class='n'&gt;options&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='no'&gt;DEFAULT_OPTIONS&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;dup&lt;/span&gt;
    &lt;span class='c1'&gt;# type of line number to print options: :inline, :table, :list, nil [default = :table]&lt;/span&gt;
    &lt;span class='c1'&gt;# you can change the line_numbers default value but you will probably have to change the css too&lt;/span&gt;
    &lt;span class='n'&gt;options&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:line_numbers&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt;      &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:line_numbers&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;to_sym&lt;/span&gt;    &lt;span class='k'&gt;unless&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:line_numbers&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;blank?&lt;/span&gt;
    &lt;span class='c1'&gt;# changes tab spacing [default = 2]&lt;/span&gt;
    &lt;span class='n'&gt;options&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:tab_width&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt;         &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:tab_width&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;to_i&lt;/span&gt;         &lt;span class='k'&gt;unless&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:tab_width&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;blank?&lt;/span&gt;
    &lt;span class='c1'&gt;# bolds every &amp;#39;X&amp;#39; line number&lt;/span&gt;
    &lt;span class='n'&gt;options&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:bold_every&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt;        &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:bold_every&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;to_i&lt;/span&gt;        &lt;span class='k'&gt;unless&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:bold_every&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;blank?&lt;/span&gt;
    &lt;span class='c1'&gt;# use it if you want to can be :info, :info_long, :debug just debugging info in the tags&lt;/span&gt;
    &lt;span class='n'&gt;options&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:hint&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt;              &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:hint&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;to_sym&lt;/span&gt;            &lt;span class='k'&gt;unless&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:hint&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;blank?&lt;/span&gt;
    &lt;span class='c1'&gt;# start with line number&lt;/span&gt;
    &lt;span class='n'&gt;options&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:line_number_start&lt;/span&gt;&lt;span class='o'&gt;]&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:line_number_start&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;to_i&lt;/span&gt; &lt;span class='k'&gt;unless&lt;/span&gt; &lt;span class='n'&gt;attributes&lt;/span&gt;&lt;span class='o'&gt;[&lt;/span&gt;&lt;span class='ss'&gt;:line_number_start&lt;/span&gt;&lt;span class='o'&gt;].&lt;/span&gt;&lt;span class='n'&gt;blank?&lt;/span&gt;

    &lt;span class='n'&gt;inner_text&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='n'&gt;inner_text&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;gsub&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='sr'&gt;/\A\r?\n/&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;chomp&lt;/span&gt;
    &lt;span class='n'&gt;html&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;&amp;quot;&lt;/span&gt;

    &lt;span class='k'&gt;begin&lt;/span&gt;
      &lt;span class='n'&gt;html&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='no'&gt;Uv&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;parse&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='n'&gt;inner_text&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;xhtml&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='n'&gt;lang&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;to_s&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='kp'&gt;false&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;lazy&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
    &lt;span class='k'&gt;rescue&lt;/span&gt;
      &lt;span class='k'&gt;unless&lt;/span&gt; &lt;span class='n'&gt;lang&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;blank?&lt;/span&gt;
        &lt;span class='no'&gt;RAILS_DEFAULT_LOGGER&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;warn&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;UltraViolet Error: &lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='vg'&gt;$!&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;message&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
        &lt;span class='no'&gt;RAILS_DEFAULT_LOGGER&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;debug&lt;/span&gt; &lt;span class='vg'&gt;$!&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;backtrace&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;join&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='se'&gt;\n&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
      &lt;span class='k'&gt;end&lt;/span&gt;
      &lt;span class='n'&gt;html&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='s2'&gt;&amp;quot;&amp;lt;pre&amp;gt;&amp;lt;code&amp;gt;&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='no'&gt;CGI&lt;/span&gt;&lt;span class='o'&gt;.&lt;/span&gt;&lt;span class='n'&gt;escapeHTML&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='n'&gt;inner_text&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&amp;quot;&lt;/span&gt;
    &lt;span class='k'&gt;end&lt;/span&gt;
    &lt;span class='s2'&gt;&amp;quot;&amp;lt;div class=&lt;/span&gt;&lt;span class='se'&gt;\&amp;quot;&lt;/span&gt;&lt;span class='s2'&gt;ultraviolet&lt;/span&gt;&lt;span class='se'&gt;\&amp;quot;&lt;/span&gt;&lt;span class='s2'&gt;&amp;gt;&lt;/span&gt;&lt;span class='se'&gt;\n&lt;/span&gt;&lt;span class='si'&gt;#{&lt;/span&gt;&lt;span class='n'&gt;html&lt;/span&gt;&lt;span class='si'&gt;}&lt;/span&gt;&lt;span class='s2'&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;span class='se'&gt;\n&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;&lt;/span&gt;
  &lt;span class='k'&gt;end&lt;/span&gt;
&lt;span class='k'&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Two things to note here:&lt;/p&gt;&lt;ol&gt;
  &lt;li&gt;Don&amp;#8217;t forget to &lt;code&gt;require 'uv'&lt;/code&gt; at the top. We won&amp;#8217;t be needing CodeRay here anymore.&lt;/li&gt;
  &lt;li&gt;Pay attention to the parameters passed to &lt;code&gt;Uv.parse&lt;/code&gt; towards the bottom.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;If you want to turn on &lt;strong&gt;line numbers&lt;/strong&gt;, set the 4th parameter for &lt;code&gt;Uv.parse&lt;/code&gt; to true. If you want to use a &lt;strong&gt;different theme&lt;/strong&gt;, place it&amp;#8217;s name in the 5th parameter. Again, a dirty hack that should be configured by the user of this library, but this isn&amp;#8217;t an article about best practices.&lt;/p&gt;&lt;h3&gt;Step 3: Generate and include the &lt;span class='caps'&gt;CSS&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;Fire up irb and run the following:&lt;/p&gt;&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&amp;gt;&amp;gt; require &lt;span class='s1'&gt;&amp;#39;uv&amp;#39;&lt;/span&gt;
&amp;gt;&amp;gt; Uv.copy_files &lt;span class='s2'&gt;&amp;quot;xhtml&amp;quot;&lt;/span&gt;, &lt;span class='s2'&gt;&amp;quot;PATH_TO_GENERATE_FILES&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will create a css directory containing all of the TextMate themes. Copy the theme you want and include it in your layout.liquid:&lt;/p&gt;&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='bash'&gt;&amp;lt;!-- layout.liquid --&amp;gt;
&lt;span class='o'&gt;{{&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;lazy&amp;#39;&lt;/span&gt; | stylesheet : &lt;span class='s1'&gt;&amp;#39;screen, projection&amp;#39;&lt;/span&gt; &lt;span class='o'&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;#8217;s it! Using it works the same way as before by using the &lt;code&gt;&amp;lt;macro:code lang=&quot;ruby&quot;&amp;gt;&lt;/code&gt; tags. A list of supported languages can be found by running &lt;code&gt;puts Uv.syntaxes.join( &quot;, &quot; )&lt;/code&gt; in irb.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Chocolate Meat Mephisto Theme</title>
   <link href="http://blog.enriquez.me/2009/3/8/chocolate-meat-mephisto-theme"/>
   <updated>2009-03-08T00:00:00-08:00</updated>
   <id>http://blog.enriquez.me/2009/3/8/chocolate-meat-mephisto-theme</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;http://s3.amazonaws.com/theezpzway/files/2/original.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;cite&gt;&lt;a href=&quot;http://www.flickr.com/photos/bigberto/2122377360/&quot;&gt;Photo by flickr user bigberto&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;p&gt;What is chocolate meat? Not only is it a delicious Filipino dish it is now also a Mephisto theme! For blogging developers, it uses a modified version of the &amp;#8220;lazy&amp;#8221; TextMate syntax highlighting theme (via Ultraviolet). Check out &lt;a href=&quot;http://theezpzway.com/2009/3/8/how-to-integrate-ultraviolet-into-mephisto&quot;&gt;my last post&lt;/a&gt; to see the syntax highlighting in action (this blog is using Chocolate Meat)&lt;/p&gt;
&lt;p&gt;Tried and tested on Mephisto 0.8. Anything else is unknown territory.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dinuguan&quot;&gt;Chocolate Meat &lt;span class=&quot;caps&quot;&gt;AKA&lt;/span&gt; Dinuguan&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Features&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;Built upon the &lt;a href=&quot;http://blueprintcss.org/&quot;&gt;Blueprint &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; Framework&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;W3C Valid &lt;span class=&quot;caps&quot;&gt;XHTML&lt;/span&gt; 1.1&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://addthis.com&quot;&gt;AddThis&lt;/a&gt; integration.&lt;/li&gt;
	&lt;li&gt;Syntax highlighting (with Ultraviolet)&lt;/li&gt;
	&lt;li&gt;It looks awesome! Check out the rest of this blog for examples.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Download&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;http://cloud.github.com/downloads/enriquez/chocolate-meat/chocolate_meat-1.0.zip&quot;&gt;chocolate_meat-1.0.zip&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Install&lt;/h3&gt;
&lt;p&gt;Log into your Mephisto site, then navigate to Design &amp;#8594; Manage Themes &amp;#8594; Import New Theme. Browse to the zip file and activate the theme.&lt;/p&gt;
&lt;p&gt;The &amp;#8220;lazy&amp;#8221; syntax highlighting theme relies on &lt;a href=&quot;http://ultraviolet.rubyforge.org/&quot;&gt;Ultraviolet&lt;/a&gt;. If you want this feature, read &lt;a href=&quot;/2009/3/8/how-to-integrate-ultraviolet-into-mephisto&quot;&gt;my last post for directions&lt;/a&gt; for integrating it into Mephisto.&lt;/p&gt;
&lt;h3&gt;Contribute&lt;/h3&gt;
&lt;p&gt;The latest version of chocolate meat is on &lt;a href=&quot;http://github.com/enriquez/chocolate-meat/tree/master&quot;&gt;github&lt;/a&gt;. Fork it, fix it, change it, whatever&amp;#8230; Please share.&lt;/p&gt;
&lt;p&gt;Note: This blog no longer uses this theme. You can see it at the &lt;a href=&quot;http://mephisto-themes.nanorails.com/gallery&quot;&gt;Mephisto Themes Gallery&lt;/a&gt; by selecting &amp;#8220;chocolate meat&amp;#8221; from the menu at the top.&lt;/p&gt;</content>
 </entry>
 

</feed>
