This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from http://appengine-cookbook.appspot.com/recipe/lazy-loading-webapp-handler/ | |
def _istring(import_name): | |
"""Imports an object based on a string. | |
@param import_name the dotted name for the object to import. | |
@return imported object | |
""" | |
module, obj = import_name.rsplit('.', 1) | |
# __import__ can't handle unicode strings in fromlist if module is a package | |
if isinstance(obj, unicode): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Implements a request handler which caches the response to GET requests. | |
Big Picture: | |
* memcache is used to cache generated content. | |
* Task queue is used to regenerate the content when it expires. | |
* When a page expires, the old page is continued to be served until the new | |
page is ready (to minimize downtime). | |
* A new page will be generated only if the old page has expired AND someone is | |
requesting the page. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2, urllib | |
class RecaptchaResponse(object): | |
def __init__(self, is_valid, error_code=None): | |
self.is_valid = is_valid | |
self.error_code = error_code | |
def submit (recaptcha_challenge_field, | |
recaptcha_response_field, | |
private_key, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application: zip-site | |
version: main | |
runtime: python | |
api_version: 1 | |
handlers: | |
- url: /.* | |
script: main.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2010 David Underhill [email protected] | |
# This module is released under the MIT license: | |
# http://www.opensource.org/licenses/mit-license.php | |
""" | |
This module provides a wrapper around the urlfetch API which maximizes the | |
concurrency of asynchronous urlfetch requests (within app engine limits). | |
To start asynchronous fetch(es), first create an AsyncURLFetchManager and then | |
call call fetch_asynchronously() as many times as needed. For optimal | |
performance, start the fetches which are fastest first. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cgi | |
import os | |
from google.appengine.ext.webapp import template | |
from google.appengine.api import users | |
from google.appengine.ext import webapp | |
from google.appengine.ext.webapp.util import run_wsgi_app | |
from google.appengine.ext import db | |
from google.appengine.api import memcache | |
from google.appengine.api import urlfetch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Nice to study. Original here http://www.20thingsilearned.com/js/twentythings.min.js | |
*/ | |
var TT = TT || {}; | |
TT.PAGE_WIDTH = 800; | |
TT.PAGE_HEIGHT = 500; | |
TT.PAGE_MIN_WIDTH = 1000; | |
TT.PAGE_MIN_HEIGHT = 680; | |
TT.PAGE_MARGIN_LEFT = 32; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (c) 2012, Miguel Araujo | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright notice, this | |
list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright notice, |
As configured in my dotfiles.
start new:
tmux
start new with session name:
OlderNewer