Skip to content

Instantly share code, notes, and snippets.

@tbfleming
Last active January 22, 2018 14:58
Show Gist options
  • Save tbfleming/2f7baf1120967895c2b07b09eddb576c to your computer and use it in GitHub Desktop.
Save tbfleming/2f7baf1120967895c2b07b09eddb576c to your computer and use it in GitHub Desktop.
cib demo: custom console
#include <stdio.h>
int main() {
for(int i = 0; i < 20; ++i) {
for(int j = 0; j < 20; ++j)
printf("%02d ", j);
printf("\n");
}
}
%init-scripts%
<style>
html,
body {
width: 100%;
height: 100%;
overflow: hidden;
}
div {
position: absolute;
left: 10px;
right: 10px;
top: 10px;
bottom: 10px;
padding: 10px;
background-color: cyan;
overflow: auto;
}
pre {
margin: 0px;
}
</style>
<div>
<pre id='console'></pre>
</div>
<script>
'use strict';
let console = document.getElementById('console');
emModule.print = emModule.printErr = msg => {
console.textContent += msg + '\n';
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment