<?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>this oughta be interesting... &#187; javascript</title>
	<atom:link href="http://joshsharpe.com/archives/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://joshsharpe.com</link>
	<description></description>
	<lastBuildDate>Mon, 05 Apr 2010 17:41:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jquery.dateTimePicker</title>
		<link>http://joshsharpe.com/archives/jquery-datetimepicker-2</link>
		<comments>http://joshsharpe.com/archives/jquery-datetimepicker-2#comments</comments>
		<pubDate>Wed, 10 Feb 2010 21:44:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://joshsharpe.com/?p=94</guid>
		<description><![CDATA[I did a ground up re-write of my date-time picker.  It now only relies on jQuery (1.4.1) and jQuery UI (1.8rc1).
Use case is pretty simple right now:

$(function(){
  $('#datetimepicker').dateTimePicker();
  $('#datepicker').dateTimePicker({showTime: false});
  $('#timepicker').dateTimePicker({showDate: false});
});

See the demo for more details. Enjoy!
]]></description>
			<content:encoded><![CDATA[<p>I did a ground up re-write of my <a href="http://crankharder.github.com/jquery.dateTimePicker/">date-time picker</a>.  It now only relies on jQuery (1.4.1) and jQuery UI (1.8rc1).</p>
<p>Use case is pretty simple right now:</p>
<pre>
$(function(){
  $('#datetimepicker').dateTimePicker();
  $('#datepicker').dateTimePicker({showTime: false});
  $('#timepicker').dateTimePicker({showDate: false});
});
</pre>
<p>See the demo for more details. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://joshsharpe.com/archives/jquery-datetimepicker-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery.dateTimePicker</title>
		<link>http://joshsharpe.com/archives/jquery-datetimepicker</link>
		<comments>http://joshsharpe.com/archives/jquery-datetimepicker#comments</comments>
		<pubDate>Wed, 22 Jul 2009 01:20:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://joshsharpe.com/?p=9</guid>
		<description><![CDATA[A basic authentication scheme should go to some length to do a little bit of remembering in the event your user hits a restricted page before they are actually authenticated.
First, some context.  I&#8217;ve got this in my ApplicationController:
def require_user
  unless current_user
    store_location
    redirect_to login_path
    [...]]]></description>
			<content:encoded><![CDATA[<p>A basic authentication scheme should go to some length to do a little bit of remembering in the event your user hits a restricted page before they are actually authenticated.</p>
<p>First, some context.  I&#8217;ve got this in my ApplicationController:</p>
<pre>def require_user
  unless current_user
    store_location
    redirect_to login_path
    return false
  end
end

def store_location
  session[:return_to] = request.request_uri
end

def redirect_back_or_default(default)
  redirect_to(session[:return_to] || default)
  session[:return_to] = nil
end
</pre>
<p>&#8230; which allows me to do this in any of my controllers:</p>
<pre>before_filter :require_user, :except =&gt; [:index, :show]</pre>
<p>&#8230; and this is cool because now my users get redirected back to where they were going after they log in.  I like saving my users a click or two here and there if at all possible.</p>
<p>There&#8217;s a problem with this though.  What happens if somehow your user POSTs to an action that is behind <code>require user</code>?  Well <code>request.request_uri</code> is *not* what you want to redirect to.  Why? Because redirect_to is going GET the same url that your user was trying to POST to.  And if you&#8217;re being a good Rails developer and using resources then you&#8217;re just going to smack them in a face with a big fat 404, and that&#8217;s not very nice.</p>
<p>I actually managed to do all of this over at <a href="http://www.github.com">github</a> earlier today by trying to comment on a commit without being logged in.  Want to see it in action? (until github fixes their ways)  First, go to <a href="http://www.github.com">github</a> and logout.  Then find any commit and try to make a comment, you can figure the rest out.  Go ahead, I&#8217;ll wait.</p>
<p>What is that critter anyways? It&#8217;s like a half octopus with a lizard tail and whiskers.  wtf.</p>
<p>Anyways, here&#8217;s the simple fix:</p>
<pre>def store_location
  session[:return_to] =
  if request.get?
    request.request_uri
  else
   request.referer
  end
end
</pre>
<p>If they&#8217;re GETing something let em keep on GETing it, otherwise take them back to where they were coming from.</p>
<p>This solution is only half-baked though.  Any form data that the user has filled out will be gone and they&#8217;ll have to redo it.   On the other hand you really shouldn&#8217;t be showing a form to an unauthenticated user that requires them to be logged in to hit it.  If you really insist on doing that have fun saving all those parameters in the session or somethin in between requests.  I&#8217;d imagine that&#8217;ll suck.</p>
]]></content:encoded>
			<wfw:commentRss>http://joshsharpe.com/archives/jquery-datetimepicker/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
