Skip to content

Instantly share code, notes, and snippets.

View kosmikko's full-sized avatar

Mikko Lehtinen kosmikko

  • Applifier
  • Helsinki, Finland
View GitHub Profile
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()
@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)
@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 / 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 / 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 / mollom.py
Created September 29, 2011 13:14
Mollom API Python (GAE) wrapper
import urllib
from google.appengine.api import urlfetch
from gdata import oauth
class MollomRequest(object):
API_URL = 'http://rest.mollom.com/v1/'
# mollom public API key
CONSUMER_KEY = 'xxx'
@kosmikko
kosmikko / dabblet.css
Created April 26, 2012 05:52 — forked from LeaVerou/dabblet.css
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
@kosmikko
kosmikko / dabblet.css
Created April 26, 2012 05:52
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
@kosmikko
kosmikko / base_mixin.coffee
Created June 30, 2012 14:03
Provides common extensions to Chaplin views to be used as a mixin
define [
'chaplin'
'Handlebars'
], (Chaplin, Handlebars) ->
'use strict'
BaseExtensions =
trackAction: (category, action, label, value) ->
# track user action with Google Analytics
@kosmikko
kosmikko / base_view.coffee
Created June 30, 2012 14:17
Extending Chaplin views
define [
'underscore'
'chaplin/views/view'
'app/views/base_extensions'
], (_, ChaplinView, BaseExtensions) ->
class BaseView extends ChaplinView
_(@prototype).extend BaseExtensions