Skip to content

Instantly share code, notes, and snippets.

View pamelafox's full-sized avatar

Pamela Fox pamelafox

View GitHub Profile
@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'))
@pamelafox
pamelafox / gist:2716823
Created May 17, 2012 05:56
JS Errors and Causes
These arent always the causes, just in the cases I saw them.
Unexpected {
Cause: mismatched curly braces, count your braces
Unexpected token .
Cause: var buttonDiv.bla = 4
SyntaxError: Unexpected string
Cause: var bla = bla + ' hi ' ' you'
@pamelafox
pamelafox / editorhack.diff
Created May 15, 2012 22:11
EditorManager + CommandManager
diff --git a/src/brackets.js b/src/brackets.js
index 39e30b2..cb20367 100644
--- a/src/brackets.js
+++ b/src/brackets.js
@@ -199,7 +199,8 @@ define(function (require, exports, module) {
//{"Ctrl-X": Commands.EDIT_CUT},
//{"Ctrl-C": Commands.EDIT_COPY},
//{"Ctrl-V": Commands.EDIT_PASTE},
-
+ {"Ctrl-I": Commands.SHOW_OTHER_STUFF},
@pamelafox
pamelafox / IframeViewer.js
Created May 15, 2012 21:50
IframeViewer for Brackets
/*
* Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
@pamelafox
pamelafox / CameraLauncher.java
Created May 15, 2012 15:06
PhoneGap Camera.java (Hacked up)
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@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