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
deploy: dependencies check | |
# index must be clean (no modified files) | |
git diff-index --quiet --cached HEAD | |
# no uncomitted changes | |
git diff-files --quiet | |
# create a branch for the current version | |
git branch -f deploy_`grep -E '^version: ' app.yaml | cut -d ' ' -f 2` | |
# push current code to that branch | |
git push -f . deploy_`grep -E '^version: ' app.yaml | cut -d ' ' -f 2` |
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
from google.appengine.api import ( | |
apiproxy_stub_map, | |
quota | |
) | |
import logging | |
def _log_api_pre_call(service, call, request, response, rpc): | |
logging.debug('RPC(pre) %s.%s', service, call) | |
def _log_api_post_call(service, call, request, response, rpc, error): |
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
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
""" | |
########################################################################## | |
ZipMe : GAE Content Downloader | |
########################################################################## | |
Just add this lines in your app.yaml : | |
- url: /zipme | |
script: zipme.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
class SendAnEmailImmediately(Worker) | |
def doExecute(self): | |
logging.info("Sending emails to %s" % lemailStr) | |
lmessage = mail.EmailMessage( | |
sender="[email protected]", | |
to="[email protected]", | |
subject= "Hi Betty", | |
body="I know you love email!" | |
) | |
lmessage.send() |
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
def weighted_average(values): | |
'''Multiply the pixel counts (the values in the histogram) | |
by the pixel values (the index in the values list). | |
Then add them, to get a weighted sum. | |
Then divide by the number of pixels to | |
get the weighted average.''' | |
weighted_sum = sum(i * values[i] for i in range(len(values))) | |
num_pixels = sum(values) |
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
# install nose, nosegae, gaetestbed, webtest | |
# the root of your project, where ever the app.yaml for the project is | |
SRC_PATH=./ | |
# the path to a subfolder or package where the tests are | |
TESTS_PATH=./test | |
# path to the module file where the tests you want to run are | |
TESTS_MODULE_PATH=./test/test_models.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
http://pinterest.com/pin/create/button/?url=http://www.domain.com&description=&media= | |
ex: | |
http://pinterest.com/pin/create/button/?url=http://www.youworkforthem.com&media=http://www.youworkforthem.com/img/eps/E1174/E1174_00.jpg&description=Escapism 30 pulls further away from reality by manipulating organic materials into beautiful, hi-res bursting textures. This is art, this is space, this is nature, this is chaos. Use as you wish. |
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
function until_timeout(callback, deadline){ | |
var interval = setInterval(function(){ | |
if(callback()) { | |
clearInterval(interval); | |
} | |
}, deadline) | |
} |