<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: Ianpurton's Code Snippets</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 26 Jul 2008 05:12:34 GMT</pubDate>
    <description>DZone Snippets: Ianpurton's Code Snippets</description>
    <item>
      <title>Helper to Display Rails Flash Messages</title>
      <link>http://snippets.dzone.com/posts/show/3145</link>
      <description>A simple code snippet for displaying your flash[:warning] = "Warning Message" messages in rails.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def flash_helper&lt;br /&gt;  &lt;br /&gt;    f_names = [:notice, :warning, :message]&lt;br /&gt;    fl = ''&lt;br /&gt;    &lt;br /&gt;    for name in f_names&lt;br /&gt;      if flash[name]&lt;br /&gt;        fl = fl + "&lt;div class=\"notice\" id=\"#{name}\"&gt;#{flash[name]}&lt;/div&gt;"&lt;br /&gt;      end&lt;br /&gt;      flash[name] = nil;&lt;br /&gt;    end&lt;br /&gt;    return fl&lt;br /&gt;  end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 13 Dec 2006 19:35:07 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3145</guid>
      <author>ianpurton ()</author>
    </item>
    <item>
      <title>Wordpress HTML Outline</title>
      <link>http://snippets.dzone.com/posts/show/2956</link>
      <description>// Basic HTML structure for a wordpress page&lt;br /&gt;&lt;code&gt;&lt;body&gt;&lt;br /&gt;	&lt;div id="wrap"&gt;&lt;br /&gt;		&lt;div id="top"&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;		&lt;div id="content" class="single"&gt;&lt;br /&gt;			&lt;div class="post-wrap" id="post-6"&gt;&lt;br /&gt;				&lt;h1 class="post-title"&gt;The Title Of Your Post&lt;/h1&gt;&lt;br /&gt;				&lt;div class="story-content"&gt;&lt;br /&gt;				&lt;/div&gt;&lt;br /&gt;				&lt;br /&gt;				&lt;div class="metawrap"&gt;&lt;br /&gt;				&lt;/div&gt;&lt;br /&gt;			&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;			&lt;div id="commentwrap"&gt;&lt;br /&gt;				&lt;h3 id="respond"&gt;Leave Your Comment&lt;/h3&gt;&lt;br /&gt;				&lt;form&gt;&lt;br /&gt;				&lt;/form&gt;&lt;br /&gt;			&lt;/div&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;		&lt;div id="side"&gt;&lt;br /&gt;			&lt;ul&gt;&lt;br /&gt;				&lt;li&gt;&lt;!-- One side bar item --&gt;&lt;/li&gt;&lt;br /&gt;			&lt;/ul&gt;&lt;br /&gt;		&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;		&lt;div id="bottom"&gt;&lt;/div&gt;&lt;br /&gt;		&lt;br /&gt;	&lt;/div&gt;&lt;!-- end wrap --&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 02 Nov 2006 15:42:27 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2956</guid>
      <author>ianpurton ()</author>
    </item>
    <item>
      <title>Move multiple options from one select to another</title>
      <link>http://snippets.dzone.com/posts/show/1513</link>
      <description>// Theis code requires you include prototype.js&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;function copyOptions(from , to)&lt;br /&gt;{&lt;br /&gt;	for (var i=0; i &lt; $(from).options.length; i++) &lt;br /&gt;	{&lt;br /&gt;        if ($(from).options[i].selected) &lt;br /&gt;        {&lt;br /&gt;            var optionName = new Option($(from).options[i].text, &lt;br /&gt;            	$(from).options[i].value);&lt;br /&gt;            $(to).options[$(to).length] = optionName;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    remove($(from));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function remove(theSel)&lt;br /&gt;{&lt;br /&gt;  	var selIndex = theSel.selectedIndex;&lt;br /&gt;  	if (selIndex != -1) &lt;br /&gt;  	{&lt;br /&gt;	    for(i=theSel.length-1; i&gt;=0; i--)&lt;br /&gt;	    {&lt;br /&gt;		      if(theSel.options[i].selected)&lt;br /&gt;		      	theSel.options[i] = null;&lt;br /&gt;	    }&lt;br /&gt;    	if (theSel.length &gt; 0) &lt;br /&gt;      		theSel.selectedIndex = selIndex == 0 ? 0 : selIndex - 1;&lt;br /&gt;  	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 17 Feb 2006 15:59:41 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1513</guid>
      <author>ianpurton ()</author>
    </item>
    <item>
      <title>Place Timezone information into a cookie</title>
      <link>http://snippets.dzone.com/posts/show/1511</link>
      <description>Set a cookie with the users timezone&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;//By default, getTimezoneOffset returns the time zone offset in minutes&lt;br /&gt;setCookie("timezone", new Date().getTimezoneOffset()/60);&lt;br /&gt;&lt;br /&gt;function setCookie(name, value, expires, path, domain, secure) &lt;br /&gt;{&lt;br /&gt;    document.cookie= name + "=" + escape(value) +&lt;br /&gt;        ((expires) ? "; expires=" + expires.toGMTString() : "") +&lt;br /&gt;        ((path) ? "; path=" + path : "") +&lt;br /&gt;        ((domain) ? "; domain=" + domain : "") +&lt;br /&gt;        ((secure) ? "; secure" : "");&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 17 Feb 2006 14:52:34 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1511</guid>
      <author>ianpurton ()</author>
    </item>
  </channel>
</rss>
