Skip to content

Instantly share code, notes, and snippets.

View kosmikko's full-sized avatar

Mikko Lehtinen kosmikko

  • Applifier
  • Helsinki, Finland
View GitHub Profile
@kosmikko
kosmikko / show_query.py
Created March 11, 2011 11:12
get app engine Query decoded to string
def show_query(query):
"""
Represent a query as a string
Based on http://kupuguy.googlecode.com/svn/trunk/appengine-doctests/showquery.py
"""
from google.appengine.api import datastore
kind = query._model_class.kind()
ancestor = query._Query__ancestor
filters = query._Query__query_sets[0]
@kosmikko
kosmikko / javascript.html
Created February 21, 2011 12:10
JavaScript Widget
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Netcycler RSS feed example page</title>
<!-- Date: 2010-12-30 -->
</head>
<body>
@kosmikko
kosmikko / iframe-widget.html
Created February 21, 2011 12:06
netcycler iframe widget
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Netcycler RSS feed</title>
<!-- Date: 2010-12-30 -->
</head>
@kosmikko
kosmikko / buttons.sass
Created November 5, 2010 19:08
Cross browser button with CSS3 and Sass
@mixin pie
//using CSS3Pie for IE support
behavior: url(/PIE.htc)
.pie
@include pie
@mixin mybutton($bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor, $bordercolor, $textshadowcolor)
//this a mixin for general buttons with gradient background
@include vertical-gradient($bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4)
def run_in_namespace(namespace):
"""
Decorator for executing a function in a given namespace, then return back to the
current namescape.
"""
def decorator(function):
def wrapper(*args, **kwargs):
current_namespace = namespace_manager.get_namespace()
try:
current_namespace = namespace_manager.get_namespace()