Skip to content

Instantly share code, notes, and snippets.

View pamelafox's full-sized avatar

Pamela Fox pamelafox

View GitHub Profile
@pamelafox
pamelafox / phonegap.html
Created May 15, 2012 13:38
Android localStorage in PhoneGap timing test
<!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" />
<base target="_blank">
<title>eatdifferent</title>
<script>
var ED = ED || {};
ED.VERSION = '36'
@pamelafox
pamelafox / grunt.js
Created May 7, 2012 20:31
Grunt for a CSS/JS WebApp
/*global module:false*/
module.exports = function(grunt) {
var CSS_DIR = 'src/css/';
var JS_DIR = 'src/js/';
var BUILD_DIR = '../build/';
// Project configuration.
grunt.initConfig({
@pamelafox
pamelafox / util_log.js
Created April 26, 2012 09:28
ED.util.log()
// Logging
var allLogs = [];
function log(something) {
// Store
var storedSomething = something;
if (window.JSON) {
storedSomething = JSON.stringify(something);
}
storedSomething = 'LOG @ ' + new Date().toString() + ': ' + truncateText(storedSomething, 200);
allLogs.push(storedSomething);
@pamelafox
pamelafox / mobile_photo.js
Created April 19, 2012 02:49
Getting/rotating photos in PhoneGap
function getPhoto(mealId, sourceType, saveOnSuccess) {
var $mealDiv = $('#log-meal-' + mealId);
var $mealImg = $mealDiv.find('.log-meal-photo-button img');
var $quickpicStatus = $('#mobile-quickpic-link span');
function resetQuickPicStatus() {
$quickpicStatus.html('').addClass('icon-camera');
}
@pamelafox
pamelafox / zepto.js
Created April 17, 2012 05:04
Zepto Port (Bootstrap-friendly, Plugin-friendly, etc)
// Zepto.js
// (c) 2010, 2011 Thomas Fuchs
// Zepto.js may be freely distributed under the MIT license.
(function(undefined){
if (String.prototype.trim === undefined) // fix for iOS 3.2
String.prototype.trim = function(){ return this.replace(/^\s+/, '').replace(/\s+$/, '') };
// For iOS 3.x
// from https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce
@pamelafox
pamelafox / impl_example.js
Created April 13, 2012 19:08
impl example
function MobilePage() {
this.initialized = false;
}
MobilePage.prototype.setup = function() {};
MobilePage.prototype.setupOnce = function() {
if (this.initialized !== true) this.setup();
this.initialized = true;
};
@pamelafox
pamelafox / util.js
Created April 13, 2012 17:44
JavaScript Utility Libraries (Scroll down!)
var ED = ED || {};
// Utility functions
ED.util = (function() {
// Data structure functions
function each(object, callback) {
if (object === null) return;
@pamelafox
pamelafox / tumlbr_template.html
Created April 12, 2012 19:07
Twitter Bootstrap Tumblr Theme
<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://ogp.me/ns#"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name='description' content='{MetaDescription}'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@pamelafox
pamelafox / README.md
Created April 9, 2012 20:49
Instagram Python API Reference

python-instagram

A Python client for the Instagram REST and Search APIs

Installation

pip install python-instagram

Requires

@pamelafox
pamelafox / queue.yaml
Created April 6, 2012 21:48
Geocoding with named task queue parameters on App Engine
queue:
- name: geocoding
rate: 1/m
retry_parameters:
task_retry_limit: 60
task_age_limit: 3d
min_backoff_seconds: 120