Skip to content

Instantly share code, notes, and snippets.

View domenkozar's full-sized avatar
💭
I may be slow to respond.

Domen Kožar domenkozar

💭
I may be slow to respond.
View GitHub Profile
@domenkozar
domenkozar / gist:1189518
Created September 2, 2011 18:59 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job:
Django/Plone/Pyramid developer
Favorite Python project:
Pyramid
Favorite Conference:
Plone Conf 2010
Python Experience Level:
@domenkozar
domenkozar / gist:1193435
Created September 4, 2011 20:15
Chameleon error
view_macros python:path('here/%s/macros|nothing' % view_template);
@domenkozar
domenkozar / dozer_server.py
Created September 22, 2011 11:06 — forked from jeffkistler/dozer_server.py
Django Dozer runserver command.
from django.core.management.commands.runserver import BaseRunserverCommand
from django.conf import settings
from dozer import Profiler
class Command(BaseRunserverCommand):
def get_handler(self, *args, **options):
"""
Returns the normal handler wrapped in a warm Dozer embrace.
"""
@domenkozar
domenkozar / autovpn.py
Created January 1, 2012 16:00 — forked from anonymous/autovpn.py
AutoVPN for NetworkManager
#!/usr/bin/env python
"""
Copyright 2011 Domen Kozar. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
@domenkozar
domenkozar / airbnb.py
Created February 10, 2012 14:16
Airbnb search query sample
"""
Sample specific search query to airbnb returning list of new flats (compared to last run) as stdout (meant to be used as crontab).
Copyright 2011 Domen Kozar. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
@domenkozar
domenkozar / sqlalchemy_lowercase_inspector.py
Created February 21, 2012 20:05
lower case sqlalchemy.engine.reflection.Inspector
import string
from sqlalchemy.engine.reflection import Inspector
class LowerCaseInspector(Inspector):
"""Implements reflection inspector that reflects everything lowercase"""
def get_table_names(self, *a, **kw):
tables = super(LowerCaseInspector, self).get_table_names(*a, **kw)
@domenkozar
domenkozar / test.py
Created March 28, 2012 12:26
Using Integer type with SelectWidget renders wrong selected values
import deform
import colander
class TestSchema(colander.MappingSchema):
list = colander.SchemaNode(colander.Integer(),
widget=deform.widget.SelectWidget(values=[(1, 'one'), (2, 'two')]))
class Test2Schema(colander.MappingSchema):
list = colander.SchemaNode(colander.Integer(),
@domenkozar
domenkozar / gist:3315020
Created August 10, 2012 15:26
Only in javascript.
> []+{}
"[object Object]"
> {}+[]
0
@domenkozar
domenkozar / timezone_test.py
Created October 23, 2012 12:37
Timezone test
import datetime
import icalendar
import pytz
tz = pytz.timezone('Europe/Ljubljana')
dt = datetime.datetime(2012, 10, 23, 14, 0, 0)
print "datetime without timezone information: ", dt
dt_localized = tz.localize(dt)
print "localized into DST Europe/Ljubljana: ", dt_localized
@domenkozar
domenkozar / bootstrap.py
Created November 21, 2012 00:54
coverage fail under zc.buildout when no gcc is present
##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS