Skip to content

Instantly share code, notes, and snippets.

View pamelafox's full-sized avatar

Pamela Fox pamelafox

View GitHub Profile
@pamelafox
pamelafox / selenium_page.py
Created November 30, 2011 22:48
Selenium Utility Funcs
from selenium.common.exceptions import NoSuchElementException, TimeoutException, WebDriverException
class SeleniumPage(object):
driver = None
waiter = None
def open_page(self, url):
self.driver.get(url)
@pamelafox
pamelafox / withings.py
Created December 8, 2011 18:59
Withings Python OAuth Wrapper
# -*- coding: utf-8 -*-
# Based on https://github.com/ikasamah/withings-garmin/blob/master/withings.py
import urllib
from datetime import datetime
import urlparse
import oauth2 as oauth
try:
import json
@pamelafox
pamelafox / flask_tests.py
Created December 8, 2011 23:08
Python Flask App Engine Unit Test
import unittest
import sys
import os
import logging
# locate app-engine SDK
AE_PATH = "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/"
# path to app code
APP_PATH = os.path.abspath(".")
@pamelafox
pamelafox / gist:1469925
Created December 13, 2011 01:10
Click/touchstart wrapper
function addClickHandler(dom, callback, logThis) {
if (useTouchEvents()) {
dom.each(function() {
$(this).unbind('tap', callback);
$(this).bind('tap', callback);
$(this).bind('touchstart', function(e) {
var item = e.currentTarget;
if (ISTOUCHING) return;
@pamelafox
pamelafox / Makefile
Created December 23, 2011 02:03
Android PhoneGap Workflow
MAKEFLAGS = --no-print-directory --always-make
MAKE = make $(MAKEFLAGS)
BUILDDIR = ./.build
CLOSUREURL = http://closure-compiler.googlecode.com/files/compiler-latest.zip
CLOSUREDIR = $(BUILDDIR)/closure
CLOSUREFILE = $(CLOSUREDIR)/compiler.jar
YUIURL = http://yui.zenfs.com/releases/yuicompressor/yuicompressor-2.4.6.zip
YUIDIR = $(BUILDDIR)/yui
@pamelafox
pamelafox / log.html
Created December 24, 2011 00:10
Jinja2 Template Example (Everyday.io Log)
{% extends "yourbase.html" %}
{% block subheader %}
<div class="page-header">
<h1>
<span id="log-date">{{ title }}</span>
<a data-tooltip="Change the date" id="log-date-button" href="javascript:void(0);" style="margin-left: 10px;"><img src="img/calendar.png"></a>
</h1>
</div>
{% endblock %}
@pamelafox
pamelafox / render_index.py
Created December 24, 2011 00:12
PhoneGap Index Renderer (Jinja2)
import sys
sys.path.append('/Library/Python/2.7/site-packages')
from jinja2 import Environment, FileSystemLoader
if __name__ == "__main__":
env = Environment(loader=FileSystemLoader('application/templates/'))
template = env.get_template('phonegap/index.html')
print template.render(debug=False, mobile=True, native=True)
@pamelafox
pamelafox / phonegap.html
Created December 24, 2011 00:16
Phonegap Index (Jinja2)
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>everyday.io</title>
{% if g and g.debug %}
<link rel="stylesheet" href="css/colorslider.css" />
<link rel="stylesheet" href="css/dateinput.css" />
<link rel="stylesheet" href="css/bootstrap-1.3.0.min.css">
@pamelafox
pamelafox / qunit_tests.py
Created December 26, 2011 19:07
Python Selenium QUnit Runner
import unittest
from sys import *
import os
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import NoSuchElementException, TimeoutException
class QUnitTests(unittest.TestCase):
driver = None
@pamelafox
pamelafox / superfeedr_client.py
Created December 26, 2011 22:02
SuperFeedr Python Client
import urllib
import logging
import base64
from httplib2 import Http
API_URL = 'http://superfeedr.com/hubbub'
MODE_SUBSCRIBE = 'subscribe'
MODE_UNSUBSCRIBE = 'unsubscribe'
MODE_RETRIEVE = 'retrieve'