This file contains 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 urllib, urllib2 | |
import logging | |
from django.utils import simplejson | |
class Googl(): | |
def __init__(self, api_key): | |
self.api_key = api_key | |
self.base_url = 'https://www.googleapis.com/urlshortener/v1/url?key=%s' % self.api_key |
This file contains 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
<!DOCTYPE html> | |
<html"> | |
<head> | |
<script src="/static/js/jquery.min.js"></script> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
</head> | |
<body> | |
<h2 class="headline">New Talk</h2> | |
This file contains 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 findComponent(result, type) { | |
for (var i = 0; i , result.address_components.length; i++) { | |
var component = result.address_components[i]; | |
for (var j = 0; j < component.types.length; j++) { | |
if (component.types[j] == type) { | |
return component.short_name; | |
} | |
} | |
} | |
} |
This file contains 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
<!doctype html> | |
<head> | |
<link rel="stylesheet" href="/css/style.css"> | |
<body> | |
<input class="friend-search"></input> | |
<div id="fb-root"></div> | |
<script>window.jQuery || document.write("<script src='/js/libs/jquery-1.5.1.min.js'>\x3C/script>")</script> | |
<script src="/js/jquery.autosuggest.js"></script> |
This file contains 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 | |
import logging | |
def send_mail_sendgrid(from, to, subject, body): | |
base_url = 'https://sendgrid.com/api/mail.send.json' | |
params = { | |
'api_user': 'you@you.com', | |
'api_key': 'yourpassword', | |
'from': from, | |
'to': to, |
This file contains 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
//Lightweight JSONP fetcher - www.nonobtrusive.com | |
var JSONP = (function(){ | |
var counter = 0, head, query, key, window = this; | |
function load(url) { | |
var script = document.createElement('script'), | |
done = false; | |
script.src = url; | |
script.async = true; | |
script.onload = script.onreadystatechange = function() { |
This file contains 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 User(db.Model): | |
location = db.StringProperty() | |
timezone = db.StringProperty(default='America/Los_Angeles') | |
# Do this once per user | |
def calculate_timezone(self): | |
from simplegeo import Client | |
client = Client('oauth key', 'oauth secret SHH') | |
response = client.context.get_context_by_address(self.location) | |
for feature in response['features']: |
This file contains 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
""" | |
deferred.py | |
Primary App Engine app handler | |
""" | |
import sys, os | |
package_dir = "packages" |
This file contains 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
var fontNum = 0; | |
var maxCharacters = 1730; | |
var cssBaseUrl = 'http://fonts.googleapis.com/css?family='; | |
function addCss() { | |
var cssUrl = cssBaseUrl; | |
while ((cssUrl.length + allFontNames[fontNum].length) < maxCharacters && (fontNum < (allFontNames.length-1))) { | |
// dont load khmer, no point | |
if (fonts[allFontNames[fontNum]].subsets[0] != 'khmer') { | |
cssUrl += escape(allFontNames[fontNum]) + '|'; |
This file contains 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 __future__ import with_statement | |
from google.appengine.ext import db, blobstore | |
from google.appengine.api import memcache, files, images | |
class Photo(db.Model): | |
created = db.DateTimeProperty(auto_now_add=True) | |
updated = db.DateTimeProperty(auto_now=True) | |
blob_key = blobstore.BlobReferenceProperty() | |
url = db.StringProperty() | |
thumbnail_url = db.StringProperty() |