Boost logo

Boost :

Subject: [boost] [BestPracticeHandbook] Run this code online
From: Krzysztof Jusiak (krzysztof_at_[hidden])
Date: 2015-07-08 07:33:28


I've recently added a new functionality to proposed boost.di library
After `try it online` the natural next step was to add `run this code`
functionality like in or programming language.
Powered by Wandbox and CodeMirror approach, let you play with the
particular example and switch between normal quick book programming listing
mode and the editor/compiler mode.

You can check it here:

Just click on `Run this code` button and you will be switched to the editor
mode, where you would be able to edit the code and compile it online using
the newest version of the library.

Implementation details:

It's basically the same solution as `try it online`, just implemented in js
instead. Additionally, it also takes the newest version of the library from

Minimal html:
<link rel="stylesheet" href="CodeMirror/lib/codemirror.css">
<link rel="stylesheet" href="CodeMirror/theme/zenburn.css">
<script src="CodeMirror/lib/codemirror.js"></script>
<script src="CodeMirror/mode/clike/clike.js"></script>
<script src="CodeMirror/addon/selection/active-line.js"></script>
<script src="run_this_code.js"></script>

<button class="TryItBtn" id="run_it_btn" onclick="show('">Run
this code!<\/button>
<textarea style="display: none" id="code"></textarea>
<textarea style="display: none" id="output"></textarea>
<div id="code_listing">
//quick book programming listing here or anything else, which should be
hidden when editor mode is enabled

Let me know, what do you think.

Cheers, Kris

Boost list run by bdawes at, gregod at, cpdaniel at, john at