Skip to content

Instantly share code, notes, and snippets.

@plaes
plaes / flask_admin_multiple_key_issue.py
Created October 5, 2012 18:26
Flask-Admin InlineForm
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext import admin
from flask.ext.admin.contrib import sqlamodel
from flask.ext.admin.model import InlineFormAdmin
# Create application
app = Flask(__name__)
@plaes
plaes / test.html
Created August 16, 2012 07:38
CSS selector specificity - overriding #id
<!--
256 CSS Classes can Override #id:
* http://news.ycombinator.com/item?id=4388649
* http://stackoverflow.com/questions/2809024/points-in-css-specificity/11934505#11934505
W3C documentation on selector specificity:
* http://www.w3.org/TR/CSS2/cascade.html#specificity
Code samples from:
* http://codepen.io/anon/pen/zbcxs
* http://codepen.io/chriscoyier/pen/lzjqh
Also implementation source from Mozilla and WebKit:
@plaes
plaes / werkzeug.patch
Created November 9, 2011 18:54
Flask session/cookie disappearance after redirect issue - werkzeug testcase
diff --git a/werkzeug/testsuite/test.py b/werkzeug/testsuite/test.py
index 795de90..5ee8864 100644
--- a/werkzeug/testsuite/test.py
+++ b/werkzeug/testsuite/test.py
@@ -26,7 +26,7 @@ from werkzeug.datastructures import MultiDict
def cookie_app(environ, start_response):
- """A WSGI application which sets a cookie, and returns as a ersponse any
+ """A WSGI application which sets a cookie, and returns as a response any
@plaes
plaes / calc.py
Created September 12, 2015 07:15
#!/usr/bin/env python3
"""
calc.py
~~~~~~~
Simple mathematical expression parser for infix syntax.
Caveats:
- only supports +-/* and ()
- fails with prefix syntax: -1