<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Sociable is a software development house based in Devonport, Auckland.  We specialise in high quality Ruby on Rails and JavaScript development.</description><title>Sociable</title><generator>Tumblr (3.0; @sociablenz)</generator><link>http://sociable.co.nz/</link><item><title>OSH Park - PCB ordering has never been so easy.</title><description>&lt;p&gt;Back at the end of January, when I first agreed to build &lt;a href="http://oshpark.com/"&gt;oshpark.com&lt;/a&gt; for &lt;a href="http://twitter.com/laen"&gt;Laen&lt;/a&gt; I had no idea that I would spend the middle week of May cramming to squash the last of the user facing bugs before a big launch at &lt;a href="http://makerfaire.com/"&gt;Maker Faire&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;So what is OSH Park?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;OSH Park is your go-to site when it comes to fabrication of prototype circuit boards. Over the last couple of years Laen has built a reputation for quality and reliability and a large customer-base from every continent on earth. What started as a group PCB order for his local hackerspace, &lt;a href="http://dorkbotpdx.org/"&gt;DorkbotPDX&lt;/a&gt; grew and grew until it became an almost full-time job handling orders and sending panels to the fabricator every other day.  &lt;/p&gt;
&lt;p&gt;As the creator of &lt;a href="http://axe.io/"&gt;axe.io&lt;/a&gt;, prototyped using Laen&amp;#8217;s beautiful purple boards I was familiar with the problem space as well as his workflow, and having done a review of some of the competing online services in his space knew that it would be relatively straightforward to build a website which radically raised the bar on customer experience.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How does it work?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Customers upload their design files in an industry standard format and the site immediately processes these into a high-quality rendering of what the finished board should look like, as well as each of the individual layers which make up the board (silk screen, solder mask, copper layers, etc). The user is able to review that the system has processed them correctly and then continue on to ordering.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://c436628.r28.cf2.rackcdn.com/blog/upload.png" title="Initial upload screen"&gt;&lt;img alt="Initial upload screen" height="120" src="http://c436628.r28.cf2.rackcdn.com/blog/upload_thumb.png" width="120"/&gt;&lt;/a&gt; &lt;a href="http://c436628.r28.cf2.rackcdn.com/blog/aproval.png" title="Snippet of layer approval screen"&gt;&lt;img alt="Snippet of approval screen" height="120" src="http://c436628.r28.cf2.rackcdn.com/blog/aproval_thumb.png" width="120"/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The interactive front-end of the site is built using the &lt;a href="http://emberjs.com/"&gt;Ember.js&lt;/a&gt; JavaScript framework, which allows us to quickly create the interactivity of the site without having to worry about the heavy lifting of keeping the UI in sync with data from the user and server.&lt;/p&gt;
&lt;p&gt;The back-end of the site is build using &lt;a href="http://rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt;, and a job queuing system based on &lt;a href="http://rubyeventmachine.com/"&gt;Event Machine&lt;/a&gt; which allows us to asynchronously handle the processing of design files whilst still serving web requests with the same process. The web app is deployed on &lt;a href="http://www.heroku.com/"&gt;Heroku&lt;/a&gt; with &lt;a href="http://www.rackspace.com/cloud/cloud_hosting_products/files/"&gt;Rackspace Cloud Files&lt;/a&gt; providing lightning fast serving of the static assets (such as the JavaScript front-end) using the &lt;a href="http://www.akamai.com/"&gt;Akamai CDN&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m really proud of the work we were able to achieve with the launch of OSH Park, and if you&amp;#8217;re an electronics maker I hope to see your boards in the site&amp;#8217;s &lt;a href="http://www.flickr.com/groups/oshpark/"&gt;Flickr group&lt;/a&gt; in the near future.&lt;/p&gt;</description><link>http://sociable.co.nz/post/23445768847</link><guid>http://sociable.co.nz/post/23445768847</guid><pubDate>Mon, 21 May 2012 11:22:29 +1200</pubDate></item><item><title>Meteoric thoughts</title><description>&lt;a href="http://www.meteor.com/"&gt;Meteoric thoughts&lt;/a&gt;: &lt;p&gt;So, thanks to &lt;a href="http://twitter.com/peterc" title="@peterc on Twitter"&gt;Peter Cooper&lt;/a&gt;’s excellent &lt;a href="http://javascriptweekly.com/" title="JavaScript Weekly"&gt;JavaScript Weekly&lt;/a&gt; I read about &lt;a href="http://www.meteor.com/" title="Meteor"&gt;Meteor&lt;/a&gt;, which is a pretty interesting new JavaScript framework which seriously blurs the lines between server and client.&lt;/p&gt;
&lt;p&gt;Meteor is built on top of &lt;a href="http://nodejs.org/"&gt;node.js&lt;/a&gt; with some interesting ideas:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;hot code push: the server seemlessly pushes code updates to all active browser clients when the developer changes anything in the project.  This in combination continuous deployment means for some really interesting user experiences.&lt;/li&gt;
&lt;li&gt;synchronisation and latency compensation: whenever a client or the server changes anything all the clients who care about that data are automatically updated. Included with this functionality is the idea of “latency compensation”; when a client changes state it updates the local application state (so that the user sees the change instantly), pushes the update to the server and the server either broadcasts this change to any interested clients or pushes back corrected state (if perhaps the data failed validation).&lt;/li&gt;
&lt;li&gt;fully modular stack: every part of the stack and be added and removed by the developer, meaning that if you’re not using something that meteor provides you can remove it, or add extra functionality should you need it. Meteor calls these “smart packages”.&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;This all sounds great (and it is!) but there are some concerns which instantly pop into my head:&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;&lt;li&gt;security: the examples provided and my reading of the documentation indicate that the browser client can execute arbitrary queries against the back-end database. This is somewhat worrisome.&lt;/li&gt;
&lt;li&gt;separation of concerns: Meteor (at this stage anyway) looks like it will be great for smaller applications, the idea of writing a large project with it seems a little daunting.  At this stage the documentation for &lt;a href="http://docs.meteor.com/#structuringyourapp"&gt;structuring your app&lt;/a&gt; is pretty light, but I imagine as the project matures then some convention will evolve.  Meteor at this stage makes no predictions about whether it prefers MVC, MVVM or any other pattern for structuring apps. One thing is for sure; we don’t want to go back to the spaghetti style interminglingling of concerns of the old days of PHP and RXML.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;
&lt;p&gt;So, it’s early days for Meteor with their current release being versioned “PREVIEW 0.3.2” but given what they’ve achieved so far and the team they have behind them I’m expecting a lot of my concerns to be addressed before an eventual 1.0 release.  All I can say is that this is one to watch!&lt;/p&gt;</description><link>http://sociable.co.nz/post/21180477801</link><guid>http://sociable.co.nz/post/21180477801</guid><pubDate>Mon, 16 Apr 2012 12:05:15 +1200</pubDate><category>meteor</category><category>meteorjs</category><category>javascript</category><category>ux</category></item><item><title>I threw together a quick video demonstrating how to get instant...</title><description>&lt;iframe src="http://player.vimeo.com/video/39671492" width="400" height="300" frameborder="0"&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;I threw together a quick video demonstrating how to get instant spec feedback on your code changes right in your editor - brilliant for those of us who test-drive our code.&lt;/p&gt;
&lt;p&gt;Used in this Video is:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.vim.org/"&gt;Vim 7.3&lt;/a&gt; (actually, &lt;a href="http://macvim.org/"&gt;MacVim’s&lt;/a&gt; binary in a terminal).&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/conque/"&gt;conque 2.3&lt;/a&gt; - allows running interactive console apps in a vim buffer.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/vim-scripts/cmdalias.vim"&gt;cmdalias.vim&lt;/a&gt; - nicely manages vim command aliases so that they don’t unexpected expand.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/guard/guard"&gt;guard&lt;/a&gt; - watches project files for changes and runs appropriate actions.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/guard/guard-rspec"&gt;guard-rspec&lt;/a&gt; - Guard plugin for running specs based on regex matches.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;I have customised my .vimrc somewhat so that ConqueTerm’s rather long commands are shortened as much as possible:&lt;/p&gt;
&lt;script src="https://gist.github.com/2288773.js?file=.vimrc" type="text/javascript"&gt;&lt;/script&gt;</description><link>http://sociable.co.nz/post/20386030309</link><guid>http://sociable.co.nz/post/20386030309</guid><pubDate>Tue, 03 Apr 2012 14:05:26 +1200</pubDate></item><item><title>Serving Ember.js with Rails 3.1's asset pipeline</title><description>&lt;p&gt;Last week I spent some time modifying &lt;a href="http://kiskolabs.com/"&gt;Kisko Labs&lt;/a&gt;&amp;#8217; &lt;a href="https://github.com/kiskolabs/sproutcore-rails"&gt;sproutcore-rails&lt;/a&gt; gem to use the latest build of &lt;a href="http://www.emberjs.com/"&gt;Ember.js&lt;/a&gt;. emberjs-rails is a fairly simple wrapper that add&amp;#8217;s support for serving Handlebars templates from the asset pipeline using a hjs file extension. It also serves Ember&amp;#8217;s html5 boilerplate template as a layout called ember.  Here&amp;#8217;s a quick run through:&lt;/p&gt;
&lt;p&gt;First, start with an empty Rails 3.1 installation:&lt;/p&gt;
&lt;script src="https://gist.github.com/1519692.js?file=install_rails.txt"&gt;&lt;/script&gt;&lt;p&gt;Next, install an empty Rails application:&lt;/p&gt;
&lt;script src="https://gist.github.com/1519692.js?file=new_rails.app.txt"&gt;&lt;/script&gt;&lt;p&gt;Add emberjs-rails to your application&amp;#8217;s Gemfile and run bundler:&lt;/p&gt;
&lt;script src="https://gist.github.com/1519692.js?file=add_emberjs-rails-gem.txt"&gt;&lt;/script&gt;&lt;p&gt;Generate a controller to serve your Ember.js application from:&lt;/p&gt;
&lt;script src="https://gist.github.com/1519692.js?file=generate_a_controller.txt"&gt;&lt;/script&gt;&lt;p&gt;Setup basic routing for your new controller: &lt;em&gt;config/routes.rb&lt;/em&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/1519692.js?file=config_routes.rb"&gt;&lt;/script&gt;&lt;p&gt;Modify your new controller to use the ember layout included in emberjs-rails, this is a slight modification of the html5 boilerplate file included with Ember.js&amp;#8217; starter kit: &lt;em&gt;app/controllers/hello_controller.rb&lt;/em&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/1519692.js?file=appcontrollershello_controller.rb"&gt;&lt;/script&gt;&lt;p&gt;Create a handlebars template to use within your Ember.js application: &lt;em&gt;app/assets/javascripts/views/hello.js.hjs&lt;/em&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/1519692.js?file=appassetsjavascriptsviews.js"&gt;&lt;/script&gt;&lt;p&gt;Create a view on for your home_controller to include your new handlebars view, which the asset pipeline will compile for you automatically. You can also include additional information for the html meta tags and page title if you want to: &lt;em&gt;app/views/hello/index.html.erb&lt;/em&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/1519692.js?file=appviewshelloindex.html.erb"&gt;&lt;/script&gt;&lt;p&gt;Lastly, create your Ember.js application and create a view from the template above.  The rails 3.1 ships with CoffeeScript support by default, so I&amp;#8217;ve created the app using CoffeeScript to show how it&amp;#8217;s done:&lt;/p&gt;
&lt;script src="https://gist.github.com/1519692.js?file=appassetsjavascriptshello.js.coffee"&gt;&lt;/script&gt;&lt;p&gt;Now if you start your server and browse to it (usually &lt;a href="http://localhost:3000/"&gt;localhost:3000&lt;/a&gt; you should see a large &amp;#8220;Hello World!&amp;#8221; which is rendered using the template and the property on the view we created.  You can also open up your browser&amp;#8217;s JavaScript console and change the value of the text property on the hello_view object and watch it dynamically change on screen.&lt;/p&gt;
&lt;p&gt;I hope that gives you enough information to go forth and JavaScript.  Enjoy!&lt;/p&gt;</description><link>http://sociable.co.nz/post/14789329418</link><guid>http://sociable.co.nz/post/14789329418</guid><pubDate>Mon, 26 Dec 2011 14:51:00 +1300</pubDate></item><item><title>Properly validating email addresses.</title><description>&lt;p&gt;There seems to be a lot of chit chat in the rails world about correctly validating email addresses.  The main problem is the compromise between speed and correctness, observe:&lt;/p&gt;

&lt;script src="https://gist.github.com/1495920.js?file=user.rb"&gt;&lt;/script&gt;&lt;p&gt;The examples above illustrate the possible methods of email validation ranging from pathetic to extreme.  Given the average response speed of DNS, I think it&amp;#8217;s legitimate to attempt a DNS lookup of the addresses domain name.  This ensures that at least the user isn&amp;#8217;t just entering &amp;#8216;asdf@asdf.asdf&amp;#8217; to circumvent validation.  Some applications however will require a higher level of certainty though, and the only way you can do that is to connect to the remote MTA and start message delivery for the address.  Note that you don&amp;#8217;t have to complete it, just verify that the SMTP server accepts the RCPT TO command without throwing an error.&lt;/p&gt;
&lt;p&gt;I hope you find this somehow useful.&lt;/p&gt;</description><link>http://sociable.co.nz/post/14449234573</link><guid>http://sociable.co.nz/post/14449234573</guid><pubDate>Mon, 19 Dec 2011 21:25:15 +1300</pubDate></item><item><title>"no reply": it's just not cricket</title><description>&lt;p&gt;You know what I&amp;#8217;m talking about. Businesses all over the world send out emails, whether they&amp;#8217;re some sort of notification, invoice or marketing communication and they disallow direct replies, either by explicitly asking you not to or using a dead-end email address such as &amp;#8220;no-reply@idontvaluemycustomers.com&amp;#8221;.&lt;/p&gt;
&lt;p&gt;This totally disrespects your customer, and devalues their time. I, as a customer am supposed to go to your website, find out how to contact you and then effectively communicate the context of my suggestion or problem when just hitting the reply button in my email client would have provided all this for me.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s my suggestion:&lt;/p&gt;
&lt;blockquote&gt;&lt;img height="113" width="411" alt="we value your opinion." src="http://cdn.axe.io/please_reply.png"/&gt;&lt;/blockquote&gt;
&lt;p&gt;From now on I will be adding a &amp;#8220;please reply&amp;#8221; option to emails sent from my projects to ensure my customers know that I&amp;#8217;m here to help them. See &lt;a href="https://gist.github.com/1177378"&gt;this gist&lt;/a&gt; for source.&lt;/p&gt;</description><link>http://sociable.co.nz/post/9522334245</link><guid>http://sociable.co.nz/post/9522334245</guid><pubDate>Mon, 29 Aug 2011 11:30:00 +1200</pubDate></item><item><title>Doing AVR development on a Mac?</title><description>&lt;p&gt;Yeah, I know. The Arduino development environment is quite limiting - especially if you are using an AVR chip that is not supported or you don&amp;#8217;t have room for the bootloader in your project.&lt;/p&gt;
&lt;p&gt;Something you might not have realised is that the Arduino environment comes with all the development tools needed (avr-gcc, etc) needed to build and burn firmwares for a large number of AVR based MCUs.  Rather than waste your time building and installing development environment you can just hijack Arduino&amp;#8217;s ones for your purposes with a single line of shell code.  I&amp;#8217;ve added the following to my .bashrc:&lt;/p&gt;

&lt;script src="https://gist.github.com/954482.js?file=.bashrc"&gt;&lt;/script&gt;&lt;p&gt;Using this I am able to compile &lt;a href="http://axe.io/"&gt;axe.io&lt;/a&gt;&amp;#8217;s &lt;a href="https://github.com/axeio/vusb-midi"&gt;usb firmware&lt;/a&gt; without issue.&lt;/p&gt;</description><link>http://sociable.co.nz/post/5174473256</link><guid>http://sociable.co.nz/post/5174473256</guid><pubDate>Wed, 04 May 2011 11:58:20 +1200</pubDate></item><item><title>axe.io: Welcome to axe.io</title><description>&lt;a href="http://axe.io/post/3412714714"&gt;axe.io: Welcome to axe.io&lt;/a&gt;: &lt;p&gt;&lt;a href="http://axe.io/post/3412714714"&gt;axeio&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Here’s the thing; &lt;a title="Venus is too close" href="http://venusistooclose.com/"&gt;I’m in this band&lt;/a&gt;, and due to the terrible prog rock nature of this band I needed more control over my tone than I was able to get just from my amplifier, so I invested in an &lt;a title="IKmultimedia iRig" href="http://www.ikmultimedia.com/irig/features/"&gt;iRig and a copy of Amplitube for iPhone&lt;/a&gt;. I was blown away by the quality of simulation available on…&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://sociable.co.nz/post/3494901825</link><guid>http://sociable.co.nz/post/3494901825</guid><pubDate>Fri, 25 Feb 2011 15:48:34 +1300</pubDate></item><item><title>Venus is too close - space rock from outer space.
Today I...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_ld1othJNun1qd0oq2o1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Venus is too close - space rock from outer space.&lt;/p&gt;
&lt;p&gt;Today I deployed the site for &lt;a title="Venus is too close" href="http://venusistooclose.com/"&gt;Venus is too close&lt;/a&gt; - my space rock band. This wouldn’t ordinarily be newsworthy, however it is interesting because it’s a completely static site built using HAML and SASS to generate the output markup using a &lt;a title="Automatic rebuild of HAML and SASS." href="http://sociable.co.nz/post/1482858080/automatic-rebuild-of-haml-and-sass"&gt;technique I’ve mentioned here before&lt;/a&gt; and deployed into production using &lt;a title="Chef - Opscode" href="http://opscode.com/chef/"&gt;Chef&lt;/a&gt;’s git deploy resource.&lt;/p&gt;</description><link>http://sociable.co.nz/post/2130024667</link><guid>http://sociable.co.nz/post/2130024667</guid><pubDate>Tue, 07 Dec 2010 19:32:00 +1300</pubDate></item><item><title>Serve GridFS files directly from rack.</title><description>&lt;p&gt;&lt;a href="https://kimonoapp.com/"&gt;Kimono&lt;/a&gt; is using &lt;a href="http://carrierwave.rubyforge.org/"&gt;Carrierwave&lt;/a&gt; to handle image attachments and save them into &lt;a href="http://www.mongodb.org/display/DOCS/GridFS"&gt;GridFS&lt;/a&gt; - MongoDB&amp;#8217;s built-in filesystem.  GridFS is great because you get the benefits of MongoDB&amp;#8217;s replication and sharding.  Putting files into GridFS is pretty straight forward, and I won&amp;#8217;t waste time getting into that here, &lt;a href="http://socialmemorycomplex.net/2010/06/02/gridfs-with-mongoid-and-carrierwave-on-rails-3/"&gt;Jeremy Weiland has written an excellent post on using Rails 3, Carrierwave and GridFS&lt;/a&gt; which does a great job of covering off the specifics of getting the three pieces of software to talk nicely together.  One thing that immediately jumped out to me was the fact that Jeremy&amp;#8217;s Rails Metal controller reads the entire file contents into RAM before sending it back to the client:&lt;/p&gt;
&lt;p&gt;
&lt;script src="https://gist.github.com/715896.js?file=jeremys_original_gridfs_controller.rb"&gt;&lt;/script&gt;&lt;/p&gt;
&lt;p&gt;Rather than go his route I decided to monkey patch Mongo::GridIO to respond to the each method, which is required by the Rack API:&lt;/p&gt;
&lt;p&gt;
&lt;script src="https://gist.github.com/715896.js?file=grid_io.rb"&gt;&lt;/script&gt;&lt;/p&gt;
&lt;p&gt;Next I can use the Rails 3 router&amp;#8217;s ability to pass in a proc to use directly as a rack handler to respond to the request while bypassing as much of the rails stack as possible:&lt;/p&gt;
&lt;p&gt;
&lt;script src="https://gist.github.com/715896.js?file=routes.rb"&gt;&lt;/script&gt;&lt;/p&gt;
&lt;p&gt;So now the GridFS file is streamed chunk-by-chunk to the client without storing the contents of the file in RAM on the way.  Also, with a small modification this file can be moved directly to a rackup file and used directly by a rack enabled web servers such as passenger:&lt;/p&gt;
&lt;p&gt;
&lt;script src="https://gist.github.com/715896.js?file=config.ru"&gt;&lt;/script&gt;&lt;/p&gt;
&lt;p&gt;I hope I&amp;#8217;ve given you a good overview of how insanely great Rack is, and how easy it is to use GridFS from within Rack.  Yay for us.&lt;/p&gt;</description><link>http://sociable.co.nz/post/1683853316</link><guid>http://sociable.co.nz/post/1683853316</guid><pubDate>Fri, 26 Nov 2010 10:14:00 +1300</pubDate></item><item><title>Start and stop Delayed::Workers with daemonizer</title><description>&lt;p&gt;&lt;a title="collectiveidea's delayed_job on github.com" href="https://github.com/collectiveidea/delayed_job"&gt;Delayed::Job&lt;/a&gt; comes out of the box with a startup script that relies on the &lt;a title="Daemon's gem documentation on Rubyforge." href="http://daemons.rubyforge.org/"&gt;daemons gem&lt;/a&gt;. to start and stop worker processes.  Problem is, I&amp;#8217;ve never actually had it work. After browsing around my options I decided to give &lt;a title="glebpom's daemonizer on github.com" href="https://github.com/glebpom/daemonizer"&gt;daemonizer&lt;/a&gt; a go.  The main advantage I saw to daemonizer is that you simply define a single &amp;#8220;Daemonfile&amp;#8221; in your project&amp;#8217;s root (similar to a Gemfile or Rakefile) explaining how to set up each processes environment.&lt;/p&gt;
&lt;p&gt;My Daemonfile looks like this:&lt;/p&gt;
&lt;script src="https://gist.github.com/666841.js?file=Daemonfile.rb"&gt;&lt;/script&gt;&lt;p&gt;The only minor problem I had was with daemonizer&amp;#8217;s gem dependencies clashing with my apps.  I have &lt;a title="pull request for daemonizer" href="https://github.com/glebpom/daemonizer/pull/12"&gt;submitted a patch&lt;/a&gt; to make sure that daemonizer uses bundle if the project has a Gemfile present.&lt;/p&gt;</description><link>http://sociable.co.nz/post/1509890594</link><guid>http://sociable.co.nz/post/1509890594</guid><pubDate>Mon, 08 Nov 2010 11:11:29 +1300</pubDate></item><item><title>Automatic rebuild of HAML and SASS.</title><description>&lt;p&gt;I love &lt;a title="#HAML" href="http://haml-lang.com/"&gt;HAML&lt;/a&gt;. I love &lt;a title="Sass." href="http://sass-lang.com/"&gt;SASS&lt;/a&gt;. They&amp;#8217;ve both saved me a heap of time writing view code in Rails, but what if you&amp;#8217;re throwing together some static HTML and CSS to mock out an interface?  This is where the &lt;a title="gem install fssm" href="https://github.com/ttilley/fssm"&gt;Travis Tilley&amp;#8217;s excellent file system state monitor gem&lt;/a&gt; comes in:&lt;/p&gt;
&lt;script src="https://gist.github.com/663354.js?file=rebuild.rb"&gt;&lt;/script&gt;&lt;p&gt;Boom!&lt;/p&gt;</description><link>http://sociable.co.nz/post/1482858080</link><guid>http://sociable.co.nz/post/1482858080</guid><pubDate>Fri, 05 Nov 2010 12:06:59 +1300</pubDate></item><item><title>Patch Rails3 route helpers to use STI base class.</title><description>&lt;p&gt;If you&amp;#8217;ve perused the source of any moderately complicated Rails application you are likely to have come across the &lt;a href="http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html"&gt;Single Table Inheritance (STI) pattern&lt;/a&gt;.  STI allows you to have polymorphic models all stored in the same table or collection. It may be best to give you an example:&lt;/p&gt;
&lt;script src="http://gist.github.com/619545.js?file=example_schema.rb"&gt;&lt;/script&gt;&lt;p&gt;As you can see from the example, we have three models, Meat, Bacon and ChunkyBacon all using the &amp;#8220;meats&amp;#8221; table for storage.  This is really great, especially if there is common model logic (attributes, validations, life-cycle callbacks, etc) needed for all three models, and extra logic on the child models (imagine ChunkyBacon has a season).&lt;/p&gt;
&lt;p&gt;&lt;a title="Kimono" href="https://kimonoapp.com/"&gt;Kimono&lt;/a&gt; makes extensive use of STI behaviour throughout it&amp;#8217;s model graph, although built upon the &lt;a href="http://mongoid.org/"&gt;Mongoid&lt;/a&gt; ORM.  I kept running into problems where I needed to have routes for every new subclass I created and it didn&amp;#8217;t really fit the way I wanted the application to work.  The problem is not actually the router (a simple map.resources :meats) works perfectly, but with the route helpers. A call to url_for or link_to when passed in a model instance would throw an exception because there were no routes defined for Bacon or ChunkyBacon.  I started with overriding the helpers (link_to, et al) but soon discovered this didn&amp;#8217;t work well enough because the assumptions Rails makes about routing your models go deep.  How deep? To &lt;a href="http://rubydoc.info/docs/rails/3.0.0/ActionDispatch/Routing/PolymorphicRoutes"&gt;ActionDispatch::Routing::PolymorphicRoutes&lt;/a&gt; as it turns out.&lt;/p&gt;
&lt;p&gt;In order to create the behaviour I wanted I needed to add a reusable method to climb up a model&amp;#8217;s superclass chain checking if the parent is a Mongoid document until it reaches the top of the inheritance tree,  then I needed to patch &amp;#8220;build_named_route_call&amp;#8221; to use this instead of just using the class of the model being routed.  Enter lib/kimono/routing.rb:&lt;/p&gt;
&lt;script src="http://gist.github.com/619545.js?file=routing.rb"&gt;&lt;/script&gt;&lt;p&gt;Once that&amp;#8217;s done, I simply add an initialiser to patch in the behaviour I want:&lt;/p&gt;
&lt;script src="http://gist.github.com/619545.js?file=patch_routing_helpers.rb"&gt;&lt;/script&gt;&lt;p&gt;Now when I call url_for(@bacon) I get &amp;#8220;/meats/1&amp;#8221; back.  Thanks Ruby.&lt;/p&gt;</description><link>http://sociable.co.nz/post/1286186984</link><guid>http://sociable.co.nz/post/1286186984</guid><pubDate>Mon, 11 Oct 2010 10:20:00 +1300</pubDate></item><item><title>Dynamic finders for Mongoid</title><description>&lt;a href="http://github.com/jamesotron/MongoidDynamicFinders"&gt;Dynamic finders for Mongoid&lt;/a&gt;: &lt;p&gt;I’ve been busy over the last while switching a &lt;a href="http://rubyonrails.org/"&gt;Rails 3&lt;/a&gt; application over from ActiveRecord to &lt;a href="http://mongoid.org/"&gt;Mongoid&lt;/a&gt;. In a lot of ways it has gone a lot less painfully than I expected, however one of the main problems I ran into was the common use of dynamic finders in controllers:&lt;/p&gt;

&lt;script src="http://gist.github.com/587348.js?file=gistfile1.rb"&gt;&lt;/script&gt;&lt;p&gt;Mongoid (at the time of this writing) doesn’t officially support dynamic finders, so I have done one of my “minimum viable implementation” versions, available on &lt;a href="http://github.com/jamesotron/MongoidDynamicFinders"&gt;Github&lt;/a&gt;.  Please feel free to fork and send patches.&lt;/p&gt;</description><link>http://sociable.co.nz/post/1153604729</link><guid>http://sociable.co.nz/post/1153604729</guid><pubDate>Mon, 20 Sep 2010 14:25:31 +1200</pubDate></item><item><title>Our Rails3 Presentation from Barcamp Auckland 4.</title><description>&lt;a href="http://www.slideshare.net/sociablenz/barcamp-auckland-rails3-presentation"&gt;Our Rails3 Presentation from Barcamp Auckland 4.&lt;/a&gt;</description><link>http://sociable.co.nz/post/867758075</link><guid>http://sociable.co.nz/post/867758075</guid><pubDate>Wed, 28 Jul 2010 10:12:48 +1200</pubDate></item><item><title>Teaser for Kimono welcome page.“Ask me what is the...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_l68ka292KY1qd0oq2o1_500.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;span&gt;Teaser for Kimono welcome page.&lt;br/&gt;“Ask me what is the greatest thing in the world, I will reply; It is people, it is people, it is people!”&lt;/span&gt;&lt;/p&gt;</description><link>http://sociable.co.nz/post/867641983</link><guid>http://sociable.co.nz/post/867641983</guid><pubDate>Wed, 28 Jul 2010 09:42:02 +1200</pubDate></item></channel></rss>

