Skip to content

Instantly share code, notes, and snippets.

@scottdraves
Created April 11, 2018 19:00
Show Gist options
  • Select an option

  • Save scottdraves/2b679cd6e61ccfce82acf699ae49ac0c to your computer and use it in GitHub Desktop.

Select an option

Save scottdraves/2b679cd6e61ccfce82acf699ae49ac0c to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "# Automatic Table Display of Simple Data Structures\n\nBeakerX automatically displays Maps and Lists as Tables completely automatically in many circumstances."
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "[\"x\" : 0, \"y\" : 1]",
"execution_count": 1,
"outputs": [
{
"output_type": "display_data",
"data": {
"method": "display_data",
"application/vnd.jupyter.widget-view+json": {
"version_minor": 0,
"model_id": "7e772bab-24eb-46d3-a79d-73f98c230d40",
"version_major": 2
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "List list = new ArrayList();\nlist.add([\"x\" : 2, \"y\" : 3]);\nlist.add([\"x\" : 5, \"y\" : 8]);\nlist",
"execution_count": 2,
"outputs": [
{
"output_type": "display_data",
"data": {
"method": "display_data",
"application/vnd.jupyter.widget-view+json": {
"version_minor": 0,
"model_id": "b838467f-35dc-443e-a867-f8cc2334d3e8",
"version_major": 2
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "Map[] map = new Map[2];\nmap[0] = [\"x\" : 1.414, \"y\" : 2.718]\nmap[1] = [\"x\" : 3.141, \"y\" : 4.669]\nmap",
"execution_count": 3,
"outputs": [
{
"output_type": "display_data",
"data": {
"method": "display_data",
"application/vnd.jupyter.widget-view+json": {
"version_minor": 0,
"model_id": "cf33d5bd-0cea-453d-bc29-f3343237e658",
"version_major": 2
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "def listOfMap = []\n0.upto(10){\n listOfMap += [\"exp2\": 2**it, \"exp3\": 3**it]\n}\nlistOfMap",
"execution_count": 4,
"outputs": [
{
"output_type": "display_data",
"data": {
"method": "display_data",
"application/vnd.jupyter.widget-view+json": {
"version_minor": 0,
"model_id": "dd51bc6f-4ded-469d-b9c5-d86c140de722",
"version_major": 2
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "def myMap = [:]\ndef myList = []\nmyList << [1, 2, 3]\nmyList << [2, 3, 4]\nmyMap.put(1, myList)\nmyMap",
"execution_count": 5,
"outputs": [
{
"output_type": "display_data",
"data": {
"method": "display_data",
"application/vnd.jupyter.widget-view+json": {
"version_minor": 0,
"model_id": "27724bbe-116a-4aaf-8742-7d5578312ca0",
"version_major": 2
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "def myMap = [:]\ndef myList = [width:1, height:2]\nmyMap.put(1, myList)\nmyMap",
"execution_count": 6,
"outputs": [
{
"output_type": "display_data",
"data": {
"method": "display_data",
"application/vnd.jupyter.widget-view+json": {
"version_minor": 0,
"model_id": "fe5d71d8-608f-4e0f-8cf4-c6c794985502",
"version_major": 2
}
},
"metadata": {}
}
]
}
],
"metadata": {
"beakerx_kernel_parameters": {
"classpath": [],
"imports": []
},
"kernelspec": {
"name": "groovy",
"display_name": "Groovy",
"language": "groovy"
},
"language_info": {
"nbconverter_exporter": "",
"codemirror_mode": "groovy",
"name": "Groovy",
"mimetype": "",
"file_extension": ".groovy",
"version": "2.4.3"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"version_major": 2,
"version_minor": 0,
"state": {
"7e772bab-24eb-46d3-a79d-73f98c230d40": {
"model_name": "TableDisplayModel",
"model_module": "beakerx",
"model_module_version": "*",
"state": {
"model": {
"hasDoubleClickAction": false,
"doubleClickTag": null,
"contextMenuItems": [],
"contextMenuTags": {},
"type": "TableDisplay",
"columnNames": [
"Key",
"Value"
],
"types": [],
"subtype": "Dictionary",
"stringFormatForTimes": null,
"stringFormatForType": {},
"stringFormatForColumn": {},
"rendererForType": {},
"rendererForColumn": {},
"alignmentForType": {},
"alignmentForColumn": {},
"columnsFrozen": {},
"columnsFrozenRight": {},
"columnsVisible": {},
"columnOrder": [],
"cellHighlighters": [],
"tooltips": [],
"dataFontSize": null,
"headerFontSize": null,
"fontColor": [],
"headersVertical": false,
"hasIndex": null,
"timeZone": null,
"values": [
[
"x",
0
],
[
"y",
1
]
],
"tooManyRows": false
}
}
},
"b838467f-35dc-443e-a867-f8cc2334d3e8": {
"model_name": "TableDisplayModel",
"model_module": "beakerx",
"model_module_version": "*",
"state": {
"model": {
"hasDoubleClickAction": false,
"doubleClickTag": null,
"contextMenuItems": [],
"contextMenuTags": {},
"type": "TableDisplay",
"columnNames": [
"x",
"y"
],
"types": [
"integer",
"integer"
],
"subtype": "ListOfMaps",
"stringFormatForTimes": null,
"stringFormatForType": {},
"stringFormatForColumn": {},
"rendererForType": {},
"rendererForColumn": {},
"alignmentForType": {},
"alignmentForColumn": {},
"columnsFrozen": {},
"columnsFrozenRight": {},
"columnsVisible": {},
"columnOrder": [],
"cellHighlighters": [],
"tooltips": [],
"dataFontSize": null,
"headerFontSize": null,
"fontColor": [],
"headersVertical": false,
"hasIndex": null,
"timeZone": null,
"values": [
[
2,
3
],
[
5,
8
]
],
"tooManyRows": false
}
}
},
"cf33d5bd-0cea-453d-bc29-f3343237e658": {
"model_name": "TableDisplayModel",
"model_module": "beakerx",
"model_module_version": "*",
"state": {
"model": {
"hasDoubleClickAction": false,
"doubleClickTag": null,
"contextMenuItems": [],
"contextMenuTags": {},
"type": "TableDisplay",
"columnNames": [
"x",
"y"
],
"types": [
"double",
"double"
],
"subtype": "ListOfMaps",
"stringFormatForTimes": null,
"stringFormatForType": {},
"stringFormatForColumn": {},
"rendererForType": {},
"rendererForColumn": {},
"alignmentForType": {},
"alignmentForColumn": {},
"columnsFrozen": {},
"columnsFrozenRight": {},
"columnsVisible": {},
"columnOrder": [],
"cellHighlighters": [],
"tooltips": [],
"dataFontSize": null,
"headerFontSize": null,
"fontColor": [],
"headersVertical": false,
"hasIndex": null,
"timeZone": null,
"values": [
[
1.414,
2.718
],
[
3.141,
4.669
]
],
"tooManyRows": false
}
}
},
"dd51bc6f-4ded-469d-b9c5-d86c140de722": {
"model_name": "TableDisplayModel",
"model_module": "beakerx",
"model_module_version": "*",
"state": {
"model": {
"hasDoubleClickAction": false,
"doubleClickTag": null,
"contextMenuItems": [],
"contextMenuTags": {},
"type": "TableDisplay",
"columnNames": [
"exp2",
"exp3"
],
"types": [
"integer",
"integer"
],
"subtype": "ListOfMaps",
"stringFormatForTimes": null,
"stringFormatForType": {},
"stringFormatForColumn": {},
"rendererForType": {},
"rendererForColumn": {},
"alignmentForType": {},
"alignmentForColumn": {},
"columnsFrozen": {},
"columnsFrozenRight": {},
"columnsVisible": {},
"columnOrder": [],
"cellHighlighters": [],
"tooltips": [],
"dataFontSize": null,
"headerFontSize": null,
"fontColor": [],
"headersVertical": false,
"hasIndex": null,
"timeZone": null,
"values": [
[
1,
1
],
[
2,
3
],
[
4,
9
],
[
8,
27
],
[
16,
81
],
[
32,
243
],
[
64,
729
],
[
128,
2187
],
[
256,
6561
],
[
512,
19683
],
[
1024,
59049
]
],
"tooManyRows": false
}
}
},
"27724bbe-116a-4aaf-8742-7d5578312ca0": {
"model_name": "TableDisplayModel",
"model_module": "beakerx",
"model_module_version": "*",
"state": {
"model": {
"hasDoubleClickAction": false,
"doubleClickTag": null,
"contextMenuItems": [],
"contextMenuTags": {},
"type": "TableDisplay",
"columnNames": [
"Key",
"Value"
],
"types": [],
"subtype": "Dictionary",
"stringFormatForTimes": null,
"stringFormatForType": {},
"stringFormatForColumn": {},
"rendererForType": {},
"rendererForColumn": {},
"alignmentForType": {},
"alignmentForColumn": {},
"columnsFrozen": {},
"columnsFrozenRight": {},
"columnsVisible": {},
"columnOrder": [],
"cellHighlighters": [],
"tooltips": [],
"dataFontSize": null,
"headerFontSize": null,
"fontColor": [],
"headersVertical": false,
"hasIndex": null,
"timeZone": null,
"values": [
[
"1",
[
[
1,
2,
3
],
[
2,
3,
4
]
]
]
],
"tooManyRows": false
}
}
},
"fe5d71d8-608f-4e0f-8cf4-c6c794985502": {
"model_name": "TableDisplayModel",
"model_module": "beakerx",
"model_module_version": "*",
"state": {
"model": {
"hasDoubleClickAction": false,
"doubleClickTag": null,
"contextMenuItems": [],
"contextMenuTags": {},
"type": "TableDisplay",
"columnNames": [
"Key",
"Value"
],
"types": [],
"subtype": "Dictionary",
"stringFormatForTimes": null,
"stringFormatForType": {},
"stringFormatForColumn": {},
"rendererForType": {},
"rendererForColumn": {},
"alignmentForType": {},
"alignmentForColumn": {},
"columnsFrozen": {},
"columnsFrozenRight": {},
"columnsVisible": {},
"columnOrder": [],
"cellHighlighters": [],
"tooltips": [],
"dataFontSize": null,
"headerFontSize": null,
"fontColor": [],
"headersVertical": false,
"hasIndex": null,
"timeZone": null,
"values": [
[
"1",
{
"width": 1,
"height": 2
}
]
],
"tooManyRows": false
}
}
}
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment