<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom">
  <title>thechrisoshow</title>
  <id>http://thechrisoshow.com</id>
  <updated>2007-05-27T00:00:00Z</updated>
  <author>
    <name />
  </author>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/thechrisoshow" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="thechrisoshow" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
    <title>Brainstorming doesn't work</title>
    <link href="http://thechrisoshow.com/2012/02/08/brainstorming-doesnt-work/" rel="alternate" />
    <id>http://thechrisoshow.com/2012/02/08/brainstorming-doesnt-work/</id>
    <published>2012-02-08T00:00:00Z</published>
    <updated>2012-02-08T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;p&gt;The Jan 30 edition of the New Yorker has a fantastic article by Jonah Lehrer about brainstorming. Read it here: &lt;a href="http://www.newyorker.com/reporting/2012/01/30/120130fa_fact_lehrer"&gt;GroupThink by Jonah Lehrer&lt;/a&gt; (subscription required).&lt;/p&gt;

&lt;p&gt;The conclusion of the article is quite surprising.  Studies show that groups using &lt;strong&gt;brainstorming techniques churn out fewer ideas&lt;/strong&gt; than if the individual participants had written down a list of ideas on their own. Also, the &lt;strong&gt;ideas that were generated were poorer quality&lt;/strong&gt; than the individual efforts&amp;hellip;&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;The Jan 30 edition of the New Yorker has a fantastic article by Jonah Lehrer about brainstorming. Read it here: &lt;a href="http://www.newyorker.com/reporting/2012/01/30/120130fa_fact_lehrer"&gt;GroupThink by Jonah Lehrer&lt;/a&gt; (subscription required).&lt;/p&gt;

&lt;p&gt;The conclusion of the article is quite surprising.  Studies show that groups using &lt;strong&gt;brainstorming techniques churn out fewer ideas&lt;/strong&gt; than if the individual participants had written down a list of ideas on their own. Also, the &lt;strong&gt;ideas that were generated were poorer quality&lt;/strong&gt; than the individual efforts.&lt;/p&gt;

&lt;p&gt;The ineffectiveness of brainstorming stems from the very thing that we thought made it important &amp;ndash; not critiquing other&amp;rsquo;s ideas.&lt;/p&gt;

&lt;p&gt;From the article:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;“Debate and criticism do not inhibit ideas but, rather, stimulate them relative to every other condition,”&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Lehrer explains that the key to a productive group thinking session is to &lt;strong&gt;encourage debate and dissent&lt;/strong&gt;. When someone says something that you don&amp;rsquo;t agree with it gets the brain working, and forces you to question your assumptions.  Rather than spit out any random thing, you actually have to think!&lt;/p&gt;

&lt;p&gt;So, let&amp;rsquo;s put this into practice! But how do you have a reasoned debate session that doesn&amp;rsquo;t erupt into a heated argument?&lt;/p&gt;

&lt;h2&gt;1. Appoint an adjudicator&lt;/h2&gt;

&lt;p&gt;Make sure someone is in control. Their job is to keep everyone on topic and to ensure that everyone gets a fair say.&lt;/p&gt;

&lt;h2&gt;2. Stay on target&lt;/h2&gt;

&lt;p&gt;Start with phrasing the problem like a question and have it written down on a white board for all to see.  If the adjudicator is spotting someone going off target they can then swing them back by pointing at the question.&lt;/p&gt;

&lt;h2&gt;3. Critique the idea not the person&lt;/h2&gt;

&lt;p&gt;Instead of saying &amp;lsquo;You are wrong&amp;rsquo; say &amp;lsquo;I disagree with you&amp;rsquo;. The key is to focus on what people are saying.&lt;/p&gt;

&lt;p&gt;Avoid inflammatory phrases. As soon as you say &amp;ldquo;That&amp;rsquo;s a stupid idea&amp;rdquo; it sounds like you&amp;rsquo;re saying &amp;ldquo;You are stupid.&amp;rdquo;  This naturally causes people to get defensive and guarded.  If the idea is stupid, you need to explain &lt;em&gt;why&lt;/em&gt; it&amp;rsquo;s stupid.&lt;/p&gt;

&lt;div class="picture"&gt;&lt;img src="https://s3.amazonaws.com/thechrisoshow/images/12_angry_men.jpg" title="12 Angry Men - the best way to come to an agreement?" alt="12 angry men" /&gt;&lt;br/&gt;12 Angry Men - the best way to come to an agreement?&lt;/div&gt;


&lt;h2&gt;4. Listen&lt;/h2&gt;

&lt;p&gt;One person should speak at a time while the group listens. Put your pride aside and listen to what people have to say. Don&amp;rsquo;t interrupt when someone&amp;rsquo;s saying something that sounds dumb, instead make a quick note on a piece of paper and then continue hearing them out.  Let them have their say, and when they&amp;rsquo;re done let &amp;lsquo;em have it.&lt;/p&gt;

&lt;h2&gt;5. Have a time limit&lt;/h2&gt;

&lt;p&gt;Debates can get tiresome &amp;ndash; especially if you&amp;rsquo;re not sure how much longer you have to go! Make these meetings last no longer than 25 minutes.  Any shorter and you don&amp;rsquo;t have enough time for a proper debate, any longer and people lose interest and their brains get fried.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Auto-refresh a webpage with &lt;strike&gt;javascript&lt;/strike&gt; html</title>
    <link href="http://thechrisoshow.com/2011/06/15/auto-refresh-a-webpage-with-javascript/" rel="alternate" />
    <id>http://thechrisoshow.com/2011/06/15/auto-refresh-a-webpage-with-javascript/</id>
    <published>2011-06-15T00:00:00Z</published>
    <updated>2011-06-15T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;p&gt;I&amp;rsquo;m currently working on an app that has a dashboard-style page that we needs to be automatically refreshed.  After digging around, I realised that the code to do this was ridiculously trivial:&lt;/p&gt;

&lt;script src="https://gist.github.com/1026820.js"&gt; &lt;/script&gt;

</summary>
    <content type="html">&lt;p&gt;I&amp;rsquo;m currently working on an app that has a dashboard-style page that we needs to be automatically refreshed.  After digging around, I realised that the code to do this was ridiculously trivial:&lt;/p&gt;

&lt;script src="https://gist.github.com/1026820.js"&gt; &lt;/script&gt;


&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Frederic in the comments mentioned a way nicer way of doing this, without needing Javascript.  Simple add a refresh meta tag in the header of your html.&lt;/p&gt;

&lt;p&gt;e.g.&lt;/p&gt;

&lt;script src="https://gist.github.com/1027279.js"&gt; &lt;/script&gt;


&lt;p&gt;The browser automatically knows how to handle it, and you don&amp;rsquo;t need any messy javascript!&lt;/p&gt;

&lt;p&gt;Find more information about meta refresh here: &lt;a href="http://en.wikipedia.org/wiki/Meta_refresh"&gt;http://en.wikipedia.org/wiki/Meta_refresh&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>How to host a static website on S3</title>
    <link href="http://thechrisoshow.com/2011/06/05/how-to-host-a-static-website-on-s3/" rel="alternate" />
    <id>http://thechrisoshow.com/2011/06/05/how-to-host-a-static-website-on-s3/</id>
    <published>2011-06-05T00:00:00Z</published>
    <updated>2011-06-05T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;div style='text-align: right; margin-right: 30px'&gt;
  &lt;em&gt;Updated: January 19, 2012&lt;/em&gt;
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;
I was horribly wrong about how to do the domain forwarding for naked domains &amp;ndash; however there&amp;rsquo;s a simple answer. The good folks at &lt;a href="http://wwwizer.com/naked-domain-redirect"&gt;wwizer&lt;/a&gt; have got a free naked domain rewriting service.  In order to use it simple change your &lt;strong&gt;A (Host)&lt;/strong&gt; to point to the ip address 174.129.25.170 and you&amp;rsquo;ll be sorted&amp;hellip;&lt;/p&gt;
</summary>
    <content type="html">&lt;div style='text-align: right; margin-right: 30px'&gt;
  &lt;em&gt;Updated: January 19, 2012&lt;/em&gt;
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;
I was horribly wrong about how to do the domain forwarding for naked domains &amp;ndash; however there&amp;rsquo;s a simple answer. The good folks at &lt;a href="http://wwwizer.com/naked-domain-redirect"&gt;wwizer&lt;/a&gt; have got a free naked domain rewriting service.  In order to use it simple change your &lt;strong&gt;A (Host)&lt;/strong&gt; to point to the ip address 174.129.25.170 and you&amp;rsquo;ll be sorted.
&lt;img src="https://s3.amazonaws.com/thechrisoshow/images/s3-wwizer_address.jpg" alt="wwwizer naked domain redirect" /&gt;&lt;/p&gt;

&lt;hr/&gt;


&lt;p&gt;In February this year Amazon announced that you can now host static websites on S3.  This is a great cost effective way of hosting small, simple websites (like an &lt;a href="http://www.bigbuttonsapp.com"&gt;iPhone app site&lt;/a&gt; for example).&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s how you can do it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Buy the domain name for the site you want to host.  It&amp;rsquo;s best to do this first, because the S3 bucket name has to be the same as the domain.&lt;/li&gt;
&lt;li&gt;Get an &lt;a href="http://aws.amazon.com"&gt;S3 account&lt;/a&gt; (it&amp;rsquo;s cheaper than you think, I only get billed 3c a month).&lt;/li&gt;
&lt;li&gt;Log into the &lt;a href="https://console.aws.amazon.com/s3/home"&gt;aws management console&lt;/a&gt; and create a bucket with the same name as your domain (complete with www).  So for my website &lt;a href="www.bigbuttonsapp.com"&gt;www.bigbuttonsapp.com&lt;/a&gt; I called the bucket &lt;a href="www.bigbuttonsapp.com"&gt;www.bigbuttonsapp.com&lt;/a&gt;
&lt;img src="https://s3.amazonaws.com/thechrisoshow/images/s3-hosting-bucket-name.jpg" title="S3 Hosting Bucket" alt="S3 Hosting Bucket" /&gt;&lt;/li&gt;
&lt;li&gt;So that people have permission to view your website you&amp;rsquo;ll need to upload a bucket policy. Select on the newly created bucket, and click &lt;strong&gt;Actions&lt;/strong&gt; &gt; &lt;strong&gt;Properties&lt;/strong&gt;.
On the permissions tab click &lt;strong&gt;Add bucket policy&lt;/strong&gt; and copy the following in (swapping &lt;a href="www.bigbuttonsapp.com"&gt;www.bigbuttonsapp.com&lt;/a&gt; for your own domain):&lt;/li&gt;
&lt;/ul&gt;


&lt;pre lang="xml"&gt;
{
  "Version":"2008-10-17",
  "Statement":[{
    "Sid":"PublicReadGetObject",
        "Effect":"Allow",
      "Principal": {
            "AWS": "*"
         },
      "Action":["s3:GetObject"],
      "Resource":["arn:aws:s3:::www.bigbuttonsapp.com/*"
      ]
    }
  ]
}
&lt;/pre&gt;


&lt;p&gt;&lt;img src="https://s3.amazonaws.com/thechrisoshow/images/s3-hosting-policy-editor.jpg" title="S3 Hosting policy editor" alt="S3 Hosting policy editor" /&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;While you&amp;rsquo;ve got the bucket panel open, click the &lt;strong&gt;Website&lt;/strong&gt; tab and check &lt;strong&gt;Enabled&lt;/strong&gt;. Also put the filename of your index file in the &lt;strong&gt;Index Document&lt;/strong&gt; field.
&lt;img src="https://s3.amazonaws.com/thechrisoshow/images/s3-website-tab.jpg" title="S3 Website panel" alt="S3 Website panel" /&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;You can also optional include the name of your Error Document. This is the will be the document that is shown for any 4XX class of errors.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Click the &lt;strong&gt;Upload&lt;/strong&gt; button and upload your website into that bucket.  (In my case it was 3 files, index.html, error.html and styles.css)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To test it worked, click on the &lt;strong&gt;Endpoint&lt;/strong&gt; link on the Websites tab of the bucket properties.  Hopefully you should see your website up and running! (It might take a few minutes to kick in).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Domain names&lt;/h3&gt;

&lt;p&gt;Almost there, now just have to get the domain name running correctly. For this you&amp;rsquo;ll need to set up a CNAME redirect for www.&lt;br/&gt;
I know it&amp;rsquo;s horrible, but I use Godaddy, and here&amp;rsquo;s how I got this to work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log into the Godaddy domain management console and edit your zone file.&lt;/li&gt;
&lt;li&gt;Amazon S3 static website doesn&amp;rsquo;t support naked domain rewriting, but thankfully  &lt;a href="http://wwwizer.com/naked-domain-redirect"&gt;wwizer&lt;/a&gt; provide it as a free service.  In order to use it simply change the &lt;strong&gt;A (Host)&lt;/strong&gt; to the ip address 174.129.25.170
&lt;img src="https://s3.amazonaws.com/thechrisoshow/images/s3-wwizer_address.jpg" alt="wwwizer naked domain redirect" /&gt;&lt;/li&gt;
&lt;li&gt;Edit the &lt;strong&gt;www&lt;/strong&gt; subdomain to point to the endpoint that S3 gave you.
&lt;img src="https://s3.amazonaws.com/thechrisoshow/images/s3-hosting-change-to-end-point.jpg" title="Godaddy - edit subdomain" alt="Godaddy - edit subdomain" /&gt;&lt;/li&gt;
&lt;li&gt;Save the Zone File&lt;/li&gt;
&lt;li&gt;Click save, and now you should be able to browse to your site, all up and running!&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;BONUS UPLOAD SCRIPT&lt;/h3&gt;

&lt;p&gt;Here&amp;rsquo;s a script I created that let&amp;rsquo;s you upload your files to S3 with ease.
It doesn&amp;rsquo;t handle subdirectories, and it uploads all the files all the time (which isn&amp;rsquo;t very cost  efficient) &amp;ndash; but for small websites it&amp;rsquo;s pretty useful.&lt;/p&gt;

&lt;p&gt;To use it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Install the S3 gem with &lt;code&gt;gem install aws-s3&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy the script into your website directory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;Change the access key, secret and bucket name to your amazon credentials.&lt;/li&gt;
&lt;li&gt;Run it with: &lt;code&gt;ruby upload.rb&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;script src="https://gist.github.com/1008942.js"&gt; &lt;/script&gt;

</content>
  </entry>
  <entry>
    <title>Introducing Big Buttons</title>
    <link href="http://thechrisoshow.com/2011/04/30/introducing-big-buttons/" rel="alternate" />
    <id>http://thechrisoshow.com/2011/04/30/introducing-big-buttons/</id>
    <published>2011-04-30T00:00:00Z</published>
    <updated>2011-04-30T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;iframe width="560" height="349" src="http://www.youtube.com/embed/9n8Fk_ruHu0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;


&lt;p&gt;Here&amp;rsquo;s a video demo of an iPhone app I&amp;rsquo;ve been working on called &lt;em&gt;Big Buttons&lt;/em&gt;.  The idea behind it is that it allows you to control your mac with your phone&amp;hellip;&lt;/p&gt;
</summary>
    <content type="html">&lt;iframe width="560" height="349" src="http://www.youtube.com/embed/9n8Fk_ruHu0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;


&lt;p&gt;Here&amp;rsquo;s a video demo of an iPhone app I&amp;rsquo;ve been working on called &lt;em&gt;Big Buttons&lt;/em&gt;.  The idea behind it is that it allows you to control your mac with your phone.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve made a bunch of buttons that do a wide range of things, but users can also make their own buttons using AppleScript.&lt;/p&gt;

&lt;p&gt;I have a modest budget for a designer to help me make Big Buttons beautiful, so email me at &lt;a href="&amp;#109;&amp;#97;&amp;#105;&amp;#x6c;&amp;#116;&amp;#x6f;&amp;#58;&amp;#x74;&amp;#104;&amp;#x65;&amp;#x63;&amp;#x68;&amp;#114;&amp;#105;&amp;#x73;&amp;#x6f;&amp;#115;&amp;#104;&amp;#111;&amp;#x77;&amp;#x40;&amp;#103;&amp;#109;&amp;#x61;&amp;#x69;&amp;#108;&amp;#46;&amp;#x63;&amp;#x6f;&amp;#109;"&gt;&amp;#x74;&amp;#104;&amp;#101;&amp;#x63;&amp;#x68;&amp;#114;&amp;#105;&amp;#x73;&amp;#x6f;&amp;#x73;&amp;#104;&amp;#111;&amp;#119;&amp;#x40;&amp;#x67;&amp;#x6d;&amp;#97;&amp;#x69;&amp;#108;&amp;#x2e;&amp;#99;&amp;#x6f;&amp;#x6d;&lt;/a&gt; if you&amp;rsquo;re interested in helping out.  Also email me if you want to join the beta.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Speed up gem installs by not building the docs</title>
    <link href="http://thechrisoshow.com/2011/01/24/speed-up-gem-installs-by-not-building-the-docs/" rel="alternate" />
    <id>http://thechrisoshow.com/2011/01/24/speed-up-gem-installs-by-not-building-the-docs/</id>
    <published>2011-01-24T00:00:00Z</published>
    <updated>2011-01-24T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;p&gt;You know what it&amp;rsquo;s like &amp;ndash; you install a gem and are confronted by minutes of this:&lt;/p&gt;

&lt;pre&gt;
Installing ri documentation for bananas-0.4.9...
Building YARD (yri) index for bananas-0.4.9...
Installing RDoc documentation for bananas-0.4.9..
&lt;/pre&gt;


&lt;p&gt;I never look at the docs on my local machine, I either read the source, or look up the docs online.  So why bother installing all those docs?&lt;/p&gt;

&lt;p&gt;Edit your&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;You know what it&amp;rsquo;s like &amp;ndash; you install a gem and are confronted by minutes of this:&lt;/p&gt;

&lt;pre&gt;
Installing ri documentation for bananas-0.4.9...
Building YARD (yri) index for bananas-0.4.9...
Installing RDoc documentation for bananas-0.4.9..
&lt;/pre&gt;


&lt;p&gt;I never look at the docs on my local machine, I either read the source, or look up the docs online.  So why bother installing all those docs?&lt;/p&gt;

&lt;p&gt;Edit your /.gemrc file and add the following lines:&lt;/p&gt;

&lt;pre&gt;
install: --no-rdoc --no-ri --yri
update: --no-rdoc --no-ri --yri
&lt;/pre&gt;


&lt;p&gt;Boom &amp;ndash; no more updating your docs &amp;ndash; installing gems just became RIDICULOUSLY FAST.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Are your cukes not timing out?</title>
    <link href="http://thechrisoshow.com/2010/11/23/are-your-cukes-not-timing-out/" rel="alternate" />
    <id>http://thechrisoshow.com/2010/11/23/are-your-cukes-not-timing-out/</id>
    <published>2010-11-23T00:00:00Z</published>
    <updated>2010-11-23T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;p&gt;Whenever we&amp;rsquo;d run the full &lt;a href="http://cukes.info"&gt;cucumber&lt;/a&gt; suite we found that were not timing out if they couldn&amp;rsquo;t find a particular element on the page.&lt;/p&gt;

&lt;p&gt;For us, the problem was to do with &lt;a href="https://github.com/jtrupiano/timecop"&gt;Timecop&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You see, we&amp;rsquo;re using &lt;a href="https://github.com/jtrupiano/timecop"&gt;Timecop&lt;/a&gt; in our features like this:&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;Whenever we&amp;rsquo;d run the full &lt;a href="http://cukes.info"&gt;cucumber&lt;/a&gt; suite we found that were not timing out if they couldn&amp;rsquo;t find a particular element on the page.&lt;/p&gt;

&lt;p&gt;For us, the problem was to do with &lt;a href="https://github.com/jtrupiano/timecop"&gt;Timecop&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You see, we&amp;rsquo;re using &lt;a href="https://github.com/jtrupiano/timecop"&gt;Timecop&lt;/a&gt; in our features like this:&lt;/p&gt;

&lt;pre lang="ruby"&gt;
  # in features/cucumber_feature.feature
  Given the date is "21 June 2010"
    
  # in features/step_definitions/time_steps.rb
  Given /^the (date|time) is (.+)$/ do |_,string|
    Timecop.freeze(Chronic.parse(string))
  end
&lt;/pre&gt;


&lt;p&gt;This is great, because it allows us to fix the time to whenever we want.  And because we use &lt;a href="https://github.com/mojombo/chronic/"&gt;Chronic&lt;/a&gt; we can use natural language.&lt;/p&gt;

&lt;p&gt;However, because this messes with time, the time outs weren&amp;rsquo;t getting called properly! The easy fix was to put this in our a file in the features/support directory:&lt;/p&gt;

&lt;pre lang="ruby"&gt;
  # in features/support/hooks.rb
  After do 
    Timecop.return 
  end
&lt;/pre&gt;


&lt;p&gt;This gets called after every scenario and sets the time back to normal, thus removing the timeout bug.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>How to make embeddable snippets with Rails</title>
    <link href="http://thechrisoshow.com/2010/10/19/how-to-make-embeddable-snippets-with-rails/" rel="alternate" />
    <id>http://thechrisoshow.com/2010/10/19/how-to-make-embeddable-snippets-with-rails/</id>
    <published>2010-10-19T00:00:00Z</published>
    <updated>2010-10-19T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;p&gt;Embedding a gist is a doddle &amp;ndash; you create the gist, and copy the snippet, and BAM you end up with something like this:&lt;/p&gt;

&lt;script src="http://gist.github.com/633792.js?file=gistfile1.txt"&gt;&lt;/script&gt;


&lt;p&gt;I wanted to add this ability to &lt;a href="http://www.spoilertweet.com"&gt;Spoiler Tweet&lt;/a&gt; so that people can embed spoilers on their blogs (and also in the hopes that one day I&amp;rsquo;ll get access to #newtwitter &amp;rsquo;s right hand side pane.)&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;Embedding a gist is a doddle &amp;ndash; you create the gist, and copy the snippet, and BAM you end up with something like this:&lt;/p&gt;

&lt;script src="http://gist.github.com/633792.js?file=gistfile1.txt"&gt;&lt;/script&gt;


&lt;p&gt;I wanted to add this ability to &lt;a href="http://www.spoilertweet.com"&gt;Spoiler Tweet&lt;/a&gt; so that people can embed spoilers on their blogs (and also in the hopes that one day I&amp;rsquo;ll get access to #newtwitter &amp;rsquo;s right hand side pane.)&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s an example of a Spoiler Tweet embed:&lt;/p&gt;

&lt;script src="http://spoilertweet.com/q.js"&gt;&lt;/script&gt;


&lt;p&gt;How&amp;rsquo;d I do that?  Well, with Rails it&amp;rsquo;s incredibly simple.  In Spoiler Tweet I have a TweetsController for displaying Tweets.&lt;/p&gt;

&lt;pre lang="ruby"&gt;
# app/controllers/tweets_controller.rb
class TweetsController &lt; ApplicationController
  def show
    @tweet = Tweet.find(params[:id])
  end
end
&lt;/pre&gt;


&lt;p&gt;All I had to do to get an embeddable snippet to appear was to add a show.js.erb template file:&lt;/p&gt;

&lt;pre lang="rhtml"&gt;
&lt;!-- app/views/tweets/show.js.erb --&gt;
document.write('&lt;link rel="stylesheet" href="http://spoilertweet.com/stylesheets/embed.css"/&gt;')
document.write('&lt;%= escape_javascript(render(:partial =&gt; "embedded_tweet")) %&gt;');
&lt;/pre&gt;


&lt;p&gt;What this does is insert a javascript snippet into the page that does two things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;include a custom stylesheet (for styling your embed).  Make sure that this css file is compact and specifically targets your markup.&lt;/li&gt;
&lt;li&gt;inject a partial onto the page&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Note the &lt;em&gt;escape_javascript&lt;/em&gt; method &amp;ndash; this ensures that your partial parsed in a way that js can understand.&lt;/p&gt;

&lt;p&gt;Now to embed the file, just simply have your users put something like this in their template files:&lt;/p&gt;

&lt;pre lang="js"&gt;
  &lt;script src="http://spoilertweet.com/12312.js"&gt;&lt;/script&gt;
&lt;/pre&gt;


&lt;p&gt;Pretty simple!&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Get real with your specs, punk</title>
    <link href="http://thechrisoshow.com/2010/04/27/get-real-with-your-specs-punk/" rel="alternate" />
    <id>http://thechrisoshow.com/2010/04/27/get-real-with-your-specs-punk/</id>
    <published>2010-04-27T00:00:00Z</published>
    <updated>2010-04-27T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;p&gt;In my rspec spec definitions I was finding myself constantly repeating the word &amp;#8220;should&amp;#8221;.
Like:&lt;/p&gt;

&lt;pre lang="ruby" name='code'&gt;
it "should add two numbers together" 
it "should taste like bananas" 
&lt;/pre&gt;


&lt;p&gt;And it&amp;rsquo;s not just me that does this, the standard rspec rails generators have &amp;#8220;should&amp;#8221; in them too:&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;In my rspec spec definitions I was finding myself constantly repeating the word &amp;#8220;should&amp;#8221;.
Like:&lt;/p&gt;

&lt;pre lang="ruby" name='code'&gt;
it "should add two numbers together" 
it "should taste like bananas" 
&lt;/pre&gt;


&lt;p&gt;And it&amp;rsquo;s not just me that does this, the standard rspec rails generators have &amp;#8220;should&amp;#8221; in them too:&lt;/p&gt;

&lt;pre lang="ruby" name='code'&gt;
it "should create a new instance given valid attributes" do
  Banana.create!(@valid_attributes)
end
&lt;/pre&gt;


&lt;p&gt;This irritated me, why can&amp;rsquo;t rspec be like shoulda and include the word &amp;#8220;should&amp;#8221; in the actual spec definition like this:&lt;/p&gt;

&lt;pre lang="ruby" name='code'&gt;
should "taste like bananas" 
&lt;/pre&gt;


&lt;p&gt;I asked my Twitter followers what I should do, and &lt;a href="http://twitter.com/capitalist"&gt;Joe Martinez&lt;/a&gt; responded:&lt;/p&gt;

&lt;p class="center"&gt;
&lt;a href="http://twitter.com/capitalist/status/9573493146"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2010/4/27/clint1.png" alt="" /&gt;&lt;/a&gt; 
&lt;a href="http://twitter.com/capitalist/status/9573975146"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2010/4/27/clint2.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;Should is just noise!  Eureka!&lt;/p&gt;


&lt;p&gt;&lt;a href="http://www.twitter.com/l4rk"&gt;Jon Larkowski&lt;/a&gt; from Hashrocket gave a talk at The Scottish Ruby Conference about some of the more idiosynchratic aspects of RSpec, and sure enough in his examples there weren't any sign of &amp;#8220;should&amp;#8221; in the examples.  (Read it &lt;a href="http://pure-rspec-scotruby.heroku.com/"&gt;here&lt;/a&gt;)&lt;/p&gt;


&lt;p&gt;So, now my specs look like this:&lt;/p&gt;


&lt;pre lang="ruby" name='code'&gt;
it "smells like bananas" 
it "adds two numbers together" 
&lt;/pre&gt;


&lt;p&gt;This just feels better &amp;#8211; more decisive somehow.  
As my colleague &lt;a href="http://www.twitter.com/dies_el"&gt;Andrew Donaldson&lt;/a&gt; said:&lt;/p&gt;


&lt;p&gt;&amp;#8220;Gives a rough manly edge to your specs, Clint Eastwood would never say 'should'&amp;#8221;.&lt;/p&gt;


&lt;p&gt;So, in order to remove the unnecessary shoulds from my specs I came up with this RSpec formatter:&lt;/p&gt;


&lt;script src="http://gist.github.com/313426.js"&gt;&lt;/script&gt;


&lt;p&gt;This produces a list of your specs that include the word &amp;#8220;should&amp;#8221;.&lt;/p&gt;


&lt;p&gt;So be like Clint, and be decisive with your specs, &lt;em&gt;&lt;strong&gt;Punk&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p class="center"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2010/4/27/clint-eastwood-01.jpg" alt="" /&gt;&lt;/p&gt;

</content>
  </entry>
  <entry>
    <title>An example of the art of instant feedback</title>
    <link href="http://thechrisoshow.com/2010/04/15/an-example-of-the-art-of-instant-feedback/" rel="alternate" />
    <id>http://thechrisoshow.com/2010/04/15/an-example-of-the-art-of-instant-feedback/</id>
    <published>2010-04-15T00:00:00Z</published>
    <updated>2010-04-15T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;p&gt;This morning on Twitter:&lt;/p&gt;

&lt;p class="center"&gt;&lt;a href="http://twitter.com/jasoncale/status/12210991361"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2010/4/15/Twitter__freerange1.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p class="center"&gt;&lt;a href="http://twitter.com/thechrisoshow/status/12213379505"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2010/4/15/Twitter__freerange2.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;

</summary>
    <content type="html">&lt;p&gt;This morning on Twitter:&lt;/p&gt;

&lt;p class="center"&gt;&lt;a href="http://twitter.com/jasoncale/status/12210991361"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2010/4/15/Twitter__freerange1.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p class="center"&gt;&lt;a href="http://twitter.com/thechrisoshow/status/12213379505"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2010/4/15/Twitter__freerange2.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p class="center"&gt;&lt;a href="http://twitter.com/jasoncale/status/12213529700"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2010/4/15/Twitter__freerange3.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p class="center"&gt;&lt;a href="http://twitter.com/lazyatom/status/12215084996"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2010/4/15/Twitter__freerange4.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;I love stuff like this.  Kudos to the &lt;a href="http://gofreerange.com"&gt;freerange&lt;/a&gt; team.&lt;/p&gt;

&lt;p class="center"&gt;&lt;img src="http://678pla.edwards.hostingrails.com/assets/2008/10/2/rats_off_to_ya.jpg" alt="" /&gt;&lt;/p&gt;

</content>
  </entry>
  <entry>
    <title>Gravatar default images - a better way</title>
    <link href="http://thechrisoshow.com/2010/01/26/gravatar-default-images-a-better-way/" rel="alternate" />
    <id>http://thechrisoshow.com/2010/01/26/gravatar-default-images-a-better-way/</id>
    <published>2010-01-26T00:00:00Z</published>
    <updated>2010-01-26T00:00:00Z</updated>
    <author>
      <name />
    </author>
    <summary type="html">&lt;p&gt;At &lt;a href="http://www.harmonypark.net"&gt;Harmonypark&lt;/a&gt; we decided to put gravatars into one of our applications (which is so easy it&amp;#8217;s not funny) &amp;#8211; and when the time came to select the default images for the gravatar I piped up: &amp;#8220;I know how to fix this!&amp;#8221; and pointed to a blog post I wrote about it long ago: &lt;a href="http://678pla.edwards.hostingrails.com/2008/10/27/adding-gravatars-to-your-rails-apps"&gt;(You can read it here.)&lt;/a&gt;&lt;/p&gt;
</summary>
    <content type="html">&lt;p&gt;At &lt;a href="http://www.harmonypark.net"&gt;Harmonypark&lt;/a&gt; we decided to put gravatars into one of our applications (which is so easy it&amp;#8217;s not funny) &amp;#8211; and when the time came to select the default images for the gravatar I piped up: &amp;#8220;I know how to fix this!&amp;#8221; and pointed to a blog post I wrote about it long ago: &lt;a href="http://678pla.edwards.hostingrails.com/2008/10/27/adding-gravatars-to-your-rails-apps"&gt;(You can read it here.)&lt;/a&gt;
My colleague &lt;a href="http://www.twitter.com/ebonical"&gt;Ebony&lt;/a&gt; came up with a great solution:&lt;br/&gt;
&lt;quote&gt;
&amp;#8220;Why not use another gravatar as the default image.&amp;#8221;
&lt;/quote&gt;&lt;/p&gt;

&lt;p&gt;Which is an utterly brilliant idea &amp;#8211; that way the default image gravatar will scale correctly, and we wouldn&amp;#8217;t have to mess around with having different image sizes for the different scaled default images. Here&amp;#8217;s how we did it:&lt;/p&gt;


&lt;p&gt;1) Go to &lt;a href="http://gravatar.com"&gt;gravatar.com&lt;/a&gt; and add a default gravatar for some email address that you won&amp;#8217;t use.&lt;/p&gt;


&lt;p&gt;2) Install the gravatar plugin&lt;/p&gt;

&lt;pre lang="ruby" name='code'&gt;
script/install http://github.com/woods/gravatar-plugin/
&lt;/pre&gt;


&lt;p&gt;3) Extend the gravatar plugin to allow for a default email address by putting this code in lib/gravatar_extension.rb (remember to include this file in a initializer).&lt;/p&gt;


&lt;pre lang="ruby" name='code'&gt;
module GravatarHelper  
  module PublicMethods  
    def gravatar_for_with_default(object, options={})
      options.merge!(:default =&gt;  
           gravatar_url("your-default-email@example.com", options))
      gravatar_for_without_default(object, options)  
    end  
    
    alias_method_chain :gravatar_for, :default  
  end  
end
&lt;/pre&gt;


&lt;p&gt;4) Now, everytime a user is missing a gravatar, the default image will be your default gravatar, this will handle all the awesome scaling stuff that gravatar does too&lt;/p&gt;

</content>
  </entry>
</feed>

