Skip to content

Instantly share code, notes, and snippets.

@LegoStormtroopr
LegoStormtroopr / iassist2014.ddi31.xml
Last active August 29, 2015 14:02
IASSIST 2014 Conference evaluation questionnaire metadata
<?xml version="1.0"?>
<ddi:DDIInstance xmlns:ddi="ddi:instance:3_1" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sqbl="sqbl:1"
xmlns:a="ddi:archive:3_1" xmlns:r="ddi:reusable:3_1" xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:d="ddi:datacollection:3_1" xmlns:l="ddi:logicalproduct:3_1" xmlns:c="ddi:conceptualcomponent:3_1"
xmlns:ds="ddi:dataset:3_1" xmlns:s="ddi:studyunit:3_1" xmlns:g="ddi:group:3_1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="x0" version="0.0.1"
agency="com.kidstrythisathome.ddirepo.legostormtroopr">
<g:ResourcePackage id="x1">
<g:Purpose id="x2">
<r:Content />
@LegoStormtroopr
LegoStormtroopr / badge.html
Created August 16, 2014 00:40
Font-awesome login badge
<span class="face">
<i class="fg fa fa-user"></i>
</span>
@LegoStormtroopr
LegoStormtroopr / token_search_form.py
Created October 9, 2014 00:20
Haystack google-like colon searching
# Released as GPL.
# Attribute where possible :)
from haystack.constants import DEFAULT_ALIAS
from haystack import connections
class TokenSearchForm(SearchForm):
def prepare_tokens(self):
try:
query = self.cleaned_data.get('q')
except:
@LegoStormtroopr
LegoStormtroopr / input.xml
Created August 19, 2012 00:20
Using XPath1.0 to resolve the correct implied value of an XML elements xml:lang attribute
<?xml version="1.0" encoding="utf-8"?>
<data>
<foo xml:lang="en">
<bar>
<tog xml:lang="fr">
<wel>
<vay xml:lang="sv"/>
</wel>
</tog>
<tog>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="././xsltforms-beta2/xsltforms/xsltforms.xsl" type="text/xsl"?><?xsltforms-options debug="no"?><html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:rml="http://legostormtoopr/response">
<head>
@LegoStormtroopr
LegoStormtroopr / Identifiables
Created October 14, 2012 09:56
List of objects in DDI 3.1 by their most complex class
Abstract
Abstract
Access
ActionToMinimizeLosses
Attribute
Coding
CollectionEvent
CollectionSituation
CoordinateGroup
CreationSoftware
@LegoStormtroopr
LegoStormtroopr / Example_use.txt
Created February 20, 2013 10:20
A demonstration of how to read Excel files using xlrd - http://www.lexicon.net/sjmachin/xlrd.htm
Using: http://www.abs.gov.au/ausstats/meisubs.NSF/log?openagent&634501.xls&6345.0&Time%20Series%20Spreadsheet&D22A58332C098EE7CA257B17000D3976&0&Dec%202012&20.02.2013&Latest
>>> data = abs.xlrdDemo('634501 (1).xls')
>>> print data.keys()
[u'Index', u'Data1', u'Inquiries']
>>> print data['Data1'][10,5]
64.7
>>> print data['Inquiries']
{(9, 1): u'I N Q U I R I E S', (3, 0): '', (8, 0): '', (2, 1): '', (5, 1): u'Table 1. Total Hourly Rates of Pay Excluding Bonuses: Sector, Original, Seasonally Adjusted and Trend', (4, 0): '', (9, 0): '', (8, 1): '', (11, 1): u'Referral Service on 1300 135 070 or Luci Burrage on Perth (08) 9360 5151.', (5, 0): '', (10, 0): '', (4, 1): u'6345.0 Wage Price Index, Australia', (1, 1): u'Time Series Workbook', (0, 0): '', (7, 1): '', (6, 0): '', (11, 0): '', (10, 1): u'For further information about these and related statistics, contact the National Information and', (1, 0): '', (0, 1): '', (7, 0): '', (6, 1): '', (3, 1): '', (2, 0): ''}
@LegoStormtroopr
LegoStormtroopr / pyqt_xml_editor.py
Created September 1, 2013 03:00
This is a basic XML editor that shows of how to do very simple XML validation inside of a PyQT QTextEdit field. All this does is check for document well-formed-ness, but using the LXML library it shouldn't be difficult to extend this to perform Schema or DOCTYPE based validation.
import sys
from lxml import etree
from PyQt4 import QtCore, QtGui
class editor(QtGui.QMainWindow):
def __init__(self):
super(editor, self).__init__()
self.text = QtGui.QTextEdit()
self.setCentralWidget(self.text)
self.text.textChanged.connect(self.validate)
def view_historic_reversion(request, iid, vid):
item = get_object_or_404(MDR._concept, pk=iid).item
if not user_can_view(request.user, item):
if request.user.is_anonymous():
return redirect(reverse('friendly_login') + '?next=%s' % request.path)
else:
raise PermissionDenied
old_item = default_revision_manager.get_for_object_reference(
item.__class__,
@LegoStormtroopr
LegoStormtroopr / README.md
Last active August 5, 2016 05:10
Generic autocompletes for django-autocomplete-light v3.x