├── .gitignore ├── thumbnail.png ├── screenshot1.png ├── screenshot2.png ├── screenshot3.png ├── snippets_submenu_python.js ├── snippets_submenus_python ├── h5py.js ├── numba.js ├── sympy_assumptions.js ├── numpy_polynomial.js ├── pandas.js ├── astropy.js ├── matplotlib.js ├── python.js ├── python_regex.js ├── sympy_functions.js ├── numpy.js └── scipy.js ├── LICENSE ├── snippets_menu.css ├── snippets_submenu_markdown.js ├── config.yaml ├── examples_for_custom.js ├── main.js └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | Test*.ipynb -------------------------------------------------------------------------------- /thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moble/jupyter_boilerplate/HEAD/thumbnail.png -------------------------------------------------------------------------------- /screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moble/jupyter_boilerplate/HEAD/screenshot1.png -------------------------------------------------------------------------------- /screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moble/jupyter_boilerplate/HEAD/screenshot2.png -------------------------------------------------------------------------------- /screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moble/jupyter_boilerplate/HEAD/screenshot3.png -------------------------------------------------------------------------------- /snippets_submenu_python.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "require", 3 | "./snippets_submenus_python/numpy", 4 | "./snippets_submenus_python/scipy", 5 | "./snippets_submenus_python/matplotlib", 6 | "./snippets_submenus_python/sympy", 7 | "./snippets_submenus_python/pandas", 8 | "./snippets_submenus_python/astropy", 9 | "./snippets_submenus_python/h5py", 10 | "./snippets_submenus_python/numba", 11 | "./snippets_submenus_python/python", 12 | ], function (require, numpy, scipy, matplotlib, sympy, pandas, astropy, h5py, numba, python) { 13 | return { 14 | numpy:numpy, 15 | scipy:scipy, 16 | matplotlib:matplotlib, 17 | sympy:sympy, 18 | pandas:pandas, 19 | astropy:astropy, 20 | h5py:h5py, 21 | numba:numba, 22 | python:python, 23 | }; 24 | }); 25 | -------------------------------------------------------------------------------- /snippets_submenus_python/h5py.js: -------------------------------------------------------------------------------- 1 | define({ 2 | 'name' : 'h5py', 3 | 'sub-menu' : [ 4 | { 5 | 'name' : 'Setup', 6 | 'snippet' : [ 7 | 'from __future__ import print_function, division', 8 | 'import h5py', 9 | ], 10 | }, 11 | { 12 | 'name' : 'Documentation', 13 | 'external-link' : 'http://docs.h5py.org/en/latest/', 14 | }, 15 | '---', 16 | { 17 | 'name' : 'Open a file', 18 | 'snippet' : ['bp_f = h5py.File("path/to/file.h5")',], 19 | }, 20 | 21 | { 22 | 'name' : 'Close a file', 23 | 'snippet' : ['bp_f.close()',], 24 | }, 25 | 26 | { 27 | 'name' : 'Get array', 28 | 'snippet' : ['bp_array = bp_f["bp_array_item"][:]',], 29 | }, 30 | 31 | { 32 | 'name' : 'Get scalar', 33 | 'snippet' : ['bp_scalar = bp_f["bp_scalar_item"][()]',], 34 | }, 35 | ], 36 | }); 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Mike Boyle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /snippets_submenus_python/numba.js: -------------------------------------------------------------------------------- 1 | define({ 2 | 'name' : 'numba', 3 | 'sub-menu' : [ 4 | { 5 | 'name' : 'Setup', 6 | 'snippet' : [ 7 | 'from __future__ import print_function, division', 8 | 'import sys', 9 | 'if sys.version_info[0] >= 3:', 10 | ' xrange = range # Must always iterate with xrange in njit functions', 11 | 'import numba', 12 | ], 13 | }, 14 | { 15 | 'name' : 'Documentation', 16 | 'external-link' : 'http://numba.pydata.org/numba-doc/dev/index.html', 17 | }, 18 | '---', 19 | { 20 | 'name' : 'Jit function', 21 | 'snippet' : [ 22 | '@numba.njit', 23 | 'def bp_func(x):', 24 | ' r"""Some function', 25 | ' ', 26 | ' Does some stuff.', 27 | ' ', 28 | ' """', 29 | ' return x**2', 30 | ], 31 | }, 32 | 33 | { 34 | 'name' : 'Jit function with specified signature', 35 | 'snippet' : [ 36 | '@numba.njit(f8, f8[:])', 37 | 'def bp_func(x, y):', 38 | ' r"""Some function', 39 | ' ', 40 | ' Parameters', 41 | ' ----------', 42 | ' x : float', 43 | ' y : float array', 44 | ' ', 45 | ' """', 46 | ' for j in xrange(y.size):', 47 | ' y[j] *= x', 48 | ], 49 | }, 50 | ], 51 | }); 52 | -------------------------------------------------------------------------------- /snippets_menu.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | The left-side dropdown submenu is adapted from the usual right-side code at 4 | 5 | 6 | */ 7 | .dropdown-submenu-left > .dropdown-menu { 8 | left: auto; 9 | right: 100%; 10 | } 11 | 12 | /* For space-saving menus */ 13 | .dropdown-submenu > .dropdown-menu.dropdown-menu-compact { 14 | left: 50%; 15 | top: 100%; 16 | } 17 | .dropdown-submenu-left > .dropdown-menu.dropdown-menu-compact { 18 | left: auto; 19 | right: 50%; 20 | } 21 | 22 | .dropdown-submenu-left > a:after { 23 | visibility: hidden; 24 | } 25 | .dropdown-submenu-left > a:before { 26 | display: inline-block; 27 | font: normal normal normal 14px/1 FontAwesome; 28 | font-size: inherit; 29 | text-rendering: auto; 30 | -webkit-font-smoothing: antialiased; 31 | -moz-osx-font-smoothing: grayscale; 32 | transform: translate(0, 0); 33 | display: block; 34 | content: "\f0d9"; 35 | float: left; 36 | color: #333333; 37 | margin-top: 2px; 38 | margin-left: -10px; 39 | } 40 | 41 | 42 | /* 43 | 44 | The following allows for control of the "tooltip" that shows the code to be 45 | inserted when the item is clicked. Without this, the tooltip might wrap the 46 | code, making it hard to read; will cut off some of the code; won't be 47 | monospaced; etc. Note that these CSS selectors select any element with 48 | an attribute `data-snippet-code`. This attribute is necessary and sufficient 49 | for us to add the pop-up. 50 | 51 | */ 52 | a[data-snippet-code]:after { 53 | content: attr(data-snippet-code); /* Read from the data-snippet-code attribute */ 54 | font-family: monospace; 55 | font-size: 75%; 56 | position: absolute; 57 | width: auto; 58 | display: table; 59 | left: 50%; 60 | white-space: pre; 61 | z-index: 10000; 62 | background: #E8E8E8; 63 | padding: 4px; 64 | border-color : #AAA; 65 | border-style: solid; 66 | border-width: 1px; 67 | visibility: hidden; 68 | } 69 | a[data-snippet-code]:hover:after { 70 | visibility: visible; 71 | transition: all 0s ease 1s; 72 | } 73 | -------------------------------------------------------------------------------- /snippets_submenus_python/sympy_assumptions.js: -------------------------------------------------------------------------------- 1 | define({ 2 | 'name' : 'List of assumptions', 3 | 'sub-menu' : [ 4 | { 5 | 'name' : 'Bounded', 6 | 'snippet' : ['Q.bounded(x)',], 7 | }, 8 | { 9 | 'name' : 'Commutative', 10 | 'snippet' : ['Q.commutative(x)',], 11 | }, 12 | { 13 | 'name' : 'Complex', 14 | 'snippet' : ['Q.complex(x)',], 15 | }, 16 | { 17 | 'name' : 'Imaginary', 18 | 'snippet' : ['Q.imaginary(x)',], 19 | }, 20 | { 21 | 'name' : 'Real', 22 | 'snippet' : ['Q.real(x)',], 23 | }, 24 | { 25 | 'name' : 'Extended real', 26 | 'snippet' : ['Q.extended_real(x)',], 27 | }, 28 | { 29 | 'name' : 'Integer', 30 | 'snippet' : ['Q.integer(x)',], 31 | }, 32 | { 33 | 'name' : 'Odd', 34 | 'snippet' : ['Q.odd(x)',], 35 | }, 36 | { 37 | 'name' : 'Even', 38 | 'snippet' : ['Q.even(x)',], 39 | }, 40 | { 41 | 'name' : 'Prime', 42 | 'snippet' : ['Q.prime(x)',], 43 | }, 44 | { 45 | 'name' : 'Composite', 46 | 'snippet' : ['Q.composite(x)',], 47 | }, 48 | { 49 | 'name' : 'Zero', 50 | 'snippet' : ['Q.zero(x)',], 51 | }, 52 | { 53 | 'name' : 'Nonzero', 54 | 'snippet' : ['Q.nonzero(x)',], 55 | }, 56 | { 57 | 'name' : 'Rational', 58 | 'snippet' : ['Q.rational(x)',], 59 | }, 60 | { 61 | 'name' : 'Algebraic', 62 | 'snippet' : ['Q.algebraic(x)',], 63 | }, 64 | { 65 | 'name' : 'Transcendental', 66 | 'snippet' : ['Q.transcendental(x)',], 67 | }, 68 | { 69 | 'name' : 'Irrational', 70 | 'snippet' : ['Q.irrational(x)',], 71 | }, 72 | { 73 | 'name' : 'Finite', 74 | 'snippet' : ['Q.finite(x)',], 75 | }, 76 | { 77 | 'name' : 'Infinite', 78 | 'snippet' : ['Q.infinite(x)',], 79 | }, 80 | { 81 | 'name' : 'Infinitesimal', 82 | 'snippet' : ['Q.infinitesimal(x)',], 83 | }, 84 | { 85 | 'name' : 'Negative', 86 | 'snippet' : ['Q.negative(x)',], 87 | }, 88 | { 89 | 'name' : 'Nonnegative', 90 | 'snippet' : ['Q.nonnegative(x)',], 91 | }, 92 | { 93 | 'name' : 'Positive', 94 | 'snippet' : ['Q.positive(x)',], 95 | }, 96 | { 97 | 'name' : 'Nonpositive', 98 | 'snippet' : ['Q.nonpositive(x)',], 99 | }, 100 | { 101 | 'name' : 'Hermitian', 102 | 'snippet' : ['Q.hermitian(x)',], 103 | }, 104 | { 105 | 'name' : 'Antihermitian', 106 | 'snippet' : ['Q.antihermitian(x)',], 107 | }, 108 | ], 109 | }); 110 | -------------------------------------------------------------------------------- /snippets_submenu_markdown.js: -------------------------------------------------------------------------------- 1 | define({ 2 | 'name' : 'Markdown', 3 | 'sub-menu' : [ 4 | { 5 | 'name' : 'Documentation', 6 | 'external-link' : 'https://help.github.com/articles/github-flavored-markdown/', 7 | }, 8 | '---', 9 | 10 | { 11 | 'name' : 'Insert itemized list', 12 | 'snippet' : [ 13 | '* One', 14 | ' - Sublist', 15 | ' - This', 16 | ' - Sublist', 17 | ' - That', 18 | ' - The other thing', 19 | '* Two', 20 | ' - Sublist', 21 | '* Three', 22 | ' - Sublist', 23 | ], 24 | }, 25 | 26 | { 27 | 'name' : 'Insert enumerated list', 28 | 'snippet' : [ 29 | '1. Here we go', 30 | ' 1. Sublist', 31 | ' 2. Sublist', 32 | '2. There we go', 33 | '3. Now this', 34 | ], 35 | }, 36 | 37 | { 38 | 'name' : 'Insert table', 39 | 'snippet' : [ 40 | '', 41 | ' ', 42 | ' ', 43 | ' ', 44 | ' ', 45 | ' ', 46 | ' ', 47 | ' ', 48 | ' ', 49 | ' ', 50 | ' ', 51 | ' ', 52 | ' ', 53 | '
Header 1Header 2
row 1, cell 1row 1, cell 2
row 2, cell 1row 2, cell 2
', 54 | ], 55 | }, 56 | 57 | { 58 | 'name' : 'Insert local image', 59 | 'snippet' : [ 60 | '', 61 | ], 62 | }, 63 | 64 | { 65 | 'name' : 'Insert local video', 66 | 'snippet' : [ 67 | '
  • '); 169 | 170 | if (typeof menu_item_spec == 'string') { 171 | if (menu_item_spec != '---') { 172 | console.log(mod_log_prefix, 173 | 'Don\'t understand sub-menu string "' + menu_item_spec + '"'); 174 | return null; 175 | } 176 | return element.addClass('divider'); 177 | } 178 | 179 | var a = $('') 180 | .attr('href', '#') 181 | .html(menu_item_spec.name) 182 | .appendTo(element); 183 | if (menu_item_spec.hasOwnProperty('snippet')) { 184 | var snippet = menu_item_spec.snippet; 185 | if (typeof snippet == 'string' || snippet instanceof String) { 186 | snippet = [snippet]; 187 | } 188 | a.attr({ 189 | 'title' : "", // Do not remove this, even though it's empty! 190 | 'data-snippet-code' : snippet.join('\n'), 191 | }) 192 | .on('click', callback_insert_snippet) 193 | .addClass('snippet'); 194 | } 195 | else if (menu_item_spec.hasOwnProperty('internal-link')) { 196 | a.attr('href', menu_item_spec['internal-link']); 197 | } 198 | else if (menu_item_spec.hasOwnProperty('external-link')) { 199 | a.empty(); 200 | a.attr({ 201 | 'target' : '_blank', 202 | 'title' : 'Opens in a new window', 203 | 'href' : menu_item_spec['external-link'], 204 | }); 205 | $('').appendTo(a); 206 | $('').html(menu_item_spec.name).appendTo(a); 207 | } 208 | 209 | if (menu_item_spec.hasOwnProperty('sub-menu')) { 210 | element 211 | .addClass('dropdown-submenu') 212 | .toggleClass('dropdown-submenu-left', direction === 'left'); 213 | var sub_element = $('