OK I know I promised that we would start the dive into testing your Spine.JS application using Jasmine(rice) in my last article, but
this is a good diversion. If you are new to my latest series on Spine.JS and Jasmine, scroll on down to the bottom to the related
section and read back. However, for those that might be more familiar with Jasmine and specifically Guard::Jasmine and ever felt the
pain that debugging from that terminal window was lacking, read...
So this is the third part to my mini series on Rails and Spine.JS. Part one covers an initial setup and how to include Spine.JS into
your Rails project while part two is actually the first of a tome on how to test your Spine.JS application. Assuming you have covered
the bases there, lets get right down to business and review some of the elegant hacks ™ yours truly came up with while testing my
own Spine.jS application using Guard...
In my previous article I talked a little bit about why I decided to use Spine.JS and how to include the CoffeeScript source into your
Rails project using git submodules. Now I would like to talk about testing your brand new Spine.JS application. Afterward, be sure to
read the second part to this article which covers more advanced aspects of your Spine.JS application specs. Testing JavaScript OK, so
like any good programmer, you want to test your JavaScript web application,...
Our options for JavaScript MVC frameworks are numerous these days. While working on the third major rewrite of my personal bookmarking
application, HomeMarks, I decided to learn Backbone.js. Thankfully a local friend of mine recommended that I try Spine.JS. I was
immediately hooked! Why Spine.JS? Spine.JS is is authored in CoffeeScript and that is a big deal for me. I will never write raw
JavaScript again, which I consider, the deprecated syntax. So a JavaScript MVC framework that is written...
This weekend I decided to experiment with LESS CSS by replacing the existing Sass and Compass code that had been built thus far a small
project. Why? Three basic reasons. First, I wanted to see how LESS stacked up. Second, I was intrigued by some of LESS' features, in
particular their namespace support. Lastly, I wanted to use Twitter's Bootstrap project as a baseline for my design. Since Rails 3.1
has been out for some time, I was expecting the...
I ask this question a lot! To Job candidates, friends, and almost any developer that says they work with JavaScript. I believe how you
encapsulate your JavaScript is a good indicator on your level of expertise with the language. I find that most beginners have come to
JavaScript via jQuery and often define their functions at the top level namespace in some application.js file. These functions are
loosely organized and often have no way of sharing simple object state and...
I just finished my first dive into using jQuery Mobile with a Rails application and wanted to share some techniques that came out along
the way. Hopefully these will help you if your are using jQuery Mobile with Rails or want to test your mobile application's integration
layer. This post assumes you are somewhat familiar with jQuery Mobile and its basic concepts. So let's jump right in with a series of
helpful tips. A Mobile Layout In my application, I...
Friends have told me that rich domain objects are seldom wielded when using jQuery to enhance behavior on web pages. I myself have
always loved JavaScript as a rich dynamic language first and something for the DOM second. Hence most of my client-side JavaScript
follows a robust object-oriented approach similar to Ruby. This is the main reason I have used Prototype.js for so long. Since Rails
announced both jQuery and CoffeeScript as the defaults in version 3.1, I decided it...
This twitter post by Dave Thomas sparked an interesting back and forth with DHH on how Rails 3.1 could be more opinionated towards web
development for the browser. A short time before – it was announced that Rails would include CoffeeScript and Sass as defaults
for JavaScript and CSS authoring. FWIW, both of these new defaults are in my opinion the best of the breed fore each task. If you have
not done so, I suggest taking a quick read...
Last week I started reading JavaScript: The Good Parts by Douglas Crockford. It was on my list of long overdue things to do. While
reading it, I wanted to be able to kick some simple JavaScript examples around. As rubyist we have it good, irb let's us fire up an
interactive console anytime we want. But with JavaScript, options are limited. Sure you could install Johnson/EnvJS, Rhino or some
other JavaScript engine. Maybe even load up firebug or the web...
A while back ago I wrote an article about how to use Rails built-in forgery protection in your RESTful AJAX calls. Normally AJAX
requests, those responding true to request.xhr? in rails, are forgery whitelisted. But sometimes, and under what conditions I am not
sure, AJAX methods are subjected to forgery protection. Maybe you have the ActionDispatch::Request#forgery_whitelisted? overridden to
not include AJAX requests? Either way and for whatever reason – if you like to use forgery protection in your RESTful AJAX...
An updated version of UJS and forgery protection in Rails3 here. Are you bleeding on the edge of rails 3 and need to shim up some
unobtrusive JavaScript to work with your link_to code that uses a destructive :method option? I did today and here is what I did to
solve it. If you are unfamiliar with the problem, and what has been happening in rails 3 with UJS, check out Piotr Solnica's blog for a
good run down. Or...
UPDATE: May 15th, 2011 - Today I decided to to re-write this class as my first dive into both CoffeeScript and jQuery. You can find an
updated version in this gist on github. As some of you know, I am in the last steps of announcing my first iPhone application. We all
know that every good iPhone application has a great marketing website with a screen cast. I myself was heavily inspired by the Tapbots
Convertbot website while building my...
Well HomeMarks v2.0 is done and ready for the public. You can download it from my Github project page. It has a real simple rake
app:bootstrap task that I came up with over the weekend will have you running a local copy in only a few seconds, give it a try.
Sometime over the next few days, I'll move over the live site to this code base too. If you have not yet kept up on the implementation
mantra I...
Writing the new HomeMarks has been a great exercise. I've learned that the AJAX Head Design Pattern Implementation is more akin to
developing a service-oriented application (SOA) since I have moved all client-side coupling from the controllers, like RJS, and only
respond with HEAD or JSON data. Today I learned about Halcyon which is self described as a JSON web application framework built on
Rack. If you take a look at their example, it looks a lot like HomeMarks v2,...
Chris Williams did a really great write up on this pattern with great details on when/how to use it. Please considering reading it
afterward. This is the first of a few articles covering the total rewrite of the HomeMarks.com code base as I upgrade it to Rails 2.1.
The "AJAX Head" pattern is the moniker I have assigned to methodology that has come about during said rewrite and the design decisions
I choose early on. The rules were simple. Total...