OK.
That'll work fine, except, of course, swap out the 12VDC wall wart (WW) for one with an output slightly greater than your selected battery set's nominal voltage. For NiMHs I'd say, 15%, or so.
For instance, with a 4.8 VDC battery set, use a WW as close to 5.5 VDC as possible. They'll charge slowly, but safely.
And follow the advice given in the example you cite regarding monitoring the current and voltage levels to assure yourself you're not frying the battery(s).