<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>journal</title>
        <link>http://www.20seven.org/journal/</link>
        <description>...not so private reflections of greg.newman</description>
        <language>en</language>
        <copyright>Copyright 2010</copyright>
        <lastBuildDate>Sat, 09 Feb 2008 09:24:27 -0500</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>DoubleClick and Define using Apple Dictionary</title>
            <description><![CDATA[<p>A fantastic prototype script for Mac dictionary lookups.</p>



<pre><code class=&quot;javascript&quot;>
var selection;
if(window.getSelection)
  selection = window.getSelection();
else if(document.selection)
  selection = document.selection.createRange();

document.observe('dblclick', function() {
  if(navigator.userAgent.include('Macintosh')) {
      location.href = 'dict://' + selection;
    }
});
</code></pre>



<p>A quick (and probably dirty) Prototype-based hack allowing Mac users to get the definition of any word by double clicking it.</p>

<p>[Via <a href="http://alternateidea.com/">AlternateIdea - Home</a>.] </p>]]></description>
            <link>http://www.20seven.org/journal/2008/02/doubleclick-and-define-using-apple-dictionary.html</link>
            <guid>http://www.20seven.org/journal/2008/02/doubleclick-and-define-using-apple-dictionary.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Ruby on Rails</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Web</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">javascript</category>
            
            
            <pubDate>Sat, 09 Feb 2008 09:24:27 -0500</pubDate>
        </item>
        
        <item>
            <title>EJS via MinusMor</title>
            <description><![CDATA[<p>In a recent project I had to come up with a way to include a partial based on a condition from a dropdown selection.  Conditionals in <span class="caps">RJS</span>?  I don't think so.  So thank you <a href="http://www.danwebb.net">Dan Webb</a> for your <a href="http://www.danwebb.net/2006/11/24/minusmor-released">kick-ass MinusMor plugin</a>.  What this does is allow you to embed ruby in javascript as an .ejs extension which gets evaluated before any rjs templates.</p>

<p>So with an observe_field I do:</p>

<blockquote>
<code>
&lt;%= observe_field 'field_to_evaluate', :url =&gt; {:action =&gt; 'my_ejs_template_name' } %&gt;
</code><br />
</blockquote>

<p>I create an ejs template and insert the following code.</p>

<blockquote>
<code>
if (document.getElementById('field_to_evaluate').value == &quot;my_true_value&quot;) {
	$('div_container_to_update').update(&lt;%= partial('the_partial_to_show') %&gt;);
}
</code><br />
</blockquote>

<p>Now the field it is observing is a dropdown menu.  Whenever the selection is true, I see my partial. <br />
Again, a big thanks to <a href="http://www.danwebb.net">Dan Webb</a>!</p>]]></description>
            <link>http://www.20seven.org/journal/2007/02/ejs-via-minusmor.html</link>
            <guid>http://www.20seven.org/journal/2007/02/ejs-via-minusmor.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Ruby on Rails</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">javascript</category>
            
            
            <pubDate>Sat, 17 Feb 2007 04:49:59 -0500</pubDate>
        </item>
        
        <item>
            <title>Happy Programmer&apos;s Day</title>
            <description><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Programmer's_day" title="Programmer's Day">Happy Programmer's Day, or what's left of it!</a></p>]]></description>
            <link>http://www.20seven.org/journal/2006/09/happy-programmers-day.html</link>
            <guid>http://www.20seven.org/journal/2006/09/happy-programmers-day.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Apple</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Hacks</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Linux</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Mac</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">PHP</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Ruby on Rails</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">javascript</category>
            
            
            <pubDate>Wed, 13 Sep 2006 18:32:32 -0500</pubDate>
        </item>
        
        <item>
            <title>Rails Ajax Wiki</title>
            <description><![CDATA[<p>While checking my <a href="http://www.haveamint.com" title="Mint">Mint</a> stats this morning I ran across a link to <a href="http://lesserwiki.org/" title="LesserWiki">LesserWiki</a>, a Ajaxified Ruby on Rails Wiki that looks promising.  </p>

<p>I noticed right away that the wiki's page seems to keep a read history appending the latest article to the top of the page.  The downside; there is no back button so until you realize what it's doing it there is a little bit of confusion.  </p>

<p>I'm curious if anyone has used it in a production environment and if so how does it perform.</p>]]></description>
            <link>http://www.20seven.org/journal/2006/07/rails-ajax-wiki.html</link>
            <guid>http://www.20seven.org/journal/2006/07/rails-ajax-wiki.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Ajax</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">Ruby on Rails</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">javascript</category>
            
            
            <pubDate>Mon, 10 Jul 2006 02:40:00 -0500</pubDate>
        </item>
        
        <item>
            <title>Rails Captcha Validation with Javascript</title>
            <description><![CDATA[<p>A very simple way to keep machines out of your forms is through <a href="http://www.captcha.net/" title="CAPTCHA"><span class="caps">CAPTCHA'</span>s</a>.  A very simple implementation of this in your Rails forms is by using a nifty little javascript.  This is not the preferred method, since there are ways around the javascript, but it is definitely a nice little spam helper.<br />
<b>Note: This will not stop spiders, only human interaction with forms.  This is only intended to show how to integrate jcap with a rails app. Not in anyway a tutorial on how to stop spiders</b></p>

<div align="center">
<img src="http://www.busyashell.com/blog/images/captcha.png" alt="CAPTCHA" /></div>

<h3>Set it up</h3>
1.  <a href="http://www.archreality.com/jcap/" title="Jcap Captcha">Download the Jcap scripts from here</a>.  Decompress and copy them to your public/javascripts folder.  In my case, I left the cimg folder within my javascripts folder.

2.  Add the javascript include tags to your view (within the head).<br />
<blockquote><code>&lt;%= javascript_include_tag 'jcap', 'md5' %&gt;</code></blockquote>

3.  Add an onload event to the body tag.<br />
<blockquote><code>&lt;body onload=&quot;document.xfrm.uword.focus();&quot;&gt;</code></blockquote>

4.  Modify your form tags to resemble:<br />
<blockquote>
	<code>
		&lt;%= form_tag({:action =&gt; 'create'}, {:onSubmit =&gt; 'return jcap()', :name =&gt; 'xfrm'}) %&gt;
     &lt;%= render :partial =&gt; 'addlistingform' %&gt;
     <script language="javascript" type="text/javascript">cimg()</script>
     &lt;noscript&gt;[This resource requires a Javascript enabled browser.]&lt;/noscript&gt;
     Please enter the code as it is displayed above.
     &lt;input type=text name=&quot;uword&quot; id=&quot;uword&quot; value=&quot;&quot; size=20&gt;
     &lt;%= submit_tag &quot;Create&quot; %&gt;
&lt;%= end_form_tag %&gt;
	</code><br />
</blockquote>

<p>I modified my jcap.js file to reflect the location of my cimg folder.  If you keep yours in the javascripts folder you will need to do so as well.</p>

<p>The developer of the Jcap scripts recommends you use some further steps to make sure your captcha is covered by requiring the verification form field.</p>

<p>This is a neat script but does not solve all problems.  As I mentioned, if a browser does not have javascript enabled this will fail.</p>]]></description>
            <link>http://www.20seven.org/journal/2006/07/rails-captcha-validation-with-javascript.html</link>
            <guid>http://www.20seven.org/journal/2006/07/rails-captcha-validation-with-javascript.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">Ruby on Rails</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">javascript</category>
            
            
            <pubDate>Thu, 06 Jul 2006 03:28:00 -0500</pubDate>
        </item>
        
    </channel>
</rss>

