To paste code into a code widget you have to enter the code widget's edit mode. First drag and drop a code widget. Then, hover over it and click on the pencil icon. Finally, simply paste your code.
The first thing you need in order to paste code into a code widget is to have your own code.