I couldn't agree more.
It's very important to copy-paste code into an IDE for a good, detailed, tested review.
Unfortunately, copying code in scrolling boxes is not as easy as it should be.
It would be nice if you could just click within a box and press Control A,
but that's not how browsers work.
That will select everything.
Something that could help is a simple button above each block of code to select the text inside the code block, so you can press Control C to copy it.
I'd like to emphasize the point of selecting text as opposed to copying to clipboard directly.
Copying to clipboard is more complicated and usually implemented by Flash,
which I don't want to enable.
Selecting text is totally harmless, and easy to do.
For a proof of concept, run the code snippet below.
(Another example of the technique on one of my web-tools.)
jQuery.fn.selectText = function () {
var element = this[0];
var range;
if (document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(element);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();
selection.addRange(range);
}
};
$('button.select').click(function () {
$('.editor pre').selectText();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="editor">
<button class="select">Select text</button>
<pre>
def get_data(dir)
newest = get_most_recent_file_numbers(dir)
data = {} # might even be able to get rid of this with clever use of Hash.new
data = $file_prefixes.each do |type, file_prefix|
file = File.open("#{dir}/#{file_prefix}_#{newest[type]}.csv")
file.readline
???
end
end
</pre>
</div>