<?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>Guillaume Piot &#124; Application Developer &#38; User Interface Designer &#187; Javascript</title>
	<atom:link href="http://gpiot.com/category/development-tips/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://gpiot.com</link>
	<description></description>
	<lastBuildDate>Tue, 30 Apr 2013 08:42:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>jQuery &#8211; Product trailer</title>
		<link>http://gpiot.com/jquery-product-trailer/</link>
		<comments>http://gpiot.com/jquery-product-trailer/#comments</comments>
		<pubDate>Tue, 30 Apr 2013 08:42:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://gpiot.com/?p=767</guid>
		<description><![CDATA[Here&#8217;s a short snippet of jQuery I have built to enable an horizontal product trail. It simply calculate the size of the container and the size of each slide, and generate the sliding mechanism to go next and previous. That&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a short snippet of jQuery I have built to enable an horizontal product trail. It simply calculate the size of the container and the size of each slide, and generate the sliding mechanism to go next and previous. That&#8217;s it, simple and effective!</p>
<pre class="codepen" data-height="400" data-type="js" data-href="pqFKc" data-user="guillaumepiot" data-safe="true">
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:100%;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">//Mattress slider<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#mattress_slider').append('&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;previous&amp;quot;&amp;gt;&amp;amp;lt;&amp;lt;/a&amp;gt;');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#mattress_slider').append('&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;next&amp;quot;&amp;gt;&amp;amp;gt;&amp;lt;/a&amp;gt;');<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // How manay mattresses<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var mattress_count = $('#mattress_slider .product-list-item').length;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var mattress_width = $('#mattress_slider .product-list-item').width();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var slider_width = $('#mattress_slider').width();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // How manay fit in slider<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var fits = slider_width / mattress_width;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // How manay are missing<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var hidden = mattress_count - fits;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Adjust slider<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('.mattress_slider').css({'width':mattress_count * mattress_width});<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// Position arrows<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#mattress_slider .previous').hide().css({'top':50, 'left':-34}).click(function(e){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.preventDefault()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(hidden &amp;lt; (mattress_count - fits)){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var passed = mattress_count - fits - hidden;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Shift slider by one<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('.mattress_slider').stop().animate({'left': ((1-passed) * mattress_width)}, 500);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Decrement hidden<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hidden += 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Show or hide controls accordingly<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; show_hide_controls();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#mattress_slider .next').css({'top':50, 'right':-34}).click(function(e){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.preventDefault()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(hidden &amp;gt; 0){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var passed = mattress_count - fits - hidden;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Shift slider by one<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('.mattress_slider').stop().animate({'left': -((1+passed) * mattress_width)}, 500);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Decrement hidden<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hidden -= 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Show or hide controls accordingly<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; show_hide_controls();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; function show_hide_controls(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(hidden == 0) $('#mattress_slider .next').hide();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else $('#mattress_slider .next').show();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(hidden == mattress_count - fits) $('#mattress_slider .previous').hide();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else $('#mattress_slider .previous').show();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div></td></tr></tbody></table></div>

<a href="http://codepen.io/guillaumepiot/pen/pqFKc">Check out this Pen!</a></pre>
<p><script async src="http://codepen.io/assets/embed/ei.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/jquery-product-trailer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Bower &amp; Grunt: Get started with assets management</title>
		<link>http://gpiot.com/twitter-bower-grunt-get-started-with-assets-management/</link>
		<comments>http://gpiot.com/twitter-bower-grunt-get-started-with-assets-management/#comments</comments>
		<pubDate>Thu, 11 Apr 2013 14:41:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Development tips]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://gpiot.com/?p=719</guid>
		<description><![CDATA[You may have found yourself downloading latest version of your favourites JS or LESS packages every time you created a new website or app project, or even worse copy and pasted assets from an old website. In this article, I [...]]]></description>
			<content:encoded><![CDATA[<p>You may have found yourself downloading latest version of your favourites JS or LESS packages every time you created a new website or app project, or even worse copy and pasted assets from an old website. In this article, I will demonstrate how you can automate package management with <a href="http://twitter.github.io/bower/">Twitter Bower</a> and build your assets with <a href="http://gruntjs.com/">Grunt</a>, and eventually work smarter.</p>
<h2>Installing Bower</h2>
<p>Bower is written in <a href="http://nodejs.org/">Node.js</a> and therefore require Node package manager <a href="https://npmjs.org/">npm</a> to install it. So first you will need to install Node.js, by choosing an installer on the <a href="http://nodejs.org/download/">Node.js download page</a>.</p>
<p>Once Node.js is installed, simply run the following command:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ sudo npm install -r bower</div></td></tr></tbody></table></div>
<h2>Finding packages</h2>
<p>There&#8217;s two ways of looking for packages:</p>
<p>Either search for packages using the command line tool:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ bower search bootstrap</div></td></tr></tbody></table></div>
<p><a href="http://gpiot.com/wp-content/uploads/2013/04/bower-search-bootstrap.png"><img class="alignnone size-full wp-image-728" title="bower-search-bootstrap" src="http://gpiot.com/wp-content/uploads/2013/04/bower-search-bootstrap.png" alt="" /></a></p>
<p>Or alternatively, browse them from the <a href="http://sindresorhus.com/bower-components/">online repository</a></p>
<h2>Installing packages</h2>
<p>Once you have found your favourite packages, run the following command within your project folder:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ bower install bootstrap</div></td></tr></tbody></table></div>
<p>It may take a minute or so&#8230;</p>
<p><a href="http://gpiot.com/wp-content/uploads/2013/04/bower-install-bootstrap.png"><img class="alignnone size-full wp-image-732" title="bower-install-bootstrap" src="http://gpiot.com/wp-content/uploads/2013/04/bower-install-bootstrap.png" alt="" /></a></p>
<p>Please note that Bower will cache your downloaded packages in ~/.bower/cache so next time you run the install, it will use the cache version for a quicker install.</p>
<p>Though, if the packages have been updated and you want to download the latest, you can clear the cache:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ bower cache-clean</div></td></tr></tbody></table></div>
<p>Or if you wish to update your packages:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ bower update bootstrap</div></td></tr></tbody></table></div>
<h2>Building your assets</h2>
<p>Grunt is wonderful tool build in Node.js which basically allows you to write a set of functions that will process your assets as required. You can for example command to <strong>jshint</strong> (check JS syntax), <strong>concat</strong> (Concatenated multiple files in one) and <strong>uglify</strong> (minify files) a bundle of JS files as required.</p>
<p>The list of plugins is long so check the <a href="http://gruntjs.com/plugins">Grunt plugin page</a> to see what it can do. For the purpose of this article, I will demonstrate how to use Grunt for scaffolding the assets installed by Bower, and building a deployment methodology to manage our assets.</p>
<p>First we need to install Grunt, in a similar fashion as we did for Bower, using NPM:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ sudo npm install -g grunt-cli </div></td></tr></tbody></table></div>
<p>Then, we need to create a package.json file to indicate which Grunt dependencies we need to install:</p>
<p><script src="https://gist.github.com/guillaumepiot/5363418.js"></script> And install:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ npm install</div></td></tr></tbody></table></div>
<p>Then, we must create a gruntfile.js to config which action we would like Grunt to execute:  <script src="https://gist.github.com/guillaumepiot/5363386.js"></script></p>
<p>In this config, we specify which files to copy files from downloaded packages (<strong>copy</strong>), check for syntax (<strong>jshint</strong>), which file to concatenate (<strong>concat</strong>), which file to uglify (<strong>uglify</strong>) and finally which file to watch (<strong>watch</strong>).</p>
<p>To execute this command:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ grunt</div></td></tr></tbody></table></div>
<p>By default, grunt will run the &#8216;default&#8217; tasks. So it is also possible to run a specific task for example:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ grunt build</div></td></tr></tbody></table></div>
<p>The build command will pull the assets from the packages downloaded by Bower and set up a default starting architecture for the new project. So technically, it should only be run once.</p>
<h3>Watch file changes</h3>
<p>You can also watch you files, so if you change any of those files, then grunt will automatically re-run the config, which great to test development work.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ grunt watch</div></td></tr></tbody></table></div>
<p>So if you use something like <strong>CodeKit</strong>, then you won&#8217;t need it anymore!</p>
<h2>Further reading</h2>
<p>You can read the <a href="https://npmjs.org/package/bower">NPM Bower package instructions</a> for an overview of all the commands or simply look on the <a href="http://twitter.github.io/bower/">Twitter Bower home page</a>.</p>
<p>For Grunt, you can refer to their <a href="http://gruntjs.com/getting-started">online documentation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/twitter-bower-grunt-get-started-with-assets-management/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>AngularJS: useful tips to get started</title>
		<link>http://gpiot.com/angularjs-useful-tips-to-get-started/</link>
		<comments>http://gpiot.com/angularjs-useful-tips-to-get-started/#comments</comments>
		<pubDate>Tue, 23 Oct 2012 15:43:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AngularJS]]></category>
		<category><![CDATA[Development tips]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://gpiot.com/?p=670</guid>
		<description><![CDATA[AJAX POST calls: CSRF token for Django In order to pass in the required CRSF token for Django POST requests, we can config our Angular module to add the X-CSRFToken POST header parameter on every call. To do so, set a [...]]]></description>
			<content:encoded><![CDATA[<h2>AJAX POST calls: CSRF token for Django</h2>
<p>In order to pass in the required CRSF token for Django POST requests, we can config our Angular module to add the X-CSRFToken POST header parameter on every call. To do so, set a config on the app module that way:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> myApp <span style="color: #339933;">=</span> angular.<span style="color: #660066;">module</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'myApp'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">config</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$httpProvider<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
$httpProvider.<span style="color: #660066;">defaults</span>.<span style="color: #660066;">headers</span>.<span style="color: #660066;">post</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'X-CSRFToken'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[name=csrfmiddlewaretoken]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>In this scenario, the csrfmiddlewaretoken is output by the Django template context as an hidden input field.</p>
<p><strong>Download the gist:</strong> <a href="https://gist.github.com/3939452">ANGULARJS &#8211; Django CSRF Token header setup</a></p>
<h2>Route path changes (or URL redirect)</h2>
<p>Obviously in AngularJS, we don&#8217;t actually redirect the user but we change the url path (the one followed by #/) in order to load a different controller. It is quite simple to do, simply by giving a url parameter to the <strong>path()</strong> method:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">myApp.<span style="color: #660066;">controller</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'myCtrl'</span><span style="color: #339933;">,</span>&nbsp; <span style="color: #003366; font-weight: bold;">function</span> myCtrl<span style="color: #009900;">&#40;</span>$location<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
$location.<span style="color: #660066;">path</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'/mypath'</span><span style="color: #009900;">&#41;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Do not forget to pass $location in your controller arguments!</p>
<p>More in depth documentation is available on the <a href="http://docs.angularjs.org/api/ng.$location">AngularJS $location reference page</a></p>
<h2>Passing data to a POST call with $http</h2>
<p>The $http POST call on AngularJS will not automatically convert your data array to a set of parameter for the AJAX call. So you must encode the data array as follow (i&#8217;m using jQuery to do so):</p>
<p>$.param(data))</p>
<p><strong>Example:</strong></p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$scope.<span style="color: #660066;">add_flight_route</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>route_id<span style="color: #339933;">:</span>$rootScope.<span style="color: #660066;">route_info</span>.<span style="color: #660066;">route_id</span><span style="color: #009900;">&#125;</span><br />
<br />
$http.<span style="color: #660066;">post</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'/ajax/vall/?rand='</span><span style="color: #339933;">+</span>d.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> $.<span style="color: #660066;">param</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">success</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<h3>Related links</h3>
<p>I found even more tips and tricks on this blog: <a href="http://deansofer.com/posts/view/14/AngularJs-Tips-and-Tricks-UPDATED">http://deansofer.com/posts/view/14/AngularJs-Tips-and-Tricks-UPDATED</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/angularjs-useful-tips-to-get-started/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AngularJS on IE7 not working: how to fix it.</title>
		<link>http://gpiot.com/angularjs-on-ie7-not-working-how-to-fix-it/</link>
		<comments>http://gpiot.com/angularjs-on-ie7-not-working-how-to-fix-it/#comments</comments>
		<pubDate>Wed, 17 Oct 2012 16:53:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AngularJS]]></category>
		<category><![CDATA[Development tips]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://gpiot.com/?p=649</guid>
		<description><![CDATA[We must tag accordingly The main issue with IE7 is its lack of support for HTML5 tags, so we have to tag our AngularJS HTML template accordingly to make sure it will load our app. So here&#8217;s how it got [...]]]></description>
			<content:encoded><![CDATA[<h2>We must tag accordingly</h2>
<p>The main issue with IE7 is its lack of support for HTML5 tags, so we have to tag our AngularJS HTML template accordingly to make sure it will load our app.</p>
<p>So here&#8217;s how it got it to work:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ng-app&quot;</span> ng-app<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;routemapApp&quot;</span>&gt;</span></div></td></tr></tbody></table></div>
<p>Now I have seen many sites suggesting adding those attributes on the <strong>&lt;html&gt;</strong> tag, but for me <strong>it doesn&#8217;t work! </strong>So stick with the body tag and you should be a much happier person!</p>
<p>Then, we need to tag our ng-view accordingly as well:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ng-view&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>Using the class binder is safer than trying to support for &lt;ng-view&gt;</p>
<h2>Adding support for JSON</h2>
<p>You will need to load this JSON polyfill for IE7 and IE8</p>
<p><a href="http://bestiejs.github.com/json3/">http://bestiejs.github.com/json3/</a></p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!--[if lte IE 8]&gt;</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp;&lt;script src=&quot;/static/js/libs/json3.min.js&quot;&gt;&lt;/script&gt;</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp;&lt;![endif]--&gt;</span></div></td></tr></tbody></table></div>
<h2>Supporting for special tags</h2>
<p>AngularJS developer site provides a great starting guide on adding support for special tags on IE7, so here&#8217;s a good way to start:</p>
<p><a href="http://docs.angularjs.org/guide/ie">http://docs.angularjs.org/guide/ie</a></p>
<p>This is what they suggest:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a> xmlns:ng<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://angularjs.org&quot;</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--[if lte IE 8]&gt;</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp;&lt;script&gt;</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp; &nbsp;document.createElement('ng-include');</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp; &nbsp;document.createElement('ng-pluralize');</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp; &nbsp;document.createElement('ng-view');</span><br />
 <br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp; &nbsp;// Optionally these for CSS</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp; &nbsp;document.createElement('ng:include');</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp; &nbsp;document.createElement('ng:pluralize');</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp; &nbsp;document.createElement('ng:view');</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp; &nbsp;&lt;/script&gt;</span><br />
<span style="color: #808080; font-style: italic;"> &nbsp; &nbsp;&lt;![endif]--&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
&nbsp; &nbsp; ...<br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>Though I am not using it, I&#8217;d rather stick to the old fashion class binding system!</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/angularjs-on-ie7-not-working-how-to-fix-it/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Facebook page tab: hide scroll bars from iframe</title>
		<link>http://gpiot.com/facebook-page-tab-hide-scroll-bars-from-iframe/</link>
		<comments>http://gpiot.com/facebook-page-tab-hide-scroll-bars-from-iframe/#comments</comments>
		<pubDate>Tue, 18 Oct 2011 19:05:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cheat sheet]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://gpiot.com/?p=347</guid>
		<description><![CDATA[In the following case, we are using an iFrame to render a page tab in our Facebook page. The page in the iFrame is hosted on a different server. 1. First of all, we need to setup the Facebook app [...]]]></description>
			<content:encoded><![CDATA[<p>In the following case, we are using an iFrame to render a page tab in our Facebook page. The page in the iFrame is hosted on a different server.</p>
<p><strong> </strong></p>
<p>1. First of all, we need to setup the Facebook app canvas settings accordingly (in the advanced settings of the app):</p>
<p><a href="http://gpiot.com/wp-content/uploads/2011/10/Screen-Shot-2011-10-18-at-11.05.57.png"><img class="alignnone size-full wp-image-353" title="Screen Shot 2011-10-18 at 11.05.57" src="http://gpiot.com/wp-content/uploads/2011/10/Screen-Shot-2011-10-18-at-11.05.57.png" alt="" width="630" /></a></p>
<p>2. Then using javascript we&#8217;ll ask Facebook to resize the frame automatically. Add the following code inside your page &lt;head&gt;:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;https://connect.facebook.net/en_US/all.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span> <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>// <span style="color: #009900;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; FB.Canvas.setAutoResize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</span><br />
<span style="color: #009900;"><span style="color: #66cc66;">//</span> <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>3. Finally, we need to force our body and html tag to avoid scroll bars. In your style sheet add the following:</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">body<span style="color: #00AA00;">,</span> html <span style="color: #00AA00;">&#123;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span><br />
<br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>or inline with the html code:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;overflow:hidden;&quot;</span>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;overflow:hidden;&quot;</span>&gt;</span></div></td></tr></tbody></table></div>
<p>This has worked for me to remove all the scroll bars. It&#8217;s working on the 18th of October, but because Facebook keep changing their code, it may change in the future.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/facebook-page-tab-hide-scroll-bars-from-iframe/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Live Twitter feed using jQuery, filter by username and # tags</title>
		<link>http://gpiot.com/live-twitter-feed-using-jquery-filter-by-username-and-tags/</link>
		<comments>http://gpiot.com/live-twitter-feed-using-jquery-filter-by-username-and-tags/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 08:48:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://piot.co.uk/?p=175</guid>
		<description><![CDATA[There&#8217;s a few jQuery plugins out there that allow you to dynamically fetch tweets to your web page, making Twitter integration an easy task. Though, you may want to fetch specific kind of tweets to your website. I&#8217;m case I [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a few jQuery plugins out there that allow you to dynamically fetch tweets to your web page, making Twitter integration an easy task.</p>
<p>Though, you may want to fetch specific kind of tweets to your website. I&#8217;m case I needed to filter by username &amp; #tags.</p>
<p>First let&#8217;s download and embed the necessary code from here: <a href="http://elektronaut.github.com/jquery.livetwitter/">http://elektronaut.github.com/jquery.livetwitter/</a></p>
<p>Follow the instructions (very simple) and then tweak you javascript embedding code:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;div id=&quot;twitterSearch&quot; class=&quot;tweets&quot;&gt;&lt;/div&gt;<br />
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><br />
<span style="color: #006600; font-style: italic;">// Search usage</span><br />
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#twitterSearch'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">liveTwitter</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#tag1 OR #tag2t username'</span><span style="color: #339933;">,</span> <br />
<span style="color: #009900;">&#123;</span>limit<span style="color: #339933;">:</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> rate<span style="color: #339933;">:</span> <span style="color: #CC0000;">5000</span><span style="color: #339933;">,</span> showAuthor<span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p>The following code will filter tweets that contains (#tag1 OR #tag2) AND username.</p>
<p>It&#8217;s as simple as that.</p>
<p>Here&#8217;s a list of the search query criteria you can use with the search API on Twitter:</p>
<ul>
<li><strong>term1 term2</strong>: search for tweets containing both term1 and term2 in any order</li>
<li><strong>term1 OR term2</strong>: search for tweets containing either term1 or term2</li>
<li><strong>“term1 term2”</strong>: search for tweets containing the phrase “term1 term2”</li>
<li><strong>term1 -term2</strong>: search for tweets containing term1 but not including term2</li>
<li><strong>from</strong>: to search only for tweets from a specific Twitter user (e.g. from:briansolis)*</li>
<li><strong>to</strong>: to search only for tweets directed to a specific Twitter user (e.g. to:briansolis)*</li>
<li><strong>since</strong>: to search only for tweets after a specific date in UTC (e.g. since:2010-03-30)</li>
<li><strong>until</strong>: to search only for tweets before a specific date in UTC (e.g. until:2010-03-30)</li>
<li><strong>filter</strong>:links to search only for tweets containing links</li>
<li><strong>source</strong>: to search only for tweets from a specific Twitter source (e.g. source:tweetie)</li>
<li><strong>lang</strong>: to search for only tweets in a particular language (e.g. lang:en for only English tweets, <a href="http://help.tweetreach.com/entries/161042-what-languages-can-i-limit-search-results-to">more info about languages here</a>)</li>
</ul>
<p>Happy tweeting.</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/live-twitter-feed-using-jquery-filter-by-username-and-tags/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cool effect: JQuery Cycle, for HTML slideshow</title>
		<link>http://gpiot.com/cool-effect-jquery-cycle-for-html-slideshow/</link>
		<comments>http://gpiot.com/cool-effect-jquery-cycle-for-html-slideshow/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 11:31:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Animation]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://localhost/devblog/?p=46</guid>
		<description><![CDATA[There&#8217;s a cool JQuery plugin which allows you to slide pieces of HTML one after the other, more than sliding photos, you can slide block of image, text, links and more. Just give it a go! http://jquery.malsup.com/cycle/ Example: // The [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a cool JQuery plugin which allows you to slide pieces of HTML one after the other, more than sliding photos, you can slide block of image, text, links and more.</p>
<p>Just give it a go!</p>
<p><a href="http://jquery.malsup.com/cycle/">http://jquery.malsup.com/cycle/</a></p>
<p>Example:<br />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"></script><script src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.72.js" type="text/javascript"></script><script type="text/javascript">// <![CDATA[
        $(document).ready(function() {
            // jquery slider business
            var cycleStart = 0;$('.slideshow').cycle({
                startingSlide: cycleStart,
                fx:     'scrollHorz',
                prev:   '#Lbut',
                next:   '#Rbut',
                speed:   500,
                timeout: 5000,
                delay: -3000,
                pause: true,
                pauseOnPagerHover: true});}); // ]]&gt;</script></p>
<div class="slideshow">
<div><img src="http://cloud.github.com/downloads/malsup/cycle/beach1.jpg" alt="" width="200" height="200" /><br />
The first image</div>
<div><img src="http://cloud.github.com/downloads/malsup/cycle/beach2.jpg" alt="" width="200" height="200" /><br />
The second image</div>
<div><img src="http://cloud.github.com/downloads/malsup/cycle/beach3.jpg" alt="" width="200" height="200" /><br />
The third image</div>
</div>
<p>The code:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:100%;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;<br />
<br />
&lt;script src=&quot;http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.74.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;<br />
<br />
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #006600; font-style: italic;">// &lt;![CDATA[</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// jquery slider business</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> cycleStart <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.slideHTML'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">cycle</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startingSlide<span style="color: #339933;">:</span> cycleStart<span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fx<span style="color: #339933;">:</span> &nbsp; &nbsp; <span style="color: #3366CC;">'scrollHorz'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prev<span style="color: #339933;">:</span> &nbsp; <span style="color: #3366CC;">'#Lbut'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; next<span style="color: #339933;">:</span> &nbsp; <span style="color: #3366CC;">'#Rbut'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; speed<span style="color: #339933;">:</span> &nbsp; <span style="color: #CC0000;">500</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timeout<span style="color: #339933;">:</span> <span style="color: #CC0000;">5000</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; delay<span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">3000</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pause<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pauseOnPagerHover<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #006600; font-style: italic;">// ]]&gt;&lt;/script&gt;</span></div></td></tr></tbody></table></div>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;slideshow&quot;</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;&lt;<a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">img</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://cloud.github.com/downloads/malsup/cycle/beach1.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
The first image<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;&lt;<a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">img</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://cloud.github.com/downloads/malsup/cycle/beach2.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
The second image<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;&lt;<a href="http://december.com/html/4/element/img.html"><span style="color: #000000; font-weight: bold;">img</span></a> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://cloud.github.com/downloads/malsup/cycle/beach3.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
The third image<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/cool-effect-jquery-cycle-for-html-slideshow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
