Snap window to a grid

Is it possible to snap a window to a grid?

You may see the “Snap to a 20x20 grid” example below:

jqueryui.com/demos/draggable/#snap-to

There is not such a build-in feature.