Skip to content

Instantly share code, notes, and snippets.

George Nava GeorgeNava

View GitHub Profile
@GeorgeNava
GeorgeNava / app.py
Created Aug 31, 2010
Basic application handler in python for App Engine
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)
@GeorgeNava
GeorgeNava / ImageToBase64.py
Created May 8, 2010
Converts all images in a folder to base64
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.
'''
@GeorgeNava
GeorgeNava / dataserver.js
Created Mar 13, 2010
Dataserver module for MySQL in V8CGI
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){
You can’t perform that action at this time.