<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>thirstymind.org &#187; javascript</title>
	<atom:link href="http://www.thirstymind.org/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thirstymind.org</link>
	<description>andrew watts' weblog</description>
	<lastBuildDate>Sat, 17 Oct 2009 22:11:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fixing twitterrific&#8217;s iphone lat lon cryptography the hard way</title>
		<link>http://www.thirstymind.org/2008/08/03/fixing-twitterrifics-iphone-lat-lon-cryptography-the-hard-way/</link>
		<comments>http://www.thirstymind.org/2008/08/03/fixing-twitterrifics-iphone-lat-lon-cryptography-the-hard-way/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 00:10:18 +0000</pubDate>
		<dc:creator>Andrew Watts</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[twitterrific]]></category>

		<guid isPermaLink="false">http://www.thirstymind.org/?p=381</guid>
		<description><![CDATA[Twitterrific&#8217;s iPhone App updates your location on twitter using the twitter api.  This is fine and dandy but the problem is that it updates with the actual latitude and longitude that (I assume) comes from the iphone api.
So, since most people simply just want to know where you are without hurting their heads doing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://iconfactory.com/software/twitterrific">Twitterrific&#8217;s iPhone App</a> updates your location on twitter using the <a href="http://groups.google.com/group/twitter-development-talk/web/api-documentation#AccountMethods">twitter api</a>.  This is fine and dandy but the problem is that it updates with the actual latitude and longitude that (I assume) comes from the iphone api.</p>
<p>So, since most people simply just want to know where you are without hurting their heads doing a reverse geocode,  I have created a <a href="https://addons.mozilla.org/en-US/firefox/addon/748">greasemonkey</a> user script to help them out.  </p>
<p><em>It takes a twitterrific created location that says &#8220;iPhone: 40.733956,-73.992789&#8243; and turns it into &#8220;New York, New York, US&#8221;</em></p>
<p>If you have greasemonkey installed, all you need to do is <a href="http://www.thirstymind.org/playpen/js/twitter-latlon2address/twitter-latlon2address.user.js" alt="twitter-latlon2address.user.js">download and install this user script</a> and you will be set.  If you don&#8217;t have greasemonkey, then you will need to obviously install it first and revisit this page to download the user script.</p>
<p>Hopefully one day the twitterrific iphone app will do this automatically so this script is not needed, but until then, I hope this helps some people out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thirstymind.org/2008/08/03/fixing-twitterrifics-iphone-lat-lon-cryptography-the-hard-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dustin Diaz&#8217;s Brain Teaser</title>
		<link>http://www.thirstymind.org/2008/07/08/dustin-diazs-brain-teaser/</link>
		<comments>http://www.thirstymind.org/2008/07/08/dustin-diazs-brain-teaser/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 03:43:30 +0000</pubDate>
		<dc:creator>Andrew Watts</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[riddle]]></category>

		<guid isPermaLink="false">http://www.thirstymind.org/?p=370</guid>
		<description><![CDATA[Late last night Dustin Diaz posted a short brain teaser,  there are lots of solutions already posted, but I didn&#8217;t see any with a similar approach to mine, so I thought I would also share:



&#160; &#160; &#160; &#160; &#160; &#160; var arr = &#91;&#39;a&#39;, &#39;b&#39;, &#39;c&#39;, &#39;c&#39;, &#39;d&#39;, &#39;e&#39;, &#39;e&#39;,


&#160; &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Late last night <a href="http://www.dustindiaz.com/">Dustin Diaz</a> posted a <a href="http://www.dustindiaz.com/programming-brain-teaser/">short brain teaser</a>,  there are lots of solutions already posted, but I didn&#8217;t see any with a similar approach to mine, so I thought I would also share:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> arr = <span class="br0">&#91;</span><span class="st0">&#39;a&#39;</span>, <span class="st0">&#39;b&#39;</span>, <span class="st0">&#39;c&#39;</span>, <span class="st0">&#39;c&#39;</span>, <span class="st0">&#39;d&#39;</span>, <span class="st0">&#39;e&#39;</span>, <span class="st0">&#39;e&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#39;e&#39;</span>, <span class="st0">&#39;e&#39;</span>, <span class="st0">&#39;e&#39;</span>, <span class="st0">&#39;f&#39;</span>, <span class="st0">&#39;e&#39;</span>, <span class="st0">&#39;f&#39;</span>, <span class="st0">&#39;e&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&#39;f&#39;</span>, <span class="st0">&#39;a&#39;</span>, <span class="st0">&#39;a&#39;</span>, <span class="st0">&#39;a&#39;</span>, <span class="st0">&#39;f&#39;</span>, <span class="st0">&#39;f&#39;</span>, <span class="st0">&#39;f&#39;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> output &nbsp;= <span class="br0">&#91;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> tracker = <span class="br0">&#91;</span><span class="br0">&#93;</span>; </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; arr.<span class="me1">forEach</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="kw1">item</span>, index, ar<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// check if the tracker array matches the current item </span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> tracker<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> === <span class="kw1">item</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// then check if we need to insert a marker</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> tracker.<span class="me1">length</span> == <span class="nu0">2</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output<span class="br0">&#91;</span>output.<span class="me1">length</span><span class="br0">&#93;</span> = <span class="st0">&#39;&amp;lt;span&amp;gt;&#39;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">else</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// if it is different check if we need to close the marker</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>tracker.<span class="me1">length</span> <span class="sy0">&gt;</span> <span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output<span class="br0">&#91;</span>output.<span class="me1">length</span><span class="br0">&#93;</span> = <span class="st0">&#39;&amp;lt;/span&amp;gt;&#39;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// now reset the tracking array</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tracker = <span class="br0">&#91;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// add to the tracking and output arrays</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tracker<span class="br0">&#91;</span>tracker.<span class="me1">length</span><span class="br0">&#93;</span> = <span class="kw1">item</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; output<span class="br0">&#91;</span>output.<span class="me1">length</span><span class="br0">&#93;</span> = <span class="kw1">item</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// close up, just incase we are open</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span> index == ar.<span class="me1">length</span> &#8211; <span class="nu0">1</span> &nbsp;<span class="sy0">&amp;&amp;</span> tracker.<span class="me1">length</span> <span class="sy0">&gt;</span> <span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;output<span class="br0">&#91;</span>output.<span class="me1">length</span><span class="br0">&#93;</span> = <span class="st0">&#39;&amp;lt;span&amp;gt;&#39;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;document.<span class="kw1">write</span><span class="br0">&#40;</span>output.<span class="me1">join</span><span class="br0">&#40;</span><span class="st0">&#39;&#39;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>and here is <a href="http://www.thirstymind.org/playpen/js/dustin-diaz-brain-teaser-01/index.html">my live demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thirstymind.org/2008/07/08/dustin-diazs-brain-teaser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
