Monthly Archives: May 2014

setting a html5 data attribute with jquery

Abstract I have a single bootstrap modal, which is called from different places, and so the modal contains some data-* attributes I want to set before showing it. Just using the .data() offered by jquery does not work. Detailed example Suppose you have mark-up like this: <div data-some-important-value=”123″> Asking the value is quite easy: $(‘[data-some-important-value]’).data(‘some-important-value’) […]

[ruby] hate private methods? use protected instead

I started out writing something like the following: If I could change just one thing in ruby, I would change how private works. Aaarrgghh. For instance, I am trying to implement an equality of bounding boxes in ruby. I would presume I could write something like: class BoundingBox attr_accessor :xmin, :ymin, :xmax, :ymax def initialize(xmin, […]