View app.py
import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
# We extend 'webapp.RequestHandler' to reduce excess code
class request(webapp.RequestHandler):
# I hate typing, make it shorter
def write(self,text):
self.response.out.write(text)
View ImageToBase64.py
'''
This program converts all images in a folder to base64
for embedding in an html page inside a <style> tag like:
<style>
.img_name1{content:url("data:image/jpg;base64,abcdef...");}
.img_name2{content:url("data:image/jpg;base64,abcdef...");}
</style>
The 'content' property only works in webkit browsers.
'''
View dataserver.js
/* dataserver.jss
USE:
sql = new SQL();
sql.connect();
num = sql.getValue('SELECT count(1) FROM customers')
rec = sql.getRecord('SELECT * FROM customers WHERE id=123456')
recs = sql.getRecords('SELECT * FROM customers')
list = sql.getList('SELECT DISTINCT name FROM customers')
table = sql.getTable('SELECT * FROM customers')
View selectors.js
/* selectors.js
Use:
head = $('head')
mydiv = $('#mydiv')
list = $$('li')
*/
function $(selector,element){