<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Inspired Pixel]]></title>
  <link href="http://peterhamilton.github.com/atom.xml" rel="self"/>
  <link href="http://peterhamilton.github.com/"/>
  <updated>2013-01-24T16:35:37+00:00</updated>
  <id>http://peterhamilton.github.com/</id>
  <author>
    <name><![CDATA[Pete Hamilton]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[My First GoCardless Payment]]></title>
    <link href="http://peterhamilton.github.com/blog/2012/11/19/my-first-gocardless-payment/"/>
    <updated>2012-11-19T16:37:00+00:00</updated>
    <id>http://peterhamilton.github.com/blog/2012/11/19/my-first-gocardless-payment</id>
    <content type="html"><![CDATA[<p>I recently needed to take payment from a friend for an item I had sold them. Usually this would be paypal or bank transfer affair but since I came across <a href="http://gocardless.com">GoCardless</a>, I&#8217;ve been itching to use it (<a href="https://gocardless.com/how-it-works">see how it works</a>).</p>

<p>I took the opportunity to record the process (with my friend&#8217;s assistance) of taking payments from a student&#8217;s perspective.</p>

<p>What followed was the single easiest payment process I&#8217;ve ever been through.</p>

<h2>1. Setup and Send a Paylink</h2>

<p>GoCardless Paylinks are without a doubt the most awesome invention in the world of online payments right now.</p>

<p>I choose how much the link charges and how often the person visiting it should be charged (VERY flexible but in my case this was just &#8216;once&#8217;).</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/gocardless/setup.png"></p>

<p>I also have the option to set a &#8216;redirect&#8217; link. I imagine as a company this would most likely be a &#8216;thankyou&#8217; page, however I know my friend has a love of pugs so I&#8217;m going to personalize mine and send her to an amusing <a href="http://www.youtube.com/watch?v=sVMhuiHm50I">pug-related youtube video</a> I think she&#8217;ll enjoy.</p>

<p>I dropped my friend the paylink via a facebook message but the beauty of paylinks is that I could have put this anywhere and send it to any number of people, in an email, a text, a direct message on twitter, pretty much anywhere you can stick text or a link. I could have printed it out and sent it via letter if I wanted (although this might have been a little inefficient).</p>

<h2>2. Friend Pays</h2>

<p>At this point my friend was able to enter their bank details and pay me via the link. I asked them to screenshot all the steps in the process and they sent back two images. One was this:</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/gocardless/userpay.png"></p>

<p>And the next was this:</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/gocardless/pugs.png"></p>

<p>Needless to say, she found getting redirected to the youtube clip hilarious :)</p>

<p><em>Note: There was also the login screen I think since this was their first GoCardless payment but you could almost argue that since they didn&#8217;t even mention it it must have been super easy</em></p>

<h2>3. Rolling in $$$</h2>

<p>At this point I received an email letting me know I&#8217;d been paid:</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/gocardless/email.png"></p>

<p>I could also see the payment on my GoCardless Overview and in my list of payments:</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/gocardless/payments.png"></p>

<h2>Conclusion</h2>

<p>That&#8217;s literally it. I do lose 1% of my transaction up to £2 in commission but it&#8217;s way less than their competitors and for a process this awesome, it&#8217;s a no brainer.</p>

<p>I highly recommend you check it out, maybe you could use it to settle a few I.O.Us, collect the rent or split the heating bill this winter? If you&#8217;re a small business, you probably have even more to gain by giving it a look since their <a href="https://gocardless.com/how-it-works/api">API</a> is incredible.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Adding Travis CI to a Ruby Project]]></title>
    <link href="http://peterhamilton.github.com/blog/2012/11/17/adding-travis-ci-to-a-ruby-project/"/>
    <updated>2012-11-17T17:05:00+00:00</updated>
    <id>http://peterhamilton.github.com/blog/2012/11/17/adding-travis-ci-to-a-ruby-project</id>
    <content type="html"><![CDATA[<p>So over the last few days I created a gem to help me generate weekly digest emails for my university computing society. <a href="https://github.com/PeterHamilton/digest-email">See the Project</a></p>

<p>I often wish I could use <a href="www.travis-ci.com">Travis CI</a> for my projects but usually the repositories are private and so I&#8217;m forced to find an alternative (see <a href="http://peterhamilton.github.com/blog/2012/10/27/continuous-integration-for-rails-with-circleci/">my previous post on ci</a>).</p>

<p>This time however, my project is fully public and so I wanted to make use of Travis and also get those nice build messages you often see on github like this:
<img class="center" src="http://peterhamilton.github.com/images/blog_images/misc/travis_ci_buildimage.png"></p>

<p>I had a bit of a trial and error first experience with Travis CI so I wanted to note down here how to do it for future projects.</p>

<h2>1. Add <code>.travis.yml</code> in the root of your project</h2>

<p>This will be used by travis-ci when building your project and defines what to test against.</p>

<p>For my digest email project (a command line ruby gem) it looks like this:</p>

<figure class='code'><figcaption><span>.travis.yml</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="n">language</span><span class="p">:</span> <span class="n">ruby</span>
</span><span class='line'><span class="n">rvm</span><span class="p">:</span>
</span><span class='line'>  <span class="o">-</span> <span class="mi">1</span><span class="o">.</span><span class="mi">9</span><span class="o">.</span><span class="mi">3</span>
</span><span class='line'>  <span class="o">-</span> <span class="mi">1</span><span class="o">.</span><span class="mi">8</span><span class="o">.</span><span class="mi">7</span>
</span></code></pre></td></tr></table></div></figure>


<p>Mine simply says to test against Ruby 1.9.3 and 1.8.7 but there are a lot more configuration options available depending on what kind of application you&#8217;re testing. <a href="http://about.travis-ci.org/docs/user/build-configuration/">See here</a> for more info.</p>

<h2>2. Depend on the <code>rake</code> gem</h2>

<p>Travis CI uses rake to run your tests so you need to require it in your Gemfile. If you want you can only put it in the test group.</p>

<figure class='code'><figcaption><span>Gemfile</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="n">group</span> <span class="ss">:test</span> <span class="k">do</span>
</span><span class='line'>  <span class="n">gem</span> <span class="s1">&#39;rake&#39;</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<h2>3. Make sure your Rakefile has a default task</h2>

<p>Travis CI will attempt to run <code>rake</code> to execute your tests. You need to ensure you have a default task which will run all the tests you wish to execute.</p>

<p>My Rake file for the digest-email gem looks like this:</p>

<figure class='code'><figcaption><span>Rakefile</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="nb">require</span> <span class="s2">&quot;bundler/gem_tasks&quot;</span>
</span><span class='line'><span class="nb">require</span> <span class="s1">&#39;rspec/core/rake_task&#39;</span>
</span><span class='line'>
</span><span class='line'><span class="no">RSpec</span><span class="o">::</span><span class="no">Core</span><span class="o">::</span><span class="no">RakeTask</span><span class="o">.</span><span class="n">new</span>
</span><span class='line'>
</span><span class='line'><span class="n">task</span> <span class="ss">:default</span> <span class="o">=&gt;</span> <span class="ss">:spec</span>
</span></code></pre></td></tr></table></div></figure>


<p>Push this all to your project and you&#8217;re ready to link Travis to your repository.</p>

<h2>4. Ask Travis to test your repository</h2>

<ol>
<li>Visit https://travis-ci.org/ and sign in with github</li>
<li>Visit https://travis-ci.org/profile/YOUR_GITHUB_USERNAME</li>
<li><p>Switch on testing for your repo by finding it and flicking the switch.
You may need to sync with your github account if the repository doesn&#8217;t appear.Also, only public repositories will be visible.
<img class="center" src="http://peterhamilton.github.com/images/blog_images/misc/travis_ci_switch.png"></p></li>
<li><p>Visit https://travis-ci.org/YOUR_GITHUB_USERNAME/GITHUB_REPO_NAME
You&#8217;ll see the current build status. You&#8217;ll notice that travis has yet to run any tests. This will update whenever you push your code to github.</p></li>
</ol>


<h2>5. The icing on the cake - build status images</h2>

<p>This is really simple, in your github readme, simply add the following snippet onto your title, like this (if using markdown):</p>

<figure class='code'><figcaption><span>Readme.md</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='text'><span class='line'># DigestEmail [![Build Status](https://travis-ci.org/PeterHamilton/digest-email.png)](https://travis-ci.org/PeterHamilton/digest-email)
</span></code></pre></td></tr></table></div></figure>


<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/misc/travis_ci_buildimage.png"></p>

<p>For other README formats or to show build statuses for specific branches <a href="http://about.travis-ci.org/docs/user/status-images/">see here</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Mail.app Gmail Aliases]]></title>
    <link href="http://peterhamilton.github.com/blog/2012/11/02/mail-dot-app-gmail-aliases/"/>
    <updated>2012-11-02T19:07:00+00:00</updated>
    <id>http://peterhamilton.github.com/blog/2012/11/02/mail-dot-app-gmail-aliases</id>
    <content type="html"><![CDATA[<p>For a while now I&#8217;ve been using <a href="http://www.gmail.com">Gmail</a> in the browser but recently I decided to make the switch back to Mail.app</p>

<p>One of the things I made extensive use of in Gmail was consolidating all my email accounts through one main account. From that main account I could receive and send email as any one of many aliases.</p>

<p>However in Mail.app, when I signed in with my Google credentials, I could only send mail from the main account. Disaster.</p>

<p>However while fiddling around I discovered this nifty secret in Mail.app settings where you can enter multiple email addresses in one box.</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/misc/apple_mail_aliases_hover.png"></p>

<p>Completely confused as to why this isn&#8217;t publicized, I guess it probably only works if you can successfully send mail from them all through the same SMTP server so isn&#8217;t a standard user feature. Great for Gmail Aliases though!</p>

<ol>
<li>Open Mail&#8217;s preferences: <code>Mail &gt; Preferences</code></li>
<li>Select your gmail account in the left sidebar</li>
<li>Click the &#8216;Account Information&#8217; tab</li>
<li>Add all aliases in the &#8220;Email Address&#8221; field, separated by commas</li>
<li>Exit Preferences</li>
<li>Compose new email and select an alias from the Dropdown</li>
<li>Make a cup of tea and set your sights on Inbox Zero.</li>
</ol>


<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/misc/apple_mail_aliases.png"></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Creating Gems for Rails Assets]]></title>
    <link href="http://peterhamilton.github.com/blog/2012/11/01/creating-gems-for-rails-assets/"/>
    <updated>2012-11-01T21:59:00+00:00</updated>
    <id>http://peterhamilton.github.com/blog/2012/11/01/creating-gems-for-rails-assets</id>
    <content type="html"><![CDATA[<p>Today I found a javascript library which I wanted to include in a rails project I&#8217;m working on.</p>

<p>The library was <a href="https://github.com/thedersen/backbone.validation">Backbone.Validation</a> and fter looking for a wrapper-gem and coming up empty handed, I decided to create my own. What follows is a walkthrough of the steps I took in order to create the gem <a href="https://github.com/PeterHamilton/backbone-validation-rails">backbone-validation-rails</a> to wrap this library up so I could add it to my assets pipeline.</p>

<h2>1. Creating the Gem Framework</h2>

<p>Bundler is capable of initializing a new gem framework for you very easily.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>bundle gem backbone-validation-rails
</span><span class='line'>  create  backbone-validation-rails/Gemfile
</span><span class='line'>  create  backbone-validation-rails/Rakefile
</span><span class='line'>  create  backbone-validation-rails/LICENSE.txt
</span><span class='line'>  create  backbone-validation-rails/README.md
</span><span class='line'>  create  backbone-validation-rails/.gitignore
</span><span class='line'>  create  backbone-validation-rails/backbone-validation-rails.gemspec
</span><span class='line'>  create  backbone-validation-rails/lib/backbone-validation-rails.rb
</span><span class='line'>  create  backbone-validation-rails/lib/backbone-validation-rails/version.rb</span></code></pre></td></tr></table></div></figure>


<p>It creates a bunch of files and folders (which I cover later) and a README with some TODOs/blank sections and contribution guidelines).</p>

<h2>2. Managing Versions</h2>

<p>Since the backbone.validation gem will simply be a wrapper for the actual backbone.validation javascript library, we will make the version of the gem track the version of the library.</p>

<p>This is done by modifying <code>lib/backbone-validation-rails/version.rb</code></p>

<figure class='code'><figcaption><span>lib/backbone-validation-rails/version.rb</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="k">module</span> <span class="nn">Backbone</span>
</span><span class='line'>  <span class="k">module</span> <span class="nn">Validation</span>
</span><span class='line'>    <span class="k">module</span> <span class="nn">Rails</span>
</span><span class='line'>      <span class="no">VERSION</span> <span class="o">=</span> <span class="s2">&quot;0.6.2&quot;</span>
</span><span class='line'>    <span class="k">end</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<h2>3. Adding the Engine</h2>

<p>Bundler has helpfully created a new module for our gem, however we need to use a Rails engine. It’s an empty class but it means that the resources for the gem (namely our JS library file) will be included.</p>

<p>If you have used dashes in your gem name, it will assume a modular structure and create a new nested module for each section.</p>

<figure class='code'><figcaption><span>lib/backbone-validation-rails.rb</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="nb">require</span> <span class="s2">&quot;backbone-validation-rails/version&quot;</span>
</span><span class='line'>
</span><span class='line'><span class="k">module</span> <span class="nn">Backbone</span>
</span><span class='line'>  <span class="k">module</span> <span class="nn">Validation</span>
</span><span class='line'>    <span class="k">module</span> <span class="nn">Rails</span>
</span><span class='line'>      <span class="k">class</span> <span class="nc">Engine</span> <span class="o">&lt;</span> <span class="o">::</span><span class="no">Rails</span><span class="o">::</span><span class="no">Engine</span>
</span><span class='line'>      <span class="k">end</span>
</span><span class='line'>    <span class="k">end</span>
</span><span class='line'>  <span class="k">end</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>


<h2>4. Including the Assets</h2>

<p>Download the files (css/js library) you’re wrapping and if given the option, choose the full (non-minified) version.</p>

<p>The reason I say this is that I included the minified version of backbone.validation in my gem originally and have since regretted it. I would prefer to have readability in development (console/inspector etc) and rely on minification in production using something like Uglifier.</p>

<p>I put the files in vendor/ since they’re externally maintained. This isn’t necessary, I just feel it’s a nice logical structure.</p>

<p>I then nest the folders in the same way as my app. For example, I put backbone.validation.js in vendor/assets/javascripts</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>mkdir -p vendor/assets/javascript
</span><span class='line'>curl https://raw.github.com/thedersen/backbone.validation/master/dist/backbone-validation.js -o vendor/assets/javascripts/backbone-validation.js
</span></code></pre></td></tr></table></div></figure>


<h2>5. Filling in the Gemspec</h2>

<p>The file backbone-validation-rails.gemspec has a number of TODOs left in it. Description, Summary etc.</p>

<p>Fill these in, describing your new wrapper gem. For an example, see the one for backbone-validation-rails <a href="https://github.com/PeterHamilton/backbone-validation-rails/blob/master/backbone-validation-rails.gemspec">here</a></p>

<p>It’s also worth replacing the default file includes line:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="n">gem</span><span class="o">.</span><span class="n">files</span> <span class="o">=</span> <span class="sb">`git ls-files`</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="vg">$/</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>


<p>with</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="n">gem</span><span class="o">.</span><span class="n">files</span> <span class="o">=</span> <span class="no">Dir</span><span class="o">[</span><span class="s2">&quot;{lib,vendor}/**/*&quot;</span><span class="o">]</span> <span class="o">+</span> <span class="o">[</span><span class="no">LIST</span><span class="p">,</span> <span class="no">OF</span><span class="p">,</span> <span class="no">OTHER</span><span class="p">,</span> <span class="no">FILES</span><span class="p">,</span> <span class="no">TO</span><span class="p">,</span> <span class="no">INCLUDE</span><span class="o">]</span>
</span></code></pre></td></tr></table></div></figure>


<p>I had seen this before in other gemspecs and personally feel it’s is a bit nicer than relying on git to grab your includes, especially for something simple like this.</p>

<h2>6. Releasing to RubyGems</h2>

<p>You’re going to want to push your code to github (for hosting and community love) and ruby gems (for easy distribution). To release your code to rubygems just run:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>rake release
</span></code></pre></td></tr></table></div></figure>


<p>Note: In order to push to rubygems you will require an account and the first time you release a gem you will be asked to provide your credentials. From then on an api key is stored in <code>~/.gem/credentials</code></p>

<p>You can then visit RubyGems and look at your new gem up there for the world to see!</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/misc/backbone_validation_rubygems.png"></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Kittens Make Great Placeholders]]></title>
    <link href="http://peterhamilton.github.com/blog/2012/10/28/kittens-make-great-placeholders/"/>
    <updated>2012-10-28T02:46:00+00:00</updated>
    <id>http://peterhamilton.github.com/blog/2012/10/28/kittens-make-great-placeholders</id>
    <content type="html"><![CDATA[<p>There often comes a point in web dev projects when you need to stick an image placeholder into your page.
At this point my options are usually as follows:</p>

<ol>
<li>Style a div to have a solid background and imagine an image there</li>
<li>Create images which are the right size by hand and stuff them in the source &#8216;temporarily&#8217;</li>
<li>Host common image sizes somewhere else, like <a href="http://aws.amazon.com/s3/">Amazon S3</a></li>
</ol>


<p>The methods are messy, time consuming and quite frankly, crap.</p>

<p>Enter <a href="http://placekitten.com/">placekitten</a>.</p>

<p>An AWESOME site which can serve you an image of a kitten at any resolution you want. Just provide a width and height in the url like so:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>http://placekitten.com/650/200</span></code></pre></td></tr></table></div></figure>


<p><img src="http://placekitten.com/650/200"></p>

<p>BAM, perfectly sized kittens.</p>

<p>It even transpires that there is a Ruby gem for this on github - <a href="https://github.com/Wijnand/PlaceKitten">PlaceKitten</a></p>

<p>Using this in a rails app is then as simple as adding <code>gem 'placekitten'</code> to your gem file and then adding the following in your view:</p>

<figure class='code'><figcaption><span>kitten_view.rb</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="c1"># Insert an 800x600px kitten image</span>
</span><span class='line'><span class="n">image_tag</span><span class="p">(</span><span class="no">Placekitten</span><span class="o">.</span><span class="n">kitten_for</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">600</span><span class="p">))</span>
</span></code></pre></td></tr></table></div></figure>


<p>I found it nice to have a simple helper function for this:</p>

<figure class='code'><figcaption><span>kitten_helper.rb</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class='ruby'><span class='line'><span class="nb">require</span> <span class="s1">&#39;place_kitten&#39;</span>
</span><span class='line'>
</span><span class='line'><span class="c1"># Inserts an image of a kitten with the specified WxH</span>
</span><span class='line'><span class="k">def</span> <span class="nf">kitten_image</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">height</span><span class="p">)</span>
</span><span class='line'>  <span class="n">image_tag</span><span class="p">(</span><span class="no">Placekitten</span><span class="o">.</span><span class="n">kitten_for</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">height</span><span class="p">))</span>
</span><span class='line'><span class="k">end</span>
</span></code></pre></td></tr></table></div></figure>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Continuous Integration for Rails With CircleCi]]></title>
    <link href="http://peterhamilton.github.com/blog/2012/10/27/continuous-integration-for-rails-with-circleci/"/>
    <updated>2012-10-27T19:00:00+01:00</updated>
    <id>http://peterhamilton.github.com/blog/2012/10/27/continuous-integration-for-rails-with-circleci</id>
    <content type="html"><![CDATA[<p>Recently I have been working on a Rails app to facilitate Corporate &amp; Industry links here at Imperial.</p>

<p>As a team we decided that some form of continuous integration was needed and so I set about in search of a solution. We just needed something simple so we could start making use of CI straight away and get the hang of integrating it into our workflow.</p>

<p>I looked at a few potential solutions and have outlined a brief summary of my findings.</p>

<h1>Option 1 - Travis CI</h1>

<p>Travis CI seems like a fantastic CI system and I&#8217;ve seen it all over various repositories and projects so it was my first port of call.</p>

<p><img src="http://peterhamilton.github.com/images/blog_images/coding/travisci_builds.png"></p>

<p>Unfortunately it transpires that Travis CI doesn&#8217;t currently support private repositories and given the nature of the project, it can&#8217;t be hosted in a public repo just yet.</p>

<p>Apparently you can sign up for early-access to Travis CI at <a href="http://beta.travis-ci.com/?lrRef=GHg6x">beta.travis-ci.com</a> but it doesn&#8217;t appear ready yet.</p>

<h1>Option 2 - Roll your own</h1>

<p>Another option I considered was a &#8216;roll-you-own&#8217; approach.
Surely it couldn&#8217;t be complicated to set up a local virtual machine or even a server in the cloud. This could then repeatedly pull in changes from the git repository and re-run test and integration suites.
If anything failed, I could simply have it email/text/notify me.</p>

<p>It sounds simple, but as I discovered, I had grossly oversimplified the process. Whilst this method theoretically worked for this particular project, it would get very complicated when people started branching to work on features etc. I still wanted the other team members to be able to take advantage of the test suites which we were writing, even if they weren&#8217;t on the master branch (without too much code-fu).</p>

<h1>Option 3 - Circle CI</h1>

<p>Similar to Travis CI, Circle CI is currently in beta and so is offering the ability to sign up private repositories on their system for free.</p>

<p>After a very basic setup linking the code repository and their continuous integration system, we were off! A nice clean list of commits (on all branches) and the consequent status of the build/test suite.</p>

<p><img src="http://peterhamilton.github.com/images/blog_images/coding/circleci_builds.png"></p>

<p>There were a few hiccups and it feels much less polished and feature-filled than Travis CI but the functionality is there and it works. On top of this, on the odd occasion we have had questions or issues, the team has been fantastic and taken our feedback on board. The one issue we did have (some failed auto-pulls of my git repo) was fixed within a matter of hours and didn&#8217;t really slow us down at all.</p>

<h1>Summary</h1>

<p>Out of the selection of options above and the few others I looked over, the easiest to integrate with (for this project right now) was Circle CI.</p>

<p>However, if this was an open source community project, I would choose Travis CI hands down. It just seems more mature and also has the weight of the open source community behind a lot of additional plugins and features which.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The Bare Necessities]]></title>
    <link href="http://peterhamilton.github.com/blog/2012/10/26/the-bare-necessities-blogging-with-octopress/"/>
    <updated>2012-10-26T05:27:00+01:00</updated>
    <id>http://peterhamilton.github.com/blog/2012/10/26/the-bare-necessities-blogging-with-octopress</id>
    <content type="html"><![CDATA[<p>Simplification.</p>

<p>That&#8217;s the idea behind my move to <a href="http://octopress.org/">Octopress</a>.</p>

<p>Instead of trying (and failing) to maintain a comprehensive record of 100 different things. I have decided to come up with a small list of things I come across daily which would be worth putting online for reference, information or amusement.</p>

<p>The plan is to back-date some of this to bring my blog up to date with some of the things I have done and forgotten to write about.</p>

<p>So far on my list of topics to cover I have:</p>

<ol>
<li><p><strong>Useful Code Snippets</strong> - So I don&#8217;t have to scour the net and my internet history to find that little chunk of code.</p></li>
<li><p><strong>Tools</strong> - There are so many tools and apps which I have set up on my machine. Useful ones should be reviewed or at least mentioned</p></li>
<li><p><strong>New Languages</strong> - It seems almost Every day I experiment with something new and I think it would be good to write down the results, however brief</p></li>
<li><p><strong>Events</strong> - I do a lot of hackathons and should really do writeups afterward outlining what I or my team built</p></li>
</ol>


<p><a href="http://octopress.org/">Octopress</a> allows me to type my blog post in a nice simple editor using <a href="http://daringfireball.net/projects/markdown/">Markdown</a> syntax on my local machine.</p>

<p>The entire process then fits into a normal development workflow. Create, commit, push. Simple.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A Brief Pause]]></title>
    <link href="http://peterhamilton.github.com/blog/2012/01/25/a-brief-pause/"/>
    <updated>2012-01-25T10:41:00+00:00</updated>
    <id>http://peterhamilton.github.com/blog/2012/01/25/a-brief-pause</id>
    <content type="html"><![CDATA[<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/misc/paperwork.jpg"></p>

<p>Due to the combination of a high workload and my incredible studiousness, I am taking a break from this blog. I really should at least try and pass my exams&#8230;</p>

<p>Many tales of development related endeavours are piled up and are waiting to be typed and shared but they will have to wait for another day.</p>

<p>That’s it. For now&#8230;</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Shortlisted for a .NET award]]></title>
    <link href="http://peterhamilton.github.com/blog/2011/08/05/shortlisted-for-a-net-award/"/>
    <updated>2011-08-05T00:00:00+01:00</updated>
    <id>http://peterhamilton.github.com/blog/2011/08/05/shortlisted-for-a-net-award</id>
    <content type="html"><![CDATA[<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/misc/net_awards.png"></p>

<p>I probably should have blogged about this when it happened but in standard fashion this is a very delayed post.</p>

<p>So, recently some amazing people nominated me for a .net magazine ‘Young Developer of the Year’ award (Thanks guys!). That in itself was pretty awesome, but I have now also been shortlisted as one of the top 10!</p>

<p>If you haven’t had a look at the shortlists for the various categories yet, I highly recommend you do, there is a seriously high concentration of talented companies and individuals up there and I encourage you to vote in as many categories as you can (follow the link below).</p>

<p>I would really appreciate your support in this if you could give it, it means a lot to know people are rooting for you and I would like to say a huge thanks to the many people who I know have already voted for me. That said, if you haven’t voted and feel like you can lend me your support that would be awesome!</p>

<p>If you feel I deserve it, I would grateful if you could <a href="http://www.thenetawards.com/#num14">Vote For Me</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Introducing e-mergency]]></title>
    <link href="http://peterhamilton.github.com/blog/2011/08/03/introducing-e-mergency/"/>
    <updated>2011-08-03T12:06:00+01:00</updated>
    <id>http://peterhamilton.github.com/blog/2011/08/03/introducing-e-mergency</id>
    <content type="html"><![CDATA[<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/interactivism/emergency.png"></p>

<p>I just met up with our development team for the project we submitted for the Google Interactivism Award!
Now that we have won said award and are being given money to develop the project further we thought it was about time we actually did something and got cracking!</p>

<p>So today Myself, Kushal, Florian and Simon all met up to try and verbally work our way through the planning stage of the project. It all went pretty well and we now have a name, domain, dev plan and I think we would all agree an increased level of enthusiasm for this!</p>

<p>In case you hadn’t realised, the idea changed slightly from our original idea when we submitted to Google and now instead of tracking waiting room times, we are showing people the nearest A &amp; E or clinic along with the current waiting time. We are now calling the project e-mergency!</p>

<p>I am pasting a copy of our development slides below for those who are interested</p>

<p>We meet again in a little over a week for our first development sprint so check back here for updates!</p>

<iframe src="http://www.slideshare.net/slideshow/embed_code/8758430 " width="595" height="446" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen></iframe>


<p></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Interactivism Update]]></title>
    <link href="http://peterhamilton.github.com/blog/2011/07/28/interactivism-update/"/>
    <updated>2011-07-28T06:19:00+01:00</updated>
    <id>http://peterhamilton.github.com/blog/2011/07/28/interactivism-update</id>
    <content type="html"><![CDATA[<p>Update from Interactivism Hack Day
FutureGov has posted <a href="http://wearefuturegov.com/2011/07/11/how-to-hackday-lessons-from-interactivism/">an article outlining the lessons they have learned from the hack day</a>, it’s actually really good and definitely worth a read.
On top of this, the ubercoolsuperawesome guys at <a href="http://www.markthreemedia.com/">markthreemedia</a> have finished their video of the event and it is included in the above post. If you are really too lazy to click more than once, the video is below for your viewing pleasure.
See anyone you recognise? (me and my blue apple mac make various appearances)</p>

<div class="embed-video-container"><iframe src="http://player.vimeo.com/video/26163808 "></iframe></div>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[We Won an Interactivism Award]]></title>
    <link href="http://peterhamilton.github.com/blog/2011/07/12/we-won-an-interactivism-award/"/>
    <updated>2011-07-12T11:39:00+01:00</updated>
    <id>http://peterhamilton.github.com/blog/2011/07/12/we-won-an-interactivism-award</id>
    <content type="html"><![CDATA[<p>Firstly, I realise this blog hasn’t been updated as often as I would like, what with my new job and moving house 3 times in 2 weeks I have been somewhat stretched&#8230;</p>

<p>Anyway, today I received some very exciting news! But first some background.</p>

<p>After the interactivism hackday I attended a while ago, team NHS TimeTag got together and had a rethink through our idea. Eventually we ended with a slightly different take on the original idea of NHS waiting times in clinics. We have instead decided to target the waiting times in NHS emergency departments. We aim to do this initially using an online service, with a freely available API which could eventually support a mobile app.</p>

<p>The first thing you will be thinking will undoubtedly be the thing which also came into my head during the brainstorming session which was “The last thing on your mind in an emergency will be to check the internet…” Totally true, but that’s not the situation our idea is targeted at.</p>

<p>Instead, imagine you sustain an injury such as a sprained ankle, but decide to sleep on it and see if it gets better overnight on its own (like all good manly men do…). In the morning your foot resembles a footBALL and you decide that regardless of how manly you may feel, for the good of your health you should probably go to A&amp;E and get it seen to.</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/interactivism/interactivism_logo.png"></p>

<p>Enter our interactivism project. Enabling you to locate the nearest and/or least busy A&amp;E department. The benefits of this are twofold:</p>

<ol>
<li><p>You get seen faster and more efficiently, meaning you’re happy and your foot stops doing an admirable impression of a basketball.</p></li>
<li><p>A&amp;E departments don’t get overrun with people all coming to them when there might be a perfectly good empty clinic down the road who could deal with your injury, thus relieving the pressure on them.</p></li>
</ol>


<p>Now you know all about what we have planned, I am literally bouncing up and down to say: WE WON AN INTERACTIVISM AWARD! So excited, proud of our team and ridiculously eager to get started! Other than the above rough outline, I’m not going to go into specifics yet, we need to meet up as a team for beer and celebrations and eventually maybe even some planning… Needless to say watch this space!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Code, Grannies and a Gallon of Redbull]]></title>
    <link href="http://peterhamilton.github.com/blog/2011/06/22/code-grannies-and-a-gallon-of-redbull/"/>
    <updated>2011-06-22T11:32:00+01:00</updated>
    <id>http://peterhamilton.github.com/blog/2011/06/22/code-grannies-and-a-gallon-of-redbull</id>
    <content type="html"><![CDATA[<p>So earlier this week I attended my first ever hackathon so I thought what better for a first real blog post than a quick writeup!</p>

<p>For those who have been paying attention on twitter recently to all things #accessibility and #interactivism related, last weekend <a href="http://www.lbi.co.uk/contact/">LBi Offices</a> were home to the first <a href="https://sites.google.com/site/interactivismaward/">Google Interactivism</a> event, a student developer accessibility hack weekend organised by <a href="http://simpl.co/">Simpl</a> and <a href="http://wearefuturegov.com/">FutureGov</a>. People from many backgrounds turned up to hack together cool new ideas including accessibility experts, student developers, <a href="http://www.gransnet.com/">Gransnet</a>-ers and guys from Google who were there help and mentor us all through it.</p>

<p>I am aware that this has already been covered by some of the organisers of the event and you can find the other write-ups at some of the links below:</p>

<ul>
<li><a href="http://wearefuturegov.com/2011/06/reporting-back-from-the-interactivism-weekender/">FutureGov</a> – Check out yours truly front and centre</li>
<li><a href="http://lucyhughes.com/post/6686574795">Lucy Hughes</a></li>
<li><a href="http://thinkpublic.com/2011/06/thinkpublic-at-interactivism-hack-event/">thinkpublic</a></li>
</ul>


<p>Also, you can see some <a href="http://www.gransnet.com/forums/other_subjects/1188519-Gransnet-meets-Google#m24744700">fab comments from the gransnet</a> members who were in my team (1st three at that link). I know all the gransnetters were amazing but I would like to say a special thanks to ours who even got involved in some coding (of a sort) at one point!</p>

<p>I also highly recommend you check out the <a href="http://www.flickr.com/groups/interactivism/pool/">Interactivism Flickr Page</a> for loads of pictures from the event. Note the excessively large number of post-its and diagrams everywhere. It was epic.</p>

<p>So, anyway, not sure quite what to expect, I put my name down for the event and turned up on their doorstep at 9am Friday morning, laptop in hand. Seemed like a good turn out but later it became apparent that quite a few people hadn&#8217;t turned up, mostly students, this caused quite a few issues when trying to distribute people between all the great ideas but it was definitely their loss!</p>

<p>The talk was started with some info from <a href="http://twitter.com/#!/andreweland">Andrew Eland</a> at Google and <a href="http://twitter.com/#!/dominiccampbell">Dominic Campbell</a> from FutureGov on what the weekend was all about and how it would work. We then had a talk from Mike Bradley, a lecturer in Product Design at Middlesex University who had some great points and good things to consider when designing our products regarding user experience. This was followed up by an absolutely brilliant presentation by Peter Oakley, otherwise known as <a href="http://www.youtube.com/user/geriatric1927">geriatric1927</a> what can I say, go watch his videos, the man is a genius and an inspiration. We were treated to this gem, I guarantee anyone who has tried to teach their grandparents to use a computer (and of course the grandparents themselves) will appreciate it:</p>

<div class="embed-video-container"><iframe src="http://www.youtube.com/embed/VPWsVAkETe4 "></iframe></div>


<p>Next up were the people with a plan, these were the guys who had the big ideas on which the rest of us were about to be let loose. Around this point I was getting pretty excited and working out which project to actually choose was definitely proving a challenge.</p>

<p>I eventually chose to work on an NHS <a href="http://www.simpl.co/NHS-Timetable-Boards">Appointment Timetable Board</a> application which would let people know if their appointment was running behind before they set off for a delayed appointment (unknown to them) 4 hours too early. I thought this was great and so pretty much went straight over to join <a href="http://twitter.com/#!/katiekatetweets">Kate</a> who had pitched the idea. Initially we had quite a few people who obviously agreed with me as we soon had a good group of professionals, gransnet-ers and student developers all itching to pitch in.</p>

<p>Unfortunately, the no-show students (seriously, you missed out!) meant that some teams were very thin on the ground developer/designer-wise and so we quickly lost half our members to other teams, bit sad but it was the fairest thing to do I guess.</p>

<p>We got straight down to it, discussing ideas while a flurry of buzzword and key-phrase post-its flew onto the table from <a href="http://twitter.com/#!/liesa">Leisa</a></p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/interactivism/post-its.jpg"></p>

<p>Pretty soon we had come up with some good stuff, mostly revolving around text-based messaging for communication with the system to ensure we included people who didn’t have access to a computer or a smartphone. Our idea began to take shape and we gradually got it to a point where we were happy with the features we had come up with.</p>

<p>It was time to code!</p>

<p>This the bit which most excited me, but then I <em>was</em> there as a student developer and the planning stage is never as cool as seeing something being built, no matter how many sticky notes are involved…</p>

<p>For those less technically minded, please look away now.</p>

<p>We decided to go for a Ruby On Rails app because it is my <strong>favourite</strong> web development framework right now and Florian and Alex (who actually later got stolen by another team – sad times!), the other student developers on our team were willing to give it a go. Lucky me!</p>

<p>We had a shedload of issues setting up our environment on Farouk’s (Our Googler) Macbook Pro due to a load of Snow Leopard Ruby SQlite issues which I had resolved before but couldn’t remember for the life of me how (hence why this blog is now here…)</p>

<p>Like all initial Rails apps it was basic, up and running (as far as models and general underlying structure was concerned) in a matter of minutes. Over next the two days Florian did some cool stuff with <a href="http://geokit.rubyforge.org/">Geokit</a> to allow the system to detect the nearest hospital to you (on the web version) and I worked on finding a good Ruby API for sending and receiving text messages – probably a whole blog post in the next few days as it was quite interesting (unless you don’t like that kind of thing, in which case you shouldn’t be reading this bit).</p>

<p>I was personally not looking forward to generating the fixtures and test data for our system, which we would need in order to test everything but luckily our amazing gransnet members pitched in and helped out by typing it all out in the correct format. Yes you heard me, our grannies were <strong>CODING</strong>. Came up with some brilliant sample data and think they secretly had a lot of fun coming up with pun-influenced doctor and patient names.</p>

<p>We used <a href="http://haml-lang.com/">HAML</a> for our templating language and <a href="http://sass-lang.com/">SASS</a> for a nice programmer-friendly way of generating our CSS files which sped up the design implementation side of things quite nicely.</p>

<p><strong>Code haters, you can read again now</strong>, back to pictures and non-geek friendly things…</p>

<p>We called it a night at 10pm (/got kicked out), but me and Florian met up again back at Uni to code late into the night. I had personally prepared in advance:</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/interactivism/redbull.jpg" title="'How it’s done'" ></p>

<p>The next day we met up (my blood-redbull content sitting at dangerous levels..) to mash what we had done code wise with the designs <a href="http://twitter.com/#!/joesmithdesign">Joe</a> had come up with.</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/interactivism/theteam.png"></p>

<p>Florain, Me and Joe – our Design Guru</p>

<p>I would try and describe the designs but instead I will just show you what the finished thing looked like:</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/interactivism/dss1.png">
<img class="center" src="http://peterhamilton.github.com/images/blog_images/interactivism/dss2.png">
<img class="center" src="http://peterhamilton.github.com/images/blog_images/interactivism/dss3.png"></p>

<p>Cool huh?</p>

<p>To round off the end of the second day, we had a presentation from each team. Ours was prepared by Joe and Kate. Kate did an excellent presentation and I did a quick technical run through, but we had to miss off some of our best features due to time constraints as is often the case.</p>

<p>I noticed this image (see below) in the simpl writeup and thought I should give a shout out to our <strong>awesome</strong> gransnet members (that’s them in the photo), from those smiles it must have obviously been me and Kate up front! They were true grannies and when they weren’t doing interviews for the filming of the event or coming up with user interface ideas they were helping us out and reminding us to eat “because it doesn’t do you any good on your plate”. You were FAB.</p>

<p><img class="center" src="http://peterhamilton.github.com/images/blog_images/interactivism/grannies.png"></p>

<p>Our awesome gransnet members.</p>

<p>Finally there was the big prize presentation. The main prize went to EZPZ Browser – a simplified stripped down web browser to help people who have never used the internet before to get online. A really interesting concept and had I not been determined to develop something web based I would probably have liked to help out on this. The gransnet prize (voted by gransnet members) was Spotted – an app to share likes, dislikes, photos and experiences relating to disability access. Two very worthy winners!</p>

<p>The winning idea-creators got new Nexus-S phones (Jealous!), with the rest of their team getting ipod shuffles or Android models. Everyone else got free google bits and bobs with quite a few t-shirts given out (Rather pleased with mine and my laptop is sporting a Google transfer sticker this very minute – automatically raises the IQ y’know…).</p>

<p>All in all a pretty awesome weekend! When I was asked on monday what I did at the weekend, I was actually able to say “I sat on my computer for two days living off pizza, beer, curry and coke” without feeling the least bit guilty!</p>

<p>Thanks to all involved and I look forward to seeing you at the next event.</p>

<p>Can’t wait!</p>
]]></content>
  </entry>
  
</feed>
