Joshua Bambrick

Results 24 comments of Joshua Bambrick

A run-once, vanilla javascript hack: ``` var oldText = Raphael.prototype.text; Raphael.prototype.text = function () { var textElement = oldText.apply(this, arguments); setTimeout(function () { var tspanElement = textElement.node.getElementsByTagName('tspan')[0]; if (tspanElement) tspanElement.setAttribute('dy',...

@megawac Could you possibly elaborate on this a bit more? I think using `_.sortedIndex` would require considerable code replication which I think is best avoided if possible. I have read...

@megawac In fact, looking at the underscore source code, there is no obvious, efficient way to use `_.sortedIndex` - the iterator is not passed the index of the element currently...

`getMin` and `getMax` are the only options at present. Whilst your suggestion is probably fair in the usual case, it does increase the complexity of this function from O(lg n)...

> future-compatibility with `_.sortBy` might be worthwhile, although I would quite like to hear why you think this method could ever become incompatible. I'm not sure that your suggested change...

It would be great to get a few more opinions on this. If others agree with you, I would be happy to implement your ideas. That being said, if this...

It might improve the interface to take the second parameter as `getMax` and if that parameter is not `true`, assume that the user wants the minimum.

bumped test underscore to 1.7.0 to include @megawac's new `_.comparator` method for consistency with `Array.prototype.sort` and `_.sortedIndex` also only have `getMax` as a boolean, and otherwise efficiently fetch the minimum...

you're right. I wasn't quite sure what the protocol was in this situation.

we could update the pull request we a local copy of [`_.comparator`](https://github.com/jashkenas/backbone/pull/3207/files), and then update it to use that defined in underscore, when it becomes available.