Skip to content

Instantly share code, notes, and snippets.

View natbat's full-sized avatar

Natalie Downe natbat

View GitHub Profile
@natbat
natbat / Pluralize
Created January 18, 2012 15:12
pluralize in django to be two words
{{ group.adverts|length|pluralize:"this,these" }}
@natbat
natbat / Mailto
Created January 18, 2012 15:29
Mailto formatting
mailto:jsmith@example.com?subject=A%20Test&body=My%20idea%20is%3A%20%0A
@natbat
natbat / spreadsheet-template.txt
Last active September 29, 2015 23:57
Template for videos and notes in spreadsheets to output docs code
=IF(ISBLANK(F5),"", B5 & CHAR(10) & "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" & CHAR(10) & TEXT(A5, "mmmm d yyyy") & " a "& D5& " by " & E5 & CHAR(10) & CHAR(10) & IF(ISBLANK(F5),"", Concat("`Video <https://www.youtube.com/watch?v=", Concat(F5, ">`__, "))) & IF(ISBLANK(G5),"", Concat("`Author slides/docs <", Concat(G5, ">`__, "))) & IF(ISBLANK(H5),"", Concat("`Collective notes <", Concat(H5, ">`__, "))) & CHAR(10) & CHAR(10) & C5 & CHAR(10) & CHAR(10) & CHAR(10))
@natbat
natbat / Django nice times
Created April 10, 2012 13:45
9am to 9:30am in django templating
{{ session.start_time|date:"g" }}{% with session.start_time|date:"i" as mm %}{% if mm != "00" %}{{ session.start_time|date:":i" }}{% endif %}{% endwith %}{{ session.start_time|date:"A"|lower }}
@natbat
natbat / gist:4109493
Created November 19, 2012 07:51
18th November 2012 hamster.log
Revolutions: 1 (time = 1353270795.1)
Revolutions: 2 (time = 1353270820.32)
Revolutions: 3 (time = 1353275042.99)
Revolutions: 4 (time = 1353275045.56)
Revolutions: 5 (time = 1353275051.18)
Revolutions: 6 (time = 1353275057.6)
Revolutions: 7 (time = 1353275063.12)
Revolutions: 1 (time = 1353275203.54)
Revolutions: 2 (time = 1353275959.26)
Revolutions: 3 (time = 1353275962.48)
@natbat
natbat / django dates
Created January 20, 2013 14:03
Better django date formatting eg "1:21pm, January 2nd, 2013"
{{object.date|date:"fA"|lower}}, {{object.date|date:"F jS, Y"}}
@natbat
natbat / SVG animation experiment.markdown
Created January 29, 2016 22:37
SVG animation experiment
@natbat
natbat / legacy-db-conversion.py
Created April 7, 2016 19:18
Conversion script is for writing legacy data to a csv file suitable for wordpress import - by Matthew Antone
# TODO:
# . add alt tags to image links
# . image thumbnails? (featured image)
import psycopg2
import psycopg2.extras
import re
import lxml
jQuery(function($){
// addSizes was written by Natalie Downe
// http://natbat.net/2008/Aug/27/addSizes/
// Copyright (c) 2008, Natalie Downe under the BSD license
// http://www.opensource.org/licenses/bsd-license.php
$('a[href$=".pdf"], a[href$=".doc"], a[href$=".mp3"], a[href$=".jpg"], a[href$=".png"], a[href$=".swf"], a[href$=".zip"], a[href$=".ogg"], a[href$=".m4u"]').each(function(){
// looking at the href of the link, if it contains pdf, doc, zip, mp3, ogg, m4u, jpg, png, swf
@natbat
natbat / Bat+Sounds.ipynb
Last active October 22, 2023 02:24
Taking recordings from the EchoMeter Touch Bat detector and the KML file that is associated with it and uploading the sound files
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.