Skip to content

Instantly share code, notes, and snippets.

@raine
Created September 22, 2013 11:50
Show Gist options
  • Select an option

  • Save raine/6659219 to your computer and use it in GitHub Desktop.

Select an option

Save raine/6659219 to your computer and use it in GitHub Desktop.
_.mixin({
filterWith: function(list, preds) {
return _.filter(list, function(obj) {
var call = function(a, b) { return b(a); };
return _.every(preds, _.partial(call, obj));
});
}
});
var b = {
isNotConsole : function(buf) { return buf.attributes.buffer_type !== 'console'; },
isNotArchived : function(buf) { return buf.attributes.archived != true; },
isUnseen : function(buf) { return buf.unseen; }
};
var getBuffers = function() {
return _.filterWith(SESSION.buffers.models, _.toArray(arguments));
};
getBuffers(b.isNotConsole, b.isNotArchived, b.isUnseen);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment