Skip to content

Instantly share code, notes, and snippets.

View pamelafox's full-sized avatar

Pamela Fox pamelafox

View GitHub Profile
@pamelafox
pamelafox / impressflow.js
Created February 15, 2012 23:37
impress.js: Attempt at flowchart generation
// Each DIV has data-parent="parentid" (except the top)
// Go through all steps, make hierarchy of parent to children
var childrenIds = {};
var topId;
$('.step').each(function() {
var id = $(this).attr('id');
var parentId = $(this).attr('data-parent');
if (!parentId) {
topId = id;
} else {
@pamelafox
pamelafox / redirect.py
Created February 16, 2012 00:56
App Engine Redirect Handler
"""
Licensed under the Apache License, Version 2.0:
http://www.apache.org/licenses/LICENSE-2.0
"""
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
redirects = {
'/learning': 'http://blog.pamelafox.org',
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@pamelafox
pamelafox / Makefile
Created February 21, 2012 19:05
Phonegap/App Engine Makefile
# Javascript/CSS Compressor Makefile - By Benjamin "balupton" Lupton (MIT Licenced)
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
@pamelafox
pamelafox / senderror.js
Created February 21, 2012 19:20
Sending JS errors to server
function sendError(message, url, lineNum) {
var i;
// First check the URL and line number of the error
url = url || window.location.href;
lineNum = lineNum || 'None';
// If the error is from these 3rd party script URLs, we ignore
// We could also just ignore errors from all scripts that aren't our own
var scriptURLs = [
@pamelafox
pamelafox / fancybox.js
Created March 18, 2012 04:01
Zepto + FancyBox
/*
* FancyBox - jQuery Plugin
* Simple and fancy lightbox alternative
*
* Examples and documentation at: http://fancybox.net
*
* Copyright (c) 2008 - 2010 Janis Skarnelis
* That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
*
* Version: 1.3.4 (11/11/2010)
@pamelafox
pamelafox / fancybox.diff
Created March 18, 2012 04:04
Zepto + FancyBox Diffs
diff --git a/application/static/js/libs/jquery.fancybox.js b/application/static/js/libs/jquery.fancybox.js
index be77275..c1d74b7 100755
--- a/application/static/js/libs/jquery.fancybox.js
+++ b/application/static/js/libs/jquery.fancybox.js
@@ -359,7 +359,6 @@
this.style.visibility = 'inherit';
});
}
-
overlay.show();
@pamelafox
pamelafox / autoresizer.js
Created March 22, 2012 06:11
TextArea AutoResizer (Bootstrap jQuery/Zepto Plugin)
var AutoResizer = function (textArea, options) {
var self = this;
this.$textArea = $(textArea);
this.minHeight = this.$textArea.height();
this.options = $.extend({}, $.fn.autoResizer.defaults, options)
this.$shadowArea = $('<div></div>').css({
@pamelafox
pamelafox / phonegap-photofetcher.js
Created March 23, 2012 18:32
PhoneGap Convert Photo File URI to Data URI
function getPhoto() {
navigator.camera.getPicture(onPhotoSuccess, onPhotoFail,
{quality: 70, targetWidth: 500, targetHeight: 500,
sourceType: navigator.camera.SourceType.PHOTOLIBRARY,
destinationType: navigator.camera.DestinationType.FILE_URI,
});
}
function onPhotoSuccess(imageUri) {
var $img = $('<img/>');
@pamelafox
pamelafox / twitter-bootstrap.scss
Created March 24, 2012 15:53
Bootstrap Android Overrides
body.android {
.modal {
@include box-shadow(none);
@include background-clip(border-box);
@include border-radius(0px);
border: 1px solid black;
}
.alert {
@include border-radius(0px);
text-shadow: none;