<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0"> <channel><title>dBlogIt</title> <link>http://dblogit.com</link> <description>Practical front-end development for the web professional. Written by Dustin Boston.</description> <lastBuildDate>Fri, 01 Mar 2013 21:19:20 +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> <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/dblogit" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="dblogit" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>How to convert your CoffeeScript project to Literate style in about 30 minutes</title><link>http://dblogit.com/archives/4296</link> <comments>http://dblogit.com/archives/4296#comments</comments> <pubDate>Fri, 01 Mar 2013 21:17:45 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Post]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4296</guid> <description><![CDATA[CoffeeScript 1.5 brings with it the ability to use Literate style programming. This is an incredibly human way to treat code. Not everybody will like it, but those who do will be happy to know that it&#8217;s relatively simple to &#8230;]]></description> <content:encoded><![CDATA[<p>CoffeeScript 1.5 brings with it the ability to use Literate style programming. This is an incredibly human way to treat code. Not everybody will like it, but those who do will be happy to know that it&#8217;s relatively simple to convert your existing project to use the literate style in 30 minutes or less. Here&#8217;s how I did it (in order). BTW, make sure to read through to the end where I outline my assumptions.</p><p>Replace existing code blocks with blockquoted code blocks</p><pre><code>find . -type f \( -name "*.coffee" \) | xargs sed -i 's/#\s\s\s\s\s/# &gt;    /g'
</code></pre><p>Add four spaces to the beginning of every coffee file</p><pre><code>find . -type f \( -name "*.coffee" \) | xargs sed -i 's/^/    /g'
</code></pre><p>Remove preceeding spaces and # symbols from single line comments</p><pre><code>find . -type f \( -name "*.coffee" \) | xargs sed -i 's/^\s*#\s//g'
</code></pre><p>Replace lines that are only made up of # symbols with an empty line</p><pre><code>find . -type f \( -name "*.coffee" \) | xargs sed -i 's/^[ \t]*#\{1,3\}//g'
</code></pre><p>Replace lines that are ony made up of spaces with an empty line</p><pre><code>find . -type f \( -name "*.coffee" \) | xargs sed -i 's/^\s*$//g'
</code></pre><p>Rename all coffee files to litcoffee</p><pre><code>find . -type f \( -name "*.coffee" \) -exec rename -v 's/\.coffee$/.litcoffee/' {} \;
</code></pre><p>Compile litcoffee files</p><pre><code>coffee --compile ./
</code></pre><p>Bonus: SVN Remove all coffee files</p><pre><code>svn st | grep ^! | awk '{print $2}' | xargs svn delete
</code></pre><p>My assumptions are that you do not use any block comments (###) and that you do not have any lines that comment out code e.g. <code># foo = 'bar'</code>. While these will just get turned into regular text it&#8217;s probably a good idea to quickly look through your <code>litcoffee</code> files to make sure that things aren&#8217;t messed up. This is especially true if you have block commented out code. In that case you will probably end up with blocks of code that will actually get parsed and break stuff.</p> ]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4296/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Complete Convergence</title><link>http://dblogit.com/archives/4280</link> <comments>http://dblogit.com/archives/4280#comments</comments> <pubDate>Thu, 03 Jan 2013 19:05:04 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Post]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[smartphone]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4280</guid> <description><![CDATA[I am absolutely shitting myself over the the announcement from Canonical that they will be releasing Ubuntu for phones. Ubuntu for phones is a truly revolutionary convergence of mobile, desktop, and large screen devices. Mark Shuttleworth describes it perfectly: Today &#8230;]]></description> <content:encoded><![CDATA[<p>I am absolutely shitting myself over the the announcement from Canonical that they will be releasing <a
href="http://www.ubuntu.com/devices/phone">Ubuntu for phones</a>. Ubuntu for phones is a truly revolutionary convergence of mobile, desktop, and large screen devices. Mark Shuttleworth describes it perfectly:</p><blockquote><p>Today there many different devices for personal computing: laptops, tablets, smartphones&#8212;and we use completely different interfaces for them, even when they come from the same company. Now that seems a little bizarre when you consider that all of these different devices are just different faces of the same thing. You have apps, you have content, contacts, and messages, and you need to access them in a way that suits your situation. That&#8217;s why we set out to create something completely new. A family of interfaces for each of these devices. Individually great in their own right, and also coherent as a group.</p></blockquote><h2>One OS, multiple expressions</h2><p>My assumption here is it will work just like Ubuntu for Android:</p><ul><li>Your phone runs Ubuntu, so you can do all the things you would do on a desktop but with an interface that is designed specifically for small-screen devices.</li><li>You can plug it into your desktop computer and continue to work and play just as you would normally&#8212;with a mouse, keyboard, and monitor, but powered by your phone.</li></ul><p>There&#8217;s a cute video about <a
href="http://youtu.be/iv1Z7bf4jXY">Ubuntu for Android</a>, and there&#8217;s <a
href="http://youtu.be/JVSNIJs0lWw">a real-life demo</a> that help to explain the concept.</p><p>The difference between Ubuntu for Android and Ubuntu for Phones is that the former is just Ubuntu as we know it, but on a phone. Ubuntu for Phones, on the other hand, is still Ubuntu but with a beautiful, phone-centric interface.</p><h2>Privacy and portability</h2><p>My biggest issues with computing have always been privacy and portability. Unfortunately, I&#8217;ve had to compromise on privacy to achieve portability. This mostly means that I end up using a lot of web-based services for things that I would typically want to keep private, such as email and passwords.</p><p>In an ideal world, I could use a desktop app at work, on the road, and at home without ever going on the web, and without having to sync my devices. In reality that syncing process gets really fucked up. I end up emailing myself backups and importing on whatever device I&#8217;m working on, or something gets viewed on one computer but becomes unavailable on another. Ubuntu&#8217;s new take on personal computing appears to marry the best of both worlds, removing the need for syncing and allowing you to be selective about what you put in the cloud.</p><h2>Commercial Viability</h2><p>The downside is that there aren&#8217;t any takers yet, and Ubuntu needs full support from carriers and manufacturers to move forward. The upside is that a version of Ubuntu for Phones that runs on the Galaxy Nexus is going to be released in the next few weeks.</p><p>Let&#8217;s be honest: a commercially-available Ubuntu phone may never see the light of day, even with Ubuntu&#8217;s relationship with Dell. But I bet we&#8217;re going to see a run on Nexus&#8217; in the next few weeks.</p> ]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4280/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>New Book By Nicholas Zakas: Principles of Object-Oriented Programming in JavaScript</title><link>http://dblogit.com/archives/4257</link> <comments>http://dblogit.com/archives/4257#comments</comments> <pubDate>Wed, 19 Dec 2012 04:42:13 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Link]]></category> <category><![CDATA[books]]></category> <category><![CDATA[OOP]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4257</guid> <description><![CDATA[I got super excited today when I found out that Nicholas Zakas is publishing a new book. Partly because I love the topic and partly because it&#8217;s really cool how he&#8217;s going about it1. Even though I&#8217;ve been doing OOP &#8230;]]></description> <content:encoded><![CDATA[<p>I got super excited today when I found out that <a
href="http://www.nczonline.net/blog/2012/12/18/now-available-principles-of-object-oriented-programming-in-javascript-beta/">Nicholas Zakas is publishing a new book</a>. Partly because I love the topic and partly because it&#8217;s really cool how he&#8217;s going about it<sup
class='footnote'><a
href='#fn-4257-1' id='fnref-4257-1' onclick='return fdfootnote_show(4257)'>1</a></sup>.</p><p>Even though I&#8217;ve been doing OOP for some time, I still find myself questioning what I&#8217;ve done when it comes to JavaScript. Something about dynamic languages throws me off and I get really sloppy&#8212;It&#8217;s like JavaScript pulls me into some parallel dimension where I just throw a bunch of unrelated shit into an object and call it good. In the end I have this, <em>thing</em>, with a bunch of semi-related utility functions, but no real objects in the OOP sense of the word. So yeah, as soon as I saw the title I knew it was a must read.</p><p>But what I think really did me in was Zakas&#8217; transparency about the whole thing: self-publishing and the extra effort required to do so; the separate formats he wanted to support (yay .mobi!); the fact that it was written in markdown (!); the beta process and updates to final copy; and the pricing structure. Seriously how cool is it that you can pay what you like (within a certain range), and see how much he&#8217;s making off each copy sold.</p><p>The whole thing is just plain cool. And oh, by the way&#8230; it would probably make a great Christmas present (hint, hint).</p><div
class='footnotes' id='footnotes-4257'><div
class='footnotedivider'></div><ol><li
id='fn-4257-1'>And partly because he&#8217;s got some very smart shit to say, and partly because his work has been influential in a <a
href="https://github.com/addyosmani/aura">project I&#8217;ve been contributing to</a>, and everything like such as etc. <span
class='footnotereverse'><a
href='#fnref-4257-1'>&#8617;</a></span></li></ol></div>]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4257/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>I heart web 1.0</title><link>http://dblogit.com/archives/4252</link> <comments>http://dblogit.com/archives/4252#comments</comments> <pubDate>Fri, 14 Dec 2012 06:28:58 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Link]]></category> <category><![CDATA[web1.0]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4252</guid> <description><![CDATA[Anil Dash&#8217;s post, The Web We Lost is one of those gems that makes me want to write. Old school style: link lists and  comments and personality. It reminds me of the days when your community of 5 was awesome &#8230;]]></description> <content:encoded><![CDATA[<p>Anil Dash&#8217;s post, <a
href="http://dashes.com/anil/2012/12/the-web-we-lost.html">The Web We Lost</a> is one of those gems that makes me want to write. Old school style: link lists and  comments and personality. It reminds me of the days when your community of 5 was awesome and post titles didn&#8217;t have to be keyword laden link-bait. Sure, we posted a lot of shit back then, but you know what? It was actually fun.</p><p>These days I&#8217;m always trying to be conscious of whether my opinion on some topic will add an extra dimension to a conversation that&#8217;s already been had a thousand times over; I second guess whether my voice will be heard among the throngs, more intelligent than myself; I worry about the backlog of sub-par posts; even the idea of being helpful to others has become a blocker.</p><p>Some days it&#8217;s nice to just be real and open and informal. I heart web 1.0.</p> ]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4252/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>A Few Web Development Highlights From a Decade of Blogging</title><link>http://dblogit.com/archives/4199</link> <comments>http://dblogit.com/archives/4199#comments</comments> <pubDate>Fri, 19 Oct 2012 23:38:42 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Post]]></category> <category><![CDATA[blogging]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4199</guid> <description><![CDATA[On the 22nd I will be celebrating my 10 year blogging anniversary. I thought it would be fun to re-publish a few of my more popular dev-related posts. A tiny bit of history I started blogging in 2002 on Blogger, &#8230;]]></description> <content:encoded><![CDATA[<p>On the 22nd I will be celebrating my 10 year blogging anniversary. I thought it would be fun to re-publish a few of my more popular dev-related posts.</p><h2>A tiny bit of history</h2><p>I started blogging in 2002 on Blogger, just a while before they got bought by Google. When I graduated from college in 2003 I thought it would be an awesome idea to set up a web server in my house. I upgraded my internet service to DSL and put together my own blogging platform. It was awesome until the power went out and my email server shit the bed. After that I started hosting with third parties.</p><h2>My first post ever</h2><p>I thought it would be so cool to write a blog as a series of acrostic poems. Besides being a silly idea, it only lasted for about 10 posts. Anyway, don&#8217;t judge&#8212;the web was much more kind to bizarre forms of self expression back then. At least I had great vocabulary.</p><p>On October 20, 2002 I spent half of my work day hunched over a cheap laminate desk at the leasing office where I worked. With pencil and paper I wrote and revised. 10 lines later I had written this, the inaugural post of my soon-to-be epic blogging career (lol):</p><blockquote><p><strong>IN ACROSTIC</strong><br
/> It’s a Blog, but not the norm.<br
/> Nix all that aberrated form!<br
/></p><p>A Blog should be in perfect prose<br
/> Composed of nicely rhyming rows<br
/> Relating facts of daily life<br
/> Or lessons learned (from time to time).<br
/> So enter here and read along,<br
/> To pass the time in clever song—<br
/> It’s a Blog but not the norm.<br
/> Created In Acrostic form.</p></blockquote><p>I mean now that I&#8217;ve re-read the thing, it&#8217;s really not half bad. It&#8217;s actually kind of a cool way to start blogging.</p><h2>I was boring until 2006</h2><p>Regardless of my awesome start, I was pretty boring and stupid until 2006. So I&#8217;ll just skip everything up to that point.</p><p>In late 2006/early 2007 I ran <a
href="http://dblogit.com/archives/4182">a whole series about pricing out a website design</a>. It was originally published for my freelance company, Bajooter&#8212;I know, it&#8217;s a horribly stupid name, but in my defense it was intended to get the attention of the old-folks to whom I was marketing (BTW, it kind of worked, but I sucked at business).</p><p>In 2007-2008 I had a <a
href="http://www.devlounge.net/publishing/how-to-make-a-magazine-style-homepage-with-drupal-pt-1">total↗</a> <a
href="http://www.devlounge.net/code/how-to-make-a-magazine-style-home-page-with-drupal-pt-2">hard-on↗</a> for Drupal, so I also republished <a
href="http://dblogit.com/archives/4178">The Secret of Great Small Business Websites</a> wherein I admittedly splooge all over my screen espousing my (brief) love-affair with said CMS.</p><p>2009 was the year of minimalism. I sold all of my possessions and stripped my blog down to the bare minimum. Then <a
href="http://dblogit.com/archives/4206">I wrote a bunch of posts about it</a>, generally obsessing about anything that might be considered superfluous, including navigation, plates, and cups.</p><h2>Lessons learned</h2><p>I deleted the shit out of my blog in 2010 and then later regretted that decision. A few days ago I found the backup and that&#8217;s when I noticed that I had been blogging for almost one tenth of a century.</p><p>So what have I learned after all that time? I&#8217;ll tell you:</p><ol><li>Most of the time I post stupid shit that has no right being published on the interwebs</li><li>Only a handful of people are actually good at mixing business and personal on their blogs</li><li>I&#8217;ve always been really bad at ending blog posts <img
src='http://dblogit.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></li></ol> ]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4199/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Template Method Pattern – CoffeeScript Design Patterns</title><link>http://dblogit.com/archives/4173</link> <comments>http://dblogit.com/archives/4173#comments</comments> <pubDate>Tue, 16 Oct 2012 19:44:10 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Post]]></category> <category><![CDATA[coffeescript]]></category> <category><![CDATA[design patterns]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4173</guid> <description><![CDATA[The Template Method pattern just defines a set of methods and the order in which they should be executed. It&#8217;s pretty basic. Usage: I usually like to make the template method a static method that instantiates the class and runs &#8230;]]></description> <content:encoded><![CDATA[<p>The Template Method pattern just defines a set of methods and the order in which they should be executed. It&#8217;s pretty basic.</p><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
# * Defines abstract *primitive operations* that concrete
#   subclasses define to implement steps of an algorithm.
# * Implements a template method defining the skeleton of
#   an algorithm. The template method calls primitive
#   operations as well as operations defined in AbstractClass
#   or those of other objects.
class AbstractClass
  templateMethod: () -&gt;
    @primitiveOperation1()
    @primitiveOperation2()
  primitiveOperation1: () -&gt;
  primitiveOperation2: () -&gt;
# Implements the primitive operations to carry out subclass
# specific steps of the algorithm.
class ConcreteClass extends AbstractClass
  primitiveOperation1: () -&gt;
    console.log &quot;primitiveOperation1&quot;
  primitiveOperation2: () -&gt;
    console.log &quot;primitiveOperation2&quot;
</pre></div><h2>Usage:</h2><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
concrete = new ConcreteClass()
concrete.templateMethod()
</pre></div><p>I usually like to make the template method a static method that instantiates the class and runs the other methods. That way there&#8217;s no way to fuck it up.</p><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
# * Abstract class with static template method
# * Instantiates the class and calls its methods
class AbstractClass
  @templateMethod: () -&gt;
    cls = new @()
    cls.primitiveOperation1()
    cls.primitiveOperation2()
  primitiveOperation1: () -&gt;
  primitiveOperation2: () -&gt;
class ConcreteClass extends AbstractClass
  primitiveOperation1: () -&gt;
    console.log &quot;primitiveOperation1&quot;
  primitiveOperation2: () -&gt;
    console.log &quot;primitiveOperation2&quot;
</pre></div><h2>Usage:</h2><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
ConcreteClass.templateMethod()
</pre></div> ]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4173/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Strategy Pattern – CoffeeScript Design Patterns</title><link>http://dblogit.com/archives/4169</link> <comments>http://dblogit.com/archives/4169#comments</comments> <pubDate>Tue, 16 Oct 2012 17:13:31 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Post]]></category> <category><![CDATA[coffeescript]]></category> <category><![CDATA[design patterns]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4169</guid> <description><![CDATA[The Strategy pattern is great when you&#8217;ve got different stuff that needs to be processed using the same interface. We use it at work to resolve &#8220;runtime&#8221; values on objects of different types. One type is attr another is data &#8230;]]></description> <content:encoded><![CDATA[<p>The Strategy pattern is great when you&#8217;ve got different stuff that needs to be processed using the same interface. We use it at work to resolve &#8220;runtime&#8221; values on objects of different types. One type is <code>attr</code> another is <code>data</code> which both pull a value off of a specific DOM element (but in different ways).</p><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
# * Is configured with a ConcreteStrategy object.
# * Maintains a reference to a Strategy object.
# * May define an interface that lets Strategy access its data.
class Context
  constructor: (@strategy) -&gt;
  contextInterface: () -&gt;
    @strategy.algorithmInterface()
# Declares an interface common to all supported algorithms. Context uses
# this interface to call the algorithm defined by a ConcreteStrategy.
class Strategy
  algorithmInterface: () -&gt;
# Implements the algorithm using the Strategy interface.
class ConcreteStrategyA extends Strategy
  algorithmInterface: () -&gt;
    console.log &quot;ConcreteStrategyA&quot;
class ConcreteStrategyB extends Strategy
  algorithmInterface: () -&gt;
    console.log &quot;ConcreteStrategyB&quot;
class ConcreteStrategyC extends Strategy
  algorithmInterface: () -&gt;
    console.log &quot;ConcreteStrategyC&quot;
</pre></div><h2>Usage:</h2><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
context = new Context new ConcreteStrategyA
resultA = context.contextInterface()
context = new Context new ConcreteStrategyB
resultB = context.contextInterface()
context = new Context new ConcreteStrategyC
resultC = context.contextInterface()
</pre></div> ]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4169/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>A Call for CSS Media Type Support</title><link>http://dblogit.com/archives/4150</link> <comments>http://dblogit.com/archives/4150#comments</comments> <pubDate>Mon, 15 Oct 2012 23:27:33 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Post]]></category> <category><![CDATA[css]]></category> <category><![CDATA[media queries]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4150</guid> <description><![CDATA[The other day I was working on a responsive loading screen for the Bulbstorm App, when it occurred to me that media queries are not a silver bullet. They mostly address resolution issues, but fall short when it comes to &#8230;]]></description> <content:encoded><![CDATA[<p>The other day I was working on a responsive loading screen for the <a
href="http://www.bulbstorm.com/">Bulbstorm</a> App, when it occurred to me that media queries are not a silver bullet. They mostly address resolution issues, but fall short when it comes to identifying the actual environment the user is coming from. This is absolutely maddening to me, for reasons I&#8217;ll try and outline below.</p><h2>The three-fold nature of responsive design</h2><p>In my opinion, responsive design is three-fold:</p><ul><li>Layout</li><li>Images</li><li>Typography</li></ul><p><em>Layout</em> is pretty straight forward. Design your breakpoints around the natural flow of your design, not your device or resolution-specific limitations.</p><p><em>Images</em> are more difficult, but a lot of time and attention has been devoted to solving the problems surrounding them (picture, srcset, prefetching, etc.).</p><p><em>Typography</em> seems to have had very little attention paid to it, however. <a
href="http://informationarchitects.net/">Information Architects</a> have put <a
href="http://informationarchitects.net/blog/responsive-typography-the-basics/">a lot of thought</a> and <a
href="http://informationarchitects.net/blog/responsive-typography/">effort</a> into it and should be considered required reading on the topic.</p><h2>The responsive typography use case</h2><p>The main issue I have with responsive typography as it stands, is that it is  typically packed in with layout, e.g. increase the font size based on the resolution of the screen. In reality that is a poor approach. Consider the following examples.</p><p>Imagine a user browsing your app on a standard desktop resolution of 1366&#215;768. Then put your app inside a Facebook canvas. You are now nearing the same resolution as a 1st gen. iPad. The current approach says, &#8220;scale the text,&#8221; but the end user is  still on a desktop. They haven&#8217;t changed the position of their screen, so why should the text get bigger?</p><p>Or what about the Kindle Fire HD? It has a massive resolution of 1920&#215;1200&#8212;that&#8217;s the same size as my desktop! The user will fall outside of most tablet queries and get a tiny little font that would look great on a desktop, but is awful on a handheld device.</p><p>More succinctly, <strong>screen size is not a good indicator of how text should be rendered.</strong></p><h2>CSS media types, for the fail</h2><p>I think the best solution to the problem is CSS media types. Media types have been around for a while, and they&#8217;ve got exactly what we need to address the typography use case, as well as other issues. The W3C sums it up so perfectly <a
href="http://www.w3.org/TR/CSS21/media.html">in the spec</a>:</p><blockquote><p>One of the most important features of style sheets is that they specify how a document is to be presented on different media: on the screen, on paper, with a speech synthesizer, with a braille device, etc.</p></blockquote><p>Hell, they even outlined my whole thesis:</p><blockquote><p>a document will typically need a larger font on a computer screen than on paper. Therefore, it is necessary to express that a style sheet, or a section of a style sheet, applies to certain media types.</p></blockquote><p>I can imagine it now&#8230; slap in a little <code>&lt;link rel="stylesheet" type="text/css" media="handheld" href="handheld.css"&gt;</code> action, or throw in a little <code>@media handheld {}</code> and voila! Beautiful text perfectly scaled to the device the user is on.</p><h2>Shitty support across the board</h2><p>Unfortunately, this is not the current state of the web. <a
href="http://www.alistapart.com/articles/return-of-the-mobile-stylesheet">A List Apart explained the problem</a> way back in 2009 and it&#8217;s still largely the same. This is why we can&#8217;t have nice things:</p><blockquote><p>Many mobile browsers have implemented this feature, but in different ways:</p><ul><li>Some read only the handheld style sheet.</li><li>Some read only the handheld style sheet if there is one, but default to the screen style sheet otherwise.</li><li>Some read both the handheld style sheet and the screen style sheet.</li><li>Some read only the screen style sheet.</li></ul></blockquote><h2>The work so far</h2><p>There are a few solutions that can ease the pain regarding media types, but there isn&#8217;t anything solid yet. I put together the <a
href="https://github.com/dustinboston/css-media-types">CSS Media Types project on GitHub</a> that has a couple example solutions, a baseline for testing handheld support, and even a <a
href="http://2am.dblogit.com/css-media-types/browserscope.html">Browserscope test</a>.</p><h2>A call for support</h2><ol><li>I want to make a call to those influential individuals who are shaping the future web: Media queries don&#8217;t go far enough without media types. We need media types and we need them to be reliably and consistently applied in all browsers.</li><li>And to the community at large: we need a polyfill for CSS media types that forces browsers to load and apply stylesheets/media queries consistently, regardless of support. This will get us by until more browser vendors come on board with proper media type support.</li><li>Lastly, I need more data. Please check out the <a
href="http://2am.dblogit.com/css-media-types/browserscope.html">Browserscope test page</a> on as many random non-desktop devices as you can find. And if you have any resources that may be of help, please let me know. I&#8217;ll compile them here as a reference going forward. Thanks!</li></ol><p>Continue the conversation on <a
href="https://plus.google.com/112170718070495608167/posts/Au7PBaMa5VJ">Google Plus</a> or <a
href="https://twitter.com/dustinboston/status/257985911516708865">Twitter</a>.</p> ]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4150/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Factory Method Pattern – CoffeeScript Design Patterns</title><link>http://dblogit.com/archives/4010</link> <comments>http://dblogit.com/archives/4010#comments</comments> <pubDate>Thu, 13 Sep 2012 14:01:19 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Post]]></category> <category><![CDATA[coffeescript]]></category> <category><![CDATA[design patterns]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4010</guid> <description><![CDATA[Okay, say an API is shitting out a bunch of products, each of which has a type. You have a bazillion classes for each of those products, but you don&#8217;t want to check each one; you just want to get &#8230;]]></description> <content:encoded><![CDATA[<p>Okay, say an API is shitting out a bunch of products, each of which has a type. You have a bazillion classes for each of those products, but you don&#8217;t want to check each one; you just want to get an instance and move on without totally trashing your API class with product logic. Here&#8217;s where the Factory Method Pattern comes in handy. Party on Wayne.</p><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
# Defines the interface of objects the factory method creates.
class Product
# Implements the Product interface.
class ConcreteProduct1 extends Product
class ConcreteProduct2 extends Product
# * Declares the factory method, which returns an object of type
#   Product. Creator may also define a default implementation of
#   the factory method that returns a default ConcreteProduct
#   object.
# * May call the factory method to create a Product object.
class Creator
  factoryMethod: () -&gt;
  operation: () -&gt;
    product = @factoryMethod()
# Overrides the factory method to return an instance of a
# ConcreteProduct.
class ConcreteCreator extends Creator
  factoryMethod: (id) -&gt;
    switch id
      when id is 1 then return new ConcreteProduct1()
      when id is 2 then return new ConcreteProduct2()
</pre></div><h2>Usage:</h2><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
class Client
  @run: () -&gt;
    creator = new ConcreteCreator()
    console.log creator.factoryMethod 1
    console.log creator.factoryMethod 2
    console.log creator.factoryMethod 3
</pre></div> ]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4010/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Composite Pattern – CoffeeScript Design Patterns</title><link>http://dblogit.com/archives/4003</link> <comments>http://dblogit.com/archives/4003#comments</comments> <pubDate>Thu, 13 Sep 2012 13:45:36 +0000</pubDate> <dc:creator>Dustin Boston</dc:creator> <category><![CDATA[Post]]></category> <category><![CDATA[coffeescript]]></category> <category><![CDATA[design patterns]]></category> <guid isPermaLink="false">http://dblogit.com/?p=4003</guid> <description><![CDATA[I recently used the Composite Pattern in a situation where I had to display property panes for hundreds of widgets that were arranged in a tree view. Each widget had their own properties, some could have children. Sound like a &#8230;]]></description> <content:encoded><![CDATA[<p>I recently used the Composite Pattern in a situation where I had to display property panes for hundreds of widgets that were arranged in a tree view. Each widget had their own properties, some could have children. Sound like a daunting task? It was. I typed way too much. But by using the Composite Pattern I got a much more flexible and reusable end-result.</p><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
# * Declares the interface for objects in the composition.
# * Implements default behavior for the interface common
#   to all classes, as appropriate.
# * Declares an interface for accessing and managing its
#   child components.
# * Optionally defines an interface for accessing a
#   component's parent in the recursive structure, and
#   implements it if that's appropriate.
class Component
  constructor: () -&gt;
    @list = []
  getComposite: () -&gt;
  operation: () -&gt;
  add: (component) -&gt;
# * Represents leaf objects in the composition. A leaf
#   has no children.
# * Defines behavior for primitive objects in the composition.
class Leaf extends Component
# * Defines behavior for components having children.
# * Stores child components
# * Implements child-related operations in the
#   Component interface.
class Composite extends Component
  add: (component) -&gt;
    @list.push component
  operation: () -&gt;
    console.log @list
  getComposite: () -&gt;
    @
</pre></div><h2>Usage:</h2><div
class="nomd"><pre class="brush: coffeescript; title: ; notranslate">
# Manipulates objects in the composition through
# the Component interface.
class Client
  @run: () -&gt;
    # Create a Composite object and add a Leaf
    composite = new Composite()
    leaf = new Leaf()
    composite.add leaf
    composite.operation()
    # Add a Composite to the Composite
    composite2 = new Composite()
    composite.add composite2
    composite.operation()
</pre></div> ]]></content:encoded> <wfw:commentRss>http://dblogit.com/archives/4003/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
