1. Log into GitHub
2. Fork this Gist
3. Edit your version to share your team's activity
PDF Liberation Hackpad
IRC: https://webchat.freenode.net/ Channel: #sunlightlabs
GitHub Markdown-Cheatsheet
var Voyager = require('voyager'); | |
var defaultClient = Voyager.ApiClient.instance; | |
// Configure API key authorization: api_key | |
var api_key = defaultClient.authentications['api_key']; | |
api_key.apiKey = "YOUR API KEY" | |
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) | |
//api_key.apiKeyPrefix['api_key'] = "Token" |
<html> | |
<head> | |
</head> | |
<body> | |
<iframe allowtransparency="true" src='http://codefordayton.org/esl/' frameborder="0" style="width:100%; height:600px; border:none;" scrolling="yes"> | |
</body> | |
</html> |
def _unified_resource_format(format_): | |
''' Convert resource formats into a more uniform set. | |
eg .json, json, JSON, text/json all converted to JSON.''' | |
format_clean = format_.lower().split('/')[-1].replace('.', '') | |
formats = { | |
'csv' : 'CSV', | |
'zip' : 'ZIP', | |
'pdf' : 'PDF', | |
'xls' : 'XLS', |
1. Log into GitHub
2. Fork this Gist
3. Edit your version to share your team's activity
PDF Liberation Hackpad
IRC: https://webchat.freenode.net/ Channel: #sunlightlabs
GitHub Markdown-Cheatsheet
if not data_provided and save_action != "go-dataset-complete": | |
if save_action == 'go-dataset': | |
# go to final stage of adddataset | |
redirect(h.url_for(controller='package', | |
action='edit', id=id)) | |
# see if we have added any resources | |
try: | |
data_dict = get_action('package_show')(context, {'id': id}) | |
except NotAuthorized: | |
abort(401, _('Unauthorized to update dataset')) |
[{ | |
"title": "Data Catalog", | |
"description": "Version 1.0", | |
"contactPoint": "somebody important", | |
"keyword": ["catalog"], | |
"modified": "2013-05-09 06:00:00", | |
"publisher": "US Department of X", | |
"person": "Contact Person", | |
"mbox": "[email protected]", | |
"language": ["aav"], |
regular = "(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang)" | |
irregular = "(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)" | |
grandfathered = "(" + irregular + "|" + regular + ")" | |
privateUse = "(x(-[A-Za-z0-9]{1,8})+)" | |
singleton = "[0-9A-WY-Za-wy-z]" | |
extension = "(" + singleton + "(-[A-Za-z0-9]{2,8})+)" | |
variant = "([A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3})" | |
region = "([A-Za-z]{2}|[0-9]{3})" | |
script = "([A-Za-z]{4})" | |
extlang = "([A-Za-z]{3}(-[A-Za-z]{3}){0,2})" |
import ckanext.spatial.validation.validation as v | |
from lxml import etree | |
TEST_FILE = 'satellite-systems_dscovr.xml' | |
with open(TEST_FILE, 'r') as f: | |
xmlobj = etree.XML(f.read()) | |
validator = v.ISO19139NGDCSchema() | |
print(validator.is_valid(xmlobj)) |
{% if show_organizations_selector %} | |
{% set existing_org = data.owner_org %} | |
<div class="control-group"> | |
<label for="field-organizations" class="control-label">{{ _('Organization') }}</label> | |
<div class="controls"> | |
<select id="field-organizations" name="owner_org" data-module="autocomplete"> | |
<option value="" {% if not selected_org and data.id %} selected="selected" {% endif %}>{{ _('Select an organization...') }}</option> | |
{% for organization in organizations_available %} | |
{# get out first org from users list only if there is not an existing org #} | |
{% set selected_org = (existing_org and existing_org == organization.id) or (not existing_org and not data.id and organization.id == organizations_available[0].id) %} |
def default_create_package_schema(): | |
schema = { | |
'__before': [duplicate_extras_key, ignore], | |
'id': [empty], | |
'revision_id': [ignore], | |
'name': [not_empty, unicode, name_validator, package_name_validator], | |
'title': [if_empty_same_as("name"), unicode], | |
'author': [ignore_missing, unicode], | |
'author_email': [ignore_missing, unicode], | |
'maintainer': [ignore_missing, unicode], |