<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tiffany B. Brown</title>
	<atom:link href="http://tiffanybbrown.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tiffanybbrown.com</link>
	<description>A web log about web development and internet culture with frequent detours into other stuff.</description>
	<lastBuildDate>Sun, 12 May 2013 17:05:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>On &#8220;Lean In&#8221;</title>
		<link>http://tiffanybbrown.com/2013/04/29/on-lean-in/</link>
		<comments>http://tiffanybbrown.com/2013/04/29/on-lean-in/#comments</comments>
		<pubDate>Mon, 29 Apr 2013 09:00:44 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Books, music and movies]]></category>
		<category><![CDATA[Pop culture]]></category>
		<category><![CDATA[Productivity & Career]]></category>
		<category><![CDATA[Race, Gender, Class & Identity]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[FETWBETW]]></category>
		<category><![CDATA[Lean In]]></category>
		<category><![CDATA[Sheryl Sandberg]]></category>
		<category><![CDATA[billionaires with foundations]]></category>
		<category><![CDATA[corporate feminism]]></category>
		<category><![CDATA[trickle-down feminism]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=7326</guid>
		<description><![CDATA[Sheryl Sandberg is a formidable woman. She is, after all, the Harvard Business School educated, well-connected billionaire COO of Facebook. And that makes people want to listen to her and heed her advice. It is in this spirit, and for these reasons, I assume, that Lean In: Women, Work, and the Will to Lead was [...]]]></description>
				<content:encoded><![CDATA[<p>Sheryl Sandberg is a formidable woman. She is, after all, the Harvard Business School educated, well-connected billionaire COO of Facebook. And that makes people want to listen to her and heed her advice. It is in this spirit, and for these reasons, I assume, that <a href="http://www.amazon.com/Lean-In-Women-Work-Will/dp/0385349947/webinista-20/" class="book title">Lean In: Women, Work, and the Will to Lead</a> was written.</p>
<p>I approached <em class="book title">Lean In</em> with a truck-sized dose of skepticism. Sandberg&#8217;s tome was preceded by the biggest media blitz I&#8217;ve ever seen in advance of a book. Slate.com, for example, had <a href="http://www.slate.com/articles/double_x/doublex/2013/03/sheryl_sandberg_s_lean_in_gives_contradictory_advice.html">no</a> <a href="http://www.slate.com/blogs/xx_factor/2013/04/02/lean_in_groups_i_ve_started_one_of_sheryl_sandberg_s_groups_for_women.html">less</a> <a href="http://www.slate.com/blogs/xx_factor/2013/04/17/sheryl_sandberg_lean_in_circles_women_start_lean_in_groups_in_new_york_city.html">than</a> <a href="http://www.slate.com/blogs/xx_factor/2013/02/22/sheryl_sandberg_and_the_lean_in_movement_what_lean_in_circles_misunderstand.html">a</a> <a href="http://www.slate.com/blogs/xx_factor/2013/03/13/sheryl_sandberg_s_lean_in_why_are_female_success_stories_so_short_on_details.html">half-dozen</a> pieces about it. Salon.com and the New York Times featured <a href="http://www.salon.com/search/?q=lean+in">another half-dozen</a> <a href="http://query.nytimes.com/search/sitesearch/#/lean+in">pieces each</a>. </p>
<p>I&#8217;ll admit I have been pretty critical of <span class="book title">Lean In</span> the book, but especially of <a href="http://leanin.org/">Lean In, the movement</a>. After Sandberg&#8217;s <a href="http://www.thedailyshow.com/watch/wed-april-3-2013/sheryl-sandberg">appearance on <span class="tvshow title">The Daily Show</span></a>, I tweeted the following.</p>
<blockquote class="twitter-tweet"><p>now that i&#8217;ve heard sheryl sandberg discuss &#8220;lean in&#8221; on &#8220;the daily show,&#8221; i still feel like it&#8217;s the vanity project of a rich feminist n00b</p>
<p>&mdash; Tiffany B. Brown (@webinista) <a href="https://twitter.com/webinista/status/319655172886392832">April 4, 2013</a></p></blockquote>
<p><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> </p>
<p>That&#8217;s pretty unfair to say, considering I hadn&#8217;t even read the book. So I borrowed it from the library (you didn&#8217;t think I was going to <em>buy</em> it, did you?), and gave it a read.</p>
<p>After reading <span class="book title">Lean In</span>, I still think it&#8217;s the vanity project of a rich, feminist n00b.</p>
<p>Now I do think we should applaud a wealthy, powerful woman for calling herself a feminist. <a href="http://www.slate.com/blogs/xx_factor/2013/02/27/marissa_mayer_says_she_s_not_a_feminist_in_pbs_makers_documentary.html">Not all such women do</a>. And <span class="book title">Lean In</span> is a well-written book, perhaps even an enjoyable read. Sandberg does a wonderful job of using personal anecdotes to illustrate the book&#8217;s themes. Her language is approachable. Her points well researched. Her tone is affable, though Sandberg drops a lot of names. <strong>It&#8217;s really not a bad book.</strong></p>
<p>But neither do I think it a particularly <em>good</em> book. It&#8217;s middle of the road as far as business  books and self-help books go. <span class="book title">Lean In</span> is most certainly not the <a href="http://msmagazine.com/blog/2013/03/13/is-sheryl-sandbergs-lean-in-the-next-great-feminist-manifesto/">next great feminist manifesto</a> <span class="magazine title">Ms. Magazine</span> suggests it could be. Indeed, I have heard many of the same points about women in leadership and business before. I&#8217;ve read much of the same research elsewhere. </p>
<p><span class="book title">Lean In</span> is very much FETWBETW (that&#8217;d be &#8220;for executive-track women, by executive-track women&#8221;). Ultimately, Sandberg is doing what most billionaires do: write a book, start a foundation. If only we could <a href="https://twitter.com/WomenLEADInc/statuses/309835898470662145">all be honest about that</a>, instead of hailing her book and organization as feminism&#8217;s next great wave.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/04/29/on-lean-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Media queries in SVG and background-size</title>
		<link>http://tiffanybbrown.com/2013/04/20/media-queries-in-svg-and-background-size/</link>
		<comments>http://tiffanybbrown.com/2013/04/20/media-queries-in-svg-and-background-size/#comments</comments>
		<pubDate>Sun, 21 Apr 2013 01:01:32 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[WebKit]]></category>
		<category><![CDATA[background-size]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=7270</guid>
		<description><![CDATA[By now, you probably know it&#8217;s possible to use media queries in SVG. As with media queries in HTML documents, you can use CSS to adjust layout &#8212; or in this case, things like stroke and fill &#8212; based on the width of the document view port. With SVG documents, of course, the viewport is [...]]]></description>
				<content:encoded><![CDATA[<p>By now, you probably know it&#8217;s possible to <a href="http://my.opera.com/ODIN/blog/2009/10/12/how-media-queries-allow-you-to-optimize-svg-icons-for-several-sizes">use media queries in SVG</a>. As with media queries in HTML documents, you can use CSS to adjust layout &#8212; or in this case, things like stroke and fill &#8212; based on the width of the document view port.</p>
<p>With SVG documents, of course, the viewport is whatever <a href="http://webinista.github.io/Conditional-CSS/demos/media/svg/">width has been specified</a> for the &lt;img&gt; tag: <code>&lt;img src="star.svg" width="300"&gt;</code>, for example. This is also true, however, of <code>background-size</code>. </p>
<p><strong>This is a WebKit-only phenomenon</strong> to date, and only in very recent versions. Fire up a copy of <a href="https://www.google.com/intl/en/chrome/browser/">Chrome</a> or a <a href="http://nightly.webkit.org/">WebKit nightly</a>, build r148381 or later. You can also use the <a href="https://play.google.com/store/apps/details?id=com.opera.browser.beta">Opera for Android Beta</a>. Then come back to this page using that browser.</p>
<h2>SVG backgrounds and <code>background-size</code></h2>
<p>In the samples below, the background image is <a href="http://demos.tiffanybbrown.com/2013/media-queries-svg-background-size/star.svg">star.svg</a>. If you view its source, you will see its media queries. Notice that there are several widths at which we adjust the fill and stroke. </p>
<p>In <a href="#figure1">figure 1</a> below, we&#8217;ve set the value of the <code>background-size</code> property to <code>50px 50px</code>. As, you can see, the stars lack a stroke width, and the fill is black with a 20% opacity. </p>
<figure id="figure1" class="image640"><a href="http://demos.tiffanybbrown.com/2013/media-queries-svg-background-size/50px.html"><img src="http://webinista.s3.amazonaws.com/images/uploads/2013/04/blackstars.png" alt="blackstars" width="620" height="330" class="aligncenter size-full wp-image-7287" /></a></p>
<figcaption>Figure 1: <a href="http://demos.tiffanybbrown.com/2013/media-queries-svg-background-size/star.svg">star.svg</a> when the value of the <var>background-size</var> property is <code>50px 50px</code>.</figcaption>
</figure>
<p>If, as in <a href="#figure2">figure 2</a>, we change the background size so that it&#8217;s between 150 and 250 pixels wide &#8212; say, 120-by-120 pixels &#8212; our star gains a 10 pixel stroke width and a blue background.</p>
<figure id="figure2" class="image640"><img src="http://webinista.s3.amazonaws.com/images/uploads/2013/04/bluestars.png" alt="bluestars" width="620" height="330" class="aligncenter size-full wp-image-7286" /></p>
<figcaption>Figure 2: <a href="http://demos.tiffanybbrown.com/2013/media-queries-svg-background-size/star.svg">star.svg</a> when the value of the <var>background-size</var> property is <code>50px 50px</code>.</figcaption>
</figure>
<h2>Two elements, one image</h2>
<p>You may have noticed that in the examples above, I&#8217;m using images rather than iframes or some other element to create a live demo. Well that&#8217;s because I ran into an a quirk of using this technique when reusing an image. In Chrome, when you reuse an image, the computed dimensions of the SVG viewport will change when the element to which it&#8217;s attached comes in or out of the viewport. </p>
<p>That&#8217;s probably better <em>shown</em> than explained, so compare the background of the document in <a href="#figure3">figure 3</a>. Then scroll down a bit to see the document in <a href="#figure4">figure 4</a>.</p>
<figure id="figure3" class="image640"><iframe width="640" height="300" src="http://demos.tiffanybbrown.com.s3.amazonaws.com/2013/media-queries-svg-background-size/50px.html"></iframe></p>
<figcaption>Figure 3: <a href="http://demos.tiffanybbrown.com/2013/media-queries-svg-background-size/star.svg">star.svg</a> when the value of the <var>background-size</var> property is <code>175px 175px</code>.</figcaption>
</figure>
<p>As you may have noticed on your way to <a href="#figure4">figure 4</a>, the background in both framed documents is now blue instead of black in Chrome or a WebKit nightly build. Slowly scroll up and down a few times to see what I mean. Even though the documents are different, the browser requests the image once. As a result, a media query event in one instance will also trigger it in the other documents on the page. Other browsers do not support media queries when the SVG document is used as a background.</p>
<figure id="figure4" class="image640"><iframe width="640" height="300" src="http://demos.tiffanybbrown.com.s3.amazonaws.com/2013/media-queries-svg-background-size/175px.html"></iframe></p>
<figcaption>Figure 4: <a href="http://demos.tiffanybbrown.com/2013/media-queries-svg-background-size/star.svg">star.svg</a> when the value of the <var>background-size</var> property is <code>175px 175px</code>.</figcaption>
</figure>
<p>By the way, this is also true when you reuse an image within a document, at least in WebKit/Blink browsers. For <em>foreground</em> images, Presto-based Opera and Internet Explorer handle media queries and SVG viewports <a href="http://demos.tiffanybbrown.com/2013/media-queries-svg-background-size/withimgtag">as you&#8217;d expect</a>. Chrome, Safari, and Firefox instead apply the media query for the last instance of the image to all instances. </p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/04/20/media-queries-in-svg-and-background-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smoothing jagged edges on transformed objects in Firefox</title>
		<link>http://tiffanybbrown.com/2013/04/13/smoothing-jagged-edges-on-transformed-objects-in-firefox/</link>
		<comments>http://tiffanybbrown.com/2013/04/13/smoothing-jagged-edges-on-transformed-objects-in-firefox/#comments</comments>
		<pubDate>Sun, 14 Apr 2013 04:41:56 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[transforms]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=7258</guid>
		<description><![CDATA[Transformed elements in Firefox sometimes appear with jagged edges. The anti-aliasing isn&#8217;t as smooth as what you find in Webkit-based browsers or Internet Explorer (Figure 1). Figure 2. An image with transform: rotateX(-45deg);. View a larger version. The good news is that there&#8217;s an easy fix for this. It&#8217;s essentially the fix used to address [...]]]></description>
				<content:encoded><![CDATA[<p>Transformed elements in Firefox sometimes appear with jagged edges. The anti-aliasing isn&#8217;t as smooth as what you find in Webkit-based browsers or Internet Explorer (<a href="#figure1">Figure 1</a>).</p>
<figure id="figure1">
	<img src="http://webinista.s3.amazonaws.com/images/uploads/2013/04/jaggededges-samp.png" alt="A transformed image in Firefox." class="aligncenter size-medium wp-image-7260"></p>
<figcaption>Figure 2. An image with <code>transform: rotateX(-45deg);</code>. <a href="http://webinista.s3.amazonaws.com/images/uploads/2013/04/jaggededges.png">View</a> a larger version.</figcaption>
</figure>
<p>The good news is that there&#8217;s an easy fix for this. It&#8217;s essentially the fix used to address the <a href="http://tiffanybbrown.com/2012/10/12/striped-border-bug-in-opera-12-02/">striped border bug</a> in Opera 12.02. <b>Add <code>border: 1px solid transparent</code> to the object. The result looks more like what you see in <a href="figure2">Figure 2</a>.</p>
<figure id="figure2">
     <img src="http://webinista.s3.amazonaws.com/images/uploads/2013/04/nojaggededges-640x243.png" alt="A transformed image with smooth edges in Firefox." width="640" height="243" class="aligncenter size-medium wp-image-7259"></p>
<figcaption>Figure 2. An image with <code>transform: rotateX(-45deg);</code> and <code>border: 1px solid transparent</code></figcaption>
</figure>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/04/13/smoothing-jagged-edges-on-transformed-objects-in-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Career crossroads, culture and community</title>
		<link>http://tiffanybbrown.com/2013/03/15/career-crossroads-culture-and-community/</link>
		<comments>http://tiffanybbrown.com/2013/03/15/career-crossroads-culture-and-community/#comments</comments>
		<pubDate>Sat, 16 Mar 2013 06:48:25 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=7246</guid>
		<description><![CDATA[My stretch of funemployment has given me some time to consider the themes of culture and community, particularly as they relate to the world of technology. It&#8217;s safe to say that I&#8217;m at a career crossroads. I&#8217;m deciding whether to continue in tech or whether to pivot into another career entirely. What has brought things [...]]]></description>
				<content:encoded><![CDATA[<p>My stretch of funemployment has given me some time to consider the themes of culture and community, particularly as they relate to the world of technology. It&#8217;s safe to say that I&#8217;m at a career crossroads. I&#8217;m deciding whether to continue in tech or whether to pivot into another career entirely.</p>
<p>What has brought things to a head, I think, is the realization that the tech industry can be isolating &#8212; maddeningly isolating &#8212; for a black woman.</p>
<p>I&#8217;m tired of being The Only. </p>
<p>Developers are awfully fond of the word &#8220;community.&#8221;  The word comes up again and again when discussing programming languages. We speak of a JavaScript community, a PHP community, or just generally, a developer community. But communities have norms and boundaries, usually unspoken. It&#8217;s those unspoken boundaries that I want to talk about.</p>
<p>It&#8217;s not a secret that tech &#8212; and I&#8217;ll focus here on web developers and designers &#8212; is really white and really male. According to the A List Apart 2011 Survey (the latest year published), our industry is <a href="http://archive.aneventapart.com/alasurvey2011/00.html#eth">87.1% white</a> and <a href="http://archive.aneventapart.com/alasurvey2011/00.html#gen">81.6% male</a>. It&#8217;s also only 1.2% Black / African.<sup><a href="#n1-20130315">*</a></sup> Surveys have their biases, of course. But my experiences seem to prove this right. If there are 50 web developers in a room, there&#8217;s a <em>really</em> high likelihood that I will be the only woman <em>and</em> the only black person. <a href="http://en.wikipedia.org/wiki/Intersectionality">Intersectionality</a> is my career struggle. </p>
<p>People tend to befriend those who share their background, interests and outlook. I&#8217;m no exception. My friend circle is made up of hip-hop heads, sports fans, feminists, secularists, music addicts, art lovers, writers, cocktail enthusiasts, queer people and their allies, tomboys, and (oddly) librarians. Most of us are educated, sometimes highly. They also look more like me &#8212; tending towards women and people of color &#8212; than the attendees of your average technology gathering. </p>
<p>When I walk into a tech event, an interview, or any room full of strangers, I scan it for potential friends. People who match that pattern are the ones I feel most comfortable approaching. I even look and listen for signs: rainbow stickers on the laptop, Nike or Adidas high tops, or jokes that reference the music I listen to. When I don&#8217;t see people who match my pattern, I feel extremely out of place. </p>
<p>I think the same is true for most of us. And therein lies the problem, or my problem, anyway. Web developer communities often feel desperately homogeneous in terms of their culture.<sup><a href="#n2-20130315">**</a></sup> Peppering a talk with <em class="title movie">Star Wars</em> or punk music references is cool. But I&#8217;d feel more at home if there were more devs who could make Jay-Z jokes or catch my Drake references. I&#8217;m honestly not sure what to do about that. But I know it&#8217;s part of what keeps me from participating in these communities.</p>
<p>Why is this important? Because community connections and work relationships make or break careers. Indeed having a work friend actually <a href="http://scholarworks.umass.edu/cgi/viewcontent.cgi?article=1053&#038;context=gradconf_hospitality">increases your work satisfaction</a>. If you can&#8217;t make friends in your industry or at your work place, what is the likelihood that you&#8217;ll remain in either?</p>
<p>Culture and community aren&#8217;t exclusively web developer problems, of course. Librarian culture and its community, for example, is heavily gendered and skews female. Again, I don&#8217;t even pretend to know how to fix this. But I can say that for me, this developer culture is a big reason why I don&#8217;t feel like I am a part of its community. </p>
<p class="footnote" id="n1-20130315">* I have trouble with that label because &#8220;African&#8221; is not the same as &#8220;black.&#8221; Black as an identity really only exists in contrast to white and most Africans don&#8217;t have to work with that issue. Kind of like how &#8220;Hispanic/Latino&#8221; doesn&#8217;t exist outside of the United States.</p>
<p class="footnote" id="n2-20130315">**Yeah, I realize the limits of this sentence once we step outside of a U.S. context.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/03/15/career-crossroads-culture-and-community/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Math anxiety is real: on slaying my dragon and learning to love math*</title>
		<link>http://tiffanybbrown.com/2013/03/12/math-anxiety-is-real-on-slaying-my-dragon-and-learning-to-love-math/</link>
		<comments>http://tiffanybbrown.com/2013/03/12/math-anxiety-is-real-on-slaying-my-dragon-and-learning-to-love-math/#comments</comments>
		<pubDate>Tue, 12 Mar 2013 22:12:40 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=7222</guid>
		<description><![CDATA[While working on my article last year about the CSS Transforms Matrix, I had to re-visit some math that I hadn&#8217;t really touched since maybe 9th grade. In fact, I don&#8217;t actually remember learning it the first time. Amazingly, after a dedicated weekend of reading Wikipedia articles, I picked up enough to multiply matrices and [...]]]></description>
				<content:encoded><![CDATA[<p>While working on my article last year about the <a href="http://dev.opera.com/articles/view/understanding-the-css-transforms-matrix/">CSS Transforms Matrix</a>, I had to re-visit some math that I hadn&#8217;t really touched since maybe 9th grade. In fact, I don&#8217;t actually remember learning it the first time. Amazingly, after a dedicated weekend of reading Wikipedia articles, I picked up enough to multiply matrices and explain it to someone else.</p>
<p>Consider that my first lightbulb moment.</p>
<p>I&#8217;ve struggled with math since my days of long division, but not necessarily in the ways you might expect. I mean, my cousin taught me how to solve algebraic equations when I was 8. Typically, my #mathstruggle falls into one of two categories:</p>
<ol>
<li><b>Simple mistakes:</b> for example, forgetting to carry the 1, or using a &#8211; instead of a +</li>
<li><b>Procedural mistakes:</b> mis-remembering precisely how to solve a problem.</li>
</ol>
<p>I&#8217;ve made one or both of those mistakes so many times and in so many ways that eventually, my internal dialogue started to go like this: <q>Oh shit! Numbers. And not just numbers, but equations! Um okay. Seven times two is fourteen, and carry the one, and multiply 2 times 5 and add the one, then do that to the other side and OMG THE ANSWER IS A GINORMOUS FRACTION! THAT CAN&#8217;T BE RIGHT! <em>AND I&#8217;M SO STUPID AND WILL NEVER EVER GET MATH, LIKE EVER!</em></q> Sometimes this is capped by me sobbing and throwing my pencil.  </p>
<p>Getting so wound up served me well when it came to taking tests. I&#8217;d freak out about problem 3, spend 10 minutes getting cognitively overwhelmed by my anxiety, and another 10 trying to calm down enough to finish the test. As you might imagine, this did wonders for my math grades. And bad grades in math only reinforced my narrative about my ability to understand and do well at it.</p>
<p>Late last year, I read an article about the <a href="http://www.nytimes.com/2012/10/27/education/a-grueling-admissions-test-highlights-a-racial-divide.html?pagewanted=all">math successes of Asian-American students</a> in New York City&#8217;s schools. This quote is what stuck out for me.</p>
<blockquote cite=""><p>&#8220;Most of our parents don&#8217;t believe in &#8216;gifted,&#8217;&#8221; said Riyan Iqbal, 15, the son of Bangladeshi immigrants, as he and his friends &#8217; of Bengali, Korean and Indian descent &#8217; meandered toward the subway from the Bronx High School of Science one recent afternoon. &#8220;It&#8217;s all about hard work.&#8221;</p></blockquote>
<p>That&#8217;d be my second lightbulb moment.</p>
<p>I was always one of those &#8216;gifted&#8217; kids growing up, despite my struggle with math. I never really worked hard at any subject. I just figured I just wasn&#8217;t naturally good at math in the same way I was naturally good at remembering dates and understanding cause-and-effect as you do in history class. It honestly never occurred to me that if I paid attention, did my homework, and sought extra help when necessary &#8212; y&#8217;know <em>worked hard</em> &#8212; that my grades would improve. Plus I kind of didn&#8217;t care about grades.</p>
<p>Let&#8217;s go back to that article on CSS Transforms. While researching it, I learned that transform matrices &#8212; math! &#8212; were intimately tied to computer graphics. There are scale and rotation transformations, but even the <a href="http://en.wikipedia.org/wiki/Gaussian_blur">Gaussian blur</a> can be explained by a transformation matrix. I mean math and computing go together like <a href="http://en.wikipedia.org/wiki/Ackee_and_saltfish">ackee and saltfish</a> or gin and tonic.</p>
<p>Maybe that&#8217;s my third lightbulb moment. It&#8217;s certainly the one that sent me back to school. Yup. I am currently enrolled in an Introductory Algebra class at one of <a href="http://www.laccd.edu/">Los Angeles&#8217; community colleges</a>. Next up is Intermediate Algebra, followed by some introductory computer science classes. Whether I go all the way and get a second bachelor&#8217;s degree in computer science will depend greatly on how soon and what kind of employment I find. But this is the path I&#8217;m currently on.</p>
<p>What&#8217;s different is that I get it now. I still only sort of care about grades, but I see how math is cumulative. Basic skills are your foundation for advanced ones. Concepts compound each other. I see how it relates to my work. And I see my skills improving this time around because I took advice from a 15 year old named Riyan Iqbal and decided to work at it.</p>
<p class="footnote">* And by &#8220;love math,&#8221; I really mean &#8220;no longer weep and curl into a ball when I encounter math.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/03/12/math-anxiety-is-real-on-slaying-my-dragon-and-learning-to-love-math/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How every conversation about race ever on the internet goes</title>
		<link>http://tiffanybbrown.com/2013/02/25/how-every-conversation-about-race-ever-on-the-internet-goes/</link>
		<comments>http://tiffanybbrown.com/2013/02/25/how-every-conversation-about-race-ever-on-the-internet-goes/#comments</comments>
		<pubDate>Tue, 26 Feb 2013 05:20:33 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Pop culture]]></category>
		<category><![CDATA[Race, Gender, Class & Identity]]></category>
		<category><![CDATA[i can't with y'all]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=7145</guid>
		<description><![CDATA[Someone makes a comment or corny &#8220;joke&#8221; that is kinda racist and kinda classist, but mostly harmless.1 Someone else &#8212; sometimes in the group targeted, sometimes not &#8212; says &#8220;Hey THAT&#8217;S RACIST!&#8221; Someone else, usually not in the target group (read: &#8220;someone not black / Latino / Asian American / Native American, because those are [...]]]></description>
				<content:encoded><![CDATA[<p>Someone makes a comment or corny &#8220;joke&#8221; that is kinda racist and kinda classist, but mostly harmless.<sup><a href="#n1-20120225">1</a></sup></p>
<p><img src="http://webinista.s3.amazonaws.com/images/uploads/2013/02/thatsracist.gif" alt="kid yelling thats racist!" width="300" height="268" class="aligncenter size-full wp-image-7144" style="margin:auto;display:block;"></p>
<p>Someone else &#8212; sometimes in the group targeted, sometimes not &#8212; says &#8220;Hey THAT&#8217;S RACIST!&#8221; </p>
<p>Someone else, usually not in the target group (read: &#8220;someone not black / Latino / Asian American / Native American, because those are typically the groups of people this kind of thing involves&#8221;) says &#8220;Geez! You&#8217;re so sensitive. Can&#8217;t you take a joke?&#8221;</p>
<p>Somebody, often, but not necessarily of the target group (and again, by &#8220;target group,&#8221; I mean a <a href="http://en.wikipedia.org/wiki/Person_of_color">person of color</a> or POC), says &#8220;STOP DIMINISHING MY PAIN, YOU RACIST FUCKWIT.&#8221;</p>
<p>At <em>this</em> point, someone else, usually a POC jumps in (or is asked to weigh in) and says &#8220;Whatever. It&#8217;s not racist. I&#8217;m a POC, so I&#8217;m an official arbiter of this shit.&#8221; Sometimes this person will add &#8220;Or maybe it&#8217;s because I grew up in the suburbs, and therefore am not as <a href="http://www.youtube.com/watch?v=4KZJ75BMa-s">blackety-black</a> (or brownety-brown, etc.) as these <em>other</em> POC who have a problem with it.&#8221;<sup><a href="#n2-20120225">2</a></sup> And/or &#8220;I am used to white people&#8217;s shenanigans, and if I got mad every time I had to deal with white people shenanigans, I wouldn&#8217;t get shit else done.&#8221; The subtext is usually &#8220;GOSH OTHER POC/NON-POC ALLY STOP BEING SO SENSITIVE!&#8221; (Hint: look for the phrase &#8220;thick[er] skin.&#8221;)</p>
<p>This aforementioned POC co-signer may also ask &#8220;WHY ISN&#8217;T THIS <em>CLASSIST</em>? WHY ARE GHETTO PEOPLE&#8217;S WAYS CONSIDERED <em>ALL</em> OF OUR WAYS?&#8221; At this point, if you&#8217;re lucky, someone will <a href="http://en.wikipedia.org/wiki/Intersectionality">drop a link to the intersectionality wikipedia page</a> into the debate and point out that:</p>
<ul>
<li>it&#8217;s racist, but deeply shaped by class;</li>
<li>can&#8217;t exactly be separated from class (&#8220;It&#8217;s 52.8% racist and 47.2% classist!&#8221;);</li>
<li>and classism isn&#8217;t a distinction most of the observers of this discussion are going to make.</li>
</ul>
<p>But usually ends is with pleas for &#8220;reason,&#8221; &#8220;sanity.&#8221; And people get nowhere because they&#8217;re too busy arguing whether one side&#8217;s right to make a kinda racist, kinda classist, but mostly <a href="https://github.com/aFarkas/html5shiv/issues/91">just a really shitty, corny, supremely groan worthy, lame-ass attempt at a joke</a> supercedes the other side&#8217;s right to at least demand that if you&#8217;re going to appropriate a slang term popularized by the predominantly black (and Afro-Latino) art form known as hip-hop and try to make a joke that explicitly links it to prison culture, then perhaps you should work on improving your comedy writing skills. <sup><a href="#n3-20120225">3</a></sup>  </p>
<p id="n1-20120225" class="footnote"><sup>1</sup> And by &#8220;mostly harmless,&#8221; I mean &#8220;doesn&#8217;t deprive anyone of life, liberty, health, or employment.&#8221;</p>
<p id="n2-20120225" class="footnote"><sup>2</sup> Yeah, I <a href="https://twitter.com/bemjb/status/305728519302950913">am probably projecting</a> based on previous experiences with such black folks. Actually, this entire post could fairly be called a cheap shot. But for what it&#8217;s worth, I am also <a href="http://en.wikipedia.org/wiki/Hempstead,_New_York">from the suburbs</a>, but not the kind where &#8220;grew up in the suburbs&#8221; is code for &#8220;grew up around white people.&#8221; How&#8217;s <em>that</em> for confounding your race-and-class expectations? (<del datetime="2013-02-27T19:56:07+00:00">And why do people try to make this a class / geographic thing? when</del><ins datetime="2013-02-27T19:56:07+00:00">By the way, his comment, as </ins> any bourgeois Negro knows is <del datetime="2013-02-27T19:56:07+00:00">an example</del><ins datetime="2013-02-27T19:56:07+00:00">a prime example</ins> of <a href="http://en.wikipedia.org/wiki/Post-Blackness">post-blackness</a>.)</p>
<p class="footnote" id="n3-20120225"><sup>3</sup> Now, I didn&#8217;t bother reading past like the third post in that thread because I know how to spot a hot ass Internet mess at 20 paces. I knew whatever I said, no matter how carefully I said it, would be picked apart and contorted, if not dismissed outright, and odds were high I&#8217;d also get called a &#8220;reverse racist&#8221; in the process.</p>
<p class="footnote">That said, I noticed the original &#8220;shiv&#8221;/&#8221;homie&#8221; comment back in like 2008? 2009, maybe? It rankled me then for the reasons I explained above. I chose to ignore it, however. I knew from my decade of prior experience trying to serve &#8220;Diversity 101&#8243; lessons up to college chums and internet assholes that it would turn into a shit storm. And who wants to be at the eye of an industry shit storm? So instead, I chose to roll my eyes and crack jokes to myself and others about the diversity of the developer team&#8217;s friend circle(s). We may also have pondered whether there&#8217;s a relationship between failed jokes like this and the relative dearth of black American and Hispanic web developers in the industry. </p>
<p class="footnote">By the way, you can replace POC with &#8220;woman&#8221; and racism/classism with &#8220;sexism&#8221; and this is pretty much how conversations about gender go too.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/02/25/how-every-conversation-about-race-ever-on-the-internet-goes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why doesn&#8217;t my scale3d() / scaleZ() transform work?</title>
		<link>http://tiffanybbrown.com/2013/02/24/why-doesnt-my-scale3d-scalez-transform-work/</link>
		<comments>http://tiffanybbrown.com/2013/02/24/why-doesnt-my-scale3d-scalez-transform-work/#comments</comments>
		<pubDate>Mon, 25 Feb 2013 02:13:55 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[3D transforms]]></category>
		<category><![CDATA[css transforms]]></category>
		<category><![CDATA[css3]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=7065</guid>
		<description><![CDATA[One of the trickier parts of 3D transforms is understanding how the scaleZ() and scale3d() functions work. When applied to an element, they will often appear to have no effect. But then at other times, or in other combinations, they will. Confusing right? So what&#8217;s going on? Well, it has to do with transformation matrices, [...]]]></description>
				<content:encoded><![CDATA[<p>One of the trickier parts of 3D transforms is understanding how the <code>scaleZ()</code> and <code>scale3d()</code> functions work. When applied to an element, they will often appear to have no effect. But then at other times, or in other combinations, they will. Confusing right?</p>
<p>So what&#8217;s going on? Well, it has to do with transformation matrices, these bits of mathematical goodness that allow us to change where points are plotted within a coordinate system &#8212; in this case, your document viewport. </p>
<p>In May of 2013, I wrote an article for Dev.Opera about <a href="http://dev.opera.com/articles/view/understanding-the-css-transforms-matrix/">transform matrices</a>. If you haven&#8217;t read it yet, please do. It lays the groundwork for what I&#8217;m about to discuss here.</p>
<h2>Coordinate systems</h2>
<p>If you&#8217;ve ever taken algebra or geometry, you&#8217;ve probably learned about coordinate systems. You probably remember that the x-axis is horizontal, the y-axis is vertical, and the z-axis is perpendicular to them both.</p>
<p>If we move the coordinate system to our document viewport, our x axis goes from left-to-right on screen and the y axis goes from the top to the bottom. The z-axis sits perpendicular to the screen and viewer, but the screen itself is the 0 point of the z axis. Hold on to that point. We&#8217;ll come back to it.</p>
<h2>Coordinate vectors and matrix multiplication</h2>
<p>Let&#8217;s imagine that you have an object whose top left corner sits 100 pixels from the left edge of the document viewport, and 200 pixels from its top. This means its coordinates are (100,200,0) in a three dimensional system. It exists on the same plane as the screen, which as mentioned above, has a z-coordinate of zero.</p>
<p>Now let&#8217;s say we wanted to scale our object along the z axis by a factor of three &#8212; either <code>scale3d(1,1,3)</code> or <code>scaleZ(3)</code>. That, by the way, is equivalent to <code>matrix3d(1,0,0,0,0,1,0,0,0,0,3,0,0,0,0,1);</code>. We need to multiply our coordinate vector by our matrix as show in <a href="#figure1">figure 1</a>. </p>
<figure id="figure1">
<pre>[1 0 0 0]   [100]    [100]
[0 1 0 0] &#8226; [200] =  [200] 
[0 0 3 0]   [  0]    [  0]  
[0 0 0 1]   [  1]    [  1]
</pre>
<figcaption>Figure 1: Multiplying a 3d scaling matrix by a coordinate vector.</figcaption>
</figure>
<p>Notice anything weird about the product? It looks just like our coordinate vector. Because our z-coordinate value hasn&#8217;t changed, our transform doesn&#8217;t appear to be rendered on screen.</p>
<p>In other words, <strong>in order for a scaling transform along the z-axis to work, the matrix product of the transform must result in a z coordinate with a non-zero value.</strong> </p>
<p>Let&#8217;s run the math on an example using <code>transform: rotateY(20deg) scale3d(1,1,10)</code>. First we need to multiply our rotation matrix by our scaling matrix, as shown in <a href="#figure2">figure 2</a>.</p>
<figure id="figure2">
<pre>[1 0  0 0]   [ 0.9397 0 -0.3420 0]   [0.9397 0 -0.3420 0]
[0 1  0 0] &#8226; [ 0      1  0      0] = [0      1  0      0]
[0 0 10 0]   [-0.3420 0  0.9397 0]   [3.420  0  9.397  0]
[0 0  0 1]   [ 0      0  0      1]   [0      0  0      1]</pre>
<figcaption>Figure 2: Multiplying a 3d scaling matrix transform by a rotation along the Y axis.</figcaption>
</figure>
<p>This gives us a compound transform that we can then multiply by our coordinate vector from above ([100,200,0,1]) as we&#8217;ve done in <a href="#figure3">figure 3</a>.</p>
<figure id="figure3">
<pre>
[0.9397 0 -0.3420 0]     [100]   [ 94]
[0      1  0      0]  &#8226;  [200] = [200]
[3.420  0  9.397  0]     [  0]   [ 34]
[0      0  0      1]     [  1]   [  1]</pre>
<figcaption>Figure 3: Multiplying the matrix for a three-dimensional rotation and scaling transform by a coordinate vector.</figcaption>
</figure>
<p>Our product, [94,200,34,1] translates to a three dimensional coordinates of (94,200,34), and boom, our transform works as expected.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/02/24/why-doesnt-my-scale3d-scalez-transform-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A look at the Page Visibility API</title>
		<link>http://tiffanybbrown.com/2013/02/04/page-visibility-api-tutorial/</link>
		<comments>http://tiffanybbrown.com/2013/02/04/page-visibility-api-tutorial/#comments</comments>
		<pubDate>Mon, 04 Feb 2013 14:00:50 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[DOM]]></category>
		<category><![CDATA[JavaScript/ECMAScript]]></category>
		<category><![CDATA[Web Development & Programming]]></category>
		<category><![CDATA[Web standards]]></category>
		<category><![CDATA[mozHidden]]></category>
		<category><![CDATA[mozVisibilityState]]></category>
		<category><![CDATA[page visibility api]]></category>
		<category><![CDATA[visibilityState]]></category>
		<category><![CDATA[webkitHidden]]></category>
		<category><![CDATA[webkitVisibilityState]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=6984</guid>
		<description><![CDATA[You&#8217;re sitting in your office with your speakers un-muted. Maybe you&#8217;re making plans for dinner, and decide to check out the web site of that hot new restaurant in the North Trendy neighborhood. Of course, you&#8217;re not supposed to be making dinner plans while on the clock. So when Busybody McNosypants stops by your cube, [...]]]></description>
				<content:encoded><![CDATA[<p>You&#8217;re sitting in your office with your speakers un-muted. Maybe you&#8217;re making plans for dinner, and decide to check out the web site of that hot new restaurant in the North Trendy neighborhood. Of course, you&#8217;re not supposed to be making dinner plans while on the clock. So when Busybody McNosypants stops by your cube, you quickly tab to your company&#8217;s intranet application.    </p>
<p>Cue loud, auto-playing music. And a case of embarrassment for you.    </p>
<p>Multimedia and resource-intensive animations are precisely the kinds of things the<br />
<a href="http://www.w3.org/TR/2011/WD-page-visibility-20110602/">Page Visibility API</a> is designed to help manage. The specification is still a working draft, but is at least partially supported in all major browsers.    </p>
<p>Browsers that support this API fire a <code>visibilitychange</code> event (prefixed in some browsers) whenever the browsing context &#8212 a browser tab or window &#8212; of a document gains and/or loses visibility.    </p>
<p>What causes a document to gain or lose visibility? Weeeeell, that depends on the browser. Safari doesn&#8217;t yet support the Page Visibility API. In Opera 12.10 and Chrome (14.0+), a <code>visibilitychange</code> event gets dispatched whenever the user switches tabs. Firefox (10.0+) and Internet Explorer (10+) do the same.  However, IE and Firefox also fire a <code>visibilitychange</code> event when the window is minimized. </p>
<p>In my experiments, Firefox 19+ (I haven&#8217;t tested earlier versions) also fires a <code>visibilitychange</code> event when the document loads or unloads.  In both cases, the values of <code>document.visibilityState</code> and <code>document.hidden</code> were <code>hidden</code> and <code>true</code>, respectively. Inline frames also inherit the visibility of their containing document&#8217;s browsing context.   </p>
<p>Of course, the Page Visibility API does have its limits. Browsers do not fire an event if the user opens a new window that covers the first. Similarly, this API can&#8217;t tell you whether or not the browser window is the active window. If you switch applications, your document code will be executed as though the browser window was at the fore.     </p>
<p>So now that I&#8217;ve burst your bubble and thrown a dozen caveats at your head, let&#8217;s look at the API.    </p>
<h3>About the API</h3>
<p>As far as DOM APIs go, the Page Visibility API is one of the more straightforward ones to use. It consists of two properties and an event.    </p>
<ul>
<li><code>document.visibilityState</code>: Its value may be <code>visible</code> or  <code>hidden</code>.</li>
<li><code>document.hidden</code>: A boolean property, whose value may be <code>true</code> or <code>false</code></li>
<li><code>visibilitychange</code>: An event that can be listened for.</li>
</ul>
<p>Two more properties, <code>prerender</code> and <code>unloaded</code>, are defined in the editor&#8217;s draft of the specification. However, not all browsers support these properties.    </p>
<p>To use, you&#8217;ll need to set an event listener on the <code>document</code> object, and define an event handler. You can then query the <code>document.hidden</code> or <code>document.visibilityState</code> properties to determine the state of the document.    </p>
<pre><code>var vischangehandler = function(){
    // Check the document.hidden or document.visibilityState property
    if( document.hidden === true ){
    	// Stop the animation. Pause the video. Mute the audio.
    } else {
    	// Start or resume the animation, video, etc.
    }    
}
document.addEventListener('visibilitychange', vischangehandler, false);</code></pre>
<p>Keep in mind that in the latest versions of Chrome and Internet Explorer, and older versions of Firefox, these properties and the <code>visibilitychange</code> are still prefixed. A table of prefixed properties and events follows.</p>
<table>
<thead>
<tr>
<td></td>
<th>visibilityState</th>
<th>hidden</th>
<th>event</th>
</tr>
</thead>
<tbody>
<tr>
<th>Chrome</th>
<td>webkitVisibilityState</td>
<td>webkitHidden</td>
<td>webkitvisibilitychange</td>
</tr>
<tr>
<th>Firefox</th>
<td>mozVisibilityState</td>
<td>mozHidden</td>
<td>mozvisibilitychange</td>
</tr>
<tr>
<th>Internet Explorer</th>
<td>msVisibilityState</td>
<td>msHidden</td>
<td>msvisibilitychange</td>
</tr>
</tbody>
</table>
<h3>Testing for support</h3>
<p>Of course, in order to use the Page Visibility API, you need to test whether or not the browser supports it. A simple <code>document.visibilityState === undefined</code> check works, but it doesn&#8217;t check for prefixed versions. We might also want to abstract away some of the prefix business. One way to do this is shown below.</p>
<pre><code>(function(){

   function define_property(obj, propertyname, func){
      if( Object.defineProperty ){
         Object.defineProperty( obj, propertyname, { get: func });
      } else {
         obj.__defineGetter__(propertyname, func);
      }
   }

   if( document.visibilityState === undefined ){
      define_property( HTMLDocument.prototype, 'visibilityState', function(){
         var o;
         for(o in document){
            if( (/VisibilityState/).test(o) ){
               return document[o];
            }
         }
      });	

      ['moz','webkit'].map(function(p){	
         var visibilitychange = p+'visibilitychange';  	

         document.addEventListener( visibilitychange, function(e){
            if( e.type !== 'visibilitychange' ){
               var vischange = document.createEvent('Event');
               vischange.initEvent('visibilitychange', e.bubbles, e.cancelable );
               document.dispatchEvent( vischange );
            }
         }, false); 		
      });
   }

   if( document.hidden === undefined ){	
      define_property( HTMLDocument.prototype, 'hidden', function(){
         var o;
         for(o in document){
            if( (/Hidden/).test(o) ){
               return document[o];
            }
         }
      });	
   }
})();</code></pre>
<p>I&#8217;ve also <a href="https://gist.github.com/4652815">published</a> this as a Gist.</p>
<h3>A working example: CSS Animations</h3>
<p>    Let&#8217;s look at a working example of the Page Visibility API using CSS Animations. In this example, we will rotate three divs along the y-axis. When our page isn&#8217;t visible, we will pause the animation (it&#8217;s a very simple one) and log the status in the console. First our CSS. Note here that:</p>
<ol class="loweralpha">
<li>I am only including the animation-related CSS.</li>
<li>I am not using prefixed properties.</li>
</ol>
<p>Some browsers still require prefixed properties in order for this animation to work.    </p>
<pre><code>@keyframes rotatey {
    from {
        transform: rotateY(1deg);
    }

    to {
        transform: rotateY(360deg);
    }		
}
#stage{
    perspective: 500px;
}
.facet{
    animation-duration: 10s;
    animation-iteration-count: infinite;
}
.rotatey .facet{
    animation-name: rotatey;
}</pre>
<p></code></p>
<p>Now in our event handler, we will just toggle the <code>rotatey</code> class (using <code>classList</code>). Again, here I am using un-prefixed properties and events.    </p>
<pre><code>var vchandler = function(e){
    var stage = document.getElementById('stage');
    
    if( document.hidden === false ){
        stage.classList.add('rotatey');
        console.log('Tab is visible');
    } else {
        stage.classList.remove('rotatey');
        console.log('Tab is not visible');
    }
}
	
// Here we're going to start the animation upon page load.
window.addEventListener('DOMContentLoaded', vchandler,false);
document.addEventListener('visibilitychange', vchandler,false);</code></pre>
<p><a href="http://demos.tiffanybbrown.com/2013/pagevisibility/stopanimations/index.html">View it</a> in action. </p>
<p>Setting and clearing timeouts using <code>setTimeout()</code> and <code>clearTimeout()</code> or starting and stopping animations with <code>requestAnimationFrame()</code> and <code>clearAnimationFrame()</code> work similarly.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/02/04/page-visibility-api-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Adding custom galleries to your theme</title>
		<link>http://tiffanybbrown.com/2013/02/03/wordpress-adding-custom-galleries-to-your-theme/</link>
		<comments>http://tiffanybbrown.com/2013/02/03/wordpress-adding-custom-galleries-to-your-theme/#comments</comments>
		<pubDate>Mon, 04 Feb 2013 07:51:23 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=7040</guid>
		<description><![CDATA[WordPress has a gallery feature that allows you to include a set of images with your posts. The syntax is simple, using what&#8217;s known as a shortcode. WordPress has an entire API devoted to shortcodes. In WordPress 3.5, it&#8217;s possible to add a gallery using the gallery short code, and a comma-separated list of image [...]]]></description>
				<content:encoded><![CDATA[<p>WordPress has a <a href="http://codex.wordpress.org/Gallery_Shortcode">gallery feature</a> that allows you to include a set of images with your posts. The syntax is simple, using what&#8217;s known as a <a href="http://codex.wordpress.org/Shortcode_API">shortcode</a>. WordPress has an entire API devoted to shortcodes. </p>
<p>In WordPress 3.5, it&#8217;s possible to add a gallery using the gallery short code, and a comma-separated list of image identifiers. For example:</p>
<pre><code>&#91;gallery ids="729,732,731,720"&#93;</code></pre>
<p>This short code is parsed by the <code>gallery_shortcode</code> function, found in <code>wp-includes/functions.php</code>. <code>gallery_shortcode</code> returns markup and some rogue CSS. When building a theme, however, you may want to force some constraints on the gallery. Or you may wish to change its markup to get rid of that CSS. All of these changes should be made in your theme&#8217;s <code>functions.php</code> file, and you&#8217;ll need to know PHP.</p>
<p>If you want to <em>customize</em> the function, first you&#8217;ll need to remove the existing short code hook using <code>remove_shortcode('gallery', 'gallery_shortcode')</code>. Next, you&#8217;ll need to add a new hook using <code>add_shortcode('gallery', NEW_GALLERY_FUNCTION);</code> Where <code>NEW_GALLERY_FUNCTION</code> is the name of your replacement function. Then you can copy the <code>gallery_shortcode</code> from <code>wp-includes/functions.php</code>, and make whatever adjustments you&#8217;d like. What follows is a quick-and-dirty example from a real-life project (emphasis on <em>dirty</em>) that is more or less a duplicate of <code>gallery_shortcode</code>.</p>
<pre><code>remove_shortcode('gallery', 'gallery_shortcode');
add_shortcode('gallery', 'custom_gallery');

function custom_gallery($attr) {
	$post = get_post();

	static $instance = 0;
	$instance++;

	# hard-coding these values so that they can't be broken
	
	$attr['columns'] = 1;
	$attr['size'] = 'full';
	$attr['link'] = 'none';

	$attr['orderby'] = 'post__in';
	$attr['include'] = $attr['ids'];		

	#Allow plugins/themes to override the default gallery template.
	$output = apply_filters('post_gallery', '', $attr);
	
	if ( $output != '' )
		return $output;

	# We're trusting author input, so let's at least make sure it looks like a valid orderby statement
	if ( isset( $attr['orderby'] ) ) {
		$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
		if ( !$attr['orderby'] )
			unset( $attr['orderby'] );
	}

	extract(shortcode_atts(array(
		'order'      =&gt; 'ASC',
		'orderby'    =&gt; 'menu_order ID',
		'id'         =&gt; $post-&gt;ID,
		'itemtag'    =&gt; 'div',
		'icontag'    =&gt; 'div',
		'captiontag' =&gt; 'p',
		'columns'    =&gt; 1,
		'size'       =&gt; 'thumbnail',
		'include'    =&gt; '',
		'exclude'    =&gt; ''
	), $attr));

	$id = intval($id);
	if ( 'RAND' == $order )
		$orderby = 'none';

	if ( !empty($include) ) {
		$_attachments = get_posts( array('include' =&gt; $include, 'post_status' =&gt; 'inherit', 'post_type' =&gt; 'attachment', 'post_mime_type' =&gt; 'image', 'order' =&gt; $order, 'orderby' =&gt; $orderby) );

		$attachments = array();
		foreach ( $_attachments as $key =&gt; $val ) {
			$attachments[$val-&gt;ID] = $_attachments[$key];
		}
	} elseif ( !empty($exclude) ) {
		$attachments = get_children( array('post_parent' =&gt; $id, 'exclude' =&gt; $exclude, 'post_status' =&gt; 'inherit', 'post_type' =&gt; 'attachment', 'post_mime_type' =&gt; 'image', 'order' =&gt; $order, 'orderby' =&gt; $orderby) );
	} else {
		$attachments = get_children( array('post_parent' =&gt; $id, 'post_status' =&gt; 'inherit', 'post_type' =&gt; 'attachment', 'post_mime_type' =&gt; 'image', 'order' =&gt; $order, 'orderby' =&gt; $orderby) );
	}

	if ( empty($attachments) )
		return '';

	$gallery_style = $gallery_div = '';

	if ( apply_filters( 'use_default_gallery_style', true ) )
		$gallery_style = "&lt;!-- see gallery_shortcode() in functions.php --&gt;";
	
	$gallery_div = "&lt;div id='homepage-gallery-wrap' class='gallery gallery-columns-1 gallery-size-full'&gt;";
	
	$output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
	
	foreach ( $attachments as $id =&gt; $attachment ) {
		$link = wp_get_attachment_link($id, 'full', true, false);

		$output .= "&lt;div class='homepage-gallery-item'&gt;";
		$output .= "
			&lt;div class='homepage-gallery-icon'&gt;
				$link
			&lt;/div&gt;";
		if ( $captiontag &#038;&#038; trim($attachment-&gt;post_excerpt) ) {
			$output .= "
				&lt;p class='wp-caption-text homepage-gallery-caption'&gt;
				" . wptexturize($attachment-&gt;post_excerpt) . "
				&lt;/p&gt;";
		}
		$output .= "&lt;/div&gt;";
	}

	$output .= "&lt;/div&gt;\n";

	return $output;
}</code></pre>
<p>You could also <em>add</em> another type of gallery rather than override the existing function. To do that, simply use <code>add_shortcode(NEW_SHORTCODE, NEW_GALLERY_FUNCTION);</code>, where <code>NEW_SHORTCODE</code> is the short code you wish to use, say <code>[full_screen_gallery]</code> and <code>NEW_GALLERY_FUNCTION</code> is the name of your new function.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/02/03/wordpress-adding-custom-galleries-to-your-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>January 2013: So that happened. Of course it did.</title>
		<link>http://tiffanybbrown.com/2013/02/01/january-2013-so-that-happened/</link>
		<comments>http://tiffanybbrown.com/2013/02/01/january-2013-so-that-happened/#comments</comments>
		<pubDate>Fri, 01 Feb 2013 22:00:33 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[funemployment]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=6918</guid>
		<description><![CDATA[If my life was a movie, this would be the part where my divorce settlement gets finalized and I move to India or the south of France, open a B&#38;B or bistro, and find myself along with a sessy hot new lover and some revenge peace. Instead it&#8217;s the part where I keep my husband [...]]]></description>
				<content:encoded><![CDATA[<p>If my life was a movie, this would be the part where my divorce settlement gets finalized and I move to India or the south of France, open a B&amp;B or bistro, and find myself along with a sessy hot new lover and some revenge peace.</p>
<p>Instead it&#8217;s the part where I keep my <a href="http://misterjt.com/">husband</a> (dude, he&#8217;s awesome) and sit around laughing at it all because &#8230; <em>REALLY</em>?</p>
<p>I guess it started just before New Year&#8217;s Eve with a call from my mother. My father &#8212; who had been battling a few forms of cancer since 2012 &#8212; was in the hospital. According to Mom and what she said the doctors told her, this was a temporary, but not life-threatening set back. Some intravenous fluids, time, rehab, and continued chemo and he&#8217;d be as fine as any other person battling cancer. I didn&#8217;t entirely buy this. So I booked a plane ticket. I wanted to see for myself, and if he was coming back home soon, I wanted to help him get better. My plan was to take a red eye January 7th and arrive January 8th. </p>
<p>My father died January 5th.</p>
<p>I flew to North Carolina anyway to help make funeral arrangements. My mother wanted to have the funeral on a weekend to allow the broadest range of people to make it and my dad was a veteran, making him eligible for a free burial at a federal cemetery. That meant the funeral would be Saturday, January 12th. The burial would be Tuesday, January 15th.  </p>
<p>On the morning of January 16th, I received word that I would be out of a job as of January 31.</p>
<p>Yes. <strong>In the span of 11 days, I lost a parent and a job.</strong> Of course. Because when life hands you shit, it likes to pile it on.</p>
<p>My manager was apologetic about the timing. I sort of tuned out and only heard bits and pieces of his explanation. I actually had to stifle a chuckle by the end of the conversation. It was all darkly comedic. </p>
<p>I can&#8217;t even say either event was unexpected. I just didn&#8217;t think they&#8217;d come so soon into 2013, let alone back to back.</p>
<p>What&#8217;s next? Eh, I&#8217;m not sure yet. I&#8217;ve toyed with the idea of joining the L.A. slash-er lifestyle: freelance web developer (slash) jewelry designer (slash) visual artist (slash) technical writer (slash) bon vivant. For <em>years</em>, I&#8217;ve dreamed about having a flexible life: one where I not only earn enough to live well, but one where I <em>have enough time</em> to live well. I have severance. I have savings. And I have an employed husband, so this seems <em>possible</em> in a way it never was before. </p>
<p>That said, hustling for business is tough. Plus there are areas of technology in which I&#8217;d like to deepen my experience. There are problems I&#8217;d like the chance to solve. So I am also not opposed to the right full-time opportunity.</p>
<p>In the immediate short-term, however, I plan to enjoy some (f)unemployment. I&#8217;ll explore LA some more. I&#8217;ll deep-dive into some APIs and frameworks I&#8217;ve ignored, and re-engage with my hobbies. January 2013 has been a particularly bad January. I kind of relish having this time to recharge and reset.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/02/01/january-2013-so-that-happened/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebKit is not a cure-all</title>
		<link>http://tiffanybbrown.com/2013/02/01/webkit-is-not-a-cure-all/</link>
		<comments>http://tiffanybbrown.com/2013/02/01/webkit-is-not-a-cure-all/#comments</comments>
		<pubDate>Fri, 01 Feb 2013 13:00:19 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=6994</guid>
		<description><![CDATA[Let me say this up front: I don&#8217;t know what Opera has up its sleeve. I&#8217;m sure you&#8217;ve heard some things. But it&#8217;s not hard to find people who think everyone &#8212; meaning Opera, Microsoft, and Mozilla &#8212; should switch to WebKit. In WebKitopia, the thinking goes, we&#8217;d have One True Browser Core that magically [...]]]></description>
				<content:encoded><![CDATA[<p>Let me say this up front: I don&#8217;t know what Opera has up its sleeve. I&#8217;m sure you&#8217;ve heard <a href="http://www.pocket-lint.com/news/49375/opera-ice-new-webkit-browser">some things</a>. But it&#8217;s not hard to find people who think everyone &#8212; meaning Opera, <a href="http://www.billreiss.com/its-time-for-microsoft-to-switch-to-webkit-for-ie/">Microsoft</a>, and <a href="http://support.mozilla.org/en-US/questions/682532">Mozilla</a> &#8212; should switch to WebKit. In WebKitopia, the thinking goes, we&#8217;d have One True Browser Core that magically banished incompatibilities forever.</p>
<p>Except it wouldn&#8217;t. Business competitiveness and user fragmentation would ensure as much.</p>
<p>As Peter-Paul Koch explained back in 2009, <q><a href="http://www.quirksmode.org/blog/archives/2009/10/there_is_no_web.html">There is no WebKit on Mobile</a>.</q> There&#8217;s not really a WebKit on desktop either. On desktop, there&#8217;s Apple&#8217;s <a href="https://www.apple.com/safari/">Safari</a>, which uses WebKit&#8217;s JavaScriptCore, and Google&#8217;s <a href="http://www.chromium.org/">Chromium / Chrome</a> which uses <a href="https://code.google.com/p/v8/">V8</a>. Google <a href="https://developers.google.com/v8/design">developed V8 for speed</a>. If Opera was so inclined &#8212; and I can&#8217;t emphasize enough that this is  <em><strong>a hypothetical scenario</strong></em> &#8212; they could release a version of WebKit&#8217;s rendering core with <a href="http://my.opera.com/ODIN/blog/carakan-faq">Carakan</a> as the JavaScript engine. </p>
<p>WebKit, as a project, <a href="http://trac.webkit.org/wiki/WebKit%20Team">is dominated</a> by employees of Apple and Google. Those companies can easily prevent a feature from gaining traction. A feature could, for example, <a href="https://bugs.webkit.org/show_bug.cgi?id=86146">land in core</a>, but <a href="http://caniuse.com/#feat=css-featurequeries">take some time</a> to be released in a product. Or a feature can be committed to Safari, Chromium, or some other fork without making it back into WebKit core at all. (This is probably a good time to mention that Chromium <a href="http://dev.chromium.org/developers/contributing-to-webkit">says</a> it <q cite="http://dev.chromium.org/developers/contributing-to-webkit">prefer[s] to contribute as much code as possible upstream to improve all WebKit-based browsers.</q>) </p>
<p>And this is before we discuss mobile device implementations. Android WebKit (which is essentially dead, but still lives on in <a hre="http://developer.android.com/about/dashboards/index.html">older Android devices</a>) is different from iOS Safari, which is different from Chrome for Android, which is different from <a href="https://developer.blackberry.com/html5/">BlackBerry&#8217;s WebKit</a>, and <a href="https://labs.ericsson.com/blog/bowser-the-world-s-first-webrtc-enabled-mobile-browser">Ericsson&#8217;s experimental Bowser</a>.</p>
<p>If this sounds at all like <strong>fragmentation,</strong> it should. That&#8217;s exactly what it is. WebKit is not a cure-all for what ails us.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/02/01/webkit-is-not-a-cure-all/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>@supports API lands in Firefox Nightlies</title>
		<link>http://tiffanybbrown.com/2013/01/17/supports-api-lands-in-firefox-nightlies/</link>
		<comments>http://tiffanybbrown.com/2013/01/17/supports-api-lands-in-firefox-nightlies/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 04:15:38 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[JavaScript/ECMAScript]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[WebKit]]></category>
		<category><![CDATA[@supports]]></category>
		<category><![CDATA[css api]]></category>
		<category><![CDATA[feature testing]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=6925</guid>
		<description><![CDATA[This is old(ish) news to those of you who have been paying attention: support for the @supports API &#8212; CSS.supports() &#8212; landed in Firefox late last month. So far, a complete implementation is only available in Firefox Nightly builds. It should show up in a Firefox release sometime soon. Opera included full support for @supports [...]]]></description>
				<content:encoded><![CDATA[<p>This is old(ish) news to those of you who have been paying attention: support for the <a href="http://dev.w3.org/csswg/css3-conditional/"><code>@supports</code> API</a> &#8212; <code>CSS.supports()</code> &#8212; <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=779917">landed in Firefox</a> late last month. So far, a complete implementation is only available in <a href="http://nightly.mozilla.org/">Firefox Nightly builds</a>. It should show up in a Firefox release sometime soon. </p>
<p>Opera included full support for <code>@supports</code> and its JavaScript API (with the older <code>window.supportsCSS()</code> syntax instead of <code>CSS.supports()</code>) in its <a href="http://dev.opera.com/articles/view/native-css-feature-detection-via-the-supports-rule/">12.10 release</a>.</p>
<p>Firefox has supported the CSS portion of <code>@supports</code> for awhile. However, now in Firefox you can test whether a particular CSS feature is supported using the <code>CSS.supports()</code> API. For example, you may want to include a JavaScript animation library if CSS3 animations aren&#8217;t supported.  </p>
<pre><code>if( CSS.supports('animation-name', 'none' ) ){
    var js = document.createElement('script');
    js.src = 'animation-script.js';
    document.head.appendChild(js);
}</code></pre>
<p>Note that <code>CSS.supports()</code> returns <code>true</code> if the property is <q>a literal match for the name of a CSS property that the <abbr title="user agent">UA</abbr> supports</q> <em>and</em> the value provided <q>would be successfully parsed as a supported value for that property</q>. This means <code>CSS.supports('background','none')</code> is <code>true</code>, but <code>CSS.supports('background','pixies')</code> is <code>false</code>.</p>
<p><ins datetime="2013-01-18T21:49:47+00:00">In Opera, the syntax is slightly different. You need to use <code>window.supportsCSS('animation-name','none')</code> instead. In your development process, you may want to abstract away the <a href="https://github.com/webinista/supportsatsupports/blob/master/atsupports.js">syntactical differences</a>, since <code>CSS.supports()</code> will become the final syntax.</ins></p>
<p><del datetime="2013-01-18T21:47:33+00:00">That said, implementations between Opera and Firefox (Aurora) differ slightly for reasons I need to investigate. For example, <code>CSS.supports('animation-name')</code> currently evaluates to <code>true</code> in Opera 12.1x and <code>false</code> in Firefox. Yet <code>CSS.supports('animation-name',null)</code> evaluates to  <code>true</code> in both (as does <code>CSS.supports('animation-name', 'none')</code> since &#8216;none&#8217; is a valid value).</del></p>
<p>Webkit support for <code>@supports</code> <a href="https://bugs.webkit.org/show_bug.cgi?id=86146">is complete</a>. So far, it is only available in builds that have the <a href="http://trac.webkit.org/wiki/FeatureFlags"><code>CSS3_CONDITIONAL_RULES</code> flag enabled</a>. As of January 17, this does not include the <a href="http://nightly.webkit.org/">WebKit Nightly</a> release for Mac, which means it also isn&#8217;t yet available in any versions of Chrome or Safari.</p>
<p>Support also hasn&#8217;t landed in Opera Mobile or Firefox for Android. I can only assume that the Internet Explorer team is working on it. </p>
<p><b>Related:</b> <a href="http://tiffanybbrown.com/2012/12/04/supporting-and-detecting-supports/">Supporting and detecting @supports</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2013/01/17/supports-api-lands-in-firefox-nightlies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Supporting and detecting @supports</title>
		<link>http://tiffanybbrown.com/2012/12/04/supporting-and-detecting-supports/</link>
		<comments>http://tiffanybbrown.com/2012/12/04/supporting-and-detecting-supports/#comments</comments>
		<pubDate>Tue, 04 Dec 2012 14:20:45 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[@supports]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[DOMScripting]]></category>
		<category><![CDATA[conditional css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[modernizr]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=6899</guid>
		<description><![CDATA[Opera recently added support for the @supports feature of the CSS Conditional Rules Module. Using @supports offers a native way to feature-test support for CSS properties and values. @supports (display: flex){ /* Include flexible box styling here */ } You can also test for negation, and provide rules for cases when a feature is not [...]]]></description>
				<content:encoded><![CDATA[<p>Opera recently added support for the <a href="http://dev.w3.org/csswg/css3-conditional/#at-supports"><code>@supports</code> feature</a> of the CSS Conditional Rules Module. Using <code>@supports</code> offers a native way to feature-test support for CSS properties and values.</p>
<pre><code>@supports (display: flex){
    /* Include flexible box styling here */
}</code></pre>
<p>You can also test for negation, and provide rules for cases when a feature is not supported.</p>
<pre><code>@supports not(display: heffalump){
    /* Include not-heffalump styling here */
}</code></pre>
<p>My colleague Chris Mills <a href="http://dev.opera.com/articles/view/native-css-feature-detection-via-the-supports-rule/">wrote about the feature</a> for Dev.Opera.</p>
<h2><code>@supports</code> JavaScript API</h2>
<p>Opera supports an earlier version of the JavaScript API with the <code>window.supportsCSS()</code> method. Using this method is as simple as passing a property and value.</p>
<pre><code>var hasFlex = supportsCSS('display','flex');</code></pre>
<p>After landing in Opera, the specification changed to add a <code>window.CSS</code> object and <code>supports</code> method instead of <code>window.supportsCSS()</code>. Future syntax will probably be as follows.</p>
<pre><code>var hasFlex = CSS.supports('display','flex');</code></pre>
<h2>Testing for <code>@supports</code> support</h2>
<p>Of course, this only works when the browser supports <code>@supports</code>. So how do we test for that?</p>
<p>The simplest way I&#8217;ve found takes advantage of the <a href="http://dev.w3.org/csswg/cssom/">CSS Object Model</a> and its <strong>CSSRule</strong> interface. <code>@supports</code> extends the CSSRule interface to add the <code>SUPPORTS_RULE</code> constant. In browsers that don&#8217;t support <code>@supports</code>, its value will be undefined.</p>
<pre><code>function hasAtSupports(){
  return (window.CSSRule !== undefined) &#038;&#038; (window.CSSRule.SUPPORTS_RULE !== undefined);
}</code></pre>
<p>I&#8217;ve also published this as a <a href="https://gist.github.com/4195255">gist</a>.</p>
<p>Using the above method has its limits, however. It will tell you whether <code>@supports</code> is available <em>at all</em>, but cannot be used to detect specific features. For that, try my <a href="https://github.com/webinista/supportsatsupports">atsupports.js</a> polyfill (My first polyfill! Please be gentle!), or use <a href="http://modernizr.com/">Modernizr</a>. The atsupports.js polyfill adds <code>window.CSS.supports</code> to browsers that support <code>@supports</code> but not its JavaScript API. It uses <code>window.supportsCSS()</code> if available. You can see <a href="http://tiffanybbrown.com/code/2012/atsupports/">how this works</a> in Opera or Firefox (WebKit support is <a href="https://bugs.webkit.org/show_bug.cgi?id=100324">in a very early stage</a>. Firefox&#8217; <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=779917">window.CSS.supports()</a> support is in progress). </p>
<h2>Modernizr versus <code>@supports</code></h2>
<p>As <a href="http://www.brucelawson.co.uk/">Bruce</a> wrote recently, <a href="http://my.opera.com/ODIN/blog/why-use-supports-instead-of-modernizr">native <code>@supports</code> will perform better than JavaScript</a>. This is true. However, <a href="http://modernizr.com/">Modernizr</a> offers tests for JavaScript APIs in addition to CSS3. If you&#8217;re using newfangled HTML5 features in addition to the fancier bits of CSS, Modernizr may be the more prudent choice.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2012/12/04/supporting-and-detecting-supports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Document fragments are magic</title>
		<link>http://tiffanybbrown.com/2012/11/30/document-fragments-are-magic/</link>
		<comments>http://tiffanybbrown.com/2012/11/30/document-fragments-are-magic/#comments</comments>
		<pubDate>Fri, 30 Nov 2012 23:29:14 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[DOMScripting]]></category>
		<category><![CDATA[document object]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=6894</guid>
		<description><![CDATA[During a recent conversation about some code I&#8217;ve released, the other party asked me why I didn&#8217;t use a document fragment. I think my reaction was more or less &#8220;What, well, um, I don&#8217;t know, so I&#8217;m just going to bullshit and pretend I know what you&#8217;re talking about or something.&#8221; I&#8217;m not one to [...]]]></description>
				<content:encoded><![CDATA[<p>During a recent conversation about some code I&#8217;ve released, the other party asked me why I didn&#8217;t use a document fragment. I think my reaction was more or less &#8220;What, well, um, I don&#8217;t know, so I&#8217;m just going to bullshit and pretend I know what you&#8217;re talking about or something.&#8221;</p>
<p>I&#8217;m not one to be caught looking stupid twice, so I promptly did some Google-ing, and learned about the <a href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-35CB04B5"><strong><code>document.createDocumentFragment()</code></strong></a> method.</p>
<p>How. Did I. Not. Know. About. This. Already? This method improves your JS performance by creating a container of sorts. You can append the container and then add it to the DOM in one operation instead of several. As we know, <a href="http://dev.opera.com/articles/view/efficient-javascript/?page=3#reflow"><strong>DOM operations are expensive</strong></a>. Reducing the number is a great way to make your scripts more efficient.</p>
<p>The code in question created several objects and added them to the DOM one-by-one.</p>
<pre>
var fruits = ['apple','orange','banana','mangosteen','pineapple'],
    ol = document.getElementById('thelist');

fruits.map( function( o ){
    var li  = document.createElement('li');
    li.textContent = o;
    ol.appendChild( li );
});
</pre>
<p>This works of course, but it creates multiple reflows. Let&#8217;s improve its efficiency by using <code>document.createDocumentFragment()</code>.</p>
<pre>
var fruits = ['apple','orange','banana','mangosteen','pineapple'],
    ol,
    df = document.createDocumentFragment();

fruits.map( function( o ){
    var li  = document.createElement('li');
    li.textContent = o;
    df.appendChild( li );
});

ol = document.getElementById('thelist');
ol.appendChild( df );
</pre>
<p>There&#8217;s a little more code involved, but now it&#8217;s updating the DOM tree once. You can see how each stacks up speed-wise in this <a href="http://jsperf.com/document-fragment-vs-html-element-append/6">performance test</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2012/11/30/document-fragments-are-magic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Meet the datalist element</title>
		<link>http://tiffanybbrown.com/2012/11/08/the-datalist-element/</link>
		<comments>http://tiffanybbrown.com/2012/11/08/the-datalist-element/#comments</comments>
		<pubDate>Fri, 09 Nov 2012 02:23:17 +0000</pubDate>
		<dc:creator>tiffany</dc:creator>
				<category><![CDATA[(x)HTML]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[datalist]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[html5 forms]]></category>

		<guid isPermaLink="false">http://tiffanybbrown.com/?p=6855</guid>
		<description><![CDATA[UPDATE: Browsers vary a bit in how they render datalists based on the type of form input. Eiji Kitamura has a demo that illustrates how they all work. One of my favorite parts of HTML5 forms is the datalist element. Opera added support in version 9.0. Support in Firefox and Internet Explorer followed. Today, datalist [...]]]></description>
				<content:encoded><![CDATA[<p class="editors-note"><b>UPDATE:</b> Browsers vary a bit in how they render <code>datalist</code>s based on the type of form input. Eiji Kitamura <a href="http://demo.agektmr.com/datalist/">has a demo</a> that illustrates how they all work.</p>
<p>One of my favorite parts of HTML5 forms is the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-datalist-element"><code>datalist</code> element</a>. <b>Opera</b> added support in <a href="http://caniuse.com/#search=datalist">version 9.0</a>. Support in Firefox and Internet Explorer followed. Today, <code>datalist</code> finally landed in a <a href="http://blog.chromium.org/2012/11/a-web-developers-guide-to-latest-chrome.html">Chrome beta</a> release.</p>
<p>Simply put, <code>datalist</code> is a way <del datetime="2012-11-09T02:46:28+00:00">of providing</del><ins datetime="2012-11-09T02:46:28+00:00">to provide</ins> pre-defined choices for an <code>input</code> field. Each choice is an <code>option</code> element, and a child of the <code>datalist</code> object. You&#8217;re probably familiar with the <code>option</code> element from years of building menus with <code>select</code>.</p>
<p>Associating a <code>datalist</code> object with a form field is simple. Add a <code>list</code> attribute to <code>input</code> element. Set the value of the <code>list</code> attribute to the value of the <code>id</code> attribute of the <code>datalist</code> element. You can see an example below (click the HTML tab).</p>
<p><iframe style="width: 100%; height: 300px" src="http://jsfiddle.net/webinista/N2wGL/embedded/" allowfullscreen="allowfullscreen" frameborder="0"></iframe></p>
<p>Now: just because it&#8217;s available, doesn&#8217;t mean it works well in all browsers. It&#8217;s supported, yes. But the user interface and interaction isn&#8217;t consistent. Opera and Internet Explorer 10<sup><a href="#datalist1">1</a></sup> display the list of options when the input field receives focus as shown in <a href="#datalistinopera">Figure 1</a>.</p>
<figure id="datalistinopera" class="image500">
<video controls><source src="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinopera.webm" type='video/webm'><source src="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinopera.mp4" type='video/mp4'><source src="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinopera.theora.ogv" type='video/ogg; codecs="theora, vorbis"'></video></p>
<figcaption>Figure 1: How the <code>datalist</code> element behaves in Opera.</figcaption>
</figure>
<p>Meanwhile, Chrome currently displays the list of options only after the value of the associated <code>input</code> field changes, as shown in <a href="#datalistinchrome">Figure 2</a>. In all three aforementioned browsers, the options displayed will be filtered as user input changes. </p>
<figure id="datalistinchrome"  class="image500">
<video controls><source src="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinchrome.webm" type='video/webm'><source src="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinchrome.mp4" type='video/mp4'><source src="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinchrome.theora.ogv" type='video/ogg; codecs="theora, vorbis"'></video></p>
<figcaption>Figure 2: How the <code>datalist</code> element behaves in Chrome.</figcaption>
</figure>
<p>Firefox, on the other hand, is a special case. In my opinion, displays the worst behavior of all major browsers. Like Chrome, Firefox displays the list of options only after the value of the associated <code>input</code> changes. But its list filtering is &#8230; janky. Firefox will filter the list of options and match letters, regardless of case and their position in the string. Both &#8220;Accra, Ghana&#8221; and  &#8220;Paris, France&#8221; are among the filtered datalist items displayed (<a href="#datalistinff">Figure 3</a>). Subsequent input will re-filter the list.</p>
<figure id="datalistinff" class="image500"><img src="http://webinista.s3.amazonaws.com/images/uploads/2012/11/datalistinff.png" alt="" title="datalistinff" width="640" height="193" class="aligncenter size-full wp-image-6863" /><br />
<figcaption>Figure 3: The behavior of <code>datalist</code> in Firefox.</figcaption>
</figure>
<p><ins datetime="2012-11-13T18:36:52+00:00">I should note here that Firefox 16 for Android works much like Opera and IE10 on desktop. Datalist options appear on focus.</ins></p>
<p>What about Safari? Sorry kids. As of version 6.0.2, it&#8217;s not supported.</p>
<p><ins datetime="2012-11-09T18:41:06+00:00" class="footnote"><sup>1</sup> Internet Explorer 10 for desktop supports this <a href="https://twitter.com/girlie_mac/status/266970389387829248">IE10 for mobile does not</a>.</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://tiffanybbrown.com/2012/11/08/the-datalist-element/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
<enclosure url="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinopera.webm" length="68853" type="application/wordperfect" />
<enclosure url="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinopera.mp4" length="286841" type="video/mp4" />
<enclosure url="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinopera.theora.ogv" length="343311" type="video/ogg" />
<enclosure url="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinchrome.webm" length="41345" type="application/wordperfect" />
<enclosure url="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinchrome.mp4" length="66542" type="video/mp4" />
<enclosure url="http://tiffanybbrown.s3.amazonaws.com/videos/datalistinchrome.theora.ogv" length="130599" type="video/ogg" />
		</item>
	</channel>
</rss>
