<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Design &amp; Code</title>
  <link href="http://madeofcode.com/posts.atom" rel="self"/>
  <link href="http://madeofcode.com/" rel="alternate"/>
  <id>http://madeofcode.com/</id>
  <updated>2011-10-05T09:55:34+01:00</updated>
  <author>
    <name>Mark Dodwell</name>
  </author>
  <entry>
    <title>Performance Benchmarking Ruby with MiniTest</title>
    <link href="http://madeofcode.com/posts/86-performance-benchmarking-ruby-with-minitest" rel="alternate"/>
    <id>http://madeofcode.com/posts/86-performance-benchmarking-ruby-with-minitest</id>
    <updated>2011-10-05T10:08:25+01:00</updated>
    <content type="html">
&lt;p&gt;A handy feature of &lt;a href="https://github.com/seattlerb/minitest"&gt;MiniTest&lt;/a&gt; is the performance benchmarking assertions. Here's an example testing a couple of methods that are constant and linear in time as a function of their inputs:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;require 'rubygems' require 'minitest/benchmark' require 'minitest/autorun' class Thing def constant_time_method(n) true # O(1) end def linear_time_method(n) n.times { |i| constant_time_method(i) } # O(n) end end class AwesomeTest &lt; MiniTest::Unit::TestCase def setup @thing = Thing.new end def test_constant_time_method_performance assert_performance_constant 0.99999 do |n| @thing.constant_time_method(n) end end def test_linear_time_method_performance assert_performance_linear 0.9999 do |n| @thing.linear_time_method(n) end end end &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Whilst I wouldn't go nuts with this, it's a nice solution for when you have optimized some code and want to add a check against regressions.&lt;/p&gt; &lt;p&gt;Scope &lt;a href="https://github.com/seattlerb/minitest/blob/master/lib/minitest/benchmark.rb"&gt;the source&lt;/a&gt; and &lt;a href="http://rubydoc.info/gems/minitest/2.6.1/MiniTest/Unit/TestCase"&gt;docs&lt;/a&gt; for more details.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Backport 1.9.3 load fixes to 1.9.2 with RVM</title>
    <link href="http://madeofcode.com/posts/85-backport-1-9-3-load-fixes-to-1-9-2-with-rvm" rel="alternate"/>
    <id>http://madeofcode.com/posts/85-backport-1-9-3-load-fixes-to-1-9-2-with-rvm</id>
    <updated>2011-08-13T02:35:31+01:00</updated>
    <content type="html">
&lt;pre&gt;&lt;code&gt;$ wget http://redmine.ruby-lang.org/attachments/download/1958/ruby-1.9.2-p290-load-path-backport.diff $ rvm install 1.9.2-p290 --patch ruby-1.9.2-p290-load-path-backport.diff&lt;/code&gt;&lt;/pre&gt; &lt;p&gt; This cut the load time for Rails 3 environment for a complex project from 31 seconds down to 15, and has been running fine with no issues for 2 weeks.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Made of Code Theme for Xcode 4</title>
    <link href="http://madeofcode.com/posts/83-made-of-code-theme-for-xcode-4" rel="alternate"/>
    <id>http://madeofcode.com/posts/83-made-of-code-theme-for-xcode-4</id>
    <updated>2011-04-20T06:32:16+01:00</updated>
    <content type="html">
&lt;p&gt;&lt;a href="http://mkdynamic.s3.amazonaws.com/downloads/Made%20of%20Xcode.dvtcolortheme"&gt;&lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/28/original/Screen_shot_2011-04-19_at_22.19.42.png" /&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;A port of my TextMate theme, &lt;a href="http://madeofcode.com/posts/29-photo-my-new-textmate-theme-8220-made-of-code-8221-mdash-download-9-feb-2010-update-t"&gt;"Made of Code"&lt;/a&gt;. Being a comic genius, I call it "Made of Xcode". It only works with Xcode 4.&lt;/p&gt; &lt;p&gt;To install &lt;a href="http://mkdynamic.s3.amazonaws.com/downloads/Made%20of%20Xcode.dvtcolortheme"&gt;download it&lt;/a&gt; and copy to ~/Library/Developer/Xcode/UserData/FontAndColorThemes. Restart Xcode and you can select it (Preferences &gt; Fonts &amp; Colors).&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>QUOTE: It&#8217;s the ephemeral but very real sense when you first make contact wit...</title>
    <link href="http://madeofcode.com/posts/81-quote-it-s-the-ephemeral-but-very-real-sense-when-you-first-make-contact-with-the-product-that-some" rel="alternate"/>
    <id>http://madeofcode.com/posts/81-quote-it-s-the-ephemeral-but-very-real-sense-when-you-first-make-contact-with-the-product-that-some</id>
    <updated>2011-03-16T16:53:43+00:00</updated>
    <content type="html">
&lt;blockquote&gt;It&#8217;s the ephemeral but very real sense when you first make contact with the product that someone really truly understands you.&lt;/blockquote&gt;&lt;cite&gt;&lt;a href="http://www.cooper.com/journal/2011/03/more_better_faster_ux_design.html"&gt;More, better, faster: UX design for startups &amp;rarr;&lt;/a&gt;&lt;/cite&gt;    </content>
  </entry>
  <entry>
    <title>VIDEO: The Shape of Design &#8212; Frank Chimero</title>
    <link href="http://madeofcode.com/posts/79-video-the-shape-of-design-frank-chimero" rel="alternate"/>
    <id>http://madeofcode.com/posts/79-video-the-shape-of-design-frank-chimero</id>
    <updated>2011-02-01T06:05:01+00:00</updated>
    <content type="html">
&lt;iframe src="http://player.vimeo.com/video/17084347" width="590" height="332" frameborder="0"&gt;&lt;/iframe&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Awesome Rubygem for Gmail</title>
    <link href="http://madeofcode.com/posts/76-link-awesome-rubygem-for-gmail" rel="alternate"/>
    <id>http://madeofcode.com/posts/76-link-awesome-rubygem-for-gmail</id>
    <updated>2010-10-21T22:27:36+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://github.com/nu7hatch/gmail"&gt;Awesome Rubygem for Gmail&lt;/a&gt;&lt;/p&gt;&lt;p&gt;A small selection of what you can do:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;require "gmail" Gmail.connect(username, password) do |gmail| gmail.logged_in? gmail.inbox.count gmail.inbox.count(:unread) gmail.inbox.count(:read) gmail.inbox.find(:unread) do |email| email.read! email.attachments[0].save_to_file("/path/to/location") end end&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;(thx &lt;a href="http://twitter.com/bbergher"&gt;@bbergher&lt;/a&gt;)&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Designing Beautiful Ruby APIs</title>
    <link href="http://madeofcode.com/posts/75-link-designing-beautiful-ruby-apis" rel="alternate"/>
    <id>http://madeofcode.com/posts/75-link-designing-beautiful-ruby-apis</id>
    <updated>2010-09-06T23:45:17+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://www.slideshare.net/ihower/designing-ruby-apis"&gt;Designing Beautiful Ruby APIs&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Slides from a talk given by Wen-Tien Chang (&lt;a href="http://twitter.com/ihower"&gt;@ihower&lt;/a&gt;) at Ruby Conf China 2010. &lt;/p&gt;&lt;p&gt;They're an amazingly rich source of information, especially the second half on Ruby's object model and meta-programming. If you use Ruby, you must read them!&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: ActiveSupport core extensions: Module</title>
    <link href="http://madeofcode.com/posts/71-link-activesupport-core-extensions-module" rel="alternate"/>
    <id>http://madeofcode.com/posts/71-link-activesupport-core-extensions-module</id>
    <updated>2010-07-11T07:07:30+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://railsapi.com/doc/rails-v2.3.8/classes/Module.html"&gt;ActiveSupport core extensions: Module&lt;/a&gt;&lt;/p&gt;&lt;p&gt;ActiveSupport provides some very handy additions the Module class, including &lt;a href="http://railsapi.com/doc/rails-v2.3.8/classes/Module.html#M003008"&gt;&lt;span class="code"&gt;attr_accessor_with_default&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://railsapi.com/doc/rails-v2.3.8/classes/Module.html#M003015"&gt;&lt;span class="code"&gt; attr_internal_accessor&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://railsapi.com/doc/rails-v2.3.8/classes/Module.html#M003009"&gt;&lt;span class="code"&gt;included_in_classes&lt;/span&gt;&lt;/a&gt; and &lt;a href="http://railsapi.com/doc/rails-v2.3.8/classes/Module.html#M003019"&gt;&lt;span class="code"&gt;synchronize&lt;/span&gt;&lt;/a&gt;, amongst others.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: TextMate bundles: Rails, HAML, SASS + Shoulda</title>
    <link href="http://madeofcode.com/posts/70-link-textmate-bundles-rails-haml-sass-shoulda" rel="alternate"/>
    <id>http://madeofcode.com/posts/70-link-textmate-bundles-rails-haml-sass-shoulda</id>
    <updated>2010-06-26T09:53:26+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://gist.github.com/443129"&gt;TextMate bundles: Rails, HAML, SASS + Shoulda&lt;/a&gt;&lt;/p&gt;&lt;p&gt;An awesome set of TextMate bundles for Ruby, Rails, &lt;span class="caps"&gt;HAML&lt;/span&gt;, &lt;span class="caps"&gt;SASS&lt;/span&gt; and Shoulda from &lt;a href="http://github.com/phuibonhoa"&gt;phuibonhoa&lt;/a&gt;. &lt;a href="http://gist.github.com/443129"&gt;This script&lt;/a&gt; backs up any existing bundles you&amp;#8217;ve installed with the same name first, then installs all of the ones above.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>VSS &#8211; a vector space search engine in Ruby</title>
    <link href="http://madeofcode.com/posts/69-vss-a-vector-space-search-engine-in-ruby" rel="alternate"/>
    <id>http://madeofcode.com/posts/69-vss-a-vector-space-search-engine-in-ruby</id>
    <updated>2010-03-11T03:02:23+00:00</updated>
    <content type="html">
&lt;p&gt;&lt;a href="http://github.com/mkdynamic/vss"&gt;VSS&lt;/a&gt; is a &lt;a href="http://en.wikipedia.org/wiki/Vector_space_model"&gt;vector space&lt;/a&gt; search engine with &lt;a href="http://en.wikipedia.org/wiki/Tf&#8211;idf"&gt;tf*idf&lt;/a&gt; weighting. Checkout the &lt;a href="http://github.com/mkdynamic/vss"&gt;source on Github&lt;/a&gt;, or &lt;span class="code"&gt;gem install vss&lt;/span&gt; to get started. If you want to know how it works, read on:&lt;/p&gt; &lt;h2 style="font-size: 18px;"&gt;1. Tokenize the query&lt;/h2&gt; &lt;p&gt;First our query string is tokenized into an alpha-only, downcased, &lt;a href="http://tartarus.org/~martin/PorterStemmer/"&gt;porter stemmed&lt;/a&gt; array. We also remove common stop words and make sure the tokens are unique:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;require 'stemmer' require 'active_support' STOP_WORDS = %w[ a b c d e f g h i j k l m n o p q r s t u v w x y z an and are as at be by for from has he in is it its of on that the to was were will with upon without among ] def tokenize(string) stripped = string.to_s.gsub(/[^a-z0-9\-\s\']/i, "") #&#160;remove punctuation tokens = stripped.split(/\s+/).reject(&amp;amp;:blank?).map(&amp;amp;:downcase).map(&amp;amp;:stem) tokens.reject { |t| STOP_WORDS.include?(t) }.uniq end&lt;/code&gt;&lt;/pre&gt; &lt;h2 style="font-size: 18px;"&gt;2. Find corpus vocabulary&lt;/h2&gt; &lt;p&gt;Given a document collection (or &lt;em&gt;corpus&lt;/em&gt;):&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;doc1 = "I'm not even going to mention any TV series." doc2 = "The Wire is the best thing ever. Fact." doc3 = "Some would argue that Lost got a bit too wierd after season 2." doc4 = "Lost is surely not in the same league as The Wire." @docs = [doc1, doc2, doc3, doc4]&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;We first tokenize everything, to find our &lt;span class="code"&gt;@vocab&lt;/span&gt;:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;@vocab = tokenize(@docs.join(" "))&lt;/code&gt;&lt;/pre&gt; &lt;h2 style="font-size: 18px;"&gt;3. Generate vector indexes for each token in the vocabulary&lt;/h2&gt; &lt;pre&gt;&lt;code class="ruby"&gt;@vector_keyword_index = begin index, offset = {}, 0 @vocab.each do |keyword| index[keyword] = offset offset += 1 end index end&lt;/code&gt;&lt;/pre&gt; &lt;h2 style="font-size: 18px;"&gt;4. Perform the search, and return the ranked results&lt;/h2&gt; &lt;p&gt;We can generate a vector for any document (or query):&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;require 'matrix' def vector(doc) arr = Array.new(@vector_keyword_index.size, 0) tokens = tokenize(doc) tokens &amp;amp;= @vocab # ensure all tokens are in vocab tokens.each do |token| tf = tokens.count(token) num_docs_with_token = @docs.count { |d| tokenize(d).include?(token) } idf = @docs.size / num_docs_with_token index = @vector_keyword_index[token] arr[index] = tf * idf end return Vector.elements(arr) # create a vector from arr end&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;And compare 2 vectors:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;def cosine(vector1, vector2) dot_product = vector1.inner_product(vector2) dot_product / (vector1.r * vector2.r) end # ranks from 0 to 100 def cosine_rank(vector1, vector2) (cosine(vector1, vector2) + 1) / 2 * 100 end&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;So for our query, we just compare the cosine between each document vector and the query vector to get our &lt;strong&gt;rank&lt;/strong&gt;. Then we annotate each document in our &lt;span class="code"&gt;@docs&lt;/span&gt; collection with the rank and return the documents ordered by that value:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;@query = "How can you compare The Wire with Lost?" query_vector = vector(@query) @docs.each do |doc| doc_vector = vector(doc) rank = cosine_rank(query_vector, doc_vector) doc.instance_eval %{def rank; #{rank}; end} # bit mental end @results = @docs.sort { |a,b| b.rank &amp;lt;=&amp;gt; a.rank } # highest to lowest&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;And here's what &lt;span class="code"&gt;@results&lt;/span&gt; looks like:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;&amp;gt;&amp;gt; @results.each { |doc| puts doc + " (#{doc.rank})" } Lost is surely not in the same league as The Wire. (68.2574185835055) The Wire is the best thing ever. Fact. (58.5749292571254) Some would argue that Lost got a bit too wierd after season 2. (55.5215763037423) I'm not even going to mention any TV series. (50.0)&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;It works! I'm sure there are lots of optimizations you could make (e.g. by caching some of the tokenization steps), but for small document collections it's plenty fast enough.&lt;/p&gt; &lt;h2 style="font-size: 18px;"&gt;Credits&lt;/h2&gt; &lt;p&gt;Thanks to &lt;a href="http://blog.josephwilk.net/projects/building-a-vector-space-search-engine-in-python.html"&gt;Joseph Wilk's excellent article on building a vector space search engine in Python&lt;/a&gt;.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: MyFonts Newsletters</title>
    <link href="http://madeofcode.com/posts/68-link-myfonts-newsletters" rel="alternate"/>
    <id>http://madeofcode.com/posts/68-link-myfonts-newsletters</id>
    <updated>2010-02-23T16:26:17+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://new.myfonts.com/newsletters/"&gt;MyFonts Newsletters&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>VIDEO: Amazing short film</title>
    <link href="http://madeofcode.com/posts/67-video-amazing-short-film" rel="alternate"/>
    <id>http://madeofcode.com/posts/67-video-amazing-short-film</id>
    <updated>2010-02-22T08:55:30+00:00</updated>
    <content type="html">
&lt;object width="590" height="332"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9078364&amp;amp;server=vimeo.com&amp;amp;show_title=0&amp;amp;show_byline=0&amp;amp;show_portrait=0&amp;amp;color=ffffff&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=9078364&amp;amp;server=vimeo.com&amp;amp;show_title=0&amp;amp;show_byline=0&amp;amp;show_portrait=0&amp;amp;color=ffffff&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="590" height="332"&gt;&lt;/embed&gt;&lt;/object&gt;    </content>
  </entry>
  <entry>
    <title>Least Smallest effective difference</title>
    <link href="http://madeofcode.com/posts/66-least-smallest-effective-difference" rel="alternate"/>
    <id>http://madeofcode.com/posts/66-least-smallest-effective-difference</id>
    <updated>2010-02-19T20:57:18+00:00</updated>
    <content type="html">
&lt;p&gt;&amp;ldquo;Least effective difference&amp;rdquo; actually means something totally different, i.e. the difference which is least effective.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Useful tips for dig</title>
    <link href="http://madeofcode.com/posts/65-link-useful-tips-for-dig" rel="alternate"/>
    <id>http://madeofcode.com/posts/65-link-useful-tips-for-dig</id>
    <updated>2010-02-19T04:51:59+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://articles.slicehost.com/2010/1/11/dig-external-servers"&gt;Useful tips for dig&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: &#8220;We are what we repeatedly do. Excellence, then, is not an act, but a ...</title>
    <link href="http://madeofcode.com/posts/64-photo-ldquo-we-are-what-we-repeatedly-do-excellence-then-is-not-an-act-but-a-habit-rdquo-md" rel="alternate"/>
    <id>http://madeofcode.com/posts/64-photo-ldquo-we-are-what-we-repeatedly-do-excellence-then-is-not-an-act-but-a-habit-rdquo-md</id>
    <updated>2010-02-13T19:40:59+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://www.contrast.ie/blog/the-thickness-of-napkins/"&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/22/medium.png" /&gt; &lt;/a&gt; &lt;/p&gt; &lt;p&gt;&amp;ldquo;We are what we repeatedly do. Excellence, then, is not an act, but a habit.&amp;rdquo; &amp;mdash; &lt;i&gt;Aristotle&lt;/i&gt;&lt;/p&gt; &lt;p&gt;via &lt;a href="http://www.contrast.ie/blog/the-thickness-of-napkins/"&gt;Contrast | The Blog&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO</title>
    <link href="http://madeofcode.com/posts/63-photo" rel="alternate"/>
    <id>http://madeofcode.com/posts/63-photo</id>
    <updated>2010-02-11T01:08:23+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://www.fox.com/24"&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/21/medium.png" /&gt; &lt;/a&gt; &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Gu (Backpack CMS) new theme &amp; Heroku demo</title>
    <link href="http://madeofcode.com/posts/62-gu-backpack-cms-new-theme-amp-heroku-demo" rel="alternate"/>
    <id>http://madeofcode.com/posts/62-gu-backpack-cms-new-theme-amp-heroku-demo</id>
    <updated>2010-02-10T04:39:32+00:00</updated>
    <content type="html">
&lt;p&gt;&lt;a href="http://github.com/mkdynamic/gu"&gt;Gu&lt;/a&gt;, my Rails app enabling you to use &lt;a href="http://backpackit.com"&gt;Backpack&lt;/a&gt; as a simple CMS, now has a nicer looking default theme! You can also find &lt;a href="http://gudemo.heroku.com/"&gt;a demo running on Heroku&lt;/a&gt; which is powered by my own Backpack account. I also added some rudimentary query caching and fixed a couple of bugs.&lt;/p&gt; &lt;p&gt;See a preview of the theme below, or feel free to &lt;a href="http://github.com/mkdynamic/gu"&gt;check out the updated version on Github&lt;/a&gt;. Any patches and/or ideas very welcome.&lt;/p&gt; &lt;p&gt;&lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/20/medium.png" title="New default theme for Gu, a simple Backpack CMS" /&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Jasmine Pearls Green Tea</title>
    <link href="http://madeofcode.com/posts/60-link-jasmine-pearls-green-tea" rel="alternate"/>
    <id>http://madeofcode.com/posts/60-link-jasmine-pearls-green-tea</id>
    <updated>2010-02-08T23:12:32+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://jingtea.com/tea/scented-tea/jasmine-pearls"&gt;Jasmine Pearls Green Tea&lt;/a&gt;&lt;/p&gt;&lt;p&gt;This is really nice, I drink about 5 cups of it a day.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>VIDEO: Espresso, Intelligentsia</title>
    <link href="http://madeofcode.com/posts/59-video-espresso-intelligentsia" rel="alternate"/>
    <id>http://madeofcode.com/posts/59-video-espresso-intelligentsia</id>
    <updated>2010-02-08T22:01:01+00:00</updated>
    <content type="html">
&lt;object width="590" height="332"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8709313&amp;amp;server=vimeo.com&amp;amp;show_title=0&amp;amp;show_byline=0&amp;amp;show_portrait=0&amp;amp;color=ffffff&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=8709313&amp;amp;server=vimeo.com&amp;amp;show_title=0&amp;amp;show_byline=0&amp;amp;show_portrait=0&amp;amp;color=ffffff&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="590" height="332"&gt;&lt;/embed&gt;&lt;/object&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Please Scroll</title>
    <link href="http://madeofcode.com/posts/2-link-please-scroll" rel="alternate"/>
    <id>http://madeofcode.com/posts/2-link-please-scroll</id>
    <updated>2010-02-05T15:41:21+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://www.thereisnopagefold.com/"&gt;Please Scroll&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Best method ever?</title>
    <link href="http://madeofcode.com/posts/3-best-method-ever" rel="alternate"/>
    <id>http://madeofcode.com/posts/3-best-method-ever</id>
    <updated>2010-02-04T12:25:42+00:00</updated>
    <content type="html">
&lt;pre&gt;&lt;code class="ruby"&gt;module AdsHelper def show_ads? true end end&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;I wrote this the other day. Pure genius.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Useful resource for CSS browser quirks</title>
    <link href="http://madeofcode.com/posts/4-link-useful-resource-for-css-browser-quirks" rel="alternate"/>
    <id>http://madeofcode.com/posts/4-link-useful-resource-for-css-browser-quirks</id>
    <updated>2010-02-02T17:17:29+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://code.google.com/p/doctype/source/browse/trunk/goog/style/style.js#685"&gt;Useful resource for CSS browser quirks&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Jammit: Asset Packaging for Rails</title>
    <link href="http://madeofcode.com/posts/6-link-jammit-asset-packaging-for-rails" rel="alternate"/>
    <id>http://madeofcode.com/posts/6-link-jammit-asset-packaging-for-rails</id>
    <updated>2010-01-26T03:23:36+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://documentcloud.github.com/jammit/"&gt;Jammit: Asset Packaging for Rails&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>RubyGems version specification tip</title>
    <link href="http://madeofcode.com/posts/7-rubygems-version-specification-tip" rel="alternate"/>
    <id>http://madeofcode.com/posts/7-rubygems-version-specification-tip</id>
    <updated>2010-01-22T05:24:18+00:00</updated>
    <content type="html">
&lt;p&gt;RubyGems version string &lt;span class="code"&gt;&amp;#8220;~&amp;gt; 2.5.1&amp;#8221;&lt;/span&gt; will look for any &lt;span class="code"&gt;2.5.x&lt;/span&gt; version, greater than or equal to &lt;span class="code"&gt;2.5.1&lt;/span&gt;. For example in Rails:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;config.gem 'mygem', :version =&amp;gt; '~&amp;gt; 2.5.1'&lt;/code&gt;&lt;/pre&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: 5 minute redesign of 1Password software update dialog.</title>
    <link href="http://madeofcode.com/posts/8-photo-5-minute-redesign-of-1password-software-update-dialog" rel="alternate"/>
    <id>http://madeofcode.com/posts/8-photo-5-minute-redesign-of-1password-software-update-dialog</id>
    <updated>2010-01-22T02:31:25+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/2/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/2/medium." /&gt; &lt;/a&gt; &lt;/p&gt; &lt;p&gt;5 minute redesign of &lt;a href="http://agilewebsolutions.com/products/1Password"&gt;1Password&lt;/a&gt; software update dialog.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: via micasaessucasa</title>
    <link href="http://madeofcode.com/posts/9-photo-via-micasaessucasa" rel="alternate"/>
    <id>http://madeofcode.com/posts/9-photo-via-micasaessucasa</id>
    <updated>2010-01-22T02:02:05+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/3/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/3/medium." /&gt; &lt;/a&gt; &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: Cool approach for the redesign of the boarding pass. via http://passfa...</title>
    <link href="http://madeofcode.com/posts/10-photo-cool-approach-for-the-redesign-of-the-boarding-pass-via-http-passfail-squarespace-com" rel="alternate"/>
    <id>http://madeofcode.com/posts/10-photo-cool-approach-for-the-redesign-of-the-boarding-pass-via-http-passfail-squarespace-com</id>
    <updated>2010-01-22T01:53:01+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/4/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/4/medium." /&gt; &lt;/a&gt; &lt;/p&gt; &lt;p&gt;Cool approach for the redesign of the boarding pass. &lt;br/&gt; via &lt;a href="http://passfail.squarespace.com/"&gt;http://passfail.squarespace.com/&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Miracle Roles &#8212; simple roles for Rails</title>
    <link href="http://madeofcode.com/posts/11-link-miracle-roles-simple-roles-for-rails" rel="alternate"/>
    <id>http://madeofcode.com/posts/11-link-miracle-roles-simple-roles-for-rails</id>
    <updated>2010-01-21T01:19:51+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://github.com/mkdynamic/miracle_roles"&gt;Miracle Roles &#8212; simple roles for Rails&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Snow Leopard, TextMate &amp; Font smoothing</title>
    <link href="http://madeofcode.com/posts/12-snow-leopard-textmate-font-smoothing" rel="alternate"/>
    <id>http://madeofcode.com/posts/12-snow-leopard-textmate-font-smoothing</id>
    <updated>2010-01-20T21:02:12+00:00</updated>
    <content type="html">
&lt;p&gt;To get Inconsolata looking nice on my iMac&amp;#8217;s LCD, I had to setup some custom font smoothing for TextMate:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;defaults write com.macromates.textmate AppleFontSmoothing -int 1&lt;/code&gt;&lt;/pre&gt;    </content>
  </entry>
  <entry>
    <title>QUOTE: If somebody admits that HAML wishes it was Python and that you still h...</title>
    <link href="http://madeofcode.com/posts/13-quote-if-somebody-admits-that-haml-wishes-it-was-python-and-that-you-still-have-to-think-in-html-wh" rel="alternate"/>
    <id>http://madeofcode.com/posts/13-quote-if-somebody-admits-that-haml-wishes-it-was-python-and-that-you-still-have-to-think-in-html-wh</id>
    <updated>2010-01-20T19:25:00+00:00</updated>
    <content type="html">
&lt;blockquote&gt;If somebody admits that HAML wishes it was Python and that you still have to &lt;i&gt;think&lt;/i&gt; in HTML when using it, and still says it&amp;#8217;s great, I&amp;#8217;d say good for them if they found a tool they like.&lt;/blockquote&gt;&lt;cite&gt;RubyPanther via #rubyonrails&lt;/cite&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Building Blocks of Modularity by Jim Weirich</title>
    <link href="http://madeofcode.com/posts/14-link-building-blocks-of-modularity-by-jim-weirich" rel="alternate"/>
    <id>http://madeofcode.com/posts/14-link-building-blocks-of-modularity-by-jim-weirich</id>
    <updated>2010-01-11T21:53:26+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://mwrc2009.confreaks.com/videos/14-mar-2009-18-10-the-building-blocks-of-modularity-jim-weirich-large.mp4"&gt;Building Blocks of Modularity by Jim Weirich&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: &#8220;The Journey of a tweet&#8221; via www.ngonlinenews.com</title>
    <link href="http://madeofcode.com/posts/16-photo-the-journey-of-a-tweet-via-www-ngonlinenews-com" rel="alternate"/>
    <id>http://madeofcode.com/posts/16-photo-the-journey-of-a-tweet-via-www-ngonlinenews-com</id>
    <updated>2010-01-08T16:38:24+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/6/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/6/medium." /&gt; &lt;/a&gt; &lt;/p&gt; &lt;p&gt;&#8220;The Journey of a tweet&#8221; via &lt;a href="http://www.ngonlinenews.com"&gt;www.ngonlinenews.com&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Best maintenance notice ever?</title>
    <link href="http://madeofcode.com/posts/17-best-maintenance-notice-ever" rel="alternate"/>
    <id>http://madeofcode.com/posts/17-best-maintenance-notice-ever</id>
    <updated>2010-01-08T16:33:17+00:00</updated>
    <content type="html">
&lt;p&gt;Received the other day from &lt;a href="http://letsfreckle.com"&gt;Freckle&lt;/a&gt;, an awesome time-tracking app.&lt;/p&gt; &lt;div style="font-size: 10px; line-height: 18px; font-family: Monaco, 'Bitstream Vera Sans Mono', 'Lucida Console', Terminal, monospace !important; border: 3px solid #eee;"&gt;&lt;div style="border: 1px solid #aaa; padding: 15px;"&gt; &lt;p&gt; Hello there Mark, beloved Freckle customer! &lt;/p&gt; &lt;p&gt; &amp;#8212;&amp;#8212;-&lt;br/&gt; SCHEDULED DOWNTIME: Sunday, Jan 10 from approx. 14:00 UTC to 18:00 UTC&lt;br/&gt; (find in your local time zone: &lt;a href="http://bit.ly/8kZKwM"&gt;http://bit.ly/8kZKwM&lt;/a&gt;) &lt;br/&gt; &amp;#8212;&amp;#8212;-&lt;/p&gt; &lt;p&gt; Some of you have written in recently, noting that Freckle is not as zippy as it used to be. You&amp;#8217;re right. &lt;/p&gt; &lt;p&gt; And a few days ago, we even had a little bit of downtime due to server load.&lt;/p&gt; &lt;p&gt; That means&amp;#8230; it&amp;#8217;s time for a server upgrade! Unfortunately, that also means that we will have to take some scheduled downtime. &lt;/p&gt; &lt;p&gt; Now, Freckle will most likely NOT be down for the entire period. However, there may be scattered &amp;#8220;outages&amp;#8221; during this time. So be aware!&lt;/p&gt; &lt;p&gt; Again, that time and date is: &lt;/p&gt; &lt;p&gt; &amp;#8212;&amp;#8212;-&lt;br/&gt; SCHEDULED DOWNTIME: Sunday, Jan 10 from approx. 14:00 UTC to 18:00 UTC&lt;br/&gt; (find in your local time zone: &lt;a href="http://bit.ly/8kZKwM"&gt;http://bit.ly/8kZKwM&lt;/a&gt;) &lt;br/&gt; &amp;#8212;&amp;#8212;-&lt;/p&gt; &lt;p&gt; But when we come up, it&amp;#8217;ll be with a much beefier server and things will be faster and more pleasant all around. &lt;/p&gt; &lt;p&gt; Please excuse the interruption and thanks for your business!&lt;/p&gt; &lt;p&gt; Best wishes, &lt;/p&gt; &lt;p&gt; Your freckle team&lt;br/&gt; Amy, Thomas, Dieter and Joe&lt;br/&gt; &lt;a href="http://letsfreckle.com"&gt;http://letsfreckle.com&lt;/a&gt;&lt;/p&gt; &lt;/div&gt;&lt;/div&gt;    </content>
  </entry>
  <entry>
    <title>QUOTE: Inflation, rising food prices, graduate unemployment and a property bu...</title>
    <link href="http://madeofcode.com/posts/18-quote-inflation-rising-food-prices-graduate-unemployment-and-a-property-bubble-are-all-mounting-c" rel="alternate"/>
    <id>http://madeofcode.com/posts/18-quote-inflation-rising-food-prices-graduate-unemployment-and-a-property-bubble-are-all-mounting-c</id>
    <updated>2010-01-01T00:50:51+00:00</updated>
    <content type="html">
&lt;blockquote&gt;Inflation, rising food prices, graduate unemployment and a property bubble are all mounting concerns.&lt;/blockquote&gt;&lt;cite&gt;&lt;p&gt;Telegraph on China in 2010&lt;/p&gt; &lt;p&gt;Now, why do those problems sound familiar&amp;#8230;&lt;/p&gt;&lt;/cite&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: I really like the simplicity of this Chrome ad.</title>
    <link href="http://madeofcode.com/posts/19-photo-i-really-like-the-simplicity-of-this-chrome-ad" rel="alternate"/>
    <id>http://madeofcode.com/posts/19-photo-i-really-like-the-simplicity-of-this-chrome-ad</id>
    <updated>2010-01-01T00:32:31+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/7/original.png"&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/7/medium.png" /&gt; &lt;/a&gt; &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: 140 Characters</title>
    <link href="http://madeofcode.com/posts/20-link-140-characters" rel="alternate"/>
    <id>http://madeofcode.com/posts/20-link-140-characters</id>
    <updated>2009-12-20T16:43:53+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://www.140characters.com/app/"&gt;140 Characters&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Objectified: A Documentary Film by Gary Hustwit</title>
    <link href="http://madeofcode.com/posts/21-link-objectified-a-documentary-film-by-gary-hustwit" rel="alternate"/>
    <id>http://madeofcode.com/posts/21-link-objectified-a-documentary-film-by-gary-hustwit</id>
    <updated>2009-12-16T17:47:05+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://www.objectifiedfilm.com/"&gt;Objectified: A Documentary Film by Gary Hustwit&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: A shorthand for designing UI flows</title>
    <link href="http://madeofcode.com/posts/22-link-a-shorthand-for-designing-ui-flows" rel="alternate"/>
    <id>http://madeofcode.com/posts/22-link-a-shorthand-for-designing-ui-flows</id>
    <updated>2009-12-16T17:37:41+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://37signals.com/svn/posts/1926-a-shorthand-for-designing-ui-flows"&gt;A shorthand for designing UI flows&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: jQuery Plugin: Cross-browser placeholders</title>
    <link href="http://madeofcode.com/posts/23-link-jquery-plugin-cross-browser-placeholders" rel="alternate"/>
    <id>http://madeofcode.com/posts/23-link-jquery-plugin-cross-browser-placeholders</id>
    <updated>2009-12-12T22:49:48+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://github.com/mkdynamic/jquery-placeholders"&gt;jQuery Plugin: Cross-browser placeholders&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: My new favourite way to collect addresses on forms. Usable, and compac...</title>
    <link href="http://madeofcode.com/posts/24-photo-my-new-favourite-way-to-collect-addresses-on-forms-usable-and-compact-18-dec-2010-updat" rel="alternate"/>
    <id>http://madeofcode.com/posts/24-photo-my-new-favourite-way-to-collect-addresses-on-forms-usable-and-compact-18-dec-2010-updat</id>
    <updated>2009-12-12T09:22:27+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/8/original.png"&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/8/medium.png" /&gt; &lt;/a&gt; &lt;/p&gt; &lt;p&gt;My new favourite way to collect addresses on forms. Usable, and compact.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;[18 Dec 2010] Update:&lt;/strong&gt; Since this post, I've made a couple of jQuery plugins for this. Check &lt;a href="https://github.com/mkdynamic/jquery-inline-labels"&gt;them&lt;/a&gt; &lt;a href="https://github.com/mkdynamic/jquery-placeholders"&gt;out&lt;/a&gt; on Github.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: A very useful tip for ActiveResource logging</title>
    <link href="http://madeofcode.com/posts/25-link-a-very-useful-tip-for-activeresource-logging" rel="alternate"/>
    <id>http://madeofcode.com/posts/25-link-a-very-useful-tip-for-activeresource-logging</id>
    <updated>2009-12-11T01:37:49+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://blog.sidu.in/2009/03/activresource-logging-tip.html"&gt;A very useful tip for ActiveResource logging &lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Test by example</title>
    <link href="http://madeofcode.com/posts/27-test-by-example" rel="alternate"/>
    <id>http://madeofcode.com/posts/27-test-by-example</id>
    <updated>2009-11-26T20:47:37+00:00</updated>
    <content type="html">
&lt;p&gt;I like this pattern for testing by example. It's very readable and easy to add more cases.&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;context "#domain" do should "return correct domain from given host" do examples = { "foo.bar.mydomain.com" =&gt; "mydomain.com", "foo.bar.www.mydomain.com" =&gt; "www.mydomain.com", "foo.bar.www.mydomain.co.uk" =&gt; "www.mydomain.co.uk", "www.mydomain.com" =&gt; "www.mydomain.com", "foo.mydomain.co.uk" =&gt; "mydomain.co.uk", "foo.bar.www.my-domain.com" =&gt; "www.my-domain.com", "foo.m.net" =&gt; "m.net", "foo-bar.mydomain.www.mydomain.co.uk" =&gt; "www.mydomain.co.uk", "www.www.mydomain.com" =&gt; "www.mydomain.com" } examples.each do |host, domain| @request.host = host get :index assert_equal domain, @controller.send(:domain) end end end&lt;/code&gt;&lt;/pre&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Handy gem for making block helpers for Rails</title>
    <link href="http://madeofcode.com/posts/28-link-handy-gem-for-making-block-helpers-for-rails" rel="alternate"/>
    <id>http://madeofcode.com/posts/28-link-handy-gem-for-making-block-helpers-for-rails</id>
    <updated>2009-11-26T19:56:47+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://github.com/markevans/block_helpers"&gt;Handy gem for making block helpers for Rails&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: My new TextMate theme, &#8220;Made of Code&#8221; &#8212; Download. [9 Feb 2010] Update:...</title>
    <link href="http://madeofcode.com/posts/29-photo-my-new-textmate-theme-8220-made-of-code-8221-mdash-download-9-feb-2010-update-t" rel="alternate"/>
    <id>http://madeofcode.com/posts/29-photo-my-new-textmate-theme-8220-made-of-code-8221-mdash-download-9-feb-2010-update-t</id>
    <updated>2009-11-24T02:16:39+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://mkdynamic.s3.amazonaws.com/downloads/Made%20of%20Code.tmTheme"&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/9/medium.png" /&gt; &lt;/a&gt; &lt;/p&gt; &lt;p&gt;My new TextMate theme, &amp;#8220;Made of Code&amp;#8221; &amp;mdash; &lt;a href="http://mkdynamic.s3.amazonaws.com/downloads/Made%20of%20Code.tmTheme"&gt;Download&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;[9 Feb 2010] Update:&lt;/strong&gt; The font used in the screenshot above is Inconsolata at 18pts. In Snow Leopard, I had to &lt;a href="http://madeofcode.com/posts/12-snow-leopard-textmate-font-smoothing"&gt;tweak the font smoothing&lt;/a&gt; to make it look nice.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Cross Browser CSS Opacity</title>
    <link href="http://madeofcode.com/posts/30-cross-browser-css-opacity" rel="alternate"/>
    <id>http://madeofcode.com/posts/30-cross-browser-css-opacity</id>
    <updated>2009-11-24T01:51:23+00:00</updated>
    <content type="html">
&lt;pre&gt;&lt;code class="css"&gt;/* the joy of browser standards... seriously, IE8 - why? */ .foo { -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; /* IE 8 */ filter: alpha(opacity=50); /* IE 6 + 7 */ -khtml-opacity: 0.50; /* Safari &lt; 1.2 (KHTML) */ -moz-opacity: 0.50; /* FF &lt; 1.5, Mozilla &lt;= 1.6 */ opacity: 0.50; /* FF 1.5+, Safari 1.2+, Opera 9+ (CSS3) */&lt;/code&gt;&lt;/pre&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO</title>
    <link href="http://madeofcode.com/posts/32-photo" rel="alternate"/>
    <id>http://madeofcode.com/posts/32-photo</id>
    <updated>2009-11-08T17:37:40+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/11/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/11/medium." /&gt; &lt;/a&gt; &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO</title>
    <link href="http://madeofcode.com/posts/33-photo" rel="alternate"/>
    <id>http://madeofcode.com/posts/33-photo</id>
    <updated>2009-11-07T15:30:28+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/12/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/12/medium." /&gt; &lt;/a&gt; &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO</title>
    <link href="http://madeofcode.com/posts/34-photo" rel="alternate"/>
    <id>http://madeofcode.com/posts/34-photo</id>
    <updated>2009-11-06T15:33:06+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/13/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/13/medium." /&gt; &lt;/a&gt; &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO</title>
    <link href="http://madeofcode.com/posts/35-photo" rel="alternate"/>
    <id>http://madeofcode.com/posts/35-photo</id>
    <updated>2009-11-05T21:02:24+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/14/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/14/medium." /&gt; &lt;/a&gt; &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Stop people changing the URL in Safari</title>
    <link href="http://madeofcode.com/posts/37-link-stop-people-changing-the-url-in-safari" rel="alternate"/>
    <id>http://madeofcode.com/posts/37-link-stop-people-changing-the-url-in-safari</id>
    <updated>2009-10-30T02:22:58+00:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://s187054162.websitehome.co.uk/labs/stopurl.html"&gt;Stop people changing the URL in Safari&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Only tested this in Safari 4.0.3, does this count as a bug?&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Easy tests catch easy to debug problems...</title>
    <link href="http://madeofcode.com/posts/38-easy-tests-catch-easy-to-debug-problems" rel="alternate"/>
    <id>http://madeofcode.com/posts/38-easy-tests-catch-easy-to-debug-problems</id>
    <updated>2009-10-29T01:10:46+00:00</updated>
    <content type="html">
&lt;p&gt;Tests that are easy to write generally catch easy to debug problems. For an example, consider a method that generates a token on saving a model. Testing the token is generated on save is easy, but if the token was not generated then you could debug it fairly quickly without a test. &lt;/p&gt; &lt;p&gt;On the other hand, tests that are hard to write generally catch problems that would be harder to debug. Testing that the token is always unique is more difficult, and if we didn&amp;#8217;t have a test it would be hard to debug an non-unique token generation problem, which may well be intermittent.&lt;/p&gt; &lt;p&gt;The easy tests are quick to write and give breadth, but then the bugs they catch are obvious, whilst tests that are tricky give depth of coverage but catch problems that are more complex to debug.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO</title>
    <link href="http://madeofcode.com/posts/39-photo" rel="alternate"/>
    <id>http://madeofcode.com/posts/39-photo</id>
    <updated>2009-10-27T19:10:29+00:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/15/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/15/medium." /&gt; &lt;/a&gt; &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: I love the subtle use of gradients here.</title>
    <link href="http://madeofcode.com/posts/40-photo-i-love-the-subtle-use-of-gradients-here" rel="alternate"/>
    <id>http://madeofcode.com/posts/40-photo-i-love-the-subtle-use-of-gradients-here</id>
    <updated>2009-10-21T02:49:43+01:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://madeofcode.s3.amazonaws.com/assets/production/16/original."&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/16/medium." /&gt; &lt;/a&gt; &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Paperclip, S3 &amp; Delayed Job in Rails</title>
    <link href="http://madeofcode.com/posts/42-paperclip-s3-delayed-job-in-rails" rel="alternate"/>
    <id>http://madeofcode.com/posts/42-paperclip-s3-delayed-job-in-rails</id>
    <updated>2009-10-01T01:28:00+01:00</updated>
    <content type="html">
&lt;p&gt;Here&amp;#8217;s how I use &lt;a href="http://www.thoughtbot.com/projects/paperclip/"&gt;Paperclip&lt;/a&gt; (with storage on &lt;a href="http://aws.amazon.com/s3/"&gt;S3&lt;/a&gt;) and &lt;a href="http://github.com/tobi/delayed_job"&gt;delayed_job&lt;/a&gt; to process images after they&amp;#8217;re uploaded in the background. This means users don&amp;#8217;t have to wait while the images are resized to the versions you&amp;#8217;ve specified in &lt;a href="http://rdoc.info/projects/thoughtbot/paperclip"&gt;Paperclip&amp;#8217;s &lt;span class="code"&gt;:style&lt;/span&gt; option&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Assumes you have Paperclip configured using S3 for an existing model (Image in this example) and delayed_job installed (as plugin or gem) with the required table created.&lt;/p&gt; &lt;p&gt;Add a &lt;span class="code"&gt;:processing&lt;/span&gt; flag to our model:&lt;p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;class AddProcessingToImages &lt; ActiveRecord::Migration def self.up add_column :images, :processing, :boolean end def self.down remove_column :images, :processing end end&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Then, in our model:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;class Image # define our paperclip attachment has_attached_file :source ... ... # cancel post-processing now, and set flag... before_source_post_process do |image| if image.source_changed? image.processing = true false # halts processing end end # ...and perform after save in background after_save do |image| if image.source_changed? Delayed::Job.enqueue ImageJob.new(image.id) end end # generate styles (downloads original first) def regenerate_styles! self.source.reprocess! self.processing = false self.save(false) end # detect if our source file has changed def source_changed? self.source_file_size_changed? || self.source_file_name_changed? || self.source_content_type_changed? || self.source_updated_at_changed? end ... end &lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Create a job wrapper, which used by DelayedJob:&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;class ImageJob &lt; Struct.new(:image_id) def perform Image.find(self.image_id).regenerate_styles! end end&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;Thanks to &lt;a href="http://eastblue.org/blag/2009/05/07/delaying-paperclip.html?dsq=17898661"&gt;this article&lt;/a&gt; which helped a lot.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Heroku rocks</title>
    <link href="http://madeofcode.com/posts/43-link-heroku-rocks" rel="alternate"/>
    <id>http://madeofcode.com/posts/43-link-heroku-rocks</id>
    <updated>2009-09-29T18:19:00+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://www.heroku.com"&gt;Heroku rocks&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;img src="http://r.mkserver.co.uk/assets/images/472/large/Heroku_20090929_.png"/&gt;&lt;/p&gt; &lt;p&gt;I&amp;apos;ve been trying out &lt;a href="http://heroku.com"&gt;Heroku&lt;/a&gt; for the past few weeks, and I absolutely love it. You can literally just type &lt;span class="code"&gt;git push heroku&lt;/span&gt; and you&amp;apos;re deployed.&lt;/p&gt; &lt;p&gt;Don&amp;apos;t be fooled by it&amp;apos;s simplicity though. It&amp;apos;s not a limiting platform &#8211; it supports background jobs, database replication, cron jobs, SSL, custom domains, database exporting/importing, backups, staging servers (for free if you use a simple instance). Pretty much everything you&amp;apos;d need for a production app. And because it&amp;apos;s on Amazon cloud you can talk to other Amazon web services (like S3) for free and quickly.&lt;/p&gt; &lt;p&gt;The constraint of not having a writable file system is not a problem if you use S3 (which is a good idea anyway). You can rely on the filesystem for temporary files which will last the scope of a request, so it allows any processing you need to do of files from/to S3.&lt;/p&gt; &lt;p&gt;It's worth mentioning that whilst the &lt;a href="http://docs.heroku.com"&gt;Heroku docs&lt;/a&gt; are very well written and organised, the support seemed a bit slow the few times I needed help. &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: ivar_get, ivar_set and boolean_attr_accessor</title>
    <link href="http://madeofcode.com/posts/45-link-ivar-get-ivar-set-and-boolean-attr-accessor" rel="alternate"/>
    <id>http://madeofcode.com/posts/45-link-ivar-get-ivar-set-and-boolean-attr-accessor</id>
    <updated>2009-09-25T12:36:38+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://github.com/mkdynamic/miracle_extensions/blob/master/lib/miracle_extensions.rb"&gt;ivar_get, ivar_set and boolean_attr_accessor&lt;/a&gt;&lt;/p&gt;&lt;p&gt;A few useful Ruby extensions which I made.&lt;/p&gt; &lt;p&gt;My favourite is &lt;span class="code"&gt;boolean_attr_accessor&lt;/span&gt; which provides a Rails compatible boolean virtual attribute. You get &lt;span class="code"&gt;#attr?&lt;/span&gt; and it&amp;#8217;ll also handle setting the correct boolean value when passed things like 1 or 0, or strings like &lt;span class="code"&gt;true&lt;/span&gt; or &lt;span class="code"&gt;false&lt;/span&gt; so it works with Rails view helpers and checkboxes.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Generate gem.yml and .gems for Rails</title>
    <link href="http://madeofcode.com/posts/46-generate-gem-yml-and-gems-for-rails" rel="alternate"/>
    <id>http://madeofcode.com/posts/46-generate-gem-yml-and-gems-for-rails</id>
    <updated>2009-09-23T13:05:13+01:00</updated>
    <content type="html">
&lt;p&gt;A rake task which will generate gem configuration files based on your &lt;span class="code"&gt;config.gem&lt;/span&gt; specifications in Rails. This comes in handy when deploying to Engine Yard, or Heroku. Just run it before deploying to update the files.&lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;namespace :gems do desc "Spit out gems.yml and .gems in root of app (for Heroku + EY etc.)" task :specify =&gt; :environment do gems = Rails.configuration.gems # output gems.yml yaml = File.join(RAILS_ROOT, "gems.yml") File.open(yaml, "w") do |f| output = [] gems.each do |gem| spec = { "name" =&gt; gem.name, "version" =&gt; gem.version_requirements.to_s } spec["install_options"] = "--source #{gem.source}" if gem.source output &lt;&lt; spec end f.write output.to_yaml puts output.to_yaml end # output .gems dot_gems = File.join(RAILS_ROOT, ".gems") File.open(dot_gems, "w") do |f| output = [] gems.each do |gem| spec = "#{gem.name} --version '#{gem.version_requirements.to_s}'" spec &lt;&lt; " --source #{gem.source}" if gem.source output &lt;&lt; spec end f.write output.join("\n") puts output.join("\n") end end end&lt;/code&gt;&lt;/pre&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Bash shortcut for opening TextMate projects</title>
    <link href="http://madeofcode.com/posts/50-link-bash-shortcut-for-opening-textmate-projects" rel="alternate"/>
    <id>http://madeofcode.com/posts/50-link-bash-shortcut-for-opening-textmate-projects</id>
    <updated>2009-09-07T05:34:00+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://gist.github.com/109591"&gt;Bash shortcut for opening TextMate projects&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Opens project file if it exists, or else just opens the directory.&lt;/p&gt; &lt;pre&gt;&lt;code&gt;mm(){ [ -f *.tmproj ] &amp;&amp; open -a 'textmate' `ls -lG *.tmproj | awk '{print $9}'` || mate . }&lt;/code&gt;&lt;/pre&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Abandoning Cucumber where I'm the client</title>
    <link href="http://madeofcode.com/posts/51-link-abandoning-cucumber-where-i-m-the-client" rel="alternate"/>
    <id>http://madeofcode.com/posts/51-link-abandoning-cucumber-where-i-m-the-client</id>
    <updated>2009-09-07T05:32:00+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://gist.github.com/109615"&gt;Abandoning Cucumber where I'm the client&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Here&amp;#8217;s a real example of a test I recently converted from Cucumber to plain old Rails IntegrationTest. I don&amp;#8217;t see the benefit of Cucumber for projects were I am the one and only client. It just creates overhead. &lt;/p&gt; &lt;pre&gt;&lt;code class="ruby"&gt;require 'test_helper' class SignupTest &lt; ActionController::IntegrationTest test "signing up" do # Given there are X users 2.times { Factory(:user) } users_count = User.count # When I go to the signup page visit path_to('the signup page') # And I fill in "Name" with "joebloggs" fill_in "Name", :with =&gt; "joebloggs" # And I fill in "Password" with "password" fill_in "Password", :with =&gt; "password" # And I fill in "Confirm password" with "password" fill_in "Confirm password", :with =&gt; "password" # And I press "Save" click_button "Save" # Then I should see "Dashboard" assert_contain "Dashboard" # And there should now be X+1 users assert_equal (users_count + 1), User.count end end&lt;/code&gt;&lt;/pre&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Use 37signals' Backpack as a CMS</title>
    <link href="http://madeofcode.com/posts/52-link-use-37signals-backpack-as-a-cms" rel="alternate"/>
    <id>http://madeofcode.com/posts/52-link-use-37signals-backpack-as-a-cms</id>
    <updated>2009-08-24T01:38:00+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://github.com/mkdynamic/gu/tree/master"&gt;Use 37signals' Backpack as a CMS&lt;/a&gt;&lt;/p&gt;&lt;p&gt;A tiny rails app allowing you to use 37signals&amp;#8217; Backpack as a basic CMS. &lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>PHOTO: The recently redesigned website for my web design consultancy, mkdynam...</title>
    <link href="http://madeofcode.com/posts/53-photo-the-recently-redesigned-website-for-my-web-design-consultancy-mkdynamic-it-s-much-simpler-t" rel="alternate"/>
    <id>http://madeofcode.com/posts/53-photo-the-recently-redesigned-website-for-my-web-design-consultancy-mkdynamic-it-s-much-simpler-t</id>
    <updated>2009-08-24T01:07:22+01:00</updated>
    <content type="html">
&lt;p&gt; &lt;a style="border: none; text-decoration: none;" href="http://mkdynamic.co.uk"&gt; &lt;img src="http://madeofcode.s3.amazonaws.com/assets/production/19/medium." /&gt; &lt;/a&gt; &lt;/p&gt; &lt;p&gt;The recently redesigned website for my web design consultancy, mkdynamic. It&#8217;s much simpler than the previous version and more focused on the work rather than having heaps of text.&lt;/p&gt; &lt;p&gt;I&#8217;ve also concentrated on the 3 core areas of business; website design, building web apps, and providing email marketing. Previously I had loads of stuff about extra services which I rarely provided.&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Nicely designed login screen</title>
    <link href="http://madeofcode.com/posts/54-link-nicely-designed-login-screen" rel="alternate"/>
    <id>http://madeofcode.com/posts/54-link-nicely-designed-login-screen</id>
    <updated>2009-08-18T22:12:14+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://www.dribbble.com"&gt;Nicely designed login screen&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>LINK: Twitter 101 for Business &#8212; A Special Guide</title>
    <link href="http://madeofcode.com/posts/55-link-twitter-101-for-business-a-special-guide" rel="alternate"/>
    <id>http://madeofcode.com/posts/55-link-twitter-101-for-business-a-special-guide</id>
    <updated>2009-08-06T21:30:20+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://business.twitter.com/twitter101"&gt;Twitter 101 for Business &#8212; A Special Guide&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
  <entry>
    <title>Show size of all MySQL tables</title>
    <link href="http://madeofcode.com/posts/56-show-size-of-all-mysql-tables" rel="alternate"/>
    <id>http://madeofcode.com/posts/56-show-size-of-all-mysql-tables</id>
    <updated>2009-08-06T21:13:00+01:00</updated>
    <content type="html">
&lt;p&gt;It&amp;#8217;s not pretty but it does the job:&lt;/p&gt; &lt;pre&gt;&lt;code&gt;`which mysql` -u root -p INFORMATION_SCHEMA -e 'SELECT s.schema_name, CONCAT(IFNULL(ROUND((SUM(t.data_length) +SUM(t.index_length))/1024/1024,2),0.00),"Mb") total_size, CONCAT(IFNULL(ROUND(((SUM(t.data_length)+SUM(t.index_length)) -SUM(t.data_free))/1024/1024,2),0.00),"Mb") data_used, CONCAT(IFNULL(ROUND(SUM(data_free)/1024/1024,2),0.00),"Mb") data_free, IFNULL(ROUND((((SUM(t.data_length)+SUM(t.index_length)) -SUM(t.data_free))/((SUM(t.data_length) +SUM(t.index_length)))*100),2),0) pct_used, COUNT(table_name) total_tables FROM INFORMATION_SCHEMA.SCHEMATA s LEFT JOIN INFORMATION_SCHEMA.TABLES t ON s.schema_name = t.table_schema GROUP BY s.schema_name ORDER BY SUM(t.data_length)+SUM(t.index_length) DESC;'&lt;/code&gt;&lt;/pre&gt; &lt;pre&gt;&lt;code&gt;+--------+------------+-----------+-----------+----------+--------------+ | schema | total_size | data_used | data_free | pct_used | total_tables | +--------+------------+-----------+-----------+----------+--------------+ | foo | 63.99Mb | 63.99Mb | 0.00Mb | 100.00 | 2 | | bar | 0.03Mb | 0.03Mb | 0.00Mb | 100.00 | 2 | +--------+------------+-----------+-----------+----------+--------------+&lt;/code&gt;&lt;/pre&gt;    </content>
  </entry>
  <entry>
    <title>LINK: What should your app should cost?</title>
    <link href="http://madeofcode.com/posts/58-link-what-should-your-app-should-cost" rel="alternate"/>
    <id>http://madeofcode.com/posts/58-link-what-should-your-app-should-cost</id>
    <updated>2009-08-04T02:28:00+01:00</updated>
    <content type="html">
&lt;p&gt;Link: &lt;a href="http://is.gd/219CY"&gt;What should your app should cost?&lt;/a&gt;&lt;/p&gt;    </content>
  </entry>
</feed>
