<?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>adardesign</title>
	<atom:link href="http://adardesign.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://adardesign.com</link>
	<description>Designing the Front-End</description>
	<lastBuildDate>Fri, 27 Jan 2012 17:22:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HTML-CSS Grid alternative layout structure</title>
		<link>http://adardesign.com/micro-html-css-layout-structure/</link>
		<comments>http://adardesign.com/micro-html-css-layout-structure/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 16:34:07 +0000</pubDate>
		<dc:creator>adardesign</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Layout]]></category>

		<guid isPermaLink="false">http://adardesign.com/?p=85</guid>
		<description><![CDATA[Lately before I started working on a major site wide redesign I was looking at the ready PSD&#8217;s and started thinking of a layout structure, so you know how it goes, You start sketching down on a paper the column&#8217;s layout etc, then you go to the inner elements sketch there layout and you end&#8230;]]></description>
			<content:encoded><![CDATA[<p>Lately before I started working on a major site wide redesign<br />
I was looking at the ready PSD&#8217;s and started thinking of a layout structure, so you know how it goes, You start sketching down on a paper the column&#8217;s layout etc, then you go to the inner elements sketch there layout and you end up with a custom layout structure for almost each component. it always bothered me 1. why have this floating spaghetti all over the place with tons of styles controlling almost every element in the page, there must be a better way (Ill be honest, I already played with grids like the 960.gs but somehow i didn&#8217;t connect to it, i didn&#8217;t like the pixel representation ).</p>
<p>Also while running my recent projects CSS thru <a href="http://csslint.net/">csslint.net</a> when i looked at the results one of them was &#8220;there are too many floats&#8221; I was like what??? How else should I have my structure if not of this element float right that one float left, where you must end up with 10&#8242;s if not hundreds of floats (for large apps) looking at the about pages you can see a detailed explanation of the rule of  <a href="https://github.com/stubbornella/csslint/wiki/Disallow-too-many-floats">Disallow too many floats</a> initially I figured, you know what? instead of having rules of float left on the elements selectors ill have a class of &#8216;flLeft&#8217; and &#8216;flRight&#8217; and add these classes to the elements that need them. but you know, after all you end up with a un-sementic markup and instead of spegeti css you end up with scattered classes, so whats the benefit.</p>
<p>another thing that bothered me was that it used to be, that any structure was tied up with pixel dimensions where lets say you have a page layout of 1000px and the main column at 750px and right bar at 250px and all the layout elements followed a specific width in pixels (at least this is what i was used to, with these layouts when you want to add some responsiveness you will need to have media query re-style all these elements etc etc. This means re-writing a lot of the styles.</p>
<p>Until i stumbled upon a speech that <a href="http://www.stubbornella.org/content/">Nicole Sullivan</a> delivered at <a href="http://velocityconf.com/velocity2010/public/schedule/speaker/3332">Velocity 2010</a> Titled <a href="http://velocityconf.com/velocity2010/public/schedule/speaker/3332">The Top 5 Mistakes of Massive CSS</a> and there she suggests some very good practices, among them she introduces the <a href="http://oocss.org/">object oriented CSS (OOCSS)</a> (<a href="https://github.com/stubbornella/oocss">also on github</a> ) and the media module, which tries to collect the most common scenarios and has a unified module. so i thought to extend this idea to the global layout pro lem, why leave it at the media module? we can collect the most common layout and modularize it.</p>
<p>This means that most layout when looking at it you can categorize them into the following layouts:<br />
.layout-80-20  (col1 80% &#8211; col2 20%)<br />
.layout-20-80 (col1 20% &#8211; col2 80%)<br />
.layout-70-30 (col1 70% &#8211; col2 30%)<br />
.layout-30-70 (col1 30% &#8211; col2 70%)<br />
.layout-50-50 (col1 and col2 50%)</p>
<p>If you need some more layouts (like a 60-40) feel free to add. but you should be fine with these few layouts,<br />
in the container that contains the layout there are 2 collumns,</p>
<p>The basic layout is as follows:  </p>
<pre class="brush:html">

<tag class=”layout-70-30”>
    <tag class=”col1”></tag>
    <tag class=”col2”></tag>
</tag>
</pre>
<p>Layout can be and should be nested into other layouts</p>
<pre class="brush: html">
<tag class=”layout-70-30”>
    <tag class=”col1”></tag>
    <tag class=”col2 layout-80-20”>
            <tag class=”col1”></tag>
            <tag class=”col2”></tag>
    </tag>
</tag>
</pre>
<p>CSS</p>
<pre class="brush: css">
/*Layout structure*/

.col1, .col2{ float: left;}
.layout-reverse > .col1{ float: right;}

.layout-80-20 > .col1{ width:80%;}
.layout-80-20 > .col2{width:20%;}

.layout-20-80 > .col1{width:20%;}
.layout-20-80 > .col2{width:80%;}

.layout-70-30 > .col1{width:70%;}
.layout-70-30 > .col2{width:30%;}

.layout-30-70 > .col1{width:30%;}
.layout-30-70 > .col2{width:70%;}

.layout-60-40 > .col1{width:60%;}
.layout-60-40 > .col2{width:40%;}

.layout-50-50 > .col1, .layout-50-50 > .col2{width:50%;}

/*making sure images dont break the layout*/
.col1 img, .col2 img{ max-width: 100%;}

/*the only fix needed (because of sub-pixel rendering http://ejohn.org/blog/sub-pixel-problems-in-css/)*/
.col2{margin-left: *-2px;}
</pre>
<p>If for any reason you need a reverse layout (col2 before col1) you just add a class of layout-reverse which all it does is it says col1 float:right<br />
also, if you will look at any layout, there is no such a thing as a layout of more then 2 columns.</p>
<p>you can really automate these layouts via JS or via any preprocessing (like saas) (or if your using any templating engine which can run thru the style building before its rendered on the page) which finds the class of layout-[/0-9].. and build the needed styles&#8230; (checking if the style already exists).</p>
<p>Please check out the <a href="http://jsfiddle.net/adardesign/yMH7u">JSfiddle cross browser test</a></p>
]]></content:encoded>
			<wfw:commentRss>http://adardesign.com/micro-html-css-layout-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finally Know jQuery and jQuery UI, In and Out</title>
		<link>http://adardesign.com/finally-know-jquery-and-jquery-ui-in-and-out/</link>
		<comments>http://adardesign.com/finally-know-jquery-and-jquery-ui-in-and-out/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 14:33:37 +0000</pubDate>
		<dc:creator>adardesign</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://adardesign.com/?p=67</guid>
		<description><![CDATA[I am not new to jQuery and jQuery UI, in fact I have written quite few applications using these popular libraries. A few years ago I read Object Oriented Javascript and I liked the style in which it was written. It gave me a good base experience and understanding for structuring code properly. Using this&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://adardesign.com/?attachment_id=76" rel="attachment wp-att-76" style="float:left; margin:0 30px 100px 0;"><img  src="http://adardesign.com/wp-content/uploads/2011/11/jQueryBook-130x300.png" alt="" title="jQueryBook" width="130" height="300" class="alignnone size-medium wp-image-76" /></a>I am not new to jQuery and jQuery UI, in fact I have written quite few applications using these popular libraries. A few years ago I read <a href="https://www.packtpub.com/object-oriented-javascript/book">Object Oriented Javascript</a> and I liked the style in which it was written. It gave me a good base experience and understanding for structuring code properly. Using this book, the learning curve became easy and simple (especially while visiting the chapters dedicated to the concept of &#8220;inheritance,&#8221; which is really important to grasp for anyone developing serious javascript applications.After successfully gaining knowledge from <a href="https://www.packtpub.com/object-oriented-javascript/book">Object Oriented Javascript</a>, I decided to give <a href="http://www.packtpub.com/learning-jquery-for-interaction-design-web-development-with-javascript/book">Learning jQuery, Third Edition</a> and <a href="http://www.packtpub.com/jquery-ui-1-8-user-interface-library/book">jQuery UI 1.8</a> a try. I am glad to report both titles have nearly the same style of clarified learning, which is apparent in its simple language and comprehensible delivery. I&#8217;m certain that even if these concepts were foreign to me, learning through Learning jQuery and jQuery Ui would be a delightful breeze.</p>
<p>I loved these book for a few reasons:</p>
<ol>
<li>It first clearly explains the core concepts and then goes thru each method and utility in detail, so everything is very easy to understand.</li>
<li>The tips and &#8216;Best Practices&#8217; snippets are very useful. They helped me gain a lot of knowledge on how to structure both large and small apps, compose CSS properly and taught general good practices for UI stated css</li>
</ol>
<p>I highly recommend you get your hand on the <a href="http://www.packtpub.com/learning-jquery-for-interaction-design-web-development-with-javascript/book">Learning jQuery, Third Edition</a> and <a href="http://www.packtpub.com/jquery-ui-1-8-user-interface-library/book">jQuery UI 1.8</a> . This recommendation stands for beginners and jQuery ninjas alike, as they both coves areas that are tremendously insightful for everyone. For a beginner, it is &#8220;THE book to read&#8221; for coherently and effectively learn jQuery. For the experts out there, it is clearly an eye opener on some very important topics, and I am certain that after giving it a read, anyone&#8217;s code will both preform better and be composed in a finer manner. Additionally, it also contains inordinately valuable day-to-day hard-to-find examples that will sure be cherished.</p>
]]></content:encoded>
			<wfw:commentRss>http://adardesign.com/finally-know-jquery-and-jquery-ui-in-and-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minimize jQuery object creation</title>
		<link>http://adardesign.com/minimize-jquery-object-creation/</link>
		<comments>http://adardesign.com/minimize-jquery-object-creation/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 17:44:55 +0000</pubDate>
		<dc:creator>adardesign</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[optimization]]></category>

		<guid isPermaLink="false">http://adardesign.com/?p=44</guid>
		<description><![CDATA[Willing to optimize apps to run the fastest posible, developers can sometimes asume (mostly after reading posts amateur developers write) that some optimizations are really better practices. But unfortunately sometimes it might even slower your app. sometimes these optimization&#8217;s are just for edge cases, (for instance only where there are 1000&#8242;s of nodes to manipulate)&#8230;]]></description>
			<content:encoded><![CDATA[<p>Willing to optimize apps to run the fastest posible, developers can sometimes asume (mostly after reading posts amateur developers write) that some optimizations are really better practices.</p>
<p>But unfortunately sometimes it might even slower your app.<br />
sometimes these optimization&#8217;s are just for edge cases, (for instance only where there are 1000&#8242;s of nodes to manipulate)</p>
<p>It is very common to see code like this, where a new jQuery instance object ($) is created for every set of elements:</p>
<pre class="brush: javascript">$("div").bind("click", function(){
   $("#otherDiv").toggle();
})</pre>
<p>Each time you call the $() you create a new instance of jQuery.</p>
<p>You can get away with creating as little as a few jQuery Object&#8217;s</p>
<p>Just start off with one jQuery instance.<br />
Here is how we can optimize our javascript.</p>
<pre class="brush: javascript">// define one root element
var appRoot = $("#appRoot");
    appRoot.find(".someElement").bind("click", function(){
       appRoot.find("#otherDiv").toggle();
});</pre>
<p>Here he have one root element and we keep on looking (finding) from that root element.</p>
<h5>But&#8230;</h5>
<p>After making a few <a href="http://jsperf.com/minimize-jquery-object-creation/2">jsperf tests</a> it turns out that it is not true. <strong>It is actually much slower.</strong></p>
<p>See the <a href="http://stackoverflow.com/questions/6670605/minimizing-jquery-instance-vs-creating-more-instances">stackoverflow thread</a>  for a detailed explanation.</p>
<p>Here&#8217;s an excerpt of the answer:</p>
<blockquote><p>
You need to consider that your test contains less than 10 divs or other html elements. The reason to write code like in the first example is to make the selector faster, but with the cost of additional method calls. Normaly the selector should be the more expensive of the two by far so the the gain would outweight the loss but with a DOM this small the selector will be very cheap no matter how you write it.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://adardesign.com/minimize-jquery-object-creation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sometimes over-optimizing jQuery causes script to run slower</title>
		<link>http://adardesign.com/sometimes-helping-jquery-causes-script-to-run-slower/</link>
		<comments>http://adardesign.com/sometimes-helping-jquery-causes-script-to-run-slower/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 19:16:21 +0000</pubDate>
		<dc:creator>adardesign</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://adardesign.com/?p=19</guid>
		<description><![CDATA[Lately more and more developers are focusing on performance and it is a new hype in the javascript development world to optimize Javascript code. Developers these days do not only care that their app works in all browsers etc. They will go the extra mile and ensure that the code is optimized and that the&#8230;]]></description>
			<content:encoded><![CDATA[<p>Lately more and more developers are focusing on performance and it is a new hype in the  javascript development world to optimize Javascript code.</p>
<p>Developers these days do not only care that their app works in all browsers etc. They will go the extra mile and ensure that the code is optimized and that the javascript execution time is the fastest it can be.</p>
<p>Recently  i wrote a <a href="https://gist.github.com/1058633">new jQuery plugin</a> i tried to optimize the code as much as possible. </p>
<p>Looking at these 2 snippets:</p>
<pre class="brush: javascript">
$("div").width();</code>
</pre>
<pre class="brush: javascript">
$("div").eq(0).width();
</pre>
<p>They return the same result.<br />
Which one would be faster?</p>
<p>As you might know jQuery&#8217;s <a href="http://api.jquery.com/width/">width()</a> method returns the current computed width for the first element in the set of matched elements.</p>
<p>So I always thought why give jQuery the whole set just to get the first elements width, why not make it easier and pass only the first element in the collection by filtering the collection with <a href="http://api.jquery.com/eq/">.eq()</a> to the width method.</p>
<p>It turns out that the width method itself handles it better.<br />
See the <a href="http://jsperf.com/width-filter-or-not/2">results of the jsperf</a> i put together.</p>
<p>The truth is, as <a href="http://www.twitter.com/paul_irish">@paulirish </a> says &#8220;Don’t treat jQuery as a Black Box&#8221; always dig in to the source code and see what it does internally. </p>
<p>If you look in the <a href="http://james.padolsey.com/jquery/#v=1.6.1&#038;fn=jQuery.fn.width"> jQuery&#8217;s fn.width source </a> where you can see that jQuery filters out the first element the most native way it can and it does it right in the beginning of the function.</p>
<pre class="brush: javascript">var elem = this[0];</pre>
<p>Here are 2 videos in which paul digs into jQuery&#8217;s core.</p>
<p><a href=http://paulirish.com/2010/10-things-i-learned-from-the-jquery-source/">10 things i learned from the jquery source</a><br />
<a href="http://paulirish.com/2011/11-more-things-i-learned-from-the-jquery-source/">11 more things i learned from the jquery source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://adardesign.com/sometimes-helping-jquery-causes-script-to-run-slower/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

