The humble LM317 adjustable voltage regulator is everywhere ... how the LM317 can be used to regulate current rather than voltage to provide a constant current source under varying load.
For a regulator ... line when charging a capacitor. A constant current sink can discharge the capacitor in a straight line, too. Usually, a circuit like that will have a flip-flop to pick between ...