Created
April 17, 2018 22:32
-
-
Save okdewit/81ba0bb8cda62270839e52c4592fe1b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<script>\n", | |
" code_shown = true;\n", | |
" function code_toggle() {\n", | |
" for (let el of document.querySelectorAll('div.input')) el.style.display = code_shown ?'none':'flex';\n", | |
" code_shown = !code_shown\n", | |
" }\n", | |
"</script>\n", | |
"<form action=\"javascript:code_toggle()\"><input type=\"submit\" value=\"Toggle\"></form>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"from IPython.display import HTML\n", | |
"\n", | |
"HTML('''<script>\n", | |
" code_shown = true;\n", | |
" function code_toggle() {\n", | |
" for (let el of document.querySelectorAll('div.input')) el.style.display = code_shown ?'none':'flex';\n", | |
" code_shown = !code_shown\n", | |
" }\n", | |
"</script>\n", | |
"<form action=\"javascript:code_toggle()\"><input type=\"submit\" value=\"Toggle\"></form>''')" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment