Skip to content

Instantly share code, notes, and snippets.

View pudo's full-sized avatar

Friedrich Lindenberg pudo

View GitHub Profile
Welcome to the OpenSpending center for Cartographers & Developers!
Cartographers are community members who help to map the money by finding, cleaning
and loading spending data. If you are interested in doing this, check out the following
resources:
* Background: How does OpenSpending store data?
* What kinds of data are supported?
from uuid import uuid4
def trigger_table(connection, database_name, table):
def insert_handler(row_id):
print "DB: %s, TABLE: %s, ROW: %s" % database_name, table.name, row_id
name = 'callback_' + str(uuid4()).replace('-', 'x')
connection.connection.create_function(name, 1, insert_handler)
connection.connection.execute("""CREATE TRIGGER trigger_%s
AFTER INSERT ON foo BEGIN SELECT %s(NEW.rowid); END;""" % (name, name))
#
# openspending-ui - Pylons testing environment configuration
#
# The %(here)s variable will be replaced with the parent directory of this file
#
[DEFAULT]
debug = true
[server:main]
use = egg:Paste#http
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>OffeneDemokratie</title>
@pudo
pudo / normalize.py
Created April 18, 2012 07:08
A simple string normalization for dedup.
from unicodedata import normalize as ucnorm, category
def normalize_token(text):
""" Simplify a piece of text to generate a more canonical
representation. This involves lowercasing, stripping trailing
spaces, removing symbols, diacritical marks (umlauts) and
converting all newlines etc. to single spaces.
"""
if not isinstance(text, unicode):
text = unicode(text)
@pudo
pudo / demo.js
Created April 21, 2012 18:22
Demo OS widget
(function ($) {
OpenSpending.DemoWidget = function (elem, context, state) {
var self = this;
var resources = [
];
this.context = context;
layout title
default
OffenesParlament - was passiert im Bundestag?

Schon seit langem wünsche ich mir eine Seite wie TheyWorkForYou oder OpenCongress für Deutschland. Ein Portal, auf dem man einfachen Zugang zu den Plenarreden und Arbeitsabläufen des Bundestags bekommt. Im Gegensatz zu Abgeordnetenwatch soll der Fokus also nicht auf den Parlamentariern, sondern auf der Sache liegen. Stefan hatte dazu vor einigen Jahren mit dem Bundestagger einen ersten Aufschlag gemacht - jetzt will ich mit OffenesParlament noch einen Versuch machen.

@pudo
pudo / load_url.py
Created May 31, 2012 13:40
A python sample of how to script OS loads.
import requests
import sys
OPENSPENGING_DATASET = 'http://openspending.org/br-cgu/'
OPENSPENDING_AUTH = ('user', 'password')
if __name__ == '__main__':
# 1) Make a source within OS, linking to the URL of the source CSV
source_url = sys.argv[1]
@pudo
pudo / gist:3155503
Created July 21, 2012 11:20
UK-CRA's views.
[{
breakdown: "cofog1",
name: "default",
label: "Spending by primary function",
filters: {
name: "ukgov-finances-cra"
},
entity: "dataset",
dimension: "dataset"
},