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 / app.html
Created March 19, 2012 03:53
Simple linked pages
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css"
/>
@mlynch
mlynch / pages.html
Created March 19, 2012 04:14
Simple page
<div data-role="page" id="page1">
<div data-role="header">
<h3>
Page 1
</h3>
</div>
<div data-role="content">
<!-- components go here -->
</div>
</div>
@mlynch
mlynch / button.html
Created March 19, 2012 04:16
Simple button
<div data-role="content">
<a data-role="button" href="#page2">
Go to Page 2
</a>
</div>
@mlynch
mlynch / page2.html
Created March 19, 2012 04:18
Page 2
<div data-role="page" id="page2">
<div data-role="header">
<h3>
Page 2
</h3>
<a data-role="button" data-direction="reverse" data-rel="back" href="#page2" data-icon="arrow-l" data-iconpos="left">
Back
</a>
</div>
<div data-role="content">
@mlynch
mlynch / p2.html
Created March 19, 2012 23:42
page2
<div data-role="page" id="page2">
<div data-role="header">
<h3>
Page 2
</h3>
<a data-role="button" data-direction="reverse" data-rel="back" href="#page2" data-icon="arrow-l" data-iconpos="left">
Back
</a>
</div>
<div data-role="content">
@mlynch
mlynch / app.js
Created May 11, 2012 16:42
Backbone Model Instance
var a = new UserApp();
a.id = id;
a.fetch({
success: function(r) {
var name = r.get('name');
console.log('Loaded app:', name);
},
error: function(r) {
console.log('Unable to load app');
}
@mlynch
mlynch / app.js
Created May 11, 2012 17:03
UserAppVersions
var versions = new UserAppVersions();
versions.id = appId;
versions.fetch({
error: function() {
console.log('Unable to load user app versions');
},
success: function(versions) {
console.log('Versions', versions);
// iterate over them with the each function, or with a for loop over version.models
@mlynch
mlynch / app.js
Created May 11, 2012 17:01
Backbone Collections
var UserAppVersions = Backbone.Collection.extend({
model: UserAppVersion,
url: function() {
return '/api/v1/user/app/' + this.id + '/versions';
},
parse: function(response) {
return response.versions;
}
});
@mlynch
mlynch / versions.json
Created May 11, 2012 17:06
Version collection
{
"versions":[
{
"created_at":""
}
]
}
@mlynch
mlynch / models.js
Created May 11, 2012 16:28
Backbone Model Definitions
var UserApp = Backbone.Model.extend({
urlRoot: '/api/v1/user/app'
});