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

  <title>Damian Nicholson</title>
  <link href="http://damiannicholson.com/atom.xml" rel="self"/>
  <link href="http://damiannicholson.com/"/>
  <updated>2018-01-27T14:37:05+00:00</updated>
  <id>http://damiannicholson.com/</id>
  <author>
    <name>Damian Nicholson</name>
    <email>hi@damiannicholson.co,=m</email>
  </author>

  
  <entry>
    <title>Designing form validation the right way</title>
    <link href="http://damiannicholson.com/2018/01/27/desigining-form-validation-the-right-way.html"/>
    <updated>2018-01-27T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2018/01/27/desigining-form-validation-the-right-way</id>
    <content type="html">&lt;p&gt;&lt;img src=&quot;http://www.img.damiannicholson.com/IMG_0242.JPG&quot; alt=&quot;FrontEndNorth&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Last week I had the privilege of speaking at &lt;a href=&quot;https://frontendnorth.com/&quot;&gt;FrontEndNorth&lt;/a&gt; in Sheffield. The talk I gave was heavily based on the one &lt;a href=&quot;/2017/11/02/making-sure-your-forms-dont-suck.html&quot;&gt;I gave at JavaScript North East&lt;/a&gt; in November(with some obvious refinements) about the challenges posed to end users and developers when working with inline validation. I was able to share my experiences on both ends of the spectrum and how we can alleviate these challenges by using &lt;a href=&quot;https://reactjs.org/&quot;&gt;React&lt;/a&gt; along with some smart design decisions to prevent alienating users of the applications we build. Finally I shared some best practices about how to better design forms so attendees can use this knowledge when building out web forms in the future.&lt;/p&gt;

&lt;p&gt;A lot of the concepts behind this talk are the basis of &lt;em&gt;ConferizeForm&lt;/em&gt;* which is the library we’re using to build out our web forms in the next iteration of &lt;a href=&quot;https://www.conferize.com&quot;&gt;Conferize&lt;/a&gt;. This library will be Open Source in the near future, so stay tuned for an announcement about that!&lt;/p&gt;

&lt;p&gt;I would like to take this opportunity to thank &lt;a href=&quot;https://twitter.com/mkjones&quot;&gt;Kimb&lt;/a&gt; and the organisers behind FrontEndNorth for having me, and putting on a great conference. Secondly I would like to thank Conferize for permitting me to share some of our learnings and how we’ve been able to get around them.&lt;/p&gt;

&lt;p&gt;I’ve posted a copy of my slides below for anyone interested.&lt;/p&gt;

&lt;script async=&quot;&quot; class=&quot;speakerdeck-embed&quot; data-id=&quot;4c61d3c084cf489c8000090dac45ed8e&quot; data-ratio=&quot;1.33333333333333&quot; src=&quot;//speakerdeck.com/assets/embed.js&quot;&gt;&lt;/script&gt;

</content>
  </entry>
  
  <entry>
    <title>2017 in review</title>
    <link href="http://damiannicholson.com/2017/12/22/2017-in-review.html"/>
    <updated>2017-12-22T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/12/22/2017-in-review</id>
    <content type="html">&lt;p&gt;At the beginning of 2017 I wrote down this list of goals for the year. Unlike prior years I tried to be more realistic about what I’d like to achieve versus what’s actually possible. Upon reflection I don’t think I did too bad since I managed three out of four.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://take.ms/WM5xR&quot; alt=&quot;2017 goals&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;run-a-marathon&quot;&gt;Run a marathon&lt;/h2&gt;

&lt;p&gt;I ran the &lt;a href=&quot;http://www.greatrun.org/great-north-run&quot;&gt;Great North Run&lt;/a&gt; in 2016 and really enjoyed it. The event itself was a blast and I felt within myself when I completed it(I was out running the very next day). I figured this is as good as time as any to enter for a marathon as I may never get back to this sort of form and level of running fitness.&lt;/p&gt;

&lt;p&gt;After a few months of training I completed the &lt;a href=&quot;https://www.edinburghmarathon.com/&quot;&gt;Edinburgh marathon&lt;/a&gt; in May which was a huge achievement for me and one item checked off the bucket list.&lt;/p&gt;

&lt;h2 id=&quot;write-a-blog-post-a-month&quot;&gt;Write a blog post a month&lt;/h2&gt;

&lt;p&gt;This will be my twelfth post of the year so I managed to nail this one too. Writing is a skill and something that I find I have to work at, but once it’s done I feel a sense of catharis and relief. Blogging here is something that I plan to continue with in 2018.&lt;/p&gt;

&lt;h2 id=&quot;release-two-new-open-source-projects&quot;&gt;Release two new open source projects&lt;/h2&gt;

&lt;p&gt;Perhaps I was a little ambitious on this one as I only managed to release &lt;a href=&quot;https://github.com/damian/js-routes-rails&quot;&gt;js-routes-rails&lt;/a&gt; as &lt;a href=&quot;/2017/02/02/js-routes-rails.html&quot;&gt;I outlined&lt;/a&gt; early last year. Still contributing one Open source project is better than none at all!&lt;/p&gt;

&lt;h2 id=&quot;read-one-book-a-month&quot;&gt;Read one book a month&lt;/h2&gt;

&lt;p&gt;I &lt;strong&gt;failed miserably&lt;/strong&gt; at reading this year and feel guilty for it. I read one book in December and managed to get about 50% of the way through three others throughout the year before putting them down. I plan to knuckle down and read at least a book every two month in 2018.&lt;/p&gt;

&lt;p&gt;Some other cool things happened for me both personally and professionally in 2017, which include:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Being at Nasdaq for the Conferize IPO was a once in a lifetime opportunity and I’m thrilled to be along for the ride&lt;/li&gt;
  &lt;li&gt;Speaking at FrontendNE on &lt;a href=&quot;/2017/07/07/chrome-devtools.html&quot;&gt;Chrome DevTools&lt;/a&gt; and JavaScript North East about &lt;a href=&quot;/2017/11/02/making-sure-your-forms-dont-suck.html&quot;&gt;Making sure your forms don’t suck&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Learning how to solve a Rubik’s cube&lt;/li&gt;
  &lt;li&gt;Doing a fair bit of travelling to places like Disneyland Paris with my family, Sorrento for my cousins wedding, catching a bit of sun in Portugal, enjoying some Guiness for a weekend in Dublin and finally Copenhagen a few times to get together at Conferize HQ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;https://pbs.twimg.com/media/DDAH9KlXUAAu1Dp.jpg:small&quot; alt=&quot;Nasdaq IPO&quot; /&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Making sure your forms don't suck</title>
    <link href="http://damiannicholson.com/2017/11/02/making-sure-your-forms-dont-suck.html"/>
    <updated>2017-11-02T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/11/02/making-sure-your-forms-dont-suck</id>
    <content type="html">&lt;p&gt;Last Tuesday I had the privilege of sharing my experiences and thoughts on how to handle clientside validation at this months &lt;a href=&quot;https://attending.io/events/jsne-october-2017&quot;&gt;JavaScript North East&lt;/a&gt; meetup. It’s a non trivial problem and there are a number of things you have to be aware of before diving in. Most of the open source solutions I’ve worked with in the past I’ve found lacking, the main one being how to complement and reconcile validations performed on the server with those on the client.&lt;/p&gt;

&lt;p&gt;Finally I shared how at &lt;a href=&quot;https://www.conferize.com&quot;&gt;Conferize&lt;/a&gt;, we’ve made use of &lt;a href=&quot;https://reactjs.org/&quot;&gt;React&lt;/a&gt; to build our own clientside validation library. React makes light work of handling internal state and provides a consistent event lifecycle across browsers to overcome these challenges. It’s something which we’ll hopefully be open sourcing sometime in the near future.&lt;/p&gt;

&lt;script async=&quot;&quot; class=&quot;speakerdeck-embed&quot; data-id=&quot;170937508ba84703ad5b57d0c5fdaab2&quot; data-ratio=&quot;1.33333333333333&quot; src=&quot;//speakerdeck.com/assets/embed.js&quot;&gt;&lt;/script&gt;

</content>
  </entry>
  
  <entry>
    <title>Reduce all the things</title>
    <link href="http://damiannicholson.com/2017/10/19/reduce-all-the-things.html"/>
    <updated>2017-10-19T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/10/19/reduce-all-the-things</id>
    <content type="html">&lt;p&gt;I have long believed Ruby’s &lt;a href=&quot;https://apidock.com/ruby/Enumerable/inject&quot;&gt;inject&lt;/a&gt; to be under appreciated as it’s super flexible. It’s great for things like:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;String concatenation for example composing snippets of HTML&lt;/li&gt;
  &lt;li&gt;building a new Array(potentially shorter length than the one being enumerated over)&lt;/li&gt;
  &lt;li&gt;building a new Hash(based on it’s keys)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fortunately, we have this same utility available to us now in ES6 JavaScript too just with a different name - &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce&quot;&gt;reduce&lt;/a&gt; and I’m finding myself using it more than ever for the same reasons. The fact it’s a &lt;a href=&quot;https://en.wikipedia.org/wiki/Pure_function&quot;&gt;pure function&lt;/a&gt;, meaning it has no side effects ties in nicely with the React and Redux approach to UI development. Below are a few examples of how I’ve used this recently.&lt;/p&gt;

&lt;h2 id=&quot;example-1---building-html-classnames&quot;&gt;Example 1 - building HTML classnames&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// Function to generate a string separated class names&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;classNames&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;classes&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arguments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;classes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;classString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'string'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;err&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;classString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;val&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;trim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;classString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;''&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Avatar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;other&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;img&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;classNames&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'avatar'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;sr&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;gt;
&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Avatar&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://avatars1.githubusercontent.com/u/34645?v=2&amp;amp;s=100&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;alt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Damian Nicholson avatar&quot;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;rounded&quot;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// &amp;lt;img&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//   src=&quot;https://avatars1.githubusercontent.com/u/34645?v=2&amp;amp;s=100&quot;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//   alt=&quot;Damian Nicholson avatar&quot;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//   class=&quot;avatar rounded&quot;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// /&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;example-2---removing-an-item-from-a-normalized-collection&quot;&gt;Example 2 - removing an item from a normalized collection&lt;/h2&gt;

&lt;p&gt;Note how in the example below we’re only having to do one loop in order to remove ‘Damian’ from both collections.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myFamily&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;members&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'abc'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'abc'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Damian&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'def'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'def'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Olivia&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;s1&quot;&gt;'ghi'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'ghi'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Amanda&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'ghi'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'def'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'abc'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Suppose I want to remove Damian from this object&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;newFamily&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myFamily&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;accum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'abc'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;accum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;members&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myFamily&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;members&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;accum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;accum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;accum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;members&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{},&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;order&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;example-3---reduce-reducers&quot;&gt;Example 3 - reduce reducers&lt;/h2&gt;

&lt;p&gt;Taken directly from Andrew Clark’s(&lt;a href=&quot;https://twitter.com/acdlite&quot;&gt;@acdlite&lt;/a&gt;) &lt;a href=&quot;https://github.com/acdlite/reduce-reducers&quot;&gt;reduce-reducers&lt;/a&gt; repository to chain your Redux reducers from left to right.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;reduceReducers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(...&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;reducers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;previous&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;current&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;reducers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;reduce&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;current&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;previous&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
  </entry>
  
  <entry>
    <title>Git stash workflow</title>
    <link href="http://damiannicholson.com/2017/08/22/git-stash-workflow.html"/>
    <updated>2017-08-22T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/08/22/git-stash-workflow</id>
    <content type="html">&lt;p&gt;One of the main reasons I believe Git to be so well adopted is its flexibility. It has utilities to suit the workflow of a sole developer working on their own project and can easily scale up to meet the needs of thousands of developers contributing across multiple repositories like in Open-source.&lt;/p&gt;

&lt;p&gt;A lesser known utility of Git that I find fits my workflow well is &lt;a href=&quot;https://git-scm.com/docs/git-stash&quot;&gt;Git stash&lt;/a&gt;, and I’m going to share my rationale as to why &lt;strong&gt;I eschew working on a feature branch with frequent commits&lt;/strong&gt; which is ingrained in to most standard Git based workflows(like Git flow) and use git stash a lot. In order to do that it’s probably best that I share my current workflow first.&lt;/p&gt;

&lt;h2 id=&quot;workflow&quot;&gt;Workflow&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;Checkout master branch and do a git pull&lt;/li&gt;
  &lt;li&gt;Start my work on master branch&lt;/li&gt;
  &lt;li&gt;Add files periodically to the stage when I believe them to be in good shape(this includes any files being removed)&lt;/li&gt;
  &lt;li&gt;Get to a point where there are no more working files left and everything is added to the stage&lt;/li&gt;
  &lt;li&gt;Review all the files on the stage and fix up any issues that I notice&lt;/li&gt;
  &lt;li&gt;Make a new feature branch and commit&lt;/li&gt;
  &lt;li&gt;Pull with rebase from master in to feature branch then push to GitHub and make a pull request&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You’ll notice that &lt;code class=&quot;highlighter-rouge&quot;&gt;git stash&lt;/code&gt; was not run at any point in the above workflow. That’s because quite frequently I’ll be interuppted between steps 2-5 whether that means working on something that’s higher priority or checking out a colleagues branch to help debug a problem. This is where &lt;code class=&quot;highlighter-rouge&quot;&gt;git stash save&lt;/code&gt; really comes in to its own, versus doing a ‘WIP commit’ on the feature branch and coming back to it later for the following reasons.&lt;/p&gt;

&lt;h2 id=&quot;never-forget-which-branch-you-were-working-on&quot;&gt;Never forget which branch you were working on&lt;/h2&gt;

&lt;p&gt;This is subjective, but recalling the feature branch previously worked on was a constant problem for me. Command line magic like &lt;code class=&quot;highlighter-rouge&quot;&gt;git checkout -&lt;/code&gt; to move to the previous branch only worked some of the time. With &lt;code class=&quot;highlighter-rouge&quot;&gt;git stash&lt;/code&gt; it’s impossible to forget because the branch &lt;strong&gt;is always master&lt;/strong&gt;!&lt;/p&gt;

&lt;h2 id=&quot;two-git-commands-are-all-thats-needed&quot;&gt;Two git commands are all that’s needed&lt;/h2&gt;

&lt;p&gt;With the &lt;code class=&quot;highlighter-rouge&quot;&gt;git stash&lt;/code&gt; workflow, you’ll only ever have to recall two commands, namely &lt;code class=&quot;highlighter-rouge&quot;&gt;git stash save -u&lt;/code&gt;. The &lt;code class=&quot;highlighter-rouge&quot;&gt;-u&lt;/code&gt; is very important as this ensures that any untracked files are also added to the stash contents. The second command being &lt;code class=&quot;highlighter-rouge&quot;&gt;git stash apply&lt;/code&gt; which reverts back to the exact same state prior to running &lt;code class=&quot;highlighter-rouge&quot;&gt;git stash save -u&lt;/code&gt;. Untracked files remain untracked as you’d expect it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Never ever use &lt;code class=&quot;highlighter-rouge&quot;&gt;git stash pop&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Contrast this to the feature branch / WIP commit approach there’s far more git interaction and cognitive load required because you’re effectively left with a clean slate at this point. You either have to:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Start digging through git logs to understand where you left off and try to push on though no doubt you’ll forget something&lt;/li&gt;
  &lt;li&gt;Undo the commit using &lt;code class=&quot;highlighter-rouge&quot;&gt;git reset&lt;/code&gt; and hope that you remembered the correct flags to pass to it. If you do you can carry on that way.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;less-need-for-squashing-or-amending-commits&quot;&gt;Less need for squashing or amending commits&lt;/h2&gt;

&lt;p&gt;Because your crafting the commits as you go and using the git stash for your working changes, squashing or amending commits is rarely needed.&lt;/p&gt;

&lt;h2 id=&quot;keep-your-working-tree-as-a-todo-list&quot;&gt;Keep your working tree as a todo list&lt;/h2&gt;

&lt;p&gt;Commits aren’t final but they don’t give you good feedback of where you left things. A good commit message or TODOs written in can alleviate this, but those are overkill in my opinion. Showing the working tree status with &lt;code class=&quot;highlighter-rouge&quot;&gt;git status&lt;/code&gt; has been all I’ve ever needed alongside &lt;code class=&quot;highlighter-rouge&quot;&gt;git diff&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;git diff --staged&lt;/code&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Chrome DevTools</title>
    <link href="http://damiannicholson.com/2017/07/07/chrome-devtools.html"/>
    <updated>2017-07-07T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/07/07/chrome-devtools</id>
    <content type="html">&lt;p&gt;On Thursday I had the pleasure of speaking at this months &lt;a href=&quot;https://frontendne.co.uk/&quot;&gt;Frontend NE&lt;/a&gt; about Chromme DevTools. I shared a bunch of tips and tricks that I think are both cool and useful that help me be more productive when prototyping or working in the browser. My slides are below.&lt;/p&gt;

&lt;script async=&quot;&quot; class=&quot;speakerdeck-embed&quot; data-id=&quot;22de8a2dfd10436e9a9e572bc57ed55c&quot; data-ratio=&quot;1.33333333333333&quot; src=&quot;//speakerdeck.com/assets/embed.js&quot;&gt;&lt;/script&gt;

</content>
  </entry>
  
  <entry>
    <title>On programmers and empathy</title>
    <link href="http://damiannicholson.com/2017/06/30/on-empathy.html"/>
    <updated>2017-06-30T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/06/30/on-empathy</id>
    <content type="html">&lt;p&gt;Programmers do their best to write prose in the same way that they write code - clearly and concisely. Being able to communicate effectively is a valuable skill to have on any high functioning team, and something that I think is especially important for remote teams. Nonetheless, this approach is missing a key ingredient that most developers overlook when communicating with others, and that’s &lt;strong&gt;empathy&lt;/strong&gt;. They’re forgetting that there is a living person on the end of their ‘terse’ emails, chats in Slack and reviews on GitHub pull requests who has real feelings and emotions. They’re no longer writing instructions for a machine to carry out, so why do it?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“You’re wrong”&lt;/em&gt; is an example statement that I’ve witnessed written often by programmers(generally by someone more senior or with specialist knowledge) to another individual that I believe is entirely lacking in empathy, and as such I stay away from using it.&lt;/p&gt;

&lt;p&gt;The reason why I’m not fond of this statement is because at it’s core &lt;em&gt;“you’re wrong”&lt;/em&gt; is a binary statement(computer code) though &lt;strong&gt;reality is nuanced&lt;/strong&gt;. Any conclusion we derive and base our decisions from is based on the information we have at hand, and most of us who endeavour to do a good job don’t deliberality make poor decisions. As a result there’s no reason to make someone else feel stupid(potentially publicly humiliated in the case of open-source) just because they’re not informed. I’d imagine it would cause some level of animosity over time and most certainly a lack of respect in the short term which most certainly isn’t useful for a high functioning team. Not to mention that it makes the individual who said it in the first place a hypocrite since they’re speaking in absolute terms and not open to having their stance changed by another.&lt;/p&gt;

&lt;p&gt;Hopefully the takeaway you get from this is to consider how you’re going to be received next time you’re about to send off a message to your coworker or peer. And obviously try to refrain from saying &lt;em&gt;“you’re wrong”&lt;/em&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>CSS animations with hidden elements</title>
    <link href="http://damiannicholson.com/2017/05/13/css-animations-with-hidden-elements.html"/>
    <updated>2017-05-13T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/05/13/css-animations-with-hidden-elements</id>
    <content type="html">&lt;p&gt;Today I learned that a CSS animation applied to an element hidden through &lt;code class=&quot;highlighter-rouge&quot;&gt;visibility: hidden;&lt;/code&gt; occurs straight away. This behaviour is different to an element hidden through &lt;code class=&quot;highlighter-rouge&quot;&gt;display: none&lt;/code&gt; as the animation doesn’t fire till it’s set back to &lt;code class=&quot;highlighter-rouge&quot;&gt;display: block&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The demo below shows this in action - note how the square on the right appears part of the way through it’s animation sequence.&lt;/p&gt;

&lt;p data-height=&quot;500&quot; data-theme-id=&quot;light&quot; data-slug-hash=&quot;XRqXgm&quot; data-default-tab=&quot;result&quot; data-user=&quot;damian-1478604314&quot; data-embed-version=&quot;2&quot; data-pen-title=&quot;Hidden versus none CSS animations&quot; class=&quot;codepen&quot;&gt;See the Pen &lt;a href=&quot;http://codepen.io/damian-1478604314/pen/XRqXgm/&quot;&gt;Hidden versus none CSS animations&lt;/a&gt; by Damian Nicholson (&lt;a href=&quot;http://codepen.io/damian-1478604314&quot;&gt;@damian-1478604314&lt;/a&gt;) on &lt;a href=&quot;http://codepen.io&quot;&gt;CodePen&lt;/a&gt;.&lt;/p&gt;
&lt;script async=&quot;&quot; src=&quot;https://production-assets.codepen.io/assets/embed/ei.js&quot;&gt;&lt;/script&gt;

</content>
  </entry>
  
  <entry>
    <title>Working from home misconceptions</title>
    <link href="http://damiannicholson.com/2017/04/22/working-from-home-misconceptions.html"/>
    <updated>2017-04-22T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/04/22/working-from-home-misconceptions</id>
    <content type="html">&lt;p&gt;When I tell people that I work from home as a remote employee, most say one of two things:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;That would never work for me!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Certain lines of work simply cannot be done working from home, I understand that. Large-scale construction is one example which comes to mind.&lt;/p&gt;

&lt;p&gt;For some who’ve said that, they mean it in a different way. In the hypothetical scenario that their job could be done from home and their company permitted it, they’d &lt;strong&gt;still go about their day the same as what they do now&lt;/strong&gt;. These people prefer to leave the house, endure the commute, work from 9-5pm, and then come home in the early evening. The act of leaving the house and commuting enables them to make the context switch from home to work mode and they prefer that there is a physical separation between the two. It also plays to people’s desire to have a purpose in life, their place of work is where they’re needed so that’s where they’re headed. The social side of work life is important too and they wouldn’t want to forego that.&lt;/p&gt;

&lt;p&gt;With the exception of the social aspect of work life, the rest are things that people have been &lt;strong&gt;conditioned to believe and do just because that’s what everyone does&lt;/strong&gt;. The narrative that these workers like to tell themselves is &lt;em&gt;“I’m at work so I must be working”&lt;/em&gt; simply isn’t true. If you’ve ever worked on a project that required time tracking down to the minute(awful I know) you’ll know this is the case.&lt;/p&gt;

&lt;p&gt;Being able to work from home effectively is something that must be learnt over time. It’s no different to your first few days in school(though you probably can’t remember it). The regimented 9am start and 3:30pm finish is a shock to the system for most kids here in the UK. They simply aren’t used to concentrating for long periods of time so they end up leaving looking like zombies and just want to crash out on the sofa as soon as they arrive home. Though they soon get used to it and working from home is no different.&lt;/p&gt;

&lt;p&gt;Funnily enough, some people say the following:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;It must be piss easy to work from home all the time&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Well, I’ve got a newsflash for you, it isn’t! In fact &lt;strong&gt;it’s harder&lt;/strong&gt; than working in an office because you constantly push yourself harder!&lt;/p&gt;

&lt;p&gt;To be able to succeed working from home you need the confidence to be able to do your job, and with that confidence comes self-imposed pressure you put on yourself. Things you once found challenging become trivial and mundane, as a result, you feel guilty for not working as hard as you once did, so you try to push yourself even harder. This is a vicious cycle that can potentially lead to overwork and burnout which isn’t good for you or your company. If you want to have a healthy work life balance the key is to know when to push and when to back off, and only you can know that.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Batch file renaming in Bash</title>
    <link href="http://damiannicholson.com/2017/03/26/batch-file-rename-in-bash.html"/>
    <updated>2017-03-26T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/03/26/batch-file-rename-in-bash</id>
    <content type="html">&lt;p&gt;Batch file renaming is a common job for a developer. In the past, I’ve used a Mac application called &lt;a href=&quot;http://manytricks.com/namemangler/&quot;&gt;NameMangler&lt;/a&gt; or Finder itself to do the heavy lifting for me. Those tools work well when the files being transformed live within the same directory, but it quickly becomes more difficult when you want to be able to work across multiple, potentially nested directory structures.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://www.img.damiannicholson.com/batch-file-rename.png&quot; alt=&quot;Basic batch file renaming using Finder&quot; /&gt;&lt;/p&gt;

&lt;p&gt;On the past few occasions, I’ve used Bash to great effect, though for some reason I &lt;strong&gt;NEVER REMEMBER&lt;/strong&gt; how to correctly pipe the file transformation on to the &lt;code class=&quot;highlighter-rouge&quot;&gt;find&lt;/code&gt; command, so I’m documenting it here for future reference.&lt;/p&gt;

&lt;p&gt;Below is an example of a task that I had to carry out just the other day – renaming all files with the &lt;code class=&quot;highlighter-rouge&quot;&gt;.textile&lt;/code&gt; extension to &lt;code class=&quot;highlighter-rouge&quot;&gt;.md&lt;/code&gt;. It really is trivial.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;find . -type f -name &lt;span class=&quot;s1&quot;&gt;'*.textile'&lt;/span&gt; | &lt;span class=&quot;k&quot;&gt;while &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;read &lt;/span&gt;f; &lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;mv &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;/.textile/.md&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;; &lt;span class=&quot;k&quot;&gt;done&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
  </entry>
  
  <entry>
    <title>Tips on writing a frontend developer CV</title>
    <link href="http://damiannicholson.com/2017/03/03/tips-on-writing-a-frontend-developer-cv.html"/>
    <updated>2017-03-03T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/03/03/tips-on-writing-a-frontend-developer-cv</id>
    <content type="html">&lt;p&gt;This past couple weeks I’ve been sifting through CVs for the &lt;a href=&quot;https://www.conferize.com/jobs/senior-front-end-developer&quot;&gt;frontend developer&lt;/a&gt; we’re looking to hire at &lt;a href=&quot;https://www.conferize.com&quot;&gt;Conferize&lt;/a&gt;. So far it’s been a mixed bag, but I’ve noticed a few recurring themes across those that are being progressed on to an interview. Based on this experience I’ve jotted down some tips that I believe would help potential candidates in assembling a more well rounded application.&lt;/p&gt;

&lt;h2 id=&quot;write-a-custom-cover-letter&quot;&gt;Write a custom cover letter&lt;/h2&gt;

&lt;p&gt;We don’t expect War and Peace, but something that makes it clear you’ve spent some time looking in to the company and what you can bring to the table by joining. A two liner indicating that this application is in response to the job advertisement you came across isn’t a cover letter.&lt;/p&gt;

&lt;h2 id=&quot;read-the-job-description-carefully&quot;&gt;Read the job description carefully&lt;/h2&gt;

&lt;p&gt;Before applying ensure that your skill set overlaps those listed in the job description. The more recent experience the better for a mid to senior level frontend role as the landscape has changed a lot in the last five years. Just having &lt;a href=&quot;https://jquery.com/&quot;&gt;jQuery&lt;/a&gt; experience isn’t going to cut it anymore. Obviously there is some flexibility in the extent of the overlap, but you ought to be confident in your abilities in the things that do.&lt;/p&gt;

&lt;h2 id=&quot;ensure-links-are-still-active&quot;&gt;Ensure links are still active&lt;/h2&gt;

&lt;p&gt;Otherwise they shouldn’t be listed on your CV. Any active links ought to be representative of you and your craft. Having a personal website that looks and performs well across viewports leaves a good impression when applying for a frontend position. Obviously an active &lt;a href=&quot;https://github.com/&quot;&gt;GitHub&lt;/a&gt; profile would be ideal.&lt;/p&gt;

&lt;h2 id=&quot;spelling-and-grammar-matters&quot;&gt;Spelling and grammar matters&lt;/h2&gt;

&lt;p&gt;Syntax plays a large part in programming, and if it isn’t correct your application simply won’t compile. The writing on your CV is no different. This is especially true if your applying for a remote role where communicating effectively is of paramount importance.&lt;/p&gt;

&lt;h2 id=&quot;keep-it-short-and-concise&quot;&gt;Keep it short and concise&lt;/h2&gt;

&lt;p&gt;Try to keep your CV to two pages - anything longer is waffling. Cull any information that’s not relevant to the role except your hobbies or interests. Examples of this I see frequently are office addresses of past positions held, driving license status and work experience not in the technology sector. If your really struggling I suggest dropping any qualifications except the most prestigious.&lt;/p&gt;

&lt;h2 id=&quot;dont-lie&quot;&gt;Don’t lie!&lt;/h2&gt;

&lt;p&gt;If you claim that you possess 6 years &lt;a href=&quot;https://facebook.github.io/react/&quot;&gt;React&lt;/a&gt; experience then your obviously lying. If you claim to have contributed to &lt;a href=&quot;https://angular.io/&quot;&gt;Angular&lt;/a&gt; and it’s not on GitHub then if you come in for an interview I’ll ask you about this. I don’t mind if your PR was rejected, the fact you tried to contribute indicates your passion and understanding of the subject.&lt;/p&gt;

&lt;h2 id=&quot;finally&quot;&gt;Finally&lt;/h2&gt;

&lt;p&gt;These are just my opinions based on my experiences screening job applications for frontend roles, and your mileage may vary. Happy job hunting!&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Exposing Rails routes in JavaScript</title>
    <link href="http://damiannicholson.com/2017/02/02/js-routes-rails.html"/>
    <updated>2017-02-02T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/02/02/js-routes-rails</id>
    <content type="html">&lt;p&gt;When building any REST based applications in Rails, it’s common to create a &lt;code class=&quot;highlighter-rouge&quot;&gt;routes.js&lt;/code&gt; or &lt;code class=&quot;highlighter-rouge&quot;&gt;paths.js&lt;/code&gt; file containing URL helpers so your client side JavaScript components can render links or construct AJAX requests for the correct endpoint. For example:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// routes.js&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;routes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;buildUserProfileUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;damian&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/u/damian&quot;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;routes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;buildConferenceAboutUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;over-the-air&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/over-the-air/about&quot;&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;routes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;buildBookmarkSessionUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;over-the-air&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;keynote&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/over-the-air/speaker_sessions/keynote/bookmarks.json&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I’ve never been too fond of this approach for a few reasons:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;It’s a cheap imitation of the logic that currently resides on the server&lt;/li&gt;
  &lt;li&gt;It’s easy for it to get out of synch with server side route changes&lt;/li&gt;
  &lt;li&gt;It impacts your end users page performance as your application grows and you add more routes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Of course these URLs could be passed down in the JSON that used to populate the component, but that’s always seemed pointless and wasteful to me as it means you end up duplicating data which ought to be only declared once. For example when exposing a collection of resources your having to send more data over the wire:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;speakers&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Damian Nicholson&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;profile&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://www.conferize.com/u/damian&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;DHH&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;profile&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://www.conferize.com/u/dhh&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;jsroutesrails&quot;&gt;JSRoutesRails&lt;/h2&gt;

&lt;p&gt;Late last year, I spent a couple of hours writing a new gem called &lt;a href=&quot;https://github.com/damian/js-routes-rails&quot;&gt;js-routes-rails&lt;/a&gt; which solves the first two problems I outlined above - poor duplication and synchronisation with the server.&lt;/p&gt;

&lt;p&gt;It achieves this by declaring which of your routes you wanted exposed in your &lt;code class=&quot;highlighter-rouge&quot;&gt;config/routes.rb&lt;/code&gt; with an &lt;code class=&quot;highlighter-rouge&quot;&gt;export: true&lt;/code&gt; property:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# config/routes.rb&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:articles&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;export: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:comments&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:publishers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;export: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:magazines&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;resources&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:photos&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;match&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;/about&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;to: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;static#index&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;via: :get&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;export: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Note how this API works with both single routes and those declared as a block. Any child routes declared within the block syntax will also be exported.&lt;/p&gt;

&lt;p&gt;At this point all you have to do is run the Rake task provided to generate a JavaScript library containing all of the routes you declared to be exported so they can be consumed in your client side code.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;bundle &lt;span class=&quot;nb&quot;&gt;exec &lt;/span&gt;rake js_routes_rails:export&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;JsRoutesRails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;new_articles_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/articles/new'&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;JsRoutesRails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;edit_articles_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;23&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/articles/23/edit'&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;JsRoutesRails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;edit_magazines_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;publishers_id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/publishers/5/magazines/9/edit'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;More documentation and configuration options can be found &lt;a href=&quot;https://github.com/damian/js-routes-rails&quot;&gt;on GitHub&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>The books I read in 2016</title>
    <link href="http://damiannicholson.com/2017/01/01/the-books-i-read-in-2016.html"/>
    <updated>2017-01-01T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2017/01/01/the-books-i-read-in-2016</id>
    <content type="html">&lt;p&gt;I read seven books in 2016, and of those, I’d recommend only the first three that I’ve listed here.&lt;/p&gt;

&lt;h2 id=&quot;ready-player-one&quot;&gt;Ready Player One&lt;/h2&gt;

&lt;p&gt;Being a nerd there’s a strong likelihood that I’m going to like anything that blends computer games, 80s nostalgia(I was born in 86’), virtual reality and science fiction into a good story line, and this book certainly doesn’t disappoint!&lt;/p&gt;

&lt;p&gt;Set in the dystopian future, the divide between rich and poor is greater than ever. Most find solace by spending their time in a virtual world called OASIS. It’s within OASIS that poor Wade is on a mission to find a series of hidden easter eggs left behind by the world’s creator within the game. The first person to find all of these will win a jackpot making them become the richest person in the world.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommended&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;quiet-the-power-of-introverts-in-a-world-that-cant-stop-talking&quot;&gt;Quiet: The Power of Introverts in a World That Can’t Stop Talking&lt;/h2&gt;

&lt;p&gt;We’ve become conditioned to perceive that those who talk are smarter and therefore seen to be in charge. The flipside of this view is that those who don’t talk, who hold back to contemplate and make a reasoned decision later are seen as weak or lacking which is unfortunate for those of us who identify as introverts. I believe I lie on the introverted side of the spectrum which is why this book really resonated with me as I was able to learn a bit about myself whilst reading it. Nonetheless, the author makes a number of great arguments about how introverts are able to progress despite this tendancy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strongly recommended&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;elon-musk-inventing-the-future&quot;&gt;Elon Musk: Inventing the Future&lt;/h2&gt;

&lt;p&gt;There’s no doubt that Elon Musk is a visionary. After selling his first company PayPal to eBay, he invested all the proceeds into SpaceX and Tesla, both of which are flourishing despite the odds being heavily stacked against him. It’s truly inspiring to read about this man’s life so far and how he’s absolutely determined to colonise Mars and I for one am rooting for him!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommended&lt;/strong&gt;.&lt;/p&gt;

&lt;h2 id=&quot;the-world-of-cycling-according-to-g&quot;&gt;The World of Cycling According to G&lt;/h2&gt;

&lt;p&gt;This past year I’ve taken up cycling as a hobby. Much to the dismay of my wife I’ve even started watching it on TV. Naturally, I gravitated toward Team Sky as they have a good track record and most of their squad are British. Geraint Thomas is a double Olympic gold medallist and a long standing member of Sky. So far he’s helped the team win the Tour de France four times in five years, and won many races himself along the way. This book offers a good insight into what it takes to be a world-class cyclist at the top of their game, along with a few cheeky anecdotes about G and his teammates which I found enjoyable.&lt;/p&gt;

&lt;h2 id=&quot;racing-through-the-dark-the-fall-and-rise-of-david-millar&quot;&gt;Racing Through the Dark: The Fall and Rise of David Millar&lt;/h2&gt;

&lt;p&gt;Quite the contrast to Geraint’s book, David Millar was a talented British cyclist who started his career when doping in the pro teams was rife i.e. the Lance Armstrong era. Despite his efforts to stay on the straight and narrow, David caved and started doping himself after the pressure to perform became too much. Like Lance, David got caught and received a ban along with a hefty fine.&lt;/p&gt;

&lt;h2 id=&quot;the-racer-life-on-the-road-as-a-pro-cyclist&quot;&gt;The Racer: Life on the Road as a Pro Cyclist&lt;/h2&gt;

&lt;p&gt;After making short work of Racing Through the Dark, I felt compelled to check out another David Millar book. In contrast to that, this is a little ‘less real’ as doping has huge consequences both on and off the bike for a professional cyclist, however, I enjoyed it nonetheless. The book is focussed entirely on the art of racing and the tactics used when riding for a World Tour team. If you’re a keen cyclist then this book won’t disappoint.&lt;/p&gt;

&lt;h2 id=&quot;swim-bike-run-our-triathlon-story&quot;&gt;Swim, Bike, Run: Our Triathlon Story&lt;/h2&gt;

&lt;p&gt;Over the past five years two brothers from Bradford, namely Jonny and Alistair Brownlee have dominated the world triathlon scene. This book details their path in to the sport and provides excellent insight in to just how much work, dedication and training is needed to reach this level.&lt;/p&gt;

&lt;p&gt;The only downside to this book is that it’s devoid of many personal tales except any which outline a healthy sibling rivalry between Jonny and Alistair.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>The best books I read in 2015</title>
    <link href="http://damiannicholson.com/2015/12/31/the-best-books-i-read-in-2015.html"/>
    <updated>2015-12-31T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2015/12/31/the-best-books-i-read-in-2015</id>
    <content type="html">&lt;h2 id=&quot;the-martian---andy-weir&quot;&gt;The Martian - Andy Weir&lt;/h2&gt;

&lt;p&gt;I don’t tend to read fiction but I bought this on impulse as it was recommended by friends and also name dropped on the Tim Ferriss podcast. I’m so glad I did as read this cover to cover in two days.&lt;/p&gt;

&lt;p&gt;It’s about a botanist called Mark Watney who becomes stranded on Mars after a storm nearly kills him while his team are evacuating the planet. He figures that he might be able to survive until the next scheduled mission to Mars and this book takes us through his endeavours in trying to do that. It can be a bit heavy on the science and math at times, but I found those to enhance the story. I wholeheartedly recommend reading this!&lt;/p&gt;

&lt;h2 id=&quot;zero-to-one---peter-thiel&quot;&gt;Zero to One - Peter Thiel&lt;/h2&gt;

&lt;p&gt;Peter’s premise is that entrepreneurs should be intent on building and maintaining a monopoly, and to achieve that their focus ought to be on creating something new and original. Not something that is a variant of an existing product or service. That way you avoid competition, and are able to scale up in to becoming a monopoly by being the first business to dominate that niche. He also provides some guidance on maintaining a monopoly and some insight in to the PayPal mafia.&lt;/p&gt;

&lt;h2 id=&quot;work-rules-insights-from-inside-google-that-will-transform-how-you-live-and-lead---laszlo-bock&quot;&gt;Work Rules: Insights from Inside Google That Will Transform How You Live and Lead - Laszlo Bock&lt;/h2&gt;

&lt;p&gt;Overall I really liked this book. Laszlo is head of Google’s People Operations, and details how Google takes an unconventional approach to recruitment, hiring and managerial processes, and how these things have came to be(hint: it’s data driven). Some of the advice given probably isn’t practical for all businesses, but it’s a worthwhile read and there’s a lot to take away from it.&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <title>Stubbing AngularJS $window</title>
    <link href="http://damiannicholson.com/2015/07/21/stubbing-angulars-window.html"/>
    <updated>2015-07-21T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2015/07/21/stubbing-angulars-window</id>
    <content type="html">&lt;p&gt;It’s &lt;a href=&quot;https://docs.angularjs.org/guide/$location#what-does-it-not-do-&quot;&gt;sometimes useful&lt;/a&gt; to be able to perform a page redirect using AngularJS low-level &lt;a href=&quot;https://docs.angularjs.org/api/ng/service/$window&quot;&gt;$window API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What’s not ideal is when this behaviour needs testing and the sucker actually performs a redirect half way through your suite leaving you in limbo – not cool!&lt;/p&gt;

&lt;p&gt;This is where AngularJS liberal use of Dependency Injection(DI) really helps as we can utilise its inbuilt &lt;a href=&quot;https://docs.angularjs.org/api/auto/service/$provide&quot;&gt;$provide service&lt;/a&gt; to stub out &lt;code class=&quot;highlighter-rouge&quot;&gt;$window&lt;/code&gt; and overcome the issue.&lt;/p&gt;

&lt;p&gt;Below is an example of how I achieved this in Jasmine / CoffeeScript:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-coffeescript&quot; data-lang=&quot;coffeescript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;ctrl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;scope&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$window&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;null&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;beforeEach&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'my_module'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$provide&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$provide&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;constant&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'$window'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;dummy&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;inject&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$rootScope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$controller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_$window_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;scope&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$rootScope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;$new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$window&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;_$window_&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;ctrl&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$controller&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'MyController'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;$scope&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;scope&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;should redirect to '/some-other-url'&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toEqual&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;dummy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;myMethodWhichRedirects&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;toEqual&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;some-other-url&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
  </entry>
  
  <entry>
    <title>Why am I going to that conference again?</title>
    <link href="http://damiannicholson.com/2014/11/03/why-am-i-going-to-that-conference-again.html"/>
    <updated>2014-11-03T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2014/11/03/why-am-i-going-to-that-conference-again</id>
    <content type="html">&lt;p&gt;In order of priority I’ve outlined &lt;strong&gt;my main reasons&lt;/strong&gt; for attending a technical conference.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;To learn from the experiences of others&lt;/li&gt;
  &lt;li&gt;To be introduced to new topics&lt;/li&gt;
  &lt;li&gt;To learn about new tooling, products, libraries or approaches&lt;/li&gt;
  &lt;li&gt;To be inspired&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Networking is also a big reason I’m there but I just want to keep this strictly about the talks.&lt;/p&gt;

&lt;p&gt;After attending a number of conferences in the past five years, its become clear to me that &lt;strong&gt;this is not the order in which conference organisers curate their list of speakers and talks around&lt;/strong&gt;. In fact I’d go so far to say that organisers &lt;strong&gt;heavily lean toward choosing inspirational or self promotional talks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I understand this to a degree. Conferences are a risky business and lining up big speakers helps fill up the seats. But I’m concerned that &lt;strong&gt;this bias has become acceptable&lt;/strong&gt; and ‘the norm’ in the conference scene. Unfortunately its having the opposite effect on me, and on others who I’ve spoken to.&lt;/p&gt;

&lt;p&gt;I don’t think I’m alone in reiterating that delegates &lt;strong&gt;are there to learn first and foremost&lt;/strong&gt;. Its the very reason why most employers are happy to foot the bill and pay for the associated travel costs for their workers. &lt;strong&gt;Attendees want to leave feeling inspired, but mostly they want to leave having learnt something new&lt;/strong&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>CoffeeScript round two</title>
    <link href="http://damiannicholson.com/2014/03/17/coffeescript-round-two.html"/>
    <updated>2014-03-17T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2014/03/17/coffeescript-round-two</id>
    <content type="html">&lt;p&gt;&lt;img width=&quot;594px&quot; src=&quot;http://farm4.staticflickr.com/3017/2555556885_6a1b81a97f_z.jpg&quot; alt=&quot;Coffee cupt&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/lwy/2555556885/&quot;&gt;Photo credit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My &lt;a href=&quot;/2011/07/24/my-take-on-coffeescript.html&quot;&gt;original take on CoffeeScript&lt;/a&gt; wasn’t exactly favourable. For those who aren’t interested in reading that article the crux of my argument is this:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;CoffeeScript doesn’t solve enough of a problem to warrant it’s use&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Well I’m happy to say that my opinion on this matter has changed. I now firmly believe CoffeeScript &lt;em&gt;does solve&lt;/em&gt; a number of important problems to warrant its use. The rationale for my change of heart is outlined below.&lt;/p&gt;

&lt;h2 id=&quot;brevity-and-clarity&quot;&gt;Brevity and clarity&lt;/h2&gt;

&lt;p&gt;I like most developers value and enjoy working with code which is both clear and concise. CoffeeScript facilitates in achieving these goals by enabling us to focus in on the logic, not the superfluous syntax.&lt;/p&gt;

&lt;h2 id=&quot;abstractions-are-good&quot;&gt;Abstractions are good&lt;/h2&gt;

&lt;p&gt;Especially those that help you get around the nuances of the compiled language. Personally the transition to writing fluent CoffeeScript felt swift, as the features and benefits of the language became apparent as I struggled. This is akin to what happens when you test drive, things become hard when your approaching the problem incorrectly. A quick trip to the &lt;a href=&quot;http://coffeescript.org/&quot;&gt;CoffeeScript homepage&lt;/a&gt; and I was away again.&lt;/p&gt;

&lt;h2 id=&quot;confidence&quot;&gt;Confidence&lt;/h2&gt;

&lt;p&gt;Checking for type and equivalence &lt;em&gt;all the time&lt;/em&gt; cuts down on random runtime errors. I have more confidence in my code and test suite as a result of this.&lt;/p&gt;

&lt;h2 id=&quot;consolidation&quot;&gt;Consolidation&lt;/h2&gt;

&lt;p&gt;I like knowing that there is one way of doing things. Think of all the different approaches to inheritance in JavaScript or ensuring your in the correct context(named function, that / this confusion, call, &lt;code class=&quot;highlighter-rouge&quot;&gt;$.proxy&lt;/code&gt;). This is all taken care of in the core library, so I like to make use of it wherever I can.&lt;/p&gt;

&lt;h2 id=&quot;great-support&quot;&gt;Great support&lt;/h2&gt;

&lt;p&gt;We’re now at a point where compilation is so quick and easy that it’s became transparent. It’s been baked in to Rails since version 3.1 and CoffeeScript is supported in every other decent build / asset management tool including both &lt;a href=&quot;http://gruntjs.com/&quot;&gt;Grunt&lt;/a&gt; and &lt;a href=&quot;http://gulpjs.com/&quot;&gt;gulp&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Although the subject of CoffeeScript polarises people, I do think &lt;em&gt;some level of abstraction is natural and required&lt;/em&gt; as  more complex applications are being built on the client. So while CoffeeScript might not be the perfect solution, I do feel it has some merits(far more than my originally thought) and so is worth taking another look at. If not just to try to and prove me wrong. Any takers?&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <title>Scotland.js</title>
    <link href="http://damiannicholson.com/2013/05/23/scotland-js.html"/>
    <updated>2013-05-23T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2013/05/23/scotland-js</id>
    <content type="html">&lt;p&gt;&lt;img src=&quot;http://www.attacat.co.uk/wp-content/uploads/166412-summerhall-edinburgh.jpg&quot; alt=&quot;Summerhall&quot; width=&quot;594px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://nfs.stvfiles.com/imagebase/166/623x349/166412-summerhall-edinburgh.jpg&quot;&gt;Photo credit - STV Edinburgh&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A little over a week ago I had the pleasure of speaking at &lt;a href=&quot;http://scotlandjs.com/&quot;&gt;Scotland.js&lt;/a&gt;, a two day JavaScript conference hosted in the centre of Edinburgh.&lt;/p&gt;

&lt;h2 id=&quot;my-talk&quot;&gt;My talk&lt;/h2&gt;

&lt;p&gt;Being my first &lt;em&gt;proper speaking engagement&lt;/em&gt;, I was very nervous in the run up to the event. Its no secret that public speaking is one of man’s &lt;a href=&quot;http://www.statisticbrain.com/fear-phobia-statistics/&quot;&gt;top phobias&lt;/a&gt;, and I guess I’m no different in that respect.&lt;/p&gt;

&lt;p&gt;Anyhow I’m happy to report that my talk went down well, and I received some great comments afterwards from a handful of attendees which was very much appreciated. It managed to provoke some interesting discussion in the Q&amp;amp;A session and later on in the pub too!&lt;/p&gt;

&lt;p&gt;My talk, entitled “Writing testable, scalable, maintainable rock solid JavaScript” was geared around how to unit test your client side code, and explained some of the lesser well known benefits of unit testing. I also shared some tips and techniques that we use at Sage in order to make our code more decoupled. You can see &lt;a href=&quot;https://speakerdeck.com/damian/writing-testable-scalable-maintainable-rock-solid-javascript&quot;&gt;my slides on SpeakerDeck&lt;/a&gt; or check them out in the embed below.&lt;/p&gt;

&lt;script class=&quot;speakerdeck-embed&quot; data-id=&quot;bfb029609cae01305a0c2a4e467154fd&quot; data-ratio=&quot;1.77777777777778&quot; src=&quot;//speakerdeck.com/assets/embed.js&quot;&gt;

&lt;/script&gt;

&lt;p&gt;The video will be released sometime in the next few weeks so make sure to &lt;a href=&quot;https://twitter.com/damian&quot;&gt;follow me&lt;/a&gt; or &lt;a href=&quot;https://twitter.com/scotlandjs&quot;&gt;Scotland.js&lt;/a&gt; on Twitter to ensure you don’t miss it.&lt;/p&gt;

&lt;h2 id=&quot;scotlandjs&quot;&gt;Scotland.js&lt;/h2&gt;

&lt;p&gt;The conference itself was a blast! I learnt a lot of cool stuff about Node.js, client side databases like IndexedDB and leveldb, and to how to work around heavily nested asynchronous calls with &lt;a href=&quot;https://github.com/raimohanska/bacon.js&quot;&gt;bacon&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;The networking and social side of the conference was top notch! There was somewhere in the region of one hundred attendees, and because of this the atmosphere was very welcoming and friendly. Consequently I got to meet and chat with a load of other software developers from all over the globe in the breaks and afterward in the pub. I remember having great conversations with &lt;a href=&quot;https://twitter.com/cobyism&quot;&gt;Coby&lt;/a&gt;, &lt;a href=&quot;https://twitter.com/colin_gemmell&quot;&gt;Colin&lt;/a&gt;, Igor, Stefan, &lt;a href=&quot;https://twitter.com/jiggy_pete&quot;&gt;Peter&lt;/a&gt;, &lt;a href=&quot;https://twitter.com/janl&quot;&gt;Jan&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/dominictarr&quot;&gt;Dominic&lt;/a&gt; to name a few.&lt;/p&gt;

&lt;p&gt;I really wish more conferences were this intimate, as I find that larger crowds invite cliquish behaviour. Something which make it pretty intimidating if you want to approach and chat.&lt;/p&gt;

&lt;p&gt;I’d like to thank &lt;a href=&quot;https://twitter.com/jiggy_pete&quot;&gt;Peter Aiken&lt;/a&gt; for having me and &lt;a href=&quot;http://www.neo.com/&quot;&gt;Neo&lt;/a&gt; for putting on such a great event!&lt;/p&gt;

&lt;p&gt;Also for the support that my friends and colleagues in &lt;a href=&quot;http://uk.sageone.com&quot;&gt;Sage&lt;/a&gt; have given me in gearing up for the conference(you know who you are), it’s very much appreciated!&lt;/p&gt;

&lt;h2 id=&quot;talk&quot;&gt;Talk&lt;/h2&gt;

&lt;iframe src=&quot;http://player.vimeo.com/video/68526881&quot; width=&quot;500&quot; height=&quot;161&quot; frameborder=&quot;0&quot;&gt; &lt;/iframe&gt;
</content>
  </entry>
  
  <entry>
    <title>Moving to Android</title>
    <link href="http://damiannicholson.com/2013/05/18/moving-to-android.html"/>
    <updated>2013-05-18T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2013/05/18/moving-to-android</id>
    <content type="html">&lt;p&gt;&lt;img src=&quot;/images/android.jpg&quot; alt=&quot;Android logo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/saadirfan/5168981298/sizes/z/in/photostream/&quot;&gt;Photo credit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the title if this post isn’t enough of a giveaway, I’ve retired my iPhone 4S and purchased a Nexus 4.&lt;/p&gt;

&lt;p&gt;To say that I’ve invested a lot of time and money into the Apple ecosystem over the past five years is an understatement. So this is somewhat of a big deal for me.&lt;/p&gt;

&lt;h2 id=&quot;why-the-change&quot;&gt;Why the change?&lt;/h2&gt;

&lt;p&gt;Quite simply I think I’ve outgrown iOS and all that it has to offer. I’ve longed for more power user features and configurability over the past six months than ever before. And sadly iOS just isn’t able to provide that for me at this moment in time.&lt;/p&gt;

&lt;p&gt;Perhaps it’s a premature move on my part, since we can only speculate as to what iOS7 has in store. But knowing Apple as a company, they aren’t going to make a change, for changing sake. Looking back at their previous releases is evidence of this. Think about how long it took them to implement a simple feature like copy and paste.&lt;/p&gt;

&lt;h2 id=&quot;android-first-impressions&quot;&gt;Android first impressions&lt;/h2&gt;

&lt;p&gt;Android is pretty darn sweet now. The clunkiness of the interface has gone and the responsiveness is excellent! Added to the fact that I have been able to see dramatic software improvements take place over the past few years made this a no brainer for me. Yes there’s room for improvement, but I’m confident that these are going to get addressed in the near future.&lt;/p&gt;

&lt;p&gt;That said I’m thoroughly enjoying my Nexus 4 and all that it has to offer! In fact I’m busy writing this very blog post using the gesture enabled keyboard. Something I’d never dream of using my old iPhone.&lt;/p&gt;

&lt;h2 id=&quot;pros-and-cons&quot;&gt;Pros and cons&lt;/h2&gt;

&lt;p&gt;For those of you who are considering making the move to Android, here’s a quick rundown on a few of the things that I’ve noticed since jumping ship. Some of these might be phone specific, rather than applicable to Android, but I’m going to list them here anyways.&lt;/p&gt;

&lt;h2 id=&quot;pros&quot;&gt;Pros&lt;/h2&gt;

&lt;h3 id=&quot;hardware&quot;&gt;Hardware&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Larger screen&lt;/li&gt;
  &lt;li&gt;Increased battery life&lt;/li&gt;
  &lt;li&gt;Standard charging adapter&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;software&quot;&gt;Software&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Google integration is fantastic&lt;/li&gt;
  &lt;li&gt;Itemised breakdown of mobile data and battery usage is killer. You can even set a cap on each.&lt;/li&gt;
  &lt;li&gt;Notifications HUD is interactive i.e. you can action things within it on the fly like archiving an email&lt;/li&gt;
  &lt;li&gt;Gesture keyboard entry has completely changed the way I type on a touch screen device. I never want to touch type again&lt;/li&gt;
  &lt;li&gt;Better customisation using Apps launchers and widgets&lt;/li&gt;
  &lt;li&gt;Android updates come directly from Google. No waiting around for mobile carriers to add their guff before receiving the official Google update.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;cons&quot;&gt;Cons&lt;/h2&gt;

&lt;h3 id=&quot;hardware-1&quot;&gt;Hardware&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Position of the power button is annoying&lt;/li&gt;
  &lt;li&gt;Camera isn’t as good&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;software-1&quot;&gt;Software&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Sometimes the back button is a little inconsistent&lt;/li&gt;
  &lt;li&gt;No ability to press and hold down the full stop key to insert .com or .co.uk&lt;/li&gt;
  &lt;li&gt;No ability to touch the top of the screen and scroll to the top of the page&lt;/li&gt;
  &lt;li&gt;When you remove an icon from the home screen, it isn’t uninstalled. Perhaps this is a failure in my mental model as I’ve been so used to using iOS&lt;/li&gt;
  &lt;li&gt;Gestures aren’t used half as much as in iOS apps e.g. nice mechanisms like pull to refresh aren’t as popular&lt;/li&gt;
  &lt;li&gt;A few apps which I use almost daily don’t have an Android counterpart. DayOne, Omnifocus and Fantastical being the main ones&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>JavaScript North East</title>
    <link href="http://damiannicholson.com/2012/04/21/javascript-north-east.html"/>
    <updated>2012-04-21T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2012/04/21/javascript-north-east</id>
    <content type="html">&lt;p&gt;Last week I had the pleasure of giving a talk on &lt;a href=&quot;http://pivotal.github.com/jasmine/&quot;&gt;Jasmine&lt;/a&gt; at JavaScript North East(JSNE). Despite being nervous as hell(public speaking), the talk went ok and it managed to provide some stimulating conversation around testing.&lt;/p&gt;

&lt;h2 id=&quot;slides&quot;&gt;Slides&lt;/h2&gt;
&lt;p&gt;I’ve posted up the &lt;a href=&quot;http://speakerdeck.com/u/damian/p/ten-things-you-should-know-about-jasmine&quot;&gt;slides on SpeakerDeck&lt;/a&gt;, or you can see them embedded below.&lt;/p&gt;

&lt;script class=&quot;speakerdeck-embed&quot; data-id=&quot;4f84b0274976b80022007cd5&quot; data-ratio=&quot;1.6&quot; src=&quot;//speakerdeck.com/assets/embed.js&quot;&gt; &lt;/script&gt;

&lt;h2 id=&quot;motivation-for-the-talk&quot;&gt;Motivation for the talk&lt;/h2&gt;
&lt;p&gt;It’s clear we’re seeing a trend toward business logic living on the client. This is because we as users enjoy using rich and responsive web applications like Twitter and GMail. Now that internet speeds across the world have increased, coupled with the fact that browser vendors have worked hard to optimize their &lt;a href=&quot;http://code.google.com/p/v8/&quot;&gt;JavaScript engines&lt;/a&gt; and increase parallel downloads, developing applications like these is no longer restricted to companies who have their own server farms.&lt;/p&gt;

&lt;p&gt;Because of this trend, front-end developers have to &lt;strong&gt;grow up and start embracing software development best practices when building non-trivial web applications&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;One way we can achieve this is by testing our code using a tool like Jasmine. This ensures any JavaScript we write is maintainable, correct and modular.&lt;/p&gt;

&lt;p&gt;In my talk, I outlined why and how Jasmine is highly capable of testing any JavaScript of any platform using a few examples along the way.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>jQuery UK conference</title>
    <link href="http://damiannicholson.com/2012/02/25/jquery-uk-conference.html"/>
    <updated>2012-02-25T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2012/02/25/jquery-uk-conference</id>
    <content type="html">&lt;p&gt;&lt;img src=&quot;/images/jquery-uk.jpg&quot; alt=&quot;jQuery UK&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Two weeks ago I had the pleasure of going to jQuery UK in Oxford. I finally managed to write up my notes from the event, so without further ado, here they are.&lt;/p&gt;

&lt;h3 id=&quot;ralph-whitbeck---the-state-of-the-jquery-project&quot;&gt;Ralph Whitbeck - The State of the jQuery Project&lt;/h3&gt;

&lt;p&gt;I enjoyed Ralph’s talk, as much of what we know and love about jQuery is often taken for granted. In addition to development work and performance enhancements, it’s astounding how much goes on behind the scenes in the jQuery project. Examples include maintainence of jQuery.com, the API and the CDN. I use these resources daily, and they never ever seem to experience any downtime.&lt;/p&gt;

&lt;p&gt;Ralph also outlined what’s to come in jQuery 1.8&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;No new API’s&lt;/li&gt;
  &lt;li&gt;Some refactoring to bring down the file size&lt;/li&gt;
  &lt;li&gt;Exploring ways to break IE7/8 functionality out in to a compatibility plugin&lt;/li&gt;
  &lt;li&gt;Infrastructure overhaul&lt;/li&gt;
  &lt;li&gt;Site refresh&lt;/li&gt;
  &lt;li&gt;New plugin site&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;todd-parker---jquery-mobile&quot;&gt;Todd Parker - jQuery Mobile&lt;/h3&gt;

&lt;p&gt;This was the talk I was least looking forward to, and it turned out to be one of my favourite talks of the day. In a nutshell &lt;a href=&quot;http://jquerymobile.com/&quot;&gt;jQuery Mobile&lt;/a&gt; has came on leaps and bounds since it was first released, it’s a million times more reliable and it boasts plenty of mobile / tablet optimised features out of the box. I look forward to working with this some time in the near future.&lt;/p&gt;

&lt;p&gt;A few things which I found interesting:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Touch optimized&lt;/li&gt;
  &lt;li&gt;Hijacks links for performance reasons automatically transitions to the new page being accessed with an animation&lt;/li&gt;
  &lt;li&gt;Testing is perfomed on actual devices rather than emulators as this yields the best results&lt;/li&gt;
  &lt;li&gt;Utilises the HTML5 history API and gracefully degrades to to hashchange if this isn’t supported by the phones browser&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;dion-almaer-and-ben-galbraith---web-vs-apps&quot;&gt;Dion Almaer and Ben Galbraith - Web vs Apps&lt;/h3&gt;

&lt;p&gt;It took me a little time to get into this talk, though I wouldn’t say this is a reflection on the speakers as once I caught up, I found Dion and Ben had some good stuff to say. Their underlying message is to make people realise that both of these platforms need to be leveraged appropriately depending on what’s mission critical. For example mobile apps look and respond great, but it’ easier to A/B test and deploy to the web frequently(no resubmission to the App Store). Whichever approach is taken, it needs to be revisited frequently to move with technical developments e.g better phones, better browsers. In doing this for Walmart Dion and Ben released a Node.js framework called &lt;a href=&quot;http://walmartlabs.github.com/thorax&quot;&gt;Thorax&lt;/a&gt; which looks interesting.&lt;/p&gt;

&lt;h3 id=&quot;jorn-zaefferer---pitfalls-and-opportunities-of-single-page-web-applications&quot;&gt;Jorn Zaefferer - Pitfalls and opportunities of Single Page Web Applications&lt;/h3&gt;

&lt;p&gt;Jorn’s talk was packed with useful techniques, recommended libraries and nuggets of information. Definitely the talk that I felt I got the most out of in terms of knowledge I can take away and use immediately.&lt;/p&gt;

&lt;p&gt;Jorn managed to delve in to the topics:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Leveraging the HTML5 history API. Notably why and how it should be used. In the event that the history API isn’t supported by a users browser it should fallback gracefully to hashchange.&lt;/li&gt;
  &lt;li&gt;Client-side error tracking. Similar to the techniques outlined in Nicholas Zakas talk on &lt;a href=&quot;http://www.slideshare.net/nzakas/enterprise-javascript-error-handling-presentation&quot;&gt;Enterprise Error Handling&lt;/a&gt; except at a lower level with code examples. Jorn outlined why catching JS errors in production is helpful(it pisses off users without you knowing these errors are being thrown) and how it should be done using &lt;code class=&quot;highlighter-rouge&quot;&gt;window.onerror&lt;/code&gt; and logging this back to the server via AJAX.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;christian-heilmann---embracing-and-celebrating-redundancy&quot;&gt;Christian Heilmann - Embracing and celebrating redundancy&lt;/h3&gt;

&lt;p&gt;I found Christian’s talk highly entertaining and informative. The fact that Christian had the balls to go to Europe’s first jQuery conference and advise people not to use jQuery I find hilarious. Humour aside, Christian supported his argument with many examples of why jQuery is simply not needed anymore. Browser vendors have fixed their weird inconsistencies over the past 5 years(IE9 &amp;amp; 10 aren’t too bad at all) and implemented native API’s that are very concise. He advocated that we should really determine the use case before jumping straight in to a new project and bootstrapping it with jQuery purely out of habit.&lt;/p&gt;

&lt;h3 id=&quot;haymo-meran---aloha-editor&quot;&gt;Haymo Meran - Aloha Editor&lt;/h3&gt;

&lt;p&gt;This isn’t a dig at Haymo, but I felt as an attendee that his entire talk was geared to market his product - &lt;a href=&quot;http://aloha-editor.org&quot;&gt;Aloha Editor&lt;/a&gt;. My advice to Haymo would be to tone down on the marketing, and explain the nitty gritty of some of the cool stuff that’s going on under the hood of Aloha Editor as it seems to be a well built product.&lt;/p&gt;

&lt;h3 id=&quot;paul-irish---webapp-development-stack--tooling&quot;&gt;Paul Irish - Webapp development stack &amp;amp; tooling&lt;/h3&gt;

&lt;p&gt;Like Christian, I found Paul’s speaking style to be informative but hilarious at the same time. Paul presented a smorgasbord of high quality tools and techniques that we shold certainly keep in our toolbox when starting a new project, building a new feature or debugging code. Paul mentioned stuff like:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;JSHint&lt;/li&gt;
  &lt;li&gt;Jade, SASS, Less, Stylus and Compass&lt;/li&gt;
  &lt;li&gt;HAML, Markdown, Jade, Handlebars&lt;/li&gt;
  &lt;li&gt;HTML5 boilerplate, Email boilerplate&lt;/li&gt;
  &lt;li&gt;CoffeeScript, Dart&lt;/li&gt;
  &lt;li&gt;Firebug, Webkit Developer Tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a big &lt;a href=&quot;http://sass-lang.com/&quot;&gt;SASS&lt;/a&gt; user, it was news to my ears to find that Paul was working on trying to get it integrated in to Google Chrome natively. Paul also showed off some awesome features in the Chrome Canary builds that are going to make my life a hell of a lot easier like JS directives.&lt;/p&gt;

&lt;h3 id=&quot;addy-osmani---large-scale-applications-using-javascript-and-jquery&quot;&gt;Addy Osmani - Large scale applications using JavaScript and jQuery&lt;/h3&gt;

&lt;p&gt;I’ve watched a couple of Addy’s presentations online before so I found I didn’t didn’t get much out of this talk. It was very good don’t get wrong, except I found it heavy on the theory(show me the code&lt;img src=&quot;&quot; alt=&quot;&quot; /&gt;), much in the same vein as the basis for his talk by Nicolas Zakas on Scalable JavaScript Architecture.&lt;/p&gt;

&lt;h3 id=&quot;doug-neiner---contextual-jquery&quot;&gt;Doug Neiner - Contextual jQuery&lt;/h3&gt;

&lt;p&gt;Doug’s knowledge of jQuery comes through in his talks as he speaks with clearly with authority. Doug outlined why certain code styles are slow(with examples) and why it’s more performant to leverage DOM traversal over ID’s and classes in the right context. It’s fine to keep markup clean and use complex sectors. Doug also presented that we shouldn’t have all selectors running on Document Ready which I found interesting. He prefers just in time intialzation of events and selectors, as there’s a chance some parts of the page won’t be used that often, so why set it all up ahead of time?&lt;/p&gt;

&lt;p&gt;To summarise, I had a fantastic time at jQuery UK (thanks &lt;a href=&quot;http://twitter.com/sageuk&quot;&gt;@sageuk&lt;/a&gt;), met some cool people, learnt a bit and would love to go again next year. Hats off to the folks from &lt;a href=&quot;http://whiteoctober.co.uk&quot;&gt;White October&lt;/a&gt; as they done a great job putting this together.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Speed up writing CSS backgrounds in Bash</title>
    <link href="http://damiannicholson.com/2011/12/26/speed-up-writing-css-backgrounds-in-bash.html"/>
    <updated>2011-12-26T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2011/12/26/speed-up-writing-css-backgrounds-in-bash</id>
    <content type="html">&lt;p&gt;I should point out that both the original idea and implementation came from &lt;a href=&quot;http://www.bradshawenterprises.com&quot;&gt;Richard Bradshaw&lt;/a&gt;. I highly recommend reading his &lt;a href=&quot;http://www.bradshawenterprises.com/blog/2011/speed-up-writing-css-backgrounds&quot;&gt;blog post&lt;/a&gt; as it’s a good primer as to why this script is so useful for people who write CSS often.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TLDR:&lt;/strong&gt; Getting the dimensions for background images in CSS is a common task for front end developers which requires application switching and memory work. Richard has scripted up this process which copies the resulting CSS with correct image dimensions directly to his clipboard. Schweet!&lt;/p&gt;

&lt;p&gt;So why am I banging on about a blog post someone else has written? I thought it would be a good learning experience to port it over to Bash as the original was Python(no flame wars please). I also knew that retrieving image dimensions is trivial using imagemagick(the only pre-requisite).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Retrieve image dimensions using imagemagick&lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# We're only concerned with the first image(gifs have multiple) hence the array notation&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;identify -format &lt;span class=&quot;s1&quot;&gt;'%w'&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0]&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;identify -format &lt;span class=&quot;s1&quot;&gt;'%h'&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0]&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Build CSS string&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;background: transparent url(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;) no-repeat 0 0;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
str+&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;width: &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;px;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
str+&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;height: &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;px;&quot;&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; -e &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt;;

&lt;span class=&quot;c&quot;&gt;# Pipe out string retaining line-breaks to macosx clipboard&lt;/span&gt;
&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; -e &lt;span class=&quot;nv&quot;&gt;$str&lt;/span&gt; | pbcopy&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Throw the above snippet in to &lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/bin/css-background&lt;/code&gt;, make it executable and reload your terminal.&lt;/p&gt;

&lt;p&gt;Next time you’ve outputted an image in Photoshop and plonked it in your images directory, give this a shot at the command line and hit paste in your editor.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;css-background path/to/your-image.jpg&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Something like the following will be outputted in to your CSS file.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;c&quot;&gt;/* Copies the following to your clipboard */&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;transparent&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;to&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;your-image&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;.jpg&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;no-repeat&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;16px&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;16px&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Oh and Merry Christmas!&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>jQuery inconsistencies</title>
    <link href="http://damiannicholson.com/2011/12/05/jquery-inconsistencies.html"/>
    <updated>2011-12-05T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2011/12/05/jquery-inconsistencies</id>
    <content type="html">&lt;p&gt;Yesterday I discovered what &lt;strong&gt;I thought to be a bug in jQuery&lt;/strong&gt;. See the snippet below which highlights the issue I ran in to.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;textInputs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'input:text'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// OK&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;submitInputs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'input:submit'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// OK&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;checkboxInputs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'input:checkbox'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// OK&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;searchInputs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'input:search'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Syntax error, unrecognized expression: search&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This error is also thrown when trying to select any of the newer inputs introduced in HTML5 in a similar pseudo selector fashion.&lt;/p&gt;

&lt;p&gt;Naturally I started looking through the &lt;a href=&quot;http://api.jquery.com/&quot;&gt;docs&lt;/a&gt; but couldn’t find a mention anywhere regarding the new HTML5 inputs. Something which I found suprising considering how prevalent the use of HTML5 is now.&lt;/p&gt;

&lt;p&gt;After some digging on Google, I unearthed &lt;a href=&quot;http://bugs.jquery.com/ticket/9132&quot;&gt;an old ticket&lt;/a&gt; on jQuery’s bug tracker asking to support the above pseudo selector notation in order to maintain consistency across its API. However the &lt;strong&gt;idea was shot down&lt;/strong&gt; due to the way older browsers handle inputs they can’t interpret(they fallback to text fields) which is a fair argument.&lt;/p&gt;

&lt;p&gt;What I don’t understand is how the same selector wrote in a slightly different way &lt;strong&gt;is supported&lt;/strong&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;searchInputs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'input[type=search]'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// OK&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;There are three things I want out of an API:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Well tested&lt;/li&gt;
  &lt;li&gt;Well documented&lt;/li&gt;
  &lt;li&gt;Consistent&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now come on guys get onboard with the latter, either make this happen or deprecate pseudo selector support entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DISCLAIMER:&lt;/strong&gt; I still love jQuery.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>HTML5 Validator Gem</title>
    <link href="http://damiannicholson.com/2011/09/10/html5-validator-gem.html"/>
    <updated>2011-09-10T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2011/09/10/html5-validator-gem</id>
    <content type="html">&lt;p&gt;We all know the benefits of adhering to web standards, but I’m sure you’ll agree it’s a laborious process manually checking the validity of each page within a site or web app using the online W3C validation service or a browser extension.&lt;/p&gt;

&lt;p&gt;In an effort to scratch my own itch, I built a gem called &lt;a href=&quot;https://rubygems.org/gems/html5_validator&quot;&gt;html5_validator&lt;/a&gt;. It’s geared to run &lt;strong&gt;as part of an RSpec test suite&lt;/strong&gt;, so if your serious about being standards compliant, you shouldn’t mind your tests failing if you’ve got some grubby HTML kicking about.&lt;/p&gt;

&lt;p&gt;It can be installed using the following command.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;html5_validator&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;What’s cool is that if your page isn’t compliant resulting in a failing spec, &lt;strong&gt;the offending HTML is printed out as part of the failing test&lt;/strong&gt;. See below an example of how this can be used in a controller test:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;describe&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;PostsController&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;render_views&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;it&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;should be valid html5&quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:new&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;should&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;be_valid_html5&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;how-does-this-work&quot;&gt;How does this work?&lt;/h3&gt;

&lt;p&gt;I wrote a wrapper around an online HTML5 validation service called &lt;a href=&quot;http://validator.nu/&quot;&gt;validator.nu&lt;/a&gt;. When run as part of an RSpec suite, the rendered HTML is posted to their web service which responds with some JSON containing the results of the validation check.&lt;/p&gt;

&lt;p&gt;I opted to use validator.nu over the official W3C validator because it supports JSON (the W3C only supports SOAP), so it’s easy to work with in Ruby.&lt;/p&gt;

&lt;h3 id=&quot;more-info&quot;&gt;More info&lt;/h3&gt;

&lt;p&gt;You can find the code on my &lt;a href=&quot;https://github.com/damian/html5_validator&quot;&gt;Github repository&lt;/a&gt; along with a few more examples.&lt;/p&gt;

&lt;p&gt;As always questions and comments are very welcome. Forks and pull requests even more so.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>iPhone style checkbox using only CSS3</title>
    <link href="http://damiannicholson.com/2011/07/25/css-experiment-iphone-like-checkbox-using-only-css3.html"/>
    <updated>2011-07-25T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2011/07/25/css-experiment-iphone-like-checkbox-using-only-css3</id>
    <content type="html">&lt;p&gt;I’m not normally one for CSS experiments, but after reading a few chapters of &lt;a href=&quot;http://hardboiledwebdesign.com/&quot;&gt;Hardboiled Webdesign&lt;/a&gt; on the plane journey back from Mexico, I had the urge to try out some CSS transitions.&lt;/p&gt;

&lt;p&gt;I didn’t want to go &lt;a href=&quot;http://anthonycalzadilla.com/css3-ATAT/&quot;&gt;AT-AT Walker&lt;/a&gt; overboard(even though it’s pure awesome), so I decided to create an iPhone checkbox using &lt;strong&gt;only CSS&lt;/strong&gt;. It turned out to be pretty easy, check out the demo and code below.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;a href=&quot;http://dl.dropbox.com/u/391082/checkbox-ios.html&quot;&gt;Check out the demo here!&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&quot;html&quot;&gt;HTML&lt;/h3&gt;

&lt;p&gt;I’ve tried to keep the markup pretty lean. Similar to what’s generated via &lt;a href=&quot;https://github.com/justinfrench/formtastic&quot;&gt;Formtastic&lt;/a&gt; or &lt;a href=&quot;https://github.com/plataformatec/simple_form&quot;&gt;SimpleForm&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;checkbox&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;check&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;checkbox&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;for=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;check&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;Check-me&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;css&quot;&gt;CSS&lt;/h3&gt;

&lt;p&gt;This is where the magic happens! The main thing to note is that we’re not really using the checkbox at all. We’re leveraging the fact that it’s toggled when we click it’s label(which has the necessary for attribute). That way the iOS checkbox image can be applied to the label, which in turn is wrapped in a div with a specific height, width and an overflow of hidden. Using the &lt;code class=&quot;highlighter-rouge&quot;&gt;:checked&lt;/code&gt; pseudo selector, we transition the position of the background image on the label, just like on an iPhone!&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nt&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;font-family&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&quot;Lucida Grande&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Verdana&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Arial&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;sans-serif&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Helvetica&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nc&quot;&gt;.checkbox&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;94px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;27px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;overflow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;hidden&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;border-radius&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;	

&lt;span class=&quot;nt&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;checkbox&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;checkbox&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;text-indent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;-9999px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;150px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;27px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;line-height&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;27px&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;background&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;transparent&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;url(sprite2.png)&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;no-repeat&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;-56px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;-webkit-transition&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;background-position&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.3s&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ease-in-out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;-moz-transition&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;background-position&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.3s&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ease-in-out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nt&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;checkbox&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;:checked&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;-webkit-transition&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;background-position&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.3s&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ease-in-out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;-moz-transition&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;background-position&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0.3s&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ease-in-out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;background-position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;-3px&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
  </entry>
  
  <entry>
    <title>My take on CoffeeScript</title>
    <link href="http://damiannicholson.com/2011/07/24/my-take-on-coffeescript.html"/>
    <updated>2011-07-24T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2011/07/24/my-take-on-coffeescript</id>
    <content type="html">&lt;p&gt;So &lt;a href=&quot;http://jashkenas.github.com/coffee-script/&quot;&gt;CoffeeScript&lt;/a&gt; has been on my radar for some time now, and unfortunately it hasn’t piqued my interest as much as other Ruby developers I know. Only recently did I eventually realise as to why this was the case - &lt;strong&gt;it doesn’t solve a problem&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I’ll rephrase that last bit. In my opinion it doesn’t solve enough of a problem to warrant learning a new language and the resulting loss in productivity that will ensue from that transition. An issue which is compounded the more developers there are on a project(most will not know CoffeeScript).&lt;/p&gt;

&lt;p&gt;As far as I’m concerned CoffeeScript is &lt;strong&gt;syntactic sugar&lt;/strong&gt;, plain and simple. Sure the JavaScript that it compiles down to is of a higher quality than most of us can write, resulting in more performant code. But I figure this gain in negligable. If it were ever to boil down to this being an issue, then I’m almost certain there are other parts of the codebase which could be given a little &lt;strong&gt;more care and attention&lt;/strong&gt;(making less HTTP requests is an example) that could make up for this.&lt;/p&gt;

&lt;p&gt;There’s also the fact that debugging will be more difficult - as any errors in the browser will correspond to the compiled version, not the CoffeeScript.&lt;/p&gt;

&lt;p&gt;To conclude, I’m not sold on CoffeeScript just yet as &lt;strong&gt;I don’t think the benefits outweigh the drawbacks&lt;/strong&gt; of introducing a new language on the stack.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Ruby Gem: Cineworld</title>
    <link href="http://damiannicholson.com/2011/04/29/ruby-gem-cineworld.html"/>
    <updated>2011-04-29T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2011/04/29/ruby-gem-cineworld</id>
    <content type="html">&lt;p&gt;I released my first ruby gem, &lt;a href=&quot;https://rubygems.org/gems/cineworld&quot;&gt;cineworld&lt;/a&gt; in to the wild a couple weeks ago. I’ll be honest most of the heavy lifting was done by &lt;a href=&quot;https://github.com/jnunemaker/httparty&quot;&gt;httparty&lt;/a&gt;, but it was a learning experience nonetheless. Hat tip to &lt;a href=&quot;https://github.com/technicalpickles/jeweler&quot;&gt;jeweler&lt;/a&gt; also.&lt;/p&gt;

&lt;p&gt;Unsurprisingly it’s a simple wrapper around the &lt;a href=&quot;https://www.cineworld.co.uk/developer&quot;&gt;Cineworld API&lt;/a&gt;, which is able to pull back cinema listings, film showings and performances from Cineworld venues around the country. Check it out on &lt;a href=&quot;https://github.com/damian/cineworld&quot;&gt;github&lt;/a&gt; or start using it now by following the instructions below.&lt;/p&gt;

&lt;h3 id=&quot;installation&quot;&gt;Installation&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cineworld&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;c1&quot;&gt;# Initialise with your API key&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;cineworld&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Cineworld&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;API&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'API_KEY'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Get all cinemas that have programmed performances&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cineworld&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;cinemas&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Get all films that have programmed performances&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cineworld&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;films&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Get all dates that have programmed performances&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cineworld&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;dates&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# Get all performances that are programmed for a particular cinema, film and date&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cineworld&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;performances&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Let me know in the comments if you find it useful, or if you want to contribute a patch, please do so on &lt;a href=&quot;https://github.com/damian/cineworld&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Why I Use Haml</title>
    <link href="http://damiannicholson.com/2011/04/19/why-i-use-haml.html"/>
    <updated>2011-04-19T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2011/04/19/why-i-use-haml</id>
    <content type="html">&lt;p&gt;If you’d asked me six months ago my stance on alternative templating engines, you would have heard me say something along the lines of ‘I can’t see the point in them. Why do I need to learn another DSL when I’m perfectly comfortable writing ERB.’ To be fair, I bet a lot of developers still feel the same way.&lt;/p&gt;

&lt;p&gt;If you were to ask me that question now however, my answer would be completely different. That’s right, I’m a convert. My off the cuff views on templating frameworks have turned full circle.&lt;/p&gt;

&lt;p&gt;How did this happen? Let me explain.&lt;/p&gt;

&lt;p&gt;About a month ago I was scanning through my feeds when I came cross &lt;a href=&quot;http://ramden.com/blog/2011/03/31/haml-and-sass-where-have-you-been-before/&quot;&gt;yet another blog post&lt;/a&gt; outlining the benefits of &lt;a href=&quot;http://haml-lang.com/&quot;&gt;Haml&lt;/a&gt;. For a long time I couldn’t quite understand why so many &lt;a href=&quot;http://blog.obiefernandez.com/content/2008/01/are-you-using-h.html&quot;&gt;luminaries&lt;/a&gt; I admired in the Rails world were opting to &lt;strong&gt;only use Haml&lt;/strong&gt; on their projects.&lt;/p&gt;

&lt;p&gt;I decided enough was enough, and I had to give Haml a try. Though rather than starting a fresh project, I decided I wanted to give it a try out on this here blog(my test bed for most new stuff I want to try out). I thought this was an ideal approach as it’s a real world Rails app in production, so I had a benchmark of what the finished product should be like. It also meant that I could merge my Haml feature branch in to master, should I prefer it in the long run(which is what I ended up doing).&lt;/p&gt;

&lt;h3 id=&quot;converting-erb-to-haml&quot;&gt;Converting Erb to Haml&lt;/h3&gt;

&lt;p&gt;Fortunately, the task of converting my ERB views to Haml was straight forward as I found a handy &lt;a href=&quot;http://screencasts.org/episodes/using-haml-with-rails-3&quot;&gt;rake script&lt;/a&gt; to take care of this. I honestly thought this step would have taken longer, but I was up an running with Haml in a couple of minutes.&lt;/p&gt;

&lt;h3 id=&quot;erb-vs-haml&quot;&gt;Erb vs Haml&lt;/h3&gt;

&lt;p&gt;Once I started digging in the code, it immediately became apparent to me as to why Haml has received so much attention over the past year or two. Simply because &lt;strong&gt;HAML RAWKS&lt;/strong&gt; and here’s my attempt to explain why.&lt;/p&gt;

&lt;h3 id=&quot;haml-is-very-lean-and-concise&quot;&gt;Haml is very lean and concise&lt;/h3&gt;

&lt;p&gt;So lean that most of my template files were reduced by at least a third in size. In some cases more like 50 − 60%. And the original markup was already lean to begin with. Check out my main layout file - it used to be 70 lines long, now it’s half that(I’ve taken out the includes for brevity).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-haml&quot; data-lang=&quot;haml&quot;&gt;&lt;span class=&quot;nt&quot;&gt;%body&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;#body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:class&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;body_classes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;.container_12&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;%header&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;%h1&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;%a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:href&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;root_path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&amp;gt;&lt;span class=&quot;err&quot;&gt;&amp;lt;&lt;/span&gt;
          damiannicholson
          &lt;span class=&quot;nt&quot;&gt;%span&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;.strapline&lt;/span&gt; web developer // diet coke drinker // master mitigator
    &lt;span class=&quot;nf&quot;&gt;#main&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;.grid_7.alpha&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;%aside&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;#right&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;.grid_4.push_1.omega&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;render&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:partial&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'other/bio'&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;yield&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:sidebar_right&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;%footer&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;render&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:partial&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;streams/stream&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:collection&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@stream&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:as&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:stream&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;#footer-bottom&lt;/span&gt;
      &lt;span class=&quot;nc&quot;&gt;.container_12&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;%p&lt;/span&gt;
          Site built and designed by Damian Nicholson. Powered by Ruby on Rails. //
          &lt;span class=&quot;nt&quot;&gt;%a&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;#scrollto&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:href&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;#body&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; Top&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;expressive-and-easy-to-digest&quot;&gt;Expressive and easy to digest&lt;/h3&gt;

&lt;p&gt;This is a byproduct of Haml being so lean in my opinion - it’s easy to get a good overview of a template in a glance, even if your not familiar with the project. Far easier to absorb than its ERB counterpart which can quite easily become tag soup, especially in larger files like layouts.&lt;/p&gt;

&lt;h3 id=&quot;less-typing&quot;&gt;Less typing&lt;/h3&gt;

&lt;p&gt;Which means that you can spend more time building stuff that matters - my only niggle is that it I’m always shifting for the percentage key(would be nice if this could be mapped to something else like &lt;a href=&quot;https://github.com/stonean/slim(which) is also awesome btw&quot;&gt;Slim&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;easy-to-spot-code-smell&quot;&gt;Easy to spot code smell&lt;/h3&gt;

&lt;p&gt;Because Haml is concise, it’s easy to spot code that’s doing too much. Therefore moving this logic in to helpers seems to be a natural side effect of the framework itself. I can only see this as a good thing, as it makes refactoring easier.&lt;/p&gt;

&lt;h3 id=&quot;works-even-better-in-a-team-environment&quot;&gt;Works even better in a team environment&lt;/h3&gt;

&lt;p&gt;Personal HTML style and formatting practices become obsolete as everyone has to adhere to the same standard. That way everyone writes code which is maintainable.&lt;/p&gt;

&lt;h3 id=&quot;performant&quot;&gt;Performant&lt;/h3&gt;

&lt;p&gt;Production mode is all about performance as the outputted HTML is stripped of formatting or indenting by default. I like this.&lt;/p&gt;

&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Stop using the slow, repetitive, and annoying templates that you don’t even know how much you hate yet.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This was taken directly from the Haml homepage, and I can certainly relate to the message that’s being conveyed. If anything I hope this post encourages a few readers to take a look at &lt;a href=&quot;http://haml-lang.com/&quot;&gt;Haml&lt;/a&gt;, and how it’s been a great addition to my development toolkit.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Nearest Cineworld is now on GitHub</title>
    <link href="http://damiannicholson.com/2011/04/12/nearest-cineworld-is-now-on-github.html"/>
    <updated>2011-04-12T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2011/04/12/nearest-cineworld-is-now-on-github</id>
    <content type="html">&lt;p&gt;&lt;a href=&quot;/posts/project-nearest-cineworld&quot;&gt;As promised&lt;/a&gt;, the codebase that powers the &lt;a href=&quot;http://nearest-cineworld.co.uk&quot;&gt;Nearest Cineworld&lt;/a&gt; is now &lt;a href=&quot;https://github.com/damian/nearest-cineworld&quot;&gt;on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It’s a noddy little app, since most of the heavy lifting is done through a bunch of Rake tasks that are triggered via Cron to pull in new films, and performance details for each cinema.&lt;/p&gt;

&lt;p&gt;Obviously it uses the &lt;a href=&quot;/posts/ruby-gem-cineworld&quot;&gt;Cineworld gem&lt;/a&gt; I built. In addition to that it’s the first project I’ve used &lt;a href=&quot;http://haml-lang.com/&quot;&gt;HAML&lt;/a&gt; from the start and also the &lt;a href=&quot;http://960.gs/&quot;&gt;960gs&lt;/a&gt;. Both are worth follow up blog posts, so I won’t go in to any more detail here. Suffice to say, if you’ve got half an hour to spare, it’s certainly worth looking in to HAML or &lt;a href=&quot;https://github.com/stonean/slim&quot;&gt;Slim&lt;/a&gt;. Going back to ERB is just painful to me now.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Project: Nearest Cineworld</title>
    <link href="http://damiannicholson.com/2011/04/07/project-nearest-cineworld.html"/>
    <updated>2011-04-07T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2011/04/07/project-nearest-cineworld</id>
    <content type="html">&lt;p&gt;As an avid cinema goer, I’m always checking the &lt;a href=&quot;http://cineworld.co.uk&quot;&gt;Cineworld&lt;/a&gt; website to see whats showing at my local venue. Because I tend not to bookmark &lt;a href=&quot;http://pinboard.in/u:damian&quot;&gt;anything locally&lt;/a&gt;, I get sick of having to go to their site, clicking the Cinemas tab, finding Boldon Tyne &amp;amp; Wear in the dropdown and so on.&lt;/p&gt;

&lt;p&gt;Fortunately they have a nice API, around which I created a wrapper, in the form of the &lt;a href=&quot;/posts/ruby-gem-cineworld&quot;&gt;cineworld gem&lt;/a&gt;. It also turns out I like making things for the web(kind of fitting being my day job and all). So I thought this would be an ideal opportunity to throw together a quick mashup leveraging the html5 geolocation API (which is a bit flakey btw), and some CSS3 webkit transforms to build the &lt;a href=&quot;http://nearest-cineworld.co.uk&quot;&gt;Nearest Cineworld&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To get a feel for what is going on behind the scenes(massive props to &lt;a href=&quot;http://www.themoviedb.org/&quot;&gt;TMDb&lt;/a&gt; btw), I’m going to be open-sourcing the app, so make sure to friend me &lt;a href=&quot;http://github.com/damian&quot;&gt;on Github&lt;/a&gt; and keep an eye out.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://nearest-cineworld.co.uk&quot;&gt;Give it a try&lt;/a&gt;, and let me know in the comments what you think, and more importantly if it doesn’t work(which is quite likely).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; I haven’t done any browser testing / graceful degredation on it, and to be fair I’m not going to.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>My top 10 most useful Ruby Gems</title>
    <link href="http://damiannicholson.com/2011/03/29/my-top-10-most-useful-ruby-gems.html"/>
    <updated>2011-03-29T11:45:55+00:00</updated>
    <id>http://damiannicholson.com/2011/03/29/my-top-10-most-useful-ruby-gems</id>
    <content type="html">&lt;p&gt;In no particular order, here are my top 10 most useful Ruby Gems as of March 2011.&lt;/p&gt;

&lt;h2 id=&quot;devise&quot;&gt;Devise&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/plataformatec/devise&quot;&gt;Devise&lt;/a&gt; is a fully featured authentication solution that works perfect straight out of the box. With it comes a whole host of niceties like password recovery, token authentication etc. Tweaking Devise isn’t a problem, as it’s a Rails engine, so everything can be overriden. If your looking to authenticate via OAuth or &lt;span class=&quot;caps&quot;&gt;LDAP&lt;/span&gt;, there’s a good chance an extension has already been written ontop of Devise for this as well. Two thumbs up!&lt;/p&gt;

&lt;h2 id=&quot;cancan&quot;&gt;CanCan&lt;/h2&gt;

&lt;p&gt;If your app needs authorization(who can do what) then look no further. &lt;a href=&quot;https://github.com/ryanb/cancan&quot;&gt;CanCan&lt;/a&gt; is both simple and flexible to work with. The fact that all permissions logic is defined in a single ability class means managing who can do what is easy. Comes with a bunch of handy helper methods for views, controllers etc so you can get really fine grained access control with little effort.&lt;/p&gt;

&lt;h2 id=&quot;kaminari&quot;&gt;Kaminari&lt;/h2&gt;

&lt;p&gt;What’s shaping up to be the successor of Will Paginate, &lt;a href=&quot;https://github.com/amatsuda/kaminari&quot;&gt;Kaminari&lt;/a&gt; is a clean solution to handle pagination. Like Devise, it’s one of those new fangled Rails 3 engines so it can be fully customised if you don’t like the markup it provides out of the box.&lt;/p&gt;

&lt;h2 id=&quot;hamlslim&quot;&gt;&lt;span class=&quot;caps&quot;&gt;HAML&lt;/span&gt;/Slim&lt;/h2&gt;

&lt;p&gt;I’ve been working more with &lt;a href=&quot;http://haml-lang.com/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;HAML&lt;/span&gt;&lt;/a&gt; lately, but my partner in crime &lt;a href=&quot;http://twitter.com/elandesign&quot;&gt;Paul&lt;/a&gt;, picked up on &lt;a href=&quot;http://slim-lang.com/&quot;&gt;Slim&lt;/a&gt; and it seems to have more going for it than the rest. Better performance, lean syntax so no percentage signs all over the place, string interpolation etc. If your used to &lt;span class=&quot;caps&quot;&gt;ERB&lt;/span&gt;, it’s worth a punt giving either of these gems a try, I promise you won’t look back. Want to try it out in a project already coded up in &lt;span class=&quot;caps&quot;&gt;ERB&lt;/span&gt;, convert your views to &lt;span class=&quot;caps&quot;&gt;HAML&lt;/span&gt; to with &lt;a href=&quot;http://screencasts.org/episodes/using-haml-with-rails-3&quot;&gt;this Rake task&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;carrierwave&quot;&gt;Carrierwave&lt;/h2&gt;

&lt;p&gt;Digging this bad boy at the moment – &lt;a href=&quot;https://github.com/jnicklas/carrierwave&quot;&gt;Carrierwave&lt;/a&gt; is a versatile file upload solution which keeps all of that mess logic away from your models. Support for Amazon S3 and other cloud based services is provided through a gem called Fog, so setting this up is painless.&lt;/p&gt;

&lt;h2 id=&quot;metasearch&quot;&gt;Metasearch&lt;/h2&gt;

&lt;p&gt;Stumbled across this lil beauty when upgrading a Rails app from 2.3.10 to 3.0.5 as a replacement for Searchlogic. Bar some tweaks here and there to the views, &lt;a href=&quot;https://github.com/ernie/meta_search&quot;&gt;Metasearch&lt;/a&gt; has been a fine stand-in. So much so I regard it as the successor to Searchlogic.&lt;/p&gt;

&lt;h2 id=&quot;formtastic&quot;&gt;Formtastic&lt;/h2&gt;

&lt;p&gt;Building semantic forms is a doddle with &lt;a href=&quot;https://github.com/justinfrench/formtastic&quot;&gt;Formtastic&lt;/a&gt; and its simple &lt;span class=&quot;caps&quot;&gt;DSL&lt;/span&gt;. Can’t think of any projects where I don’t want to use this. Staple.&lt;/p&gt;

&lt;h2 id=&quot;friendly-id&quot;&gt;Friendly ID&lt;/h2&gt;

&lt;p&gt;If your after pretty URLs, then this is should be the gem your using. &lt;a href=&quot;https://github.com/norman/friendly_id&quot;&gt;Friendly ID&lt;/a&gt; Provides integration with legacy Rails projects as there’s a rake task built in to bulk generate slugs. You can also roll your own slug creation method into it if you want more control.&lt;/p&gt;

&lt;h2 id=&quot;thinking-sphinx&quot;&gt;Thinking Sphinx&lt;/h2&gt;

&lt;p&gt;We use &lt;a href=&quot;http://freelancing-god.github.com/ts/en/&quot;&gt;Thinking Sphinx&lt;/a&gt; at &lt;span class=&quot;caps&quot;&gt;CEF&lt;/span&gt; to index and search a catalogue of over 1,300,000 products, and it’s lightning fast. That numbers not a typo.&lt;/p&gt;

&lt;h2 id=&quot;settingslogic&quot;&gt;Settingslogic&lt;/h2&gt;

&lt;p&gt;I’ve only warmed to &lt;a href=&quot;https://github.com/binarylogic/settingslogic&quot;&gt;Settingslogic&lt;/a&gt; recently, but having a central place to store credentials, &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; keys and constants across multiple environments(development, staging, production etc) is very handy. Make sure to add this file to your .gitignore if your doing open-source work on Github and don’t want to commit your sensitive info.&lt;/p&gt;
&lt;h3&gt;Honorable Mentions&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/rubyist/aasm&quot;&gt;&lt;span class=&quot;caps&quot;&gt;AASM&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://nokogiri.org/&quot;&gt;Nokogiri&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/capistrano/capistrano&quot;&gt;Capistrano&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Obviously Rails is on this list too!&lt;/p&gt;

&lt;p&gt;Are there any must have gems in your toolbox that aren’t in this list? I want to hear about them!&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Current git branch in bash prompt</title>
    <link href="http://damiannicholson.com/2011/03/22/current-git-branch-in-bash-prompt.html"/>
    <updated>2011-03-22T12:59:17+00:00</updated>
    <id>http://damiannicholson.com/2011/03/22/current-git-branch-in-bash-prompt</id>
    <content type="html">&lt;p&gt;Git users - do this happen to you?&lt;/p&gt;

&lt;p&gt;An error comes in via Hoptoad and it needs to be fixed asap. I manage to track down the source, and commit a fix. I go make a coffee while Capistrano does its thing. Crisis averted.&lt;/p&gt;

&lt;p&gt;I come back to find my Inbox full of Hoptoad exceptions. As usual I find out I broke the build and rollback to the previous, less broken version. It dawns on me that I was working in the &lt;em&gt;wrong branch&lt;/em&gt; and pushed with it some unfinished stuff. I spend a minute or so sorting it out and redeploy.&lt;/p&gt;

&lt;p&gt;The reason I posed my original question, is because this has happened to me on more than one occasion. Only recently have I found a quick &lt;a href=&quot;http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/&quot;&gt;solution&lt;/a&gt; that seems to be working well for me - showing the current git branch in your bash prompt.&lt;/p&gt;

&lt;p&gt;Throw the following snippet in your bash_profile (alter the colours to suit), load up a new terminal session and change into the root of one of your projects that you manage in git.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;  &lt;span class=&quot;c1&quot;&gt;# Bash prompt
&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;parse_git_branch&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;git&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;branch&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;no&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/dev/nu&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ll&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'/^[^*]/d'&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'s/* \(.*\)/(\1)/'&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;no&quot;&gt;RED&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\[\033&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;[0;31m&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\]&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
  &lt;span class=&quot;no&quot;&gt;YELLOW&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\[\033&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;[0;33m&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\]&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
  &lt;span class=&quot;no&quot;&gt;NO_COLOUR&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\[\033&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;[0m&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\]&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;

  &lt;span class=&quot;no&quot;&gt;PS1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;$RED&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\$&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;(date +%H:%M) &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\w&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;$YELLOW&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\$&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;(parse_git_branch)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\$&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; $NO_COLOUR&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This tweak also means that I don’t have to keep typing &lt;code class=&quot;highlighter-rouge&quot;&gt;git branch&lt;/code&gt; all over the place.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Ruby Date format gotcha</title>
    <link href="http://damiannicholson.com/2010/12/12/ruby-date-format-gotcha.html"/>
    <updated>2010-12-12T22:54:59+00:00</updated>
    <id>http://damiannicholson.com/2010/12/12/ruby-date-format-gotcha</id>
    <content type="html">&lt;p&gt;Here’s a little gotcha that I came across when parsing Date strings for insertion into a mysql date field.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'12/10/2010'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;parse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'12/1/2010'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In Ruby 1.8.7 you’ll get the following output:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;mi&quot;&gt;2010&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;
&lt;span class=&quot;mi&quot;&gt;2010&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mo&quot;&gt;01&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Though in Ruby 1.9.2 you’ll get this:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;mi&quot;&gt;2010&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;
&lt;span class=&quot;mi&quot;&gt;2010&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mo&quot;&gt;01&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;12&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;A little Ruby date format gotcha to look out for, as it took me a little time to hunt this sucker down.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Gowalla - where's my ROI?</title>
    <link href="http://damiannicholson.com/2010/11/08/gowalla-wheres-my-roi.html"/>
    <updated>2010-11-08T20:31:42+00:00</updated>
    <id>http://damiannicholson.com/2010/11/08/gowalla-wheres-my-roi</id>
    <content type="html">&lt;p&gt;I first signed up to &lt;a href=&quot;http://gowalla.com/&quot;&gt;Gowalla&lt;/a&gt; early this year, but left my account untouched, just to see whether any of location based services would catch on.&lt;/p&gt;
&lt;p&gt;Fast forward to August, and for some reason I felt the urge to give Gowalla a try, in the hopes that it would compliment my other social media outlets.&lt;/p&gt;

&lt;p&gt;I opted for Gowalla over the &lt;a href=&quot;http://foursquare.com/&quot;&gt;other one&lt;/a&gt; out of my respect for &lt;a href=&quot;http://maxvoltar.com/&quot;&gt;Tim Van Damme's&lt;/a&gt; work. I've been a follower of Tim's work for some time now and his freelance stuff on Gowalla's website is very nice. Because of this I figured Gowalla would at least be aesthetically pleasing. A few minutes later I downloaded the iPhone app and away I went.&lt;/p&gt;

&lt;p&gt;Over the past few months, I've checked in a whole bunch of times, added friends, earned a few badges and even added some new spots. However there's one question that I seem to be asking myself lately, now that I've used Gowalla for a considerable amount of time.&lt;/p&gt;

&lt;h3&gt;What value is Gowalla providing?&lt;/h3&gt;

&lt;p&gt;It turns out, &lt;strong&gt;absolutely nothing!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As far as I'm concerned, Gowalla is a &lt;strong&gt;one-way broadcast&lt;/strong&gt;, with &lt;strong&gt;no interaction between users&lt;/strong&gt;. There's &lt;strong&gt;nothing new to discover&lt;/strong&gt; and the game mechanics are &lt;strong&gt;quite pathetic&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I'm close to deleting the app and leaving my account to expire, but before I do, I wanted to get a feel for other peoples opinions of Gowalla, and location based services in general. Are you finding they have any utility?&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Google map api with ym4r</title>
    <link href="http://damiannicholson.com/2010/11/02/google-map-api-with-ym4r.html"/>
    <updated>2010-11-02T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2010/11/02/google-map-api-with-ym4r</id>
    <content type="html">&lt;p&gt;In development, the application was working fine. And because the &lt;a href=&quot;http://ym4r.rubyforge.org/&quot;&gt;ym4r plugin&lt;/a&gt; has yet to implement the Google maps api version 3, I made sure to include the appropriate api key for the domain in the config.&lt;/p&gt;

&lt;p&gt;In production however, the page was failing. Fortunately &lt;a href=&quot;http://hoptoadapp.com&quot;&gt;Hoptoad&lt;/a&gt; alerted me of the following error - &lt;code class=&quot;highlighter-rouge&quot;&gt;Ym4r::GmPlugin::AmbiguousGMapsAPIKeyException&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It turns out that ym4r was having difficulty choosing a specific host in my gmaps_api_key.yml file, as I had multiple set up for the various domains the site is hosted on. To rectify this I ended up changing the declaration at the top of my layout file, which loads the google maps api into the page, from&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;%= GMap.header %&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;%= GMap.header(:with_vml =&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:host&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
  </entry>
  
  <entry>
    <title>Nginx rewrite rule</title>
    <link href="http://damiannicholson.com/2010/11/01/nginx-rewrite-rule.html"/>
    <updated>2010-11-01T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2010/11/01/nginx-rewrite-rule</id>
    <content type="html">&lt;p&gt;A snippet of my &lt;a href=&quot;http://en.wikipedia.org/wiki/Nginx&quot;&gt;nginx&lt;/a&gt; config file showing how to rewrite all urls from www.yourdomain.com to yourdomain.com.&lt;/p&gt;

&lt;p&gt;Very simple, but worth knowing if opting for nginx over &lt;a href=&quot;http://www.apache.org/&quot;&gt;Apache&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;www&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;damiannicholson&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;rewrite&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;^&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:/&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;damiannicholson&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;vg&quot;&gt;$1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;permanent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;


&lt;span class=&quot;n&quot;&gt;server&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;listen&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;80&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;server_name&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;damiannicholson&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;com&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
  </entry>
  
  <entry>
    <title>jQuery Ajax Queue</title>
    <link href="http://damiannicholson.com/2010/07/07/jquery-ajax-queue.html"/>
    <updated>2010-07-07T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2010/07/07/jquery-ajax-queue</id>
    <content type="html">&lt;p&gt;The need to perform synchronous AJAX calls sometimes arises, for example if your passing tokens back and forth for security reasons. &lt;a href=&quot;http://jquery.com/&quot;&gt;jQuery&lt;/a&gt; makes such calls dead easy, all you have to do is set the ‘async’ option to false when setting up the AJAX handler.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.click-me'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'click'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ajax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'someurl'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;async&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'blocking'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The problem of this approach is that the browser locks up if the server takes a long time to respond. Because this is quite likely(heavy load during peak times etc) this would be damaging to the user experience. The ideal solution would be queue up AJAX requests without the browser locking up at all.&lt;/p&gt;

&lt;p&gt;Because Google can’t answer everything, I managed to come up with the following non blocking solution using &lt;a href=&quot;http://api.jquery.com/queue/&quot;&gt;queue&lt;/a&gt;, a function that’s part of jQuery core.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'.click-me'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'click'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;preventDefault&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;queue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ajax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'someurl'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'non blocking'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;dequeue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
  </entry>
  
  <entry>
    <title>New fangled technologies</title>
    <link href="http://damiannicholson.com/2010/04/29/new-technologies.html"/>
    <updated>2010-04-29T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2010/04/29/new-technologies</id>
    <content type="html">&lt;blockquote&gt;
  &lt;p&gt;A rule of thumb that has worked well for me is that if I’m excited to play around with something, it probably doesn’t belong in production.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href=&quot;http://pinboard.in/blog/63/&quot;&gt;Maciej Ceglowski&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Crafting Appropriate URLs with the Token API</title>
    <link href="http://damiannicholson.com/2010/04/14/crafting-appropriate-urls-with-the-token-api.html"/>
    <updated>2010-04-14T17:50:47+00:00</updated>
    <id>http://damiannicholson.com/2010/04/14/crafting-appropriate-urls-with-the-token-api</id>
    <content type="html">&lt;p&gt;So &lt;a href=&quot;http://drupal.org/project/pathauto&quot;&gt;Pathauto&lt;/a&gt; does most of the heavy lifting when it comes to making pretty URLs. There’s no questioning that this module is must for all &lt;a href=&quot;http://drupal.org/&quot;&gt;Drupal&lt;/a&gt; projects. However I came across a situation recently where the out of the box functionality that Pathauto provides, just wasn’t enough.&lt;/p&gt;

&lt;p&gt;I wanted to produce a different URL based on what taxonomy term was selected for a content type. I couldn’t find any way of achieving this in the automated alias settings, and after a brief chat about this with my colleagues at &lt;a href=&quot;http://www.orangebus.co.uk/&quot;&gt;Orange Bus&lt;/a&gt;, I was pointed in the direction of the &lt;a href=&quot;http://api.lullabot.com/file/contrib/token/token.module&quot;&gt;Token API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A little digging later I managed to find a solution.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-php&quot; data-lang=&quot;php&quot;&gt;/**
 * Implementation of hook_token_list().
 */
function MODULENAME_token_list($type = 'all'){
  $tokens['node']['my_token'] = t('DVD or TV Series');
  return $tokens;
}

/**
 * Implementation of hook_token_values().
 */
function MODULENAME_token_values($type, $object = NULL, $options = array()) {
  $values = array();

  if ($type == 'node' &lt;span class=&quot;err&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; $object-&amp;gt;type == 'CONTENT_TYPE_NAME') {
    // Do some conditional checking here
    $values['my_token'] = $node-&amp;gt;taxonomy[1] == 2 ? 'apple' : 'orange';
  }
  return $values;
}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The first function, creates a new token. We know this because as soon as this code is inserted in our site module, the token is visible in the ‘Replacement patterns’ fieldset on the Automated Alias Settings page. I then entered this token [my_token]/[title-raw] into the URL pattern field of the content type I wanted to name. The logic behind what this token is being set as happens in the second function, &lt;code class=&quot;highlighter-rouge&quot;&gt;hook_token_values()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What we’re doing here is checking for the presence of a particular content type before setting the token value to the result of some conditional logic. In this case we’re seeing whether the content type has a particular taxonomy term associated with it. Ultimately though this check could be based on anything, and the logic behind it could be as complex or as simple as needs be.&lt;/p&gt;

&lt;p&gt;Pretty simple stuff ey! Anywho if you’re aware of any other ways to go about achieving this, I would love to hear it.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Drupal Clear Cache Bookmarklet</title>
    <link href="http://damiannicholson.com/2010/04/11/drupal-clear-cache-bookmarklet.html"/>
    <updated>2010-04-11T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2010/04/11/drupal-clear-cache-bookmarklet</id>
    <content type="html">&lt;p&gt;Because I haven’t got round to playing with &lt;a href=&quot;http://drupal.org/project/drush&quot;&gt;Drush&lt;/a&gt; yet, I decided to throw together a bookmarklet to clear Drupal’s cache.&lt;/p&gt;

&lt;p&gt;You can check it out on &lt;a href=&quot;http://gist.github.com/362910&quot;&gt;gist&lt;/a&gt; or alternatively you can click and drag the following link to your toolbar.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;javascript:window.location = document.location.protocol + '//' + document.location.host + '/admin_menu/flush-cache?destination=' + document.location.pathname.substring(1);&quot;&gt;Clear cache&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; The snippet is dependent on using &lt;a href=&quot;http://drupal.org/project/admin_menu&quot;&gt;Admin Menu&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Why listen to audiobooks?</title>
    <link href="http://damiannicholson.com/2010/03/29/why-listen-to-audiobooks.html"/>
    <updated>2010-03-29T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2010/03/29/why-listen-to-audiobooks</id>
    <content type="html">&lt;p&gt;One of my &lt;a href=&quot;/posts/goals-for-2010&quot;&gt;goals for 2010&lt;/a&gt; is to read more books. This became a realisation when I noticed the few that lay on my nightstand had formed a nice coating of dust. The problem was that setting aside time to sit down and read had become a chore. I liken it to going to the gym. Once your there it’s great and afterward your happy you made the effort to go, but getting there really takes some motivation.&lt;/p&gt;

&lt;p&gt;So I went on the lookout for an alternative, and it didn’t take much digging before I unearthed Audible.&lt;/p&gt;

&lt;p&gt;Audible is the largest seller of audiobooks on the web. Unsurprisingly they’re Amazon owned, and at the time I managed to partake in a trial which entitled me to one free download.&lt;/p&gt;

&lt;p&gt;This was ideal, because I was somewhat skeptical at the outset. The thought of some boring bloke talking for hours on end seemed too much like University.&lt;/p&gt;

&lt;p&gt;How wrong I was.&lt;/p&gt;

&lt;p&gt;I recommend giving audiobooks a try to anyone who travels, commutes to work or has a dog. Here’s a few reasons why:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;em&gt;Multitasking&lt;/em&gt; - Its time you’d be wasting anyway doing a menial task. Put that time to better use by enjoying a good book.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;More lucrative&lt;/em&gt; - Studies show that information retention is higher through auditory stimulus.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;No eyestrain&lt;/em&gt; - If you’re reading this, I assume you spend a hefty amount of time in front of a screen. Audiobooks give your eyes a chance to rest.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Relaxing&lt;/em&gt; - Reading a book requires active concentration. Audiobooks are passive.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Faster&lt;/em&gt; - On holiday I managed to listen to 3 books in 7 days. I doubts I could have read this many in such a short period of time.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Less weight&lt;/em&gt; - You don’t have to carry a shed load of books around with you. This is the last thing you want if you’re travelling somewhere. The Kindles form factor is one of the reasons why it has made such an impact on the market.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;More engaging&lt;/em&gt; - In certain cases, the original author dictates the audiobook. I find that their passion and tone really shines through. If you don’t understand what I mean, I implore you to check out Gary Vaynerchuks Crush it in audiobook format. You don’t get this dynamic when reading a book in a conventional sense.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The pricing scheme behind Audible is dead simple. You pay a low monthly subscription, which entitles you to download one new audiobook a month, and you can opt out at any time. Alternatively you can pay per book, if you don’t want to go with the subscription model. Prices range between £6-10 this way.&lt;/p&gt;

&lt;p&gt;Do you listen to any audiobooks? Can you recommend any I should be adding to my Wishlist?&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Why aren't you Huffduffing yet?</title>
    <link href="http://damiannicholson.com/2010/01/11/why-arent-you-huffduffing-yet.html"/>
    <updated>2010-01-11T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2010/01/11/why-arent-you-huffduffing-yet</id>
    <content type="html">&lt;p&gt;Lets face it - finding interesting and information rich podcasts in a certain niche is hard work. The web is filled with podcast directories with no easy way to sift through the noise.&lt;/p&gt;

&lt;h3 id=&quot;enter-huffduffer&quot;&gt;Enter Huffduffer&lt;/h3&gt;

&lt;p&gt;A service built by Clearleft’s &lt;a href=&quot;http://adactio.com/&quot;&gt;Jeremy Keith&lt;/a&gt;, &lt;a href=&quot;http://huffduffer.com/&quot;&gt;Huffduffer&lt;/a&gt; is a social tagging tool for audio files. Think of it as a Delicious for MP3s, but better.&lt;/p&gt;

&lt;p&gt;Because the service is home to audio files that interest mostly web folk(but not restricted to), it makes discovering new content in my industry a lot easier.&lt;/p&gt;

&lt;p&gt;The icing on the cake is how Huffduffer deals with any content that gets my attention. By Huffduffing an MP3, it aggregates this into a single podcast which can be subscribed to in iTunes. Any audio file found on the web can be Huffduff’d and added to this podcast.&lt;/p&gt;

&lt;p&gt;There’s no shortage of support either, as both the handy bookmarklet and &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/13448&quot;&gt;Firefox plugin&lt;/a&gt; allow you to Huffduff any MP3s you may stumble across while browsing the web.&lt;/p&gt;

&lt;p&gt;So why aren’t you &lt;a href=&quot;http://huffduffer.com/&quot;&gt;Huffduffing&lt;/a&gt; yet?&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Goals for 2010</title>
    <link href="http://damiannicholson.com/2009/12/31/goals-for-2010.html"/>
    <updated>2009-12-31T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2009/12/31/goals-for-2010</id>
    <content type="html">&lt;p&gt;Because I’m feeling very optimistic about what next year has to bring, I’ve put together a list of things I want to achieve. In no particular order, they are:&lt;/p&gt;

&lt;h3 id=&quot;release-a-jquery-plugin&quot;&gt;Release a jQuery plugin&lt;/h3&gt;

&lt;p&gt;I started making a very basic jQuery colour swatch earlier in the year, but it went on the back-burner before I managed to perfect it. I’ll definitely be releasing this as a jQuery plugin and hopefully some other cool stuff in 2010&lt;/p&gt;

&lt;h3 id=&quot;do-a-bungee-jump&quot;&gt;Do a bungee jump&lt;/h3&gt;

&lt;p&gt;This has been a life goal of mine for some time now&lt;/p&gt;

&lt;h3 id=&quot;complete-the-great-north-run&quot;&gt;Complete the Great North Run&lt;/h3&gt;

&lt;p&gt;My main reason for this is to get fit and start jogging again. Every year I feel guilty that people travel from all over the globe to participate in the Great North Run, though I haven’t took part once and its on my front doorstep&lt;/p&gt;

&lt;h3 id=&quot;learn-gwt&quot;&gt;Learn GWT&lt;/h3&gt;

&lt;p&gt;There’s no denying that Google make the best web applications. Since all of their products are leveraged by the &lt;a href=&quot;http://en.wikipedia.org/wiki/Google_Web_Toolkit&quot;&gt;Google Web Toolkit(GWT)&lt;/a&gt;, I want to try my hand at it&lt;/p&gt;

&lt;h3 id=&quot;start-eating-fruit&quot;&gt;Start eating fruit&lt;/h3&gt;

&lt;p&gt;This may seem surprising but before mid-2008 I ate no fruit and maybe two vegetables. In 2009 I made a conscious attempt to start eating veg and now I can’t get enough of it. Here’s to hoping my efforts in 2010 won’t be fruitless ;)&lt;/p&gt;

&lt;h3 id=&quot;read-a-new-book-every-2-weeks&quot;&gt;Read a new book every 2 weeks&lt;/h3&gt;

&lt;p&gt;There’s a plethora of stuff I find interesting and want to read&lt;/p&gt;

&lt;h3 id=&quot;blog-more-often&quot;&gt;Blog more often&lt;/h3&gt;

&lt;p&gt;If your running a blog and not publishing at least 2 quality articles a week this is a given&lt;/p&gt;

&lt;h3 id=&quot;go-to-a-web-conference&quot;&gt;Go to a web conference&lt;/h3&gt;

&lt;p&gt;Now I’ve been in the industry a year, I’d really like to attend a tech conference as I think I would benefit from the experience in many ways. Nothing as ostentatious as &lt;a href=&quot;http://sxsw.com/interactive&quot;&gt;SXSW&lt;/a&gt; but maybe something like &lt;a href=&quot;http://www.whatisdibi.com/&quot;&gt;DIBI&lt;/a&gt; or &lt;a href=&quot;http://www.thinkingdigital.co.uk/&quot;&gt;Thinking Digital&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&quot;visit-berlin&quot;&gt;Visit Berlin&lt;/h3&gt;

&lt;p&gt;Stooped in history and a place I don’t think you’d ever get bored of, &lt;a href=&quot;http://en.wikipedia.org/wiki/Berlin&quot;&gt;Berlin&lt;/a&gt; will be a fantastic holiday destination&lt;/p&gt;

&lt;h3 id=&quot;pickup-golf&quot;&gt;Pickup golf&lt;/h3&gt;

&lt;p&gt;I went to the driving range for the first time in about 5 years the other day and thoroughly enjoyed myself.&lt;/p&gt;

&lt;p&gt;In his retirement my grandfather has really started to take golf seriously, so I reckon I’ll always have someone to play against and be able to pick up a few tips from along the way. Maybe even some old clubs if I’m lucky&lt;/p&gt;

&lt;h3 id=&quot;release-a-web-application-as-a-side-project&quot;&gt;Release a web application as a side-project&lt;/h3&gt;

&lt;p&gt;I know I can, I just wanna see if I can &lt;a href=&quot;http://crushitbook.com/&quot;&gt;Crush It!&lt;/a&gt; like Gary. If all goes to plan it will probably be made using GWT&lt;/p&gt;

&lt;h3 id=&quot;start-learning-spanish&quot;&gt;Start learning Spanish&lt;/h3&gt;

&lt;p&gt;Because no goals are ever complete without learning a new language&lt;/p&gt;

&lt;p&gt;In true &lt;a href=&quot;http://www.fourhourworkweek.com/blog/&quot;&gt;Tim Ferriss&lt;/a&gt; fashion, a few of these are a bit *out there, but I don’t think any are unachievable.&lt;/p&gt;

&lt;p&gt;However small or grand, what’s your ambitions for 2010? I’d really like to hear about them :)&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Internet Explorer Stylesheet Limit</title>
    <link href="http://damiannicholson.com/2009/12/21/internet-explorer-stylesheet-limit.html"/>
    <updated>2009-12-21T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2009/12/21/internet-explorer-stylesheet-limit</id>
    <content type="html">&lt;p&gt;Did you know that IE &lt;a href=&quot;http://support.microsoft.com/kb/262161&quot;&gt;ignores all style tags&lt;/a&gt; after the first 30 requests?&lt;/p&gt;

&lt;p&gt;This had me scratching my head last week as I couldn’t fathom out why certain styles weren’t being applied to a lightbox in Internet Explorer, but were working just fine in all other browsers.&lt;/p&gt;

&lt;p&gt;I figure IE inconsistencies like the &lt;a href=&quot;http://www.positioniseverything.net/explorer/doubled-margin.html&quot;&gt;double margin bug&lt;/a&gt;, &lt;a href=&quot;http://24ways.org/2007/supersleight-transparent-png-in-ie6&quot;&gt;png fix&lt;/a&gt; and &lt;a href=&quot;http://brenelz.com/2009/02/03/squish-the-internet-explorer-z-index-bug/&quot;&gt;z-index issue&lt;/a&gt; all to be common knowledge amongst web developers and designers. But why not this one? Surely the repercussions of this have more of a profound effect on a website?&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>TextMate CSS Colour Picker</title>
    <link href="http://damiannicholson.com/2009/12/13/textmate-css-colour-picker.html"/>
    <updated>2009-12-13T17:33:08+00:00</updated>
    <id>http://damiannicholson.com/2009/12/13/textmate-css-colour-picker</id>
    <content type="html">&lt;p&gt;Being a heavy mac user, I’m always in my favourite text editor - &lt;a href=&quot;http://macromates.com/&quot;&gt;TextMate&lt;/a&gt;. Here’s a tip for when working with colour in a CSS file. This shortcut brings up a real handy colour picker.&lt;/p&gt;

&lt;p style=&quot;text-align: center;&quot;&gt;&lt;strong&gt;⌘&lt;/strong&gt; + &lt;strong&gt;⇧&lt;/strong&gt; + &lt;strong&gt;c&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once a colour has been selected, the corresponding hex code is placed at the current cursor position. Definately one worth knowing in my opinion!&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Abusing JavaScript Frameworks</title>
    <link href="http://damiannicholson.com/2009/12/03/abusing-javascript-frameworks.html"/>
    <updated>2009-12-03T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2009/12/03/abusing-javascript-frameworks</id>
    <content type="html">&lt;p&gt;Tools like &lt;a href=&quot;http://jquery.com/&quot;&gt;jQuery&lt;/a&gt; and &lt;a href=&quot;http://mootools.net/&quot;&gt;MooTools&lt;/a&gt; make traversing and manipulating the DOM incredibly easy. So easy that you can get carried away with it sometimes. I have fallen down this trap more than once in my career as a web developer.&lt;/p&gt;

&lt;p&gt;Here’s an excerpt from an article I stumbled across entitled &lt;a href=&quot;http://pinoytech.org/blog/post/Add-Icons-to-External-Links-with-Mootools-and-CSS&quot;&gt;Add Icons to External Links with Mootools and CSS&lt;/a&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addEvent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'domready'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
 &lt;span class=&quot;nx&quot;&gt;$$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'a'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;each&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hostname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
   &lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'external'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Pretty basic stuff - iterating through all the anchors on the page and adding a class if the current link goes to an external site.&lt;/p&gt;

&lt;p&gt;Whether this is apparent to the author I don’t know, but the same effect can be achieved using &lt;em&gt;only CSS&lt;/em&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-css&quot; data-lang=&quot;css&quot;&gt;&lt;span class=&quot;nt&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;^=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;'http://'&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;/* styling */&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; the solution I pointed out here isn’t anything new. &lt;a href=&quot;http://www.w3.org/TR/CSS21/selector.html#attribute-selectors&quot;&gt;CSS attribute selectors&lt;/a&gt; have been around since CSS2.1, and so are are supported in all major browsers bar &lt;a href=&quot;http://www.bringdownie6.com/&quot;&gt;one&lt;/a&gt;(no prizes for those who get this right).&lt;/p&gt;

&lt;p&gt;Whilst this example is low impact, I’ve come to the conclusion that the underlying principle is one which creeps up on a lot designers and developers who get the JS fever.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;JavaScript libraries are an easy fall back for front-end problems which can’t be solved quickly.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My personal opinion to problems I can’t solve is that the use of JavaScript libraries should be a &lt;em&gt;last resort&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Sometimes people are too lazy to tackle front-end problems head on. In my experience it’s worth the effort researching a possible solution, as it makes you think about the problem and  define it more clearly. Most of the time you find yourself in one of the following situations, none of which are bad.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;You’ve thought about it a bit and realise it’s very similar to a problem you’ve faced in the past.&lt;/li&gt;
  &lt;li&gt;You find an alternative, in which case you’ve learnt something new.&lt;/li&gt;
  &lt;li&gt;There isn’t an alternative, in which case you’ve picked up some new knowledge along the way and realised that your solution was optimal. Pat yourself on the back.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Moving to Linode</title>
    <link href="http://damiannicholson.com/2009/09/25/moving-to-linode.html"/>
    <updated>2009-09-25T00:00:00+00:00</updated>
    <id>http://damiannicholson.com/2009/09/25/moving-to-linode</id>
    <content type="html">&lt;p&gt;As part of my move back over to WordPress, I also switched hosting companies. Being a &lt;a href=&quot;http://orangebus.co.uk/&quot;&gt;developer&lt;/a&gt; I wanted some hands on experience running my own server, and since the pricing for a VPS is now quite reasonable(only £5 more a month than what I was currently paying), I decided to take the plunge.&lt;/p&gt;

&lt;p&gt;It was a toss-up between Slicehost and Linode, though I finally decided to go with the latter. I’m glad I did because it really has been a breath of fresh air! Setup was suprisingly simple, as I managed to get a LAMP stack running this instance of WordPress is under an hour.&lt;/p&gt;

&lt;p&gt;Their prices are competitive, offering lots of storage, bandwidth and a plethora of distributions to choose from. In addition to this their administrative interface is a joy to use and any support tickets I’ve created have been answered in minutes. No regrets on my part.&lt;/p&gt;

&lt;p&gt;So if my post has persuaded you in any way to opt for Linode and signup using my &lt;a href=&quot;http://www.linode.com/?r=c1649a4ae2e298376a49b8af005b12c308033b54&quot;&gt;referral code&lt;/a&gt;, I’ll buy you a beer :)&lt;/p&gt;
</content>
  </entry>
  

</feed>

