Essential require.js plugins for large projects

April 25, 2012 - 16 Comments

When working on large javascript projects (like what we do in Backbone.js), its a godsend to have something like require.js to help you split your project into organized pieces. But in addition to require.js, there are quite a few require.js plugins out there that you should take advantage of.

depend.js - Rock solid loading of dependancies in order

This plugin (millermedeiros/requirejs-plugins) insures that a particular dependency is loaded prior to loading the next. I initially thought the order.js plugin accomplished this, but when you have things like jquery-ui plugins extending the base jquery-ui this can cause problems. The files would be requested in the correct order, but the plugin would load faster than the large `jquery-ui` library. Compiling was fine, but his caused intermentant errors during development. Depend.js solves this issue.

text.js - Text-based dependancies

This plugin (require.js) works great with the underscore.js _.template function. It allows you to load text-based files and use the content as a dependancy. I find this works much better than trying to load javascript templates in other ways (i.e. ajax requests or from the DOM). Also, when you run your project through the r.js compiler, all the templates are compiled right into your javascript!

cs.js - Coffeescript in require.js

This plugin (jrburke/require-cs) lets you intermix coffeescript and js dependancies within your project. All the coffeescript dependancies are complied in realtime allowing you to develop without the need to have coffeescript watch your directories for changes. Upon compiling with r.js (note: some special configuration is necessary), the files are compiled into javascript.

This is also an easy way to play around and learn coffeescript without the need to install it on your local system.

Toolkit: View memcached keys during development

February 6, 2011 - 2 Comments

At EVO we use memcached during every project in one way or another. We needed an easy to use interface to view a list of keys that are currently present during development.

After a bit of searching, I found this blog post describing how to interface with memcached over standard telnet.

This method is still somewhat manual because of the recursion necessary to actually view the key names, so I put together a python interface to easily grab the list of keys:
python-memcached-stats on github

Usage is simple and works on any system that has python installed (including mac OSX)

Post categories

Post archives