Saturday, 29 September 2012
TDD with jQuery thoughts
Monday, 24 September 2012
jsPlumb
I've been using jsPlumb in a recent project to draw some fun visualisations in conjunction with meteor.js and my thoughts on jsPlumb are very positive. jsPlumb is fast to load, draw and redraw connections, it integrates with various different JS frameworks and it's pretty simple to use. About the only criticism I have is that it would be nice if you could influence the connection routing with a bit more precision, or simply have the ability to set up some elements that the connector should try to avoid.
Integrating the library with meteor.js was as easy as placing the jquery jsplumb plugin file into the client/lib directory of the project.
Monday, 17 September 2012
RSpec with Turnip on Gentoo
Turnip is a cool RSpec extension, bring the goodness of Gherkin business readable DSL. But - like Gherkin - it's sensitive to shell encoding. I run Gentoo, so to fix Encoding::InvalidByteSequenceError
I use
export LANG=en_US.UTF-8
Thanks to stackoverflow
Thursday, 13 September 2012
Meteor.js on Appfog
I also also set the ROOT_URL environment variable for my application as I wanted to generate absolute urls from meteor.
Previously, I also needed to set the PORT environment variable to $VMC_APP_PORT but this no longer appears to be necessary. If it is necessary for future deployments, the same process is used as for the MONGO_URL variable.
fibers
package bundled with meteor. This was solved by removing the bundled package and reinstalling the fibers
package from NPM with the bundled code. As this is needed each time, I wrote the following short script to automate the process (and also store the code that was released).
With this script in place, I can now deploy to Appfog reliably whenever I need to, without having to remember a set of file modifications.
Thanks go to http://blog.philkershaw.me/2012/06/deploy-meteor-to-appfog.html as the starting point for my deployment.
Wednesday, 12 September 2012
Internet Explorer Console Shim
Chrome is my weapon of choice when developing rich CoffeeScript and JavaScript apps. This means shaking out all those little differences with IE9 towards the end of a project, and learning to live with all sorts of foible.
Turns out that that IE doesn't always play well with console
.
In particular, on IE9 calling console.debug
fails with
Object doesn't support property or method 'debug'
Since console.debug
is deprecated, I took this opportunity to grep
and replace console.debug
calls with console.log
but its wise to remember to add the console shim for troublesome older versions.
Tuesday, 11 September 2012
beforeunload events in Internet Explorer 9
Chrome is my weapon of choice for JavaScript development. This means spending a little bit of time with
IE9 when development's almost over, learning to play with its little ways. We were taking beforeunload
to display a dialog whenever the user risks losing data by navigating away — but only then. IE9 (oddly) displays null
in a dialog when null
is returned from beforeunload
. Returning undefined
instead means harmony amongst browsers. Another little trick to add to the playbook...
IE9 on Rails in Development
The asset pipeline is one of my favourite Rails 3.1 features. Assets — such as JavaScript and CSS files — are served as written in development mode. As a default, this is spot on but when debugging a rich app on IE9, I found some tuning needed. In particular, IE9 has a hard limit of 31 stylesheets. In this case, it's useful to switch on asset compilation in development. Read on to see how...
JSparklines is a cool JQuery plugin for drawing sparklines — small, in-line graphs. This library uses css injection. In development mode, IE9 raised an Invalid argument
error when this was called. A little bit cryptic, but after a little digging, the cause turned out to be that hard limit. Time to tinker.
To serve fully processed assets in development: edit config/environments/development.rb
, setting
config.assets.debug = false
Thanks Dennis Reimann for his clear example.