Skip to content

Instantly share code, notes, and snippets.

View pamelafox's full-sized avatar

Pamela Fox pamelafox

View GitHub Profile
@pamelafox
pamelafox / thirdparties.js
Created August 25, 2012 00:40
isDefined
// isDefined(window, 'google');
// isDefined(window, 'google.maps.places');
var isDefined = function(parent, name) {
var parts = name.split('.');
var part = parts.shift();
var cur = parent;
while (part) {
if (cur[part]) {
cur = cur[part];
@pamelafox
pamelafox / view.html
Created August 21, 2012 14:30
Google Maps AutoComplete for Profile Location Field
<div class="control-group">
<label class="control-label">Location</label>
<div class="controls">
<input name="location" type="text" placeholder="City, State, Country" value="">
<input name="location_city" type="hidden" value="">
<input name="location_state" type="hidden" value="">
<input name="location_country" type="hidden" value="">
<input name="location_lat" type="hidden">
<input name="location_lng" type="hidden">
</div>
@pamelafox
pamelafox / header.html
Created August 8, 2012 04:51
Handlebars Design Prototyping
<html>
<head>
<style>
.w100percent {
}
.w1280px {
}
.w900px {
}
.w768px {
@pamelafox
pamelafox / form.html
Created August 1, 2012 20:42
Functions for showing form save messages and errors
<form id="coursera-form" action="/api/save" enctype="multipart/form-data" method="POST" class="form-horizontal">
<!-- form inputs here -->
<div class="form-actions"><button type="submit" data-default-message="Save Changes" data-inflight-message="Saving..." data-success-message="Saved!" class="coursera-save-button btn btn-primary" disabled="disabled">Saved!</button></div>
</form>
@pamelafox
pamelafox / restaurants.xml
Created June 27, 2012 00:07
Sample XML: Seattle Restaurants
<?xml version="1.0"?>
<restaurants>
<restaurant name="Pan Africa Market" address="1521 1st Ave, Seattle, WA" lat="47.608940" lng="-122.340141" type="sitdown"/>
<restaurant name="Buddha Thai & Bar" address="2222 2nd Ave, Seattle, WA" lat="47.613590" lng="-122.344391" type="bar"/>
<restaurant name="The Melting Pot" address="14 Mercer St, Seattle, WA" lat="47.624561" lng="-122.356445" type="sitdown"/>
<restaurant name="Ipanema Grill" address="1225 1st Ave, Seattle, WA" lat="47.606365" lng="-122.337654" type="sitdown"/>
<restaurant name="Sake House" address="2230 1st Ave, Seattle, WA" lat="47.612823" lng="-122.345673" type="bar"/>
<restaurant name="Crab Pot" address="1301 Alaskan Way, Seattle, WA" lat="47.605961" lng="-122.340363" type="sitdown"/>
<restaurant name="Mama's Mexican Kitchen" address="2234 2nd Ave, Seattle, WA" lat="47.613976" lng="-122.345467" type="bar"/>
<restaurant name="Wingdome" address="1416 E Olive Way, Seattle, WA" lat="47.617214" lng="-122.326584" type="bar"/>
@pamelafox
pamelafox / nutrition.xml
Created June 27, 2012 00:03
Sample XML: Foods
<?xml version="1.0"?>
<nutrition>
<daily-values>
<total-fat units="g">65</total-fat>
<saturated-fat units="g">20</saturated-fat>
<cholesterol units="mg">300</cholesterol>
<sodium units="mg">2400</sodium>
<carb units="g">300</carb>
<fiber units="g">25</fiber>
<protein units="g">50</protein>
@pamelafox
pamelafox / idiomatic_JA.md
Created June 18, 2012 23:22
Idiomatic.JS, japanese translation from Mashashi

#慣用的なJavaScript, 矛盾しないコードの書き方

これは現在使っているドキュメントです。私達が使っているコードを向上させるためのアイディアはいつでも歓迎です。意見を述べるには、fork, clone, branch, commit, push, pull requestなどをしてください。

@pamelafox
pamelafox / hearty.user.js
Created June 14, 2012 05:00
TxJS Hearty User Extension
// Also requires jQuery pasted in the top in Chrome
function loadHearts() {
$('#speakers').hide();
$('#scene').hide();
$('#schedule td').each(function() {
var $talkCell = $(this);
var rateLink = $talkCell.find('a');
if (!rateLink.length) return;
@pamelafox
pamelafox / yahoogeocoder.py
Created June 7, 2012 18:49
YahooGeocoder
import urllib
import settings
try:
import json
except ImportError:
import simplejson as json
class YahooException(Exception):
pass
@pamelafox
pamelafox / render_handlebars.py
Created May 30, 2012 06:22
Handlebars Folder Renderer Script
import os
input_path = 'application/templates'
output_path = 'application/static/js/templates'
os.system('mkdir %s' % output_path)
dir_list = os.listdir(input_path)
for file_name in dir_list:
if file_name.endswith('.handlebars'):
cmd = 'handlebars %s/%s -f %s/%s' % (input_path, file_name, output_path, file_name.replace('handlebars', 'js'))