2012년 8월 15일 수요일

Implementing Set in javascript

var Set = function () { }

Set.prototype.size = function () { var cnt = 0; for (obj in this) { if (typeof this[obj] != 'function') cnt++ } return cnt; }

Set.prototype.add = function (o) { this[o] = true; }

Set.prototype.remove = function (o) { if (this[o]) { delete this[o]; } }

Set.prototype.clear = function () { for (obj in this) { if (this[obj]) delete this[obj]; } }

2012년 8월 9일 목요일

Fit image with css

<img src="" style="width:400px; height: 400px; max-height:100%; max-width:100%" >