<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Overt Pretension</title>
  <subtitle>Self-importance. Entitlement. Snobbery.</subtitle>
  <id>http://richa.avasthi.name/blog</id>
  <link href="http://richa.avasthi.name/blog"/>
  <link href="http://richa.avasthi.name/feed.xml" rel="self"/>
  <updated>2017-07-16T23:46:00-07:00</updated>
  <author>
    <name>Richa Avasthi</name>
  </author>
  <entry>
    <title>Site refresh + new open source project</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2017/07/site-refresh/"/>
    <id>http://richa.avasthi.name/blog/2017/07/site-refresh/</id>
    <published>2017-07-16T23:46:00-07:00</published>
    <updated>2019-04-06T21:51:15-07:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;I&amp;rsquo;ve just gotten done giving the site a much-needed visual refresh. Also, I&amp;rsquo;ve recently put together &lt;a href="https://github.com/facebookincubator/create-react-app"&gt;a new open-source project&lt;/a&gt;, bootstrapped by &lt;a href="https://github.com/facebookincubator/create-react-app"&gt;create-react-app&lt;/a&gt;, that includes:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integration with &lt;a href="https://github.com/reacttraining/react-router"&gt;React Router&lt;/a&gt; and &lt;a href="http://redux.js.org" title="Read Me · Redux"&gt;Redux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Styles in &lt;a href="http://sass-lang.com"&gt;Sass&lt;/a&gt; (scss format)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stylelint.io"&gt;Stylelint&lt;/a&gt; and &lt;a href="http://eslint.org"&gt;ESLint&lt;/a&gt; configs based on &lt;a href="http://ravasthi.github.io/code-guide/" title="Code Guide"&gt;my preferred coding standards&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://editorconfig.org" title="EditorConfig"&gt;&lt;code&gt;.editorconfig&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;A basic set of styles based on &lt;a href="https://github.com/ravasthi/css3-foundation"&gt;css3-foundation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Testing with &lt;a href="http://mochajs.org"&gt;Mocha&lt;/a&gt;, &lt;a href="http://chaijs.com"&gt;Chai&lt;/a&gt;, and &lt;a href="http://airbnb.io/enzyme/"&gt;Enzyme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Give &amp;lsquo;em both a spin! (And let me know about issues you find please.)&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Organizing your CSS</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2016/01/organizing-your-css/"/>
    <id>http://richa.avasthi.name/blog/2016/01/organizing-your-css/</id>
    <published>2016-01-30T17:57:00-08:00</published>
    <updated>2016-01-31T12:34:48-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;The larger your website or application gets, the harder it is to keep your CSS sane and easy to maintain. The trouble, of course, is that there is no One True Way. Lots of people have made recommendations on how to do this over the years. Here&amp;rsquo;s mine.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Let me say this first: I subscribe to neither the &lt;a href="https://smacss.com"&gt;SMACSS&lt;/a&gt; nor &lt;a href="http://getbem.com/introduction/" title="BEM — Introduction"&gt;BEM&lt;/a&gt; schools of thought, though I agree more with the latter than the former.&lt;/p&gt;

&lt;p&gt;My philosophy is that if you have a reasonable file organization, a structured commenting strategy, and &lt;em&gt;strive always to use semantic names&lt;/em&gt;, you&amp;rsquo;re in pretty good shape. No complicated naming conventions necessary.&lt;/p&gt;

&lt;h2&gt;Use a CSS pre-processor&lt;/h2&gt;

&lt;p&gt;Nowadays, even on small projects, I use a CSS pre-processor—&lt;a href="http://sass-lang.com" title="Sass: Syntactically Awesome Style Sheets"&gt;Sass&lt;/a&gt; is my favorite. They&amp;rsquo;re way more powerful than CSS, are conducive to organizing your code in smaller, topical, maintainable chunks, and just all around make your life easier. If you aren&amp;rsquo;t using a pre-processor and you build websites on a regular basis, consider switching.&lt;/p&gt;

&lt;h2&gt;File hierarchy&lt;/h2&gt;

&lt;p&gt;Here is how I organize the styles in all my web projects:&lt;/p&gt;

&lt;pre&gt;
styles
├── basics
│   ├── _colors.scss
│   ├── _grid.scss
│   └── _typography.scss
├── shared
│   ├── _alerts.scss
│   ├── _footer.scss
│   ├── _forms.scss
│   ├── _foundation.scss
│   ├── _header.scss
│   ├── _mixins.scss
│   ├── _page.scss
│   └── _pagination.scss
├── _feature-1.scss
├── feature-2
│   ├── _feature-2-component-1.scss
│   └── _feature-2-component-2.scss
├── _component-1.scss
├── application.scss
├── ie.scss
└── print.scss
&lt;/pre&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;basics/&lt;/strong&gt; contains the building blocks of the styles: the colors (more on this in just a bit), the typography, the grid.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;shared/&lt;/strong&gt; contains application-wide styles like header, footer and form styles. Default styles for the basic HTML tags should also be included here.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The rest of the styles should be organized by feature or component, with more complex features getting their own subfolders.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure that every component or feature/page in your application gets its own root-level class—sometimes this goes on the &lt;code&gt;body&lt;/code&gt; tag. Then in your style definitions, make sure to namespace the sub-feature or component styles inside the root-level class for better cleanliness and easier overriding of global styles:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- … --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"feature-1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- … --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="c1"&gt;// In _feature-1.scss&lt;/span&gt;
&lt;span class="nc"&gt;.feature-1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// …&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As is the convention in Sass, all partials should have their names preceded by an &lt;code&gt;_&lt;/code&gt; (underscore) so that the Sass compiler knows not to compile them as individual files in the output directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;application.scss&lt;/code&gt;, &lt;code&gt;ie.scss&lt;/code&gt; and &lt;code&gt;print.scss&lt;/code&gt; are manifests including some combination of the partials. Because they lack the &lt;code&gt;_&lt;/code&gt; prefix, they will be compiled into the output directory.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Colors in Less and Sass&lt;/h2&gt;

&lt;p&gt;One of the most irritating and error-prone things to have to do in CSS is change colors. When I put together my &lt;code&gt;_colors.scss&lt;/code&gt; color manifest, I do a few things to minimize the pain of changing colors, which can happen often in the early days of a web project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never use raw hex or RGB values outside the color manifest.&lt;/li&gt;
&lt;li&gt;Every hex value should be assigned a human-readable color name: &lt;code&gt;$tangerine-yellow&lt;/code&gt; is much more understandable than &lt;code&gt;#ffcc00&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Further, assign those colors to a semantic variable name based on usage:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="c1"&gt;// Main palette&lt;/span&gt;
&lt;span class="nv"&gt;$raw-steel&lt;/span&gt;       &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#3f3c3a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$sand&lt;/span&gt;            &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#dfd2c9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$aqua&lt;/span&gt;            &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#cbf1e3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$orange&lt;/span&gt;          &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#ff7f00&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$saddle-brown&lt;/span&gt;    &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#844421&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Secondary colors&lt;/span&gt;
&lt;span class="c1"&gt;// …&lt;/span&gt;

&lt;span class="c1"&gt;// Greys&lt;/span&gt;
&lt;span class="nv"&gt;$warm-grey&lt;/span&gt;       &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#c5bdb8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$light-grey&lt;/span&gt;      &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#d0d0d0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$ash&lt;/span&gt;             &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#e1dbd7&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$white&lt;/span&gt;           &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#ffffff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Backgrounds&lt;/span&gt;
&lt;span class="nv"&gt;$page-bg&lt;/span&gt;         &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$sand&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$content-bg&lt;/span&gt;      &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$accent-bg&lt;/span&gt;       &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;lighten&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ash&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Text&lt;/span&gt;
&lt;span class="nv"&gt;$body-text-color&lt;/span&gt;      &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$raw-steel&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$secondary-text-color&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$saddle-brown&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then elsewhere, you can do:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$page-bg&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$body-text-color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If later on I want to change the page background or body text color, I only need to change it in the color manifest, and it&amp;rsquo;ll get propagated everywhere with no fuss.&lt;/p&gt;

&lt;h2&gt;Commenting&lt;/h2&gt;

&lt;p&gt;Establish and consistently follow a commenting strategy. Even if you&amp;rsquo;ve broken up your styles into files, each file will likely have subsections. Do your future self and your team a favor by delineating sections of code with comments.&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s how I like to do it. You can see that the names for subsections are indented further than the top-level styles, and that if comments are necessary,
they&amp;rsquo;re included under the header.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="cm"&gt;/*-----[ foundation ]-----------------------------------------------------------
| Reusable content styles. Define your application-wide styles, like links,
| headers, body text, clearfix, etc. here. See the readme for information on
| recommended rule order.
*/&lt;/span&gt;

&lt;span class="cm"&gt;/*----------[ table of contents ]-----------------------------------------------
| tags
| non-semantic styles
*/&lt;/span&gt;

&lt;span class="cm"&gt;/*----------[ tags ]------------------------------------------------------------
*/&lt;/span&gt;
&lt;span class="c1"&gt;// …&lt;/span&gt;

&lt;span class="cm"&gt;/*----------[ non-semantic styles ]---------------------------------------------
| Purely presentational styles with non-semantic names.
*/&lt;/span&gt;
&lt;span class="c1"&gt;// …&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Semantics. Semantics. Semantics.&lt;/h2&gt;

&lt;p&gt;Years ago I hopped on the semantic markup bandwagon and never got off. I&amp;rsquo;ve developed a bone-deep loathing of purely presentational identifiers in markup and do everything short of twisting myself into a pretzel to avoid using anything besides &lt;code&gt;clearfix&lt;/code&gt; in my HTML classes.&lt;/p&gt;

&lt;p&gt;&amp;ldquo;But,&amp;rdquo; I hear you saying, &amp;ldquo;what if I need to define a common set of styles that I want to reuse? Wouldn&amp;rsquo;t I just create a class and use it everywhere?&amp;rdquo; My answer to that is: only if you&amp;rsquo;re using vanilla CSS.&lt;/p&gt;

&lt;p&gt;If you&amp;rsquo;re using a pre-processor, as most projects of significant size do, I recommend you put those reusable styles in a mixin. To me, this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"sign-up-form"&lt;/span&gt; &lt;span class="na"&gt;action=&lt;/span&gt;&lt;span class="s"&gt;"…"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- … --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"sign-up"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"Sign up"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;cta-primary&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// …&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@mixin&lt;/span&gt; &lt;span class="nf"&gt;cta-large&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// …&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nn"&gt;#sign-up-form&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Assuming a Susy grid of 12 columns&lt;/span&gt;
  &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;span&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;6&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;margin-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;span&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nc"&gt;.sign-up&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;cta-primary&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;@include&lt;/span&gt; &lt;span class="nd"&gt;cta-large&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;is infinitely preferable to markup littered with purely-presentational names like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"sign-up-form"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"col-md-6 col-md-offset-3"&lt;/span&gt; &lt;span class="na"&gt;action=&lt;/span&gt;&lt;span class="s"&gt;"…"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="c"&gt;&amp;lt;!-- … --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn btn-primary btn-large"&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;value=&lt;/span&gt;&lt;span class="s"&gt;"Sign up"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The former example achieves a much clearer separation of content and presentation, and makes the markup much, much easier to read and understand.&lt;/p&gt;

&lt;h2&gt;Order CSS rules consistently&lt;/h2&gt;

&lt;p&gt;Follow a consistent order when writing CSS rules. What the order is is largely immaterial, as long as you and your team agree on and consistently follow that order. Here&amp;rsquo;s &lt;a href="http://ravasthi.github.io/code-guide/css/#css-declaration-order" title="Code Guide"&gt;the order I prefer&lt;/a&gt;. To make doing this easier, I use &lt;a href="http://csscomb.com" title="CSScomb: Makes your code beautiful"&gt;CSScomb&lt;/a&gt; to automatically reformat my CSS according to a config file.&lt;/p&gt;

&lt;h2&gt;Coding standards&lt;/h2&gt;

&lt;p&gt;Generalizing from the last section: establish coding standards for your team and enforce them in code reviews and automated testing, to keep your code base clean and maintainable. Here are &lt;a href="http://ravasthi.github.io/code-guide/" title="Code Guide"&gt;the standards I use with my team&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Wrapping up&lt;/h2&gt;

&lt;p&gt;To summarize:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use a CSS pre-processor.&lt;/li&gt;
&lt;li&gt;Break up your styles into files by common purpose: basic styles, shared styles, then individual features or components.&lt;/li&gt;
&lt;li&gt;Structure your color manifest for maximum reuse and minimal cost of change.&lt;/li&gt;
&lt;li&gt;Establish and follow a commenting strategy to make your files easier to scan.&lt;/li&gt;
&lt;li&gt;Make the names in your markup meaningful. Minimize—strive to eliminate—purely presentational identifiers in your markup.&lt;/li&gt;
&lt;li&gt;Order your CSS rules consistently. Consider using a code formatter to help with this.&lt;/li&gt;
&lt;li&gt;Establish and enforce coding standards.&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  <entry>
    <title>Building a color palette</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2016/01/building-a-color-palette/"/>
    <id>http://richa.avasthi.name/blog/2016/01/building-a-color-palette/</id>
    <published>2016-01-29T21:56:00-08:00</published>
    <updated>2016-01-31T12:25:33-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;aside&gt;&lt;p&gt;This is the first in a series of articles on &lt;a href="/blog/series/web-design-basics/"&gt;web design basics&lt;/a&gt;, a loose collection of workflows, best practices and tips I&amp;rsquo;ve put together over many years as a web developer. Got feedback or questions? &lt;a href="https://twitter.com/ravasthi"&gt;Tweet me&lt;/a&gt;.&lt;/p&gt;&lt;/aside&gt;

&lt;p&gt;I should start out by saying that I&amp;rsquo;m operating in near total ignorance of color theory or formal education in design. So you may think what I do here is unscientific and unrefined, at best. That said, over the years I’ve felt my way into a process I like for creating color palettes for new web and design projects.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;Think about color like a UX designer&lt;/h2&gt;

&lt;p&gt;The first thing to remember is that choosing color is not &lt;em&gt;just&lt;/em&gt; about making your site/application/whatever look pretty. Usually, that&amp;rsquo;s not even the main concern. Color is an important weapon in your arsenal to convey information, and as such it should be used with intent and forethought.&lt;/p&gt;

&lt;h2&gt;The requirements&lt;/h2&gt;

&lt;p&gt;When I start a new web project, I know I&amp;rsquo;m going to need colors for a number of different kinds of information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Body text&lt;/li&gt;
&lt;li&gt;Headings&lt;/li&gt;
&lt;li&gt;Blockquotes or other emphasized areas of text (I call this &lt;em&gt;secondary text&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;Links, including hover and active states&lt;/li&gt;
&lt;li&gt;Stroke colors for borders of page elements, tables and form inputs, including focus and disabled states&lt;/li&gt;
&lt;li&gt;Highlighted or inverse text&lt;/li&gt;
&lt;li&gt;Buttons: normal, destructive, secondary, each with hover, active and disabled states&lt;/li&gt;
&lt;li&gt;Alerts of all severities: information, success, warning, failure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Realistically not all these things would require individual colors. I might decide, for example, that headings and body text are the same color, or that focus, hover and active states all get the same styling. Even so, all told I need 10 to 20 colors for a fully-functional web palette.&lt;/p&gt;

&lt;p&gt;That’s a lot of colors. If I used 20 different hues, it’d look like a rainbow went on a bender and threw up its excess all over my website. So here’s what I do: I choose 5-10 hues, then all the rest of the palette is comprised of shades, tints or tones of the main hues.&lt;/p&gt;

&lt;h2&gt;Terminology&lt;/h2&gt;

&lt;p&gt;An aside here on color terminology. All of the terminology I know I’ve learned from monkeying around with Photoshop. Well, that and a recent purchase that I’ll talk about a bit later. For the purposes of this article, let me define the terms I’m using, the way I understand them (i.e. they may not be technically correct):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hue:&lt;/strong&gt; Essentially, one of ROYGBIV. Is it reddish or bluish? Is it closer to green instead?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Saturation:&lt;/strong&gt; How intense is the color? Is it a brilliant cherry red, or closer to mauve (a greyish pink)?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Brightness:&lt;/strong&gt; How bright is the color? Is it dark (close to black), or bright (close to white)?&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Shade:&lt;/strong&gt; Hue + black&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tint:&lt;/strong&gt; Hue + white&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tone:&lt;/strong&gt; Hue + black + white&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From this you’d surmise, accurately, that my favorite color space is HSB (hue, saturation, brightness); it suits well how I like to think about color. First I pick the hue I want, then adjust its saturation and brightness to taste.&lt;/p&gt;

&lt;h2&gt;Refining the requirements&lt;/h2&gt;

&lt;p&gt;Back to the problem at hand: choosing hues. Even though we have a bunch to choose, there are constraints we have to operate within if we want people to be able to read our sites or use our applications for more than three seconds without getting a headache. In practical terms that means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The page background is white or a very pale tint of some hue.&lt;/li&gt;
&lt;li&gt;Body text is black, dark grey, or a very dark shade of some hue.&lt;/li&gt;
&lt;li&gt;Success messaging is usually in the green family, while warnings are yellow or orange and errors red.&lt;/li&gt;
&lt;li&gt;Links and buttons are almost always in the green or blue family.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Given these constraints, it’s likely you might find two similar hues in your palette. In that case, make sure that they’re different enough in hue, saturation or brightness from one another so as to be distinguishable at a glance.&lt;/p&gt;

&lt;p&gt;Okay, I hear you saying, but &lt;em&gt;where do I start&lt;/em&gt;?&lt;/p&gt;

&lt;h2&gt;The inspiration&lt;/h2&gt;

&lt;p&gt;Find something whose colors you find appealing. It can be a photograph, a fabric swatch, a picture in a catalog, anything. I would often browse color scheme sites like &lt;a href="https://color.adobe.com/explore/most-popular/?time=all"&gt;Adobe Color&lt;/a&gt; or &lt;a href="http://www.colourlovers.com"&gt;COLOURlovers&lt;/a&gt;, or look for illustrations or designs on &lt;a href="https://dribbble.com/shots/2488693-Bruno-Mangyoku-Folio"&gt;Dribbble&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;From one of those sources, I&amp;rsquo;d get a &lt;a href="http://colorpeek.com/#ded2ca,403b3b,ccf0e3,ff8000,854522" title="Mid-century modern"&gt;starting palette&lt;/a&gt; of around 5 colors—this particular one is inspired by a photo of my dining room:&lt;/p&gt;

&lt;p&gt;&lt;img src="/blog/2016/01/building-a-color-palette/starting-palette.png" alt="Starting palette" /&gt;&lt;/p&gt;

&lt;h2&gt;The palette template&lt;/h2&gt;

&lt;p&gt;Now that I&amp;rsquo;ve got my starting point, I need to build out the rest of the palette. But how do I make sure that all the colors are harmonious? That they are complementary parts of a whole? This is something I struggled with for quite a while. The answer, of course, is to put a bunch of color swatches close together and see if they look nice.&lt;/p&gt;

&lt;p&gt;But how can you arrange the swatches so that it&amp;rsquo;s easy to see if nearly every combination in your palette is harmonious? Here&amp;rsquo;s the swatch arrangement I came to after some trial and error: a bunch of triangular swatches, arranged in a circle like pieces of a pie:&lt;/p&gt;

&lt;p&gt;&lt;img src="/blog/2016/01/building-a-color-palette/palette-template.png" alt="Palette template" /&gt;&lt;/p&gt;

&lt;p&gt;Look near the center, and you&amp;rsquo;ll be able to see all the colors and how they play together. &lt;a href="palette-template.sketch"&gt;Download this file as a Sketch template&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Building methodically&lt;/h2&gt;

&lt;p&gt;Okay, now I&amp;rsquo;ve got my inspiration and my palette template, and I&amp;rsquo;m ready to build out the full palette. But how do I get from here to there? Here&amp;rsquo;s how I like to do it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Remember that we want each of the primary hues from the inspiration palette, accompanied by &lt;em&gt;at least one&lt;/em&gt; shade, tint or tone, so we don&amp;rsquo;t end up with a total hodgepodge of colors. So pick one of the colors from your inspiration palette and set the fill of one of the wedges.&lt;/li&gt;
&lt;li&gt;Now move one wedge clockwise (or counterclockwise if that&amp;rsquo;s your preference), and set that wedge to the same color as the first.&lt;/li&gt;
&lt;li&gt;Adjust the saturation and brightness settings so you get a shade, tint or tone of the first hue.&lt;/li&gt;
&lt;li&gt;Do this as many times as you want variations on the same hue.&lt;/li&gt;
&lt;li&gt;Now move to the next empty wedge and pick another color from your inspiration palette. The rule is, it has to look nice next to the wedge you colored previously; every pair of adjacent wedges should look harmonious together.&lt;/li&gt;
&lt;li&gt;Lather, rinse, repeat, working your way around the pie until all the wedges are colored. Check along the way that every pair of wedges looks nice. Also keep in mind the constraints we came up with previously. You want a shade of green for success messaging, yellow or orange for warnings, a dark grey or black for text, etc.&lt;/li&gt;
&lt;li&gt;When all the wedges are filled, do a last check of the center of the fully-colored pie. Do all the colors look nice? Do they go well together? Yes? Then you&amp;rsquo;re done.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src="/blog/2016/01/building-a-color-palette/mid-century-modern.png" alt="The finished product" /&gt;&lt;/p&gt;

&lt;h2&gt;Common problems&lt;/h2&gt;

&lt;p&gt;While I&amp;rsquo;m generally happy with this process, there are some problems I run into on a regular basis:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Sometimes I have an idea for a palette in my head, but I have a hard time translating it to colors on the screen; it just doesn&amp;rsquo;t look right. At those times I wish I just had a bunch of paint swatches or something I could hold in my hands and move around to try things out before I move to creating the palette on screen.&lt;/p&gt;

&lt;p&gt;Until very recently, I had no way to deal with that problem other than trial and error, and usually dissatisfaction that I couldn&amp;rsquo;t realize my vision easily. But that&amp;rsquo;s all going to change now. Late last year, I backed a Kickstarter project called &lt;a href="http://www.breakthroughcolour.com"&gt;BreakThroughColour&lt;/a&gt;, intended to be a system of hold-in-your-hand cards that would teach you about colors and basic color theory.&lt;/p&gt;

&lt;p&gt;They arrived last week—this is how I learned what &lt;em&gt;shade&lt;/em&gt;, &lt;em&gt;tint&lt;/em&gt; and &lt;em&gt;tone&lt;/em&gt; mean—and I couldn&amp;rsquo;t be happier with them. Though they&amp;rsquo;re physical cards printed with ink—of necessity defined in the CMYK color space—each card contains a hex code that&amp;rsquo;s a reasonable facsimile and which gives a good starting point for the color on-screen.&lt;/p&gt;

&lt;p&gt;&lt;img src="/blog/2016/01/building-a-color-palette/btc.jpg" alt="BTC" /&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once I have a palette built, there&amp;rsquo;s the tedious but unavoidable step of getting the hex codes for the colors into my CSS. I have to go into Sketch, grab the hex code for the wedge from the color picker, then paste it into my code. This is incredibly annoying.&lt;/p&gt;

&lt;p&gt;But! I recently installed &lt;a href="https://github.com/sketchplugins/plugin-directory"&gt;a few Sketch plugins&lt;/a&gt; that individually and together make this much, much, much easier:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/peterwooley/colorpeek-sketch-plugin"&gt;Sketch &amp;rarr; Colorpeek&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/andrewfiorillo/sketch-palettes"&gt;Sketch palettes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/getflourish/sketch-mate"&gt;Sketch-mate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;And the jewel in the crown: &lt;a href="https://github.com/zeplin/zeplin-sketch-plugin"&gt;the Zeplin plugin&lt;/a&gt;. This one lets you import sketch drawings into &lt;a href="https://zeplin.io"&gt;Zeplin&lt;/a&gt;, which makes it super easy to extract, name and export colors into CSS, Sass, Less, or Stylus. BOOM.&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;Other useful resources&lt;/h2&gt;

&lt;p&gt;Here, in no particular order, are some useful websites I&amp;rsquo;ve come across while trying to refine my color choosing process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Share colors online with &lt;a href="http://colorpeek.com/"&gt;colorpeek&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.0to255.com"&gt;0 to 255&lt;/a&gt; makes it dead easy to find variations on any color.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.color-blindness.com/"&gt;Colblindor&lt;/a&gt; has some great resources on color blindness, which is an important concern when designing with color. It also has a nice tool to help you &lt;a href="http://www.color-blindness.com/color-name-hue/" title="Color Name &amp;amp;#038; Hue | Colblindor"&gt;put names to colors&lt;/a&gt;—especially useful for your Sass or Less color manifests (more on this in another post).&lt;/li&gt;
&lt;li&gt;Don&amp;rsquo;t like those names? Try &lt;a href="http://chir.ag/projects/name-that-color/#6195ED" title="Name that Color - Chirag Mehta : chir.ag"&gt;Name that Color&lt;/a&gt; instead.&lt;/li&gt;
&lt;li&gt;Use &lt;a href="http://rgb.to" title="Convert Hex color #66f550 to Rgb, Pantone, RAL, HSL, HSV, HSB, JSON. Get color scheme."&gt;rgb.to&lt;/a&gt; to convert from RGB to almost any other color space. Especially useful for getting Pantone numbers.&lt;/li&gt;
&lt;li&gt;Design color schemes based on &lt;a href="http://www.zevendesign.com/color-harmony-hulk-wears-purple-pants/"&gt;color harmonies&lt;/a&gt; with &lt;a href="http://paletton.com/#uid=33h0D0kllll9HzOfLqCqVg3xwaL" title="Paletton - The Color Scheme Designer"&gt;Paletton&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Happy new year!</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2016/01/happy-new-year/"/>
    <id>http://richa.avasthi.name/blog/2016/01/happy-new-year/</id>
    <published>2016-01-04T23:12:00-08:00</published>
    <updated>2016-01-28T18:15:49-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;&lt;img src="/blog/2016/01/happy-new-year/holiday-card-2016.svg" alt="Happy new year!" /&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Working around the Yosemite/&lt;span class="keep-together"&gt;El Capitan&lt;/span&gt; &lt;span class="keep-together"&gt;Mail.app&lt;/span&gt; memory leak</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2015/11/fixing-the-yosemite-el-capitan-mail-app-memory-leak/"/>
    <id>http://richa.avasthi.name/blog/2015/11/fixing-the-yosemite-el-capitan-mail-app-memory-leak/</id>
    <published>2015-11-27T20:59:00-08:00</published>
    <updated>2015-11-27T21:18:43-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;Twice in the same week, on two different computers, I fell victim to the same egregious Mail.app memory leak. Within seconds or minutes of launching Mail, it would eat up all the available system memory, and bring the system to a grinding halt; only a hard restart would work after that. The good news, though, is that there’s a relatively straightforward workaround.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;TL;DR: An &lt;a href="https://discussions.apple.com/message/29021062#29021062"&gt;Apple support forum post&lt;/a&gt; has the right solution, which is to force the computer to rebuild Mail’s container. Practically, this will mean deleting all the saved mail and settings, then redownloading or reimporting all messages.&lt;/p&gt;

&lt;p&gt;In my experience, though, you &lt;em&gt;don’t&lt;/em&gt; have to delete and re-add all your mail accounts (Step 3 in the solution); removing the saved messages and settings did the trick for me.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Fixing your zsh path after upgrading to &lt;span class="keep-together"&gt;El Capitan&lt;/span&gt;.</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2015/10/fixing-your-zsh-path-after-upgrading-to-el-capitan/"/>
    <id>http://richa.avasthi.name/blog/2015/10/fixing-your-zsh-path-after-upgrading-to-el-capitan/</id>
    <published>2015-10-08T21:06:00-07:00</published>
    <updated>2015-11-27T21:22:42-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;I upgraded to El Capitan last week and noticed shortly thereafter that my path was messed up; when opening up new terminal windows, the active version of ruby was the system version instead of my RVM default. On investigating, I saw that for some reason the default paths in &lt;code&gt;/etc/paths&lt;/code&gt; (&lt;code&gt;/usr/local/bin:/usr/bin:…&lt;/code&gt;) were first in my path instead of last, as they would have been if &lt;a href="https://github.com/ravasthi/dotfiles"&gt;my &lt;code&gt;.zshenv&lt;/code&gt; and &lt;code&gt;.zshrc&lt;/code&gt;&lt;/a&gt; were being sourced properly. Here’s how I fixed it.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;So the problem is that El Capitan creates an &lt;code&gt;/etc/zprofile&lt;/code&gt; that contains the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="c"&gt;# system-wide environment settings for zsh(1)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; /usr/libexec/path_helper &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
   &lt;/span&gt;&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;/usr/libexec/path_helper &lt;span class="nt"&gt;-s&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;path_helper&lt;/code&gt; is a utility that adds those default paths to your path. Problem is that &lt;code&gt;/etc/zprofile&lt;/code&gt; gets sourced &lt;em&gt;after&lt;/em&gt; &lt;code&gt;~/.zshenv&lt;/code&gt; (&lt;a href="http://zsh.sourceforge.net/Intro/intro_3.html" title="An Introduction to the Z Shell - Startup Files"&gt;background&lt;/a&gt;), and if you construct your path in &lt;code&gt;.zshenv&lt;/code&gt;, like I was, this meant that all the hard work I was doing to build my path in the first file was getting screwed up by sourcing the second.&lt;/p&gt;

&lt;p&gt;So I had two choices:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Move all my path construction to &lt;code&gt;.zprofile&lt;/code&gt; or &lt;code&gt;.zshrc&lt;/code&gt;, since they get sourced after &lt;code&gt;/etc/zprofile&lt;/code&gt;. This was a no-go since I want my path to work for &lt;a href="http://zsh.sourceforge.net/Intro/intro_3.html" title="An Introduction to the Z Shell - Startup Files"&gt;non-login shells&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Simply comment out the lines in &lt;code&gt;/etc/zprofile&lt;/code&gt;. Which is what I did.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And, boom! Back in business.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Making Middleman v3.4.0 work with Pow.</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2015/08/making-middleman-v3-4-0-work-with-pow/"/>
    <id>http://richa.avasthi.name/blog/2015/08/making-middleman-v3-4-0-work-with-pow/</id>
    <published>2015-08-21T22:06:00-07:00</published>
    <updated>2015-11-27T21:22:53-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;I recently upgraded the Middleman gem in my blog installation to the latest version, v3.4.0, and found to my dismay that it no longer worked with Pow. A refactor to &lt;code&gt;Middleman::PreviewServer&lt;/code&gt; caused Pow to throw a &lt;code&gt;TypeError – PreviewServer is not a module&lt;/code&gt; exception. The good news is that the change was a simple one, and you’ll only need to change a single word in your &lt;code&gt;config.ru&lt;/code&gt; file to make it work again.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.snip2code.com/Snippet/145107/Middleman-config-ru-for-usage-with-pow-a"&gt;Various sources&lt;/a&gt; from around the internet recommend that your &lt;code&gt;config.ru&lt;/code&gt; file look something like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'rubygems'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'middleman-core/load_paths'&lt;/span&gt;

&lt;span class="no"&gt;Middleman&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setup_load_paths&lt;/span&gt;

&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'middleman-core'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'middleman-core/preview_server'&lt;/span&gt;

&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="nn"&gt;Middleman::PreviewServer&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preview_in_rack&lt;/span&gt;
    &lt;span class="vi"&gt;@options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;latency: &lt;/span&gt;&lt;span class="mf"&gt;0.25&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="vi"&gt;@app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;new_app&lt;/span&gt;

    &lt;span class="n"&gt;start_file_watcher&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="no"&gt;Middleman&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;PreviewServer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preview_in_rack&lt;/span&gt;
&lt;span class="n"&gt;run&lt;/span&gt; &lt;span class="no"&gt;Middleman&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;PreviewServer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;class&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_rack_app&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And all you have to do to make Pow work again with Middleman is to change the &lt;code&gt;module&lt;/code&gt; keyword on line 9 to &lt;code&gt;class&lt;/code&gt;: PreviewServer is now a class instead of a module.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'rubygems'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'middleman-core/load_paths'&lt;/span&gt;

&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Middleman&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setup_load_paths&lt;/span&gt;

&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'middleman-core'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'middleman-core/preview_server'&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Middleman&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;PreviewServer&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nc"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preview_in_rack&lt;/span&gt;
    &lt;span class="vi"&gt;@options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;latency: &lt;/span&gt;&lt;span class="mf"&gt;0.25&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="vi"&gt;@app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;new_app&lt;/span&gt;

    &lt;span class="n"&gt;start_file_watcher&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Middleman&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;PreviewServer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preview_in_rack&lt;/span&gt;
&lt;span class="n"&gt;run&lt;/span&gt; &lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Middleman&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;PreviewServer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;class&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_rack_app&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Boom!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Tea and transformation</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2014/11/tea-and-transformation/"/>
    <id>http://richa.avasthi.name/blog/2014/11/tea-and-transformation/</id>
    <published>2014-11-30T11:48:00-08:00</published>
    <updated>2015-11-27T20:46:10-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;Tea speaks to me of rainy afternoons and crackling fires. Of snow falling on a silent garden. Of a few quiet moments out of time, the ease of familiar movements, of being in yourself completely, at peace. It speaks of hospitality and comfort, companionship and home. Tea is more to me than just a drink.&lt;/p&gt;

&lt;p&gt;But that is only peripherally what I&amp;rsquo;ll talk about today. I decided a little while ago that I wanted to take some of my TV-watching time and devote it to learning, specifically to improving my design sense. So I bought a bunch of design books and decided to do a little project.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h2&gt;The motivation&lt;/h2&gt;

&lt;p&gt;I&amp;rsquo;d been spending a lot of time reading &lt;a href="http://www.underconsideration.com/brandnew/"&gt;Brand New&lt;/a&gt;, a designer-written blog reviewing identity and branding redesigns, and I quickly found that I didn&amp;rsquo;t have the knowledge to even look at the designs critically, let alone assess them. I wanted to gain that knowlege, and given that I learn best by doing, I thought it&amp;rsquo;d be fun to do a little rebranding project of my own.&lt;/p&gt;

&lt;p&gt;The great thing about living in a city is that there are small, mom-and-pop businesses everywhere you look, and it is rare when you find one that has both a good identity design &lt;em&gt;and&lt;/em&gt; a functional, usable, mobile-friendly website. I can&amp;rsquo;t tell you how many times I&amp;rsquo;ve walked by a menu posted in a restaurant window and wanted to redesign it for usability—or yeah, okay, maybe just do it so I have an excuse to use some of the fonts I collect.&lt;/p&gt;

&lt;p&gt;So I picked a business in my neighborhood to rebrand: &lt;a href="http://dartealing.com"&gt;Dartealing&lt;/a&gt;, a tea room (see above) with a logo I could try redesigning, a menu I could typeset, and a website I could make responsive.&lt;/p&gt;

&lt;p&gt;And no, before you ask, they don&amp;rsquo;t have any idea that I&amp;rsquo;m doing this. I just picked them because tea.&lt;/p&gt;

&lt;h2&gt;The goals&lt;/h2&gt;

&lt;p&gt;A logo design book I&amp;rsquo;d read recommended starting out with an ideation exercise: a free-association mind-map used to collect inspiration and aspiration, a sort of formless manifesto. Out of that came the following goals for the design:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Elegant&lt;/li&gt;
&lt;li&gt;Timeless&lt;/li&gt;
&lt;li&gt;Appealing to both sexes&lt;/li&gt;
&lt;li&gt;Relaxing&lt;/li&gt;
&lt;li&gt;Unpretentious&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;The solution&lt;/h2&gt;

&lt;p&gt;Using a mix of traditional and modern design elements, I came up with something that I&amp;rsquo;m rather pleased with, and that more importantly I had fun building. Read on to see what I did and how I did it.&lt;/p&gt;

&lt;h3&gt;Color&lt;/h3&gt;

&lt;p&gt;For new web projects I usually start at palette generator sites like &lt;a href="https://color.adobe.com/"&gt;Adobe Color&lt;/a&gt; (the artist formerly known as Kuler) and grab a five-color palette to start from. I was looking for colors that were vibrant but soothing, sophisticated, and modern. Here&amp;rsquo;s where I began:&lt;/p&gt;

&lt;figure&gt;
  &lt;a href="palette-inspiration.png"&gt;&lt;img src="palette-inspiration.png" alt="hope springs eternal by hyoung"/&gt;&lt;/a&gt;
  &lt;figcaption&gt;&lt;a href="https://color.adobe.com/hope-springs-eternal-color-theme-1579033/"&gt;hope springs eternal&lt;/a&gt; by hyoung&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;But five colors aren’t enough for most projects with a web component, so one thing I’ve taken to doing in the last few years is taking that initial palette and expanding it out to 20 colors. I like to do it by building a custom color wheel and following these guidelines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ten main hues, each represented by two shades: one intense and one muted.&lt;/li&gt;
&lt;li&gt;Arrange the colors like a pie chart. Each color should go well with its immediate neighbors.&lt;/li&gt;
&lt;/ul&gt;

&lt;figure&gt;
  &lt;a href="color-palette.png"&gt;&lt;img src="color-palette.png" alt="Full color palette"/&gt;&lt;/a&gt;
  &lt;figcaption&gt;Full color palette&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h3&gt;Logo&lt;/h3&gt;

&lt;p&gt;The logo comes in three color treatments and two orientations: full color, monochrome and monochrome inverse (for use on dark backgrounds), each in horizontal and vertical layout.&lt;/p&gt;

&lt;figure&gt;
  &lt;a href="all-logos.png"&gt;&lt;img src="all-logos.png" alt="Logos"/&gt;&lt;/a&gt;
  &lt;figcaption&gt;Logos&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h3&gt;Business cards&lt;/h3&gt;

&lt;p&gt;This is my favorite part of the project, and I think the part that best shows the mix of traditional and modern that I was going for:&lt;/p&gt;

&lt;table class="business-cards" border="0" cellspacing="0" cellpadding="0"&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Back&lt;/th&gt;
      &lt;th&gt;Front&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="card-1-back.png"&gt;&lt;img src="card-1-back.png" alt="Card 1 back"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="card-1-front.png"&gt;&lt;img class="card-front" src="card-1-front.png" alt="Card 1 front"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="card-2-back.png"&gt;&lt;img src="card-2-back.png" alt="Card 2 back"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="card-2-front.png"&gt;&lt;img class="card-front" src="card-2-front.png" alt="Card 2 front"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="card-3-back.png"&gt;&lt;img src="card-3-back.png" alt="Card 3 back"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="card-3-front.png"&gt;&lt;img class="card-front" src="card-3-front.png" alt="Card 3 front"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="card-4-back.png"&gt;&lt;img src="card-4-back.png" alt="Card 4 back"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="card-4-front.png"&gt;&lt;img class="card-front" src="card-4-front.png" alt="Card 4 front"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
&lt;/table&gt;

&lt;h3&gt;Tea packaging&lt;/h3&gt;

&lt;p&gt;These labels are designed assuming that they will be affixed, front and back, to a vacuum-sealed zip-top bag containing the tea sold. There are five types of labels, one for each category of tea the shop sells.&lt;/p&gt;

&lt;table class="tea-labels" border="0" cellspacing="0" cellpadding="0"&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Front&lt;/th&gt;
      &lt;th&gt;Back&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-black-front.png"&gt;&lt;img src="tea-label-black-front.png" alt="Black tea label – front"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-black-back.png"&gt;&lt;img src="tea-label-black-back.png" alt="Black tea label – back"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-green-front.png"&gt;&lt;img src="tea-label-green-front.png" alt="Green tea label – front"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-green-back.png"&gt;&lt;img src="tea-label-green-back.png" alt="Green tea label – back"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-rooibos-front.png"&gt;&lt;img src="tea-label-rooibos-front.png" alt="Rooibos tea label – front"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-rooibos-back.png"&gt;&lt;img src="tea-label-rooibos-back.png" alt="Rooibos tea label – back"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-herbal-front.png"&gt;&lt;img src="tea-label-herbal-front.png" alt="Herbal tea label – front"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-herbal-back.png"&gt;&lt;img src="tea-label-herbal-back.png" alt="Herbal tea label – back"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-rare-front.png"&gt;&lt;img src="tea-label-rare-front.png" alt="Rare tea label – front"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
      &lt;td&gt;
        &lt;figure&gt;
          &lt;a href="tea-label-rare-back.png"&gt;&lt;img src="tea-label-rare-back.png" alt="Rare tea label – back"/&gt;&lt;/a&gt;
        &lt;/figure&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
&lt;/table&gt;

&lt;h3&gt;Finally, the website&lt;/h3&gt;

&lt;p&gt;This bit is where I had the surest footing, but I definitely learned from the experience. The first order of the day was to make it responsive:&lt;/p&gt;

&lt;figure&gt;
  &lt;a href="website-desktop.png"&gt;&lt;img class="screenshot desktop" src="website-desktop.png" alt="website (desktop size)"/&gt;&lt;/a&gt;
  &lt;a href="website-tablet.png"&gt;&lt;img class="screenshot tablet" src="website-tablet.png" alt="website (tablet size)"/&gt;&lt;/a&gt;
  &lt;a href="website-mobile.png"&gt;&lt;img class="screenshot mobile" src="website-mobile.png" alt="website (mobile size)"/&gt;&lt;/a&gt;
  &lt;figcaption&gt;Website at various screen sizes&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;But I wanted to go a bit further and, well, optimize the hell out of it, based on some tricks I&amp;rsquo;d learned at &lt;a href="http://aneventapart.com/"&gt;An Event Apart&lt;/a&gt; the previous week. I ended up doing pretty well, according to &lt;a href="http://www.webpagetest.org" title="WebPagetest - Website Performance and Optimization Test"&gt;webpagetest.org&lt;/a&gt;:&lt;/p&gt;

&lt;figure&gt;
  &lt;a href="performance-score.png"&gt;&lt;img src="performance-score.png" alt="website performance score"/&gt;&lt;/a&gt;
  &lt;figcaption&gt;Performance score&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;I actually did put the whole subdomain under &lt;a href="https://www.cloudflare.com"&gt;a DNS-level CDN&lt;/a&gt;, but it seems webpagetest is just looking for certain base URLs for asset fetches…well, I&amp;rsquo;ll stop yakking and &lt;a href="http://dartealing.projects.avasthi.name" rel="nofollow"&gt;let you see for yourself&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;There it is, and there it was&lt;/h2&gt;

&lt;p&gt;So that&amp;rsquo;s it. I felt like I got a lot out of it, primarily since it was the first time I&amp;rsquo;d done a soup-to-nuts identity design and development project—special thanks to the friends who were kind enough to take a look part-way through and give me feedback. I definitely need more practice, but I think it went rather well. Most of all, I had a great time doing it. Thanks for reading.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Link brew MacVim against brew Python</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2014/08/link-brew-macvim-against-brew-python/"/>
    <id>http://richa.avasthi.name/blog/2014/08/link-brew-macvim-against-brew-python/</id>
    <published>2014-08-26T19:21:00-07:00</published>
    <updated>2015-11-27T20:46:10-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;I’m constantly tinkering with my environment; I’m on an endless quest to &lt;a href="https://github.com/ravasthi/dotfiles"&gt;simplify and automate it&lt;/a&gt; as much as possible. Between my shell, my editors and my window management solution, I’ve got things running pretty smoothly now…for the most part. Recently, my brew-installed MacVim had been giving me fits—seg faults right and left. Here’s how I solved the problem.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;As it turned out, the problem was that brew MacVim only links against the system Python, and I had a brew-installed version of Python. When trying to launch MacVim, Bad Things Happened. I spent far longer than I care to remember Googling for a solution, and found a few differing recommendations. By cobbling them together—and a fair amount of trial and error—I was finally able to get it to work. Here’s how you can do it too:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a soft link to the python config directory:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /usr/local/lib/python2.7
&lt;span class="nb"&gt;ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/Current/lib/python2.7/config config
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Edit the brew Macvim formula: &lt;code&gt;brew edit macvim&lt;/code&gt;, then add the following configure flags under &lt;code&gt;elsif build.with? &amp;quot;python&amp;quot;&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nt"&gt;--enable-pythoninterp&lt;/span&gt;
&lt;span class="nt"&gt;--with-python-config-dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/local/lib/python2.7/config
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add a soft link to the python include directory to make &lt;code&gt;Python/Python.h&lt;/code&gt; accessible:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/Current/include/python2.7
&lt;span class="nb"&gt;ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt; Python
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finally, make sure linking and building flags are the same when installing:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nv"&gt;DYLD_FORCE_FLAT_NAMESPACE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nv"&gt;vi_cv_path_python_plibs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"-L/usr/local/lib/python2.7/config -lpython2.7 -ldl -u _PyMac_Error"&lt;/span&gt; brew &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--verbose&lt;/span&gt; macvim &lt;span class="nt"&gt;--&lt;/span&gt; python
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
</content>
  </entry>
  <entry>
    <title>css3-foundation updates</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2014/07/css3-foundation-updates/"/>
    <id>http://richa.avasthi.name/blog/2014/07/css3-foundation-updates/</id>
    <published>2014-07-05T08:13:00-07:00</published>
    <updated>2015-11-27T20:46:10-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;I’ve made quite a few updates to my &lt;a href="https://github.com/ravasthi/css3-foundation"&gt;css3-foundation&lt;/a&gt; project of late. If you’re not familiar with it, it’s a Compass-based CSS3/HTML5 framework I built at my last place of work for bootstrapping web development projects.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;You might ask: “Why yet another framework? Aren’t Twitter Bootstrap or Zurb Foundation good enough?” I’m going to give the asshole answer: they’re more than I need. It’s not just that, though:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I still believe strongly in separating content from presentation. I don’t like littering my markup with a million presentation-related classes when I’m already using Sass; I prefer to keep my markup clean and readable and use Sass mixins instead. This means I don’t really believe in &lt;a href="https://smacss.com"&gt;SMACSS&lt;/a&gt;. Yeah, I said it.&lt;/li&gt;
&lt;li&gt;Outside of rapid prototyping, I feel the frameworks have limited use. You can spot a Bootstrap site from a mile away, and chances are that your production application, past the initial get-it-working stage, needs its own, unique visual identity, which you won’t achieve on one of these frameworks without significant customization. If you’re already spending so much time customizing the look and feel, why not just start from a lighter baseline and build from there?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So what I’ve done is build that lighter baseline, which has what I need and no more:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A master page layout with JS and style includes structured where and how I want them&lt;/li&gt;
&lt;li&gt;Basic styles and a framework of variables that I need to modify to set the baseline: colors, fonts, layout.&lt;/li&gt;
&lt;li&gt;Mixins for stuff I use all the time, like retina image backgrounds, common font size/line height combinations, inline lists.&lt;/li&gt;
&lt;li&gt;A responsive grid for rapid prototyping when needed; I’ve chosen to go with Susy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything else, I tend to change from project to project, so I leave that alone. This approach works for me; your mileage may vary.&lt;/p&gt;

&lt;p&gt;All that said, this project continues to be the front-end baseline of every web project I start, and I’m constantly tweaking it as I find things that work well, and to take advantage of new techniques I learn. Recent updates to the css3-foundation project include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding support for &lt;a href="http://guardgem.org"&gt;Guard&lt;/a&gt;, &lt;a href="http://livereload.com" title="LiveReload"&gt;LiveReload&lt;/a&gt; and &lt;a href="http://pow.cx" title="Pow: Zero-configuration Rack server for Mac OS X"&gt;Pow&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Upgrading the icon font mixins to use Rico Sta. Cruz’s &lt;a href="https://github.com/rstacruz/iconfonts"&gt;icon-fonts&lt;/a&gt; project&lt;/li&gt;
&lt;li&gt;Replacing the retired &lt;a href="http://andytaylor.me/2013/04/09/1140px-css-grid-retired/" title="1140px CSS Grid Retired &amp;amp;mdash; Andy Taylor"&gt;1140px CSS grid&lt;/a&gt; with &lt;a href="http://susy.oddbird.net" title="Susy"&gt;Susy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try it out; let me know what you think.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>It’s over between me and WordPress.</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2013/11/it-s-over-between-me-and-wordpress/"/>
    <id>http://richa.avasthi.name/blog/2013/11/it-s-over-between-me-and-wordpress/</id>
    <published>2013-11-10T02:48:00-08:00</published>
    <updated>2015-11-27T20:46:10-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;WordPress and I are through. We’d been together a long time, but things had started to go sour: it was needy and high-maintenance, susceptible to the wiles of passing charlatans, and finally I’d had enough. I told it “so long” and went off to find greener pastures.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;While I was at it, I decided to start totally fresh. I dumped almost all of the content I’d been building up over the last 8 years, and kept only the articles that people were reading. I’ve also switched to—in true neckbeard fashion—a static site generator that will enable me to use version control on the site’s content, and the Rails Asset Pipeline for its structure. This new site is built on &lt;a href="http://middlemanapp.com"&gt;Middleman&lt;/a&gt;, because I’ve done the Jekyll thing and was looking for a pasture greener than that.&lt;/p&gt;

&lt;p&gt;So far, so good. Look for a more detailed post in the near future about the migration and setup.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>The IE7 hover ghost bug</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2009/07/the-ie7-hover-ghost-bug/"/>
    <id>http://richa.avasthi.name/blog/2009/07/the-ie7-hover-ghost-bug/</id>
    <published>2009-07-14T00:00:00-07:00</published>
    <updated>2015-11-27T20:46:10-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;Ran into this one today, in somewhat unusual circumstances: I had a hover style where buttons inside a table row only appeared when the mouse was over the row, and if you clicked on one of the buttons but moved the mouse into another row before releasing the mouse button, the previous row would stay highlighted.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://murphy.cz/ie7-hover-ghosts-bug/"&gt;authoritative writeup&lt;/a&gt; of the bug, and most others, refer to the problem happening with dynamically-displayed submenus, but make little mention of my particular problem. There was some hope that triggering &lt;a href="http://www.satzansatz.de/cssd/onhavinglayout.html"&gt;&lt;code&gt;hasLayout&lt;/code&gt;&lt;/a&gt; would fix the problem, as it&amp;rsquo;s the closest thing we have to a magic bullet, but it (shocker!) didn&amp;rsquo;t work for me.&lt;/p&gt;

&lt;p&gt;What &lt;em&gt;did&lt;/em&gt; work for me was reverting back to the brute-force method one had to use for older versions of IE: &lt;a href="http://www.webmasterworld.com/css/3146637.htm" title=":hover - ghosts, gaps and peekaboo in IE7"&gt;using JavaScript onmouseover/onmouseout events to trigger a hover style&lt;/a&gt;&lt;sup&gt;1&lt;/sup&gt; rather than the &lt;code&gt;:hover&lt;/code&gt; pseudoclass. So much for IE7 implementing &lt;code&gt;:hover&lt;/code&gt; on non-anchor elements. Sigh.&lt;/p&gt;

&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; See the first comment. And &lt;em&gt;shame on you&lt;/em&gt;, Webmaster World, for not having permalinks to the comments. Get a load of their generated source, too: they&amp;rsquo;re still using &lt;code&gt;font&lt;/code&gt; tags. Seriously?! And this is a resource for webmasters? Come &lt;em&gt;on&lt;/em&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Speed up Mail.app</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2009/07/speed-up-mail-app/"/>
    <id>http://richa.avasthi.name/blog/2009/07/speed-up-mail-app/</id>
    <published>2009-07-06T00:00:00-07:00</published>
    <updated>2015-11-27T20:46:10-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;In these times of effectively unlimited quotas, there&amp;rsquo;s no need to ever delete email. And I don&amp;rsquo;t&amp;mdash;all my various accounts&amp;rsquo; inboxes combined add up to somewhere around 20,000 emails. Having all your emails is great, but accessing them quickly is at least as important as having them on hand. However, of late, I&amp;rsquo;d been experiencing some severe performance problems in Mail.app&amp;mdash;it was taking literally on the order of minutes for Mail to start up and shut down for me. Just brutal.&lt;/p&gt;

&lt;p&gt;Today, in an effort to alleviate some of that pain, I stumbled across a solution that worked magnificently for me: cleaning up Mail.app&amp;rsquo;s SQLite database.&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s how you do it:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Quit Mail.app.&lt;/li&gt;
  &lt;li&gt;Launch Terminal, then type &lt;code&gt;cd ~/Library/Mail/&lt;/code&gt;.
  &lt;/li&gt;&lt;li&gt;Back up &lt;code&gt;Envelope Index&lt;/code&gt; in whatever fashion you prefer. I did &lt;code&gt;cp Envelope\ Index EnvelopeIndexBackup&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Open &lt;code&gt;Envelope Index&lt;/code&gt; with SQLite: &lt;code&gt;sqlite3 Envelope\ Index&lt;/code&gt;. At the &lt;code&gt;sqlite&amp;gt;&lt;/code&gt; prompt, type: &lt;code&gt;vacuum subjects;&lt;/code&gt;. Once the prompt returns, type Ctrl-D or &lt;code&gt;.exit&lt;/code&gt; to quit SQLite.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This reduces the size of Mail.app&amp;rsquo;s database and cleans it up, usually to dramatic effect. I reduced my database from ~34 MB to ~22 MB, and Mail now starts up in seconds, not minutes. Boom!&lt;/p&gt;

&lt;p&gt;References: &lt;a href="http://www.hawkwings.net/2007/03/01/a-faster-way-to-speed-up-mailapp/" title="A faster way to speed up Mail.app | Hawk Wings"&gt;procedure&lt;/a&gt; and &lt;a href="http://www.sqlite.org/lang_vacuum.html" title="SQLite Query Language: VACUUM"&gt;information about the &lt;code&gt;vacuum&lt;/code&gt; statement&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>IE7 lessons learned: the z-index bug</title>
    <link rel="alternate" href="http://richa.avasthi.name/blog/2008/01/ie7-lessons-learned/"/>
    <id>http://richa.avasthi.name/blog/2008/01/ie7-lessons-learned/</id>
    <published>2008-01-11T00:00:00-08:00</published>
    <updated>2015-11-27T20:46:10-08:00</updated>
    <author>
      <name>Richa Avasthi</name>
    </author>
    <content type="html">&lt;p&gt;The &lt;a href="http://www.quirksmode.org/bugreports/archives/2006/01/Explorer_z_index_bug.html" title="Bug Report: Explorer z-index bug"&gt;IE z-index bug&lt;/a&gt; had been around since IE4 or 5, and was finally fixed in IE8. It&amp;rsquo;s still an issue in IE7, however, and chances are that you, the web developer, still have to support it. You should read Aleksandar Vaci&amp;#263;&amp;lsquo;s &lt;a href="http://aplus.co.yu/lab/z-pos/"&gt;in-depth characterization&lt;/a&gt; of the problem to really understand what&amp;rsquo;s happening, but what it boils down to is this: the CSS 2.1 spec &lt;a href="http://www.w3.org/TR/CSS21/visuren.html#z-index" title="Visual formatting model"&gt;says&lt;/a&gt; that a positioned element with any integer z-index value (i.e. not &lt;code&gt;auto&lt;/code&gt;) should create its own zero-based stacking context, and use the integer value specified to decide its place in its parent stacking context. In other words, if the positioned element has a z-index of &lt;code&gt;auto&lt;/code&gt;, its stacking context is inherited from its parent. Internet Explorer, however, creates a new stacking context for elements with &lt;em&gt;any&lt;/em&gt; z-index value, including &lt;code&gt;auto&lt;/code&gt;, which wreaks all kinds of havoc and generally causes mayhem in your previously neat and orderly layouts.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;So what does this mean for you? Well, if you, like many people, use any variation of ALA&amp;rsquo;s &lt;a href="http://www.alistapart.com/articles/dropdowns/" title="A List Apart: Articles: Suckerfish Dropdowns"&gt;Suckerfish dropdown menus&lt;/a&gt; on your site, you&amp;rsquo;ll notice that any positioned element, with any z-index, that is located lower down in the code than the menus will appear above the menus&amp;mdash;&lt;em&gt;no matter what z-index the menu is given&lt;/em&gt;&amp;mdash;exactly the opposite of what you want to happen. If you use IE6 or below, you&amp;rsquo;ll also see form elements like the infamous IE select box appear above the menu.&lt;/p&gt;

&lt;p&gt;Now you know what the problem is, let&amp;rsquo;s talk about how to work around it. If the problem you&amp;rsquo;re having is with form elements bleeding through, &lt;a href="http://www.last-child.com/conflicting-z-index-in-ie6/" title="Conflicting Z-Index in IE6  at  Advanced CSS Design Resources - last-child.com"&gt;one of the solutions described here&lt;/a&gt;, specifically &lt;a href="http://www.hedgerwow.com/360/bugs/css-select-free.html" title="&amp;lt;SELECT&amp;gt;-Free Layer"&gt;Hedger Wang&amp;rsquo;s solution&lt;/a&gt; (placing your menu above an iframe with a z-index of -1), should fix you right up. Unless, of course, you have subsequent positioned and z-indexed elements in your code. &lt;em&gt;Then&lt;/em&gt; it becomes a lot harder.&lt;/p&gt;

&lt;p&gt;And, surprise!, that&amp;rsquo;s exactly the problem I had. I had a bunch of relatively positioned UI widgets with absolutely positioned children, each with its own flyout menu of actions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nt"&gt;a&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;black&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;#main&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;350px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.block&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;25px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#e0d0d0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.badge&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;21px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;21px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#c0b0b0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#c0b0b0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;21px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;13px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.info&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;25px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f0e0e0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#f0d0d0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="nc"&gt;.menu-activator-arrow&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#e0c0c0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#c0a0a0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="nc"&gt;.menu-activator-arrow&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#a07070&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.menu&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;19px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f0f0f0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#a0a0a0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.menu&lt;/span&gt; &lt;span class="nt"&gt;ul&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;list-style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.menu&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.menu&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#808080&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"main"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"block"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"badge"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Ad&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"info"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      some info
      &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"menu-activator-arrow"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;v&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"menu"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"display: none;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;choice one&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;choice two&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;choice three&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /menu --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /info --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /block --&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"block"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"badge"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Ad&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"info"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      some info
      &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"menu-activator-arrow"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;v&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"menu"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"display: none;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;choice one&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;choice two&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;choice three&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /menu --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /info --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /block --&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"block"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"badge"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Ad&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"info"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      some info
      &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"menu-activator-arrow"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;v&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"menu"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"display: none;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;choice one&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;choice two&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"javascript://"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;choice three&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /menu --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /info --&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /block --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; &lt;span class="c"&gt;&amp;lt;!-- /main --&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="c1"&gt;// When the DOM is ready,&lt;/span&gt;
&lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="cm"&gt;/*
  ** For each link with class "menu-activator-arrow" inside
  ** an element with class "block",
  */&lt;/span&gt;
  &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.block a.menu-activator-arrow&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;each&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// When that link is clicked,&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$link&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;$link&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// Show or hide the element with class menu that follows it.&lt;/span&gt;
      &lt;span class="nx"&gt;$link&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.menu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And it looked like this in IE7:&lt;/p&gt;

&lt;figure&gt;
  &lt;img src="z-index-demo.gif" alt="How it looks in IE7" /&gt;
&lt;/figure&gt;

&lt;p&gt;The upshot of Vaci&amp;#263;&amp;rsquo;s article is that the relatively positioned parent of your absolutely positioned menu should be given a specific integer z-index that is higher than those of subsequent positioned elements on the page in order to ensure that your popup menu appears above all other elements. However, that requires you to know precisely how many relatively positioned elements are in the page, and to manually assign a z-index to each. But in the context of my application, these widgets were dynamically generated and I didn&amp;rsquo;t know how many I would have. So how did I deal with it? The brute force way. After all the widgets had been loaded, I searched for all divs with class block, and iterated through the list, assigning subsequently smaller z-indexes to each, thereby enabling the menu belonging to the topmost widget to appear above all subsequent widgets:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;isIE&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;userAgent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/MSIE &lt;/span&gt;&lt;span class="se"&gt;\d\.\d&lt;/span&gt;&lt;span class="sr"&gt;+/&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;zIndexWorkaround&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isIE&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;zi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.block&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;each&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;css&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;z-index&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;zi&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But that&amp;rsquo;s a bit ugly. Vaci&amp;#263; himself suggested a more elegant solution: just dynamically increase the z-index of any positioned ancestor element when your mouse is over it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;zIndexWorkaround&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// If the browser is IE,&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isIE&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/*
    ** For each div with class menu (i.e.,
    ** the thing we want to be on top),
    */&lt;/span&gt;
    &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;div.menu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;each&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// For each of its ancestors,&lt;/span&gt;
      &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;parents&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;each&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;$ancestor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;pos&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;$ancestor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;css&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;position&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// If it's positioned,&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pos&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;relative&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
           &lt;span class="nx"&gt;pos&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;absolute&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
           &lt;span class="nx"&gt;pos&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;fixed&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="cm"&gt;/*
          ** Add the "on-top" class name when the
          ** mouse is hovering over it,
          */&lt;/span&gt;
          &lt;span class="nx"&gt;$ancestor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hover&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;$ancestor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toggleClass&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;on-top&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Where &lt;code&gt;on-top&lt;/code&gt; is defined thusly:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;table class="rouge-table"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="rouge-gutter gl"&gt;&lt;pre class="lineno"&gt;1
2
3
4
&lt;/pre&gt;&lt;/td&gt;&lt;td class="rouge-code"&gt;&lt;pre&gt;&lt;span class="nc"&gt;.on-top&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And then you&amp;rsquo;d just call &lt;code&gt;zIndexWorkaround()&lt;/code&gt; from inside your domready call.&lt;/p&gt;

&lt;p&gt;Hope this is of some help.&lt;/p&gt;
</content>
  </entry>
</feed>
