Skip to content

Instantly share code, notes, and snippets.

View mlynch's full-sized avatar
🍂
Building something new

Max Lynch mlynch

🍂
Building something new
View GitHub Profile
@mlynch
mlynch / main.py
Created July 20, 2012 19:54
BaseDriveHandler modifications
class BaseDriveHandler(w2.RequestHandler):
...
def StoreUserIdInSession(self, userid):
session = sessions.LilCookies(self, SESSION_SECRET)
session.set_secure_cookie(name='userid', value=userid)
def GetUserIdFromSession(self):
session = sessions.LilCookies(self, SESSION_SECRET)
$(":jqmData(role='page')").live('pageshow', function(e) {
// Grab the id of the page that's showing, and select it on the Tab Bar on the page
var tabBar, id = $(e.target).attr('id');
tabBar = $.mobile.activePage.find(':jqmData(role="tabbar")');
if(tabBar.length) {
tabBar.tabbar('setActive', id);
}
});
(function($) {
$.widget('mobile.tabbar', $.mobile.navbar, {
_create: function() {
// Set the theme before we call the prototype, which will
// ensure buttonMarkup() correctly grabs the inheritied theme.
// We default to the "a" swatch if none is found
var theme = this.element.jqmData('theme') || "a";
this.element.addClass('ui-footer ui-footer-fixed ui-bar-' + theme);
// Call the NavBar _create prototype
@mlynch
mlynch / widget.js
Created June 18, 2012 18:42
Page Create
(function($) {
$.widget('mobile.tabbar', $.mobile.navbar, {
_create: function() {
$.mobile.navbar.prototype._create.call(this);
// ...
}
});
$(document).bind('pagecreate create', function(e) {
@mlynch
mlynch / widget.js
Created June 18, 2012 18:38
Widget Shell
(function($) {
$.widget('mobile.tabbar', $.mobile.navbar, {
_create: function() {
$.mobile.navbar.prototype._create.call(this);
}
});
})(jQuery)
@mlynch
mlynch / widget.js
Created June 18, 2012 18:32
Widget Shell
(function($) {
$.widget('mobile.tabbar', $.mobile.navbar, {
}
})(jQuery);
@mlynch
mlynch / app.js
Created June 13, 2012 22:38
Creating a new resource
initialize: function() {
this._fdb = new Firebase('http://gamma.firebase.com/opencountmadison/');
this._resources = this._fdb.child('resources');
this._bindEvents();
this._bindDataEvents();
},
// Bind interface events
_bindEvents: function() {
var self = this;
@mlynch
mlynch / resources.js
Created June 12, 2012 18:42
Resource Events
// Bind Firebase data events
_bindDataEvents: function() {
var self = this;
this._resources.on('child_added', function(resourceSnapshot) {
$(document).trigger('resource.oneAdded', resourceSnapshot.val());
});
this._resources.on('child_changed', function(resourceSnapshot) {
var resource = resourceSnapshot.val();
@mlynch
mlynch / resources.js
Created June 12, 2012 18:40
resources
initialize: function() {
this._fdb = new Firebase('http://gamma.firebase.com/opencountmadison/');
this._resources = this._fdb.child('resources');
},
// Add a new resource
_addResource: function(tag, name, max, count) {
var self = this, now = new Date();
var resourceData = {
tag: tag,
name: name,
@mlynch
mlynch / resources.js
Created June 12, 2012 18:38
Add a resource
initialize: function() {
this._fdb = new Firebase('http://gamma.firebase.com/opencountmadison/');
this._resources = this._fdb.child('resources');
},
// Add a new resource
_addResource: function(tag, name, max, count) {
var self = this, now = new Date();
var resourceData = {
tag: tag,
name: name,