Skip to content

Instantly share code, notes, and snippets.

@juhasch
juhasch / gist:5287081
Created April 1, 2013 19:28
breakpoint-demo.ipynb
{
"metadata": {
"name": "breakpoint-demo"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@juhasch
juhasch / folding_py.html
Created November 27, 2013 11:29
Testcase for Python code folding using CodeMirror
<!doctype html>
<title>CodeMirror: Code Folding Demo</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../doc/docs.css">
<link rel="stylesheet" href="../lib/codemirror.css">
<link rel="stylesheet" href="../addon/fold/foldgutter.css" />
<script src="../lib/codemirror.js"></script>
<script src="../addon/fold/foldcode.js"></script>
@juhasch
juhasch / copy-paste-cell
Created December 30, 2013 09:51
Copy/Paste a IPython notebook cell using clipboardData in Chrome.
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@juhasch
juhasch / custom.js
Last active January 3, 2016 04:19
My custom.js for the new IPython notebook 2.0 UI
// leave at least 2 line with only a star on it below, or doc generation fails
/**
*
*
*/
/*
* Wait for app_initialized.NotebookApp trigger
*/
@juhasch
juhasch / unit-conversions.ipynb
Last active August 29, 2015 13:56
Unit conversions using physical-quantities extension
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@juhasch
juhasch / gist:9812482
Created March 27, 2014 16:59
Strip spaces after first $ for math equations. Required to produce single-$ math equations when running IPython nbconvert --to=latex
from IPython.nbconvert.preprocessors import *
import re
class StripDollarSpacesPreprocessor(Preprocessor):
"""Remove spaces after leading '$' in math equations.
Make sure '$ a=10 $' is converted to '$a=10 $' and not '\$ a=10 \$'
when running nbconvert and pandoc
"""
@juhasch
juhasch / custom.js
Last active August 29, 2015 13:58
IPython Notebook: Redefine Shift-Enter
var add_edit_shortcuts = {
'shift-enter' : {
help : 'run cell, select next codecell',
help_index : 'bb',
handler : function (event) {
IPython.notebook.execute_cell_and_select_below();
// find next CodeCell and go into edit mode if possible, else stay in next cell
var i;
for (i = IPython.notebook.get_selected_index(); i < IPython.notebook.ncells() ;i++) {
var cell = IPython.notebook.get_cell(i);
@juhasch
juhasch / answer_buttons.js
Last active January 9, 2020 02:28
IPython extension snippet: Add answer buttons
"using strict";
var answer_buttons = (function() {
function add_buttons(){
console.log("runit");
$("div").each( function(){
if (this.className === 'answer') {
var button= '<input type="button" value="Answer" onclick="showHide(' + this.id + ')">';
this.insertAdjacentHTML("beforeBegin",button);
}
@juhasch
juhasch / NotebookExtensionsManager.ipynb
Last active August 29, 2015 14:02
First draft of a Notebook helping with Notebook Extensions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@juhasch
juhasch / gist:28e941a0ea6b1b6e47b8
Created July 7, 2014 05:43
Example Notebook for Code in Markdown Cell
{
"metadata": {
"name": "",
"signature": "sha256:3f216d8ac560f66c1a009e0f03595c7c2fc7d117803419f82d21cecb330525eb"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [