PinClusterer, Backbone.Routes, Rice, Fiddle.js

27 Apr 2012 | By Alex Young | Tags node geo maps backbone.js databases

PinClusterer

PinClusterer

PinClusterer (GitHub: rtsinani / PinClusterer) by Arti Sinani is a library for clustering pins on Bing maps. Pins are grouped together based on a grid size setting:

var pinClusterer = new PinClusterer(map, {
  gridSize: 40
});
pinCluster.cluster(data);

pinCluster.setOptions({ gridSize: 30 });
pinCluster.cluster();

The pin settings are all configured the same way as a standard Microsoft.Maps.Pushpin. The author has included a stylesheet that will create circular icons with a shadow and gradient.

Backbone.Routes

Backbone.Routes (License: MIT) by Teng Siong Ong is an alternative API for routing in Backbone.js. It helps centralise routes, and can trigger multiple routes for a given URL.

It seems more like the way Rails routing works, and the author indicates he’s been influenced by Rails in the project’s source code. Here’s an example:

Backbone.Routes.prefix = YourApp.Routers

Backbone.Routes.map
  '/':
    'NavbarRouter': 'index'
    'HomeRouter': 'index'

Rice

Rice (License: MIT) by Yuri Neves is a database library that uses the Web SQL Database API. Although Firefox supports Indexed DB instead, this API can be used with PhoneGap.

Usage looks like this:

rice.use('myDb')
  .select({ from: 'People', where: { age: 21 } }, function(result) {
    result.each(function(row) {
      $('<li>').html(row.name).appendTo('#myList');
    });
  });

The source is available here: rice.jscraft.org/src/rice.js.

Fiddle.js

Fiddle.js (License: MIT, npm: fiddle) by Craig Condon is a MongoDB-inspired object manipulation library. Operators like $inc, $set, $unset, and more are supported.

The fiddle method itself accepts a modifier object, and then filters and targets. The targets represent the data to modify:

// Increment age by one
var fiddled = fiddle({ $inc: { age:1 } }, null, { name: 'Craig', age: 21 });

The results returned by fiddle can be filtered and otherwise iterated over.


blog comments powered by Disqus