Skip to content

Instantly share code, notes, and snippets.

@dreamalligator
Created April 4, 2014 06:25
Show Gist options
  • Save dreamalligator/9969203 to your computer and use it in GitHub Desktop.
Save dreamalligator/9969203 to your computer and use it in GitHub Desktop.
To test the Pelican Liquid Tags plugin.

To test liquid tags plugin.

Place files accordingly:

  • content/pages/sandbox.md
  • content/notebooks/planets.ipynb
  • content/code/catrpee.py (src)
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:8fdd667e059b2e5f0df06b507d06efa147c282d8b314222937eb95da3ca46d95"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"###Pyephem Test"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import ephem\n",
"here = ephem.Observer()\n",
"here = ephem.Observer()\n",
"#my home town of Winter Springs, FL\n",
"here.lat = '28:41:36' #+N\n",
"here.lon = '81:16:44' #+E\n",
"here.elevation = 16.0 #meters\n",
"here.date = ephem.date('1988/03/04') #my birthday\n",
"mars = ephem.Mars()\n",
"jupiter = ephem.Jupiter()\n",
"bodies = [mars,jupiter]\n",
"for body in bodies:\n",
" body.compute(here)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"j = 17 #justified width\n",
"for body in bodies:\n",
" print '---------------------------'\n",
" print(body.name+':')\n",
" print 'declination:'.ljust(j),body.dec #degrees north of the equator\n",
" print 'elong:'.ljust(j),body.elong\n",
" print 'size:'.ljust(j),body.size\n",
" print 'magnitude: '.ljust(j),body.mag\n",
" print 'right ascension:'.ljust(j),body.dec #hours of arc around the celestial equator\n",
" print 'constellation:'.ljust(j),ephem.constellation(body)\n",
"print '---------------------------'"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"---------------------------\n",
"Mars:\n",
"declination: -23:35:06.4\n",
"elong: -66:30:31.6\n",
"size: 5.7856502533"
]
},
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"magnitude: 1.03\n",
"right ascension: -23:35:06.4\n",
"constellation: ('Sgr', 'Sagittarius')\n",
"---------------------------\n",
"Jupiter:\n",
"declination: 10:10:20.9\n",
"elong: 45:25:09.6\n",
"size: 35.0433349609\n",
"magnitude: -1.98\n",
"right ascension: 10:10:20.9\n",
"constellation: ('Psc', 'Pisces')\n",
"---------------------------\n"
]
}
],
"prompt_number": 4
}
],
"metadata": {}
}
]
}

Title: Sandbox Date: 2014-04-01 Author: Tom Spalding Slug: sandbox Status: hidden Summary: A sandbox to test features available to the blog.

Testing the liquid tag plugin.

##Image Tag {% img http://sfsu.acm.org/images/logos/acm-logo.jpg 200 200 %}

##Youtube Tag {% youtube 2EXpAfV85Ns %}

##Include Code Tag {% include_code catrpee.py cathessire catat %}

and a regular code block

def catatat(katze=3):
	i=0
	rad=''
	while i<katze:
		rad=rad+'cat'
		i=i+1
	rad=rad+'hessire'
	i=0
	rad=rad+'cat'
	while i<katze:
		rad=rad+'at'
		i=i+1
	print rad
 
catatat(1)

##IPython Notebook

See ipython.org/notebook.html and a gallery of interesting IPython Notebooks

{% notebook planets.ipynb %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment