johndesu

Simple Flash Messages for Your JS App Using Noty

August 7th 2013

Somewhat recently I needed to add flash messages to a Backbone.js application that I could call from anyplace in the app. After looking at a few javascript libraries that display messages for a set amount of time, I decided on noty.

With noty, it is dead simple to create a helper object that allows you to trigger the display of notice, alert, error, and success flash messages in your application. For the sake of this blog post, the application I was working on was a contact manager app namespaced under the top level javascript object ContactManager.

Here is the Coffeescript code I wrote to take care of displaying flash messages:

    window.ContactManager.Flash =
      notice: (msg) ->
        @notification 'notice', 5000, msg

A Couple of New EDM Mixes

July 19th 2013

Back in college, I used to make quite a few EDM (Electronic Dance Music) mixes. I’ve gotten back in the habit again recently and thought I’d share a couple of them here. I like listening to electronic music while I code at work and my goal with these mixes is just to put together some tracks I’d enjoy coding to.

Breeze Mix

Deep progressive house into progressive trance and uplifting trance.

Breeze by Johnd on Mixcloud

Using Sprockets to Precompile Assets in a Rails Engine

July 3rd 2013

I work on extensions (plugins) for Spree quite often. Extensions are Rails engines and thus, don’t have access to the complete suite of rake tasks that rails gives you. Recently, I needed to write tests for an extension that included a Backbone.js application written in Coffeescript. Let me first explain my dilemma, and then how I went about solving it.

If my extension was a complete rails app, I’d be able to use a gem like jasminerice to handle testing my coffeescript with Jasmine. Unfortunately, I can’t guarantee the presence of a live rails app to test against with this extension. I could test against the dummy app common in Rails engines, but using jasminerice with it would require some modifications to the dummy app itself. Rather than dive into the reasons why the dummy app didn’t fit my need, I’ll just skip straight to the solution…

Spree Product Zoom

July 20th 2012

I rolled out another new Spree Extension this week, spree_product_zoom. This extension adds lightbox zoom functionality for product images with fancyBox.

As always, installation is quite simple. Add the following to your Gemfile and run bundle install.

gem "spree_product_zoom", :git => "git://github.com/spree/spree_product_zoom.git"

Finally, copy over the required javascripts and stylesheets by running the install generator.

rails g spree_product_zoom:install

I hope that this extension is useful. For more details, give the Github Repo a visit.

Spree Social Products

July 6th 2012

This week I wrote a Spree Extension that allows you to easily add social network sharing buttons, such as the Facebook “Like” button and Pinterest “Pin It” button, to your Spree Product pages. There is support for Facebook, Pinterest, Reddit, Tumblr, Google Plus, Delicious and Twitter.

Spree Social Products

Installing is as simple as adding a line to your Gemfile and running bundle install.

gem "spree_social_products", :git => "git://github.com/spree/spree_social_products.git"

For more details, please check out the Github Repo.